Boiler stove

Hello.

I have a boilerstove connected with flukso. It measured the flow of my cold to hot water. It's an indication of what my boilerstove does.

But:

I am making a new program based on an arduino. It has 2 temperature sensors, a digital pin input, and a LCD display.
Now I am able to measure exact what my boikerstove does.
For example my inlet is 25 degrees, outlet 70 degrees, my flow is 2 liters a minute. The arduino is now calculating that the kw a of the boikerstove through the watercircuit is 6,285 kW.
But now I have THE question.
Is it possible to give those data back to flukso?
I have been thinking, maybe with a relay?
I measured kWh also.
So for example: If (kWh > 0,001)
Relay on
KWh = kWh - 0,001
Relay off

This to create a s0 pulse where flukso can work with?
Is this possible?
Or is there an easier option, cause I have to buy arduino relays.

Thanks,
Hans

AttachmentSize
wp_ss_20151122_0001.png171.19 KB
gebhardm's picture

If you are using an Arduino already then, of course, it is possible to feed back impulses to the flukso quite easily; you should interface via an optocoupler. How to do that and calculate the pulses you may take from
https://github.com/gebhardm/energyhacks/tree/master/Impulsformer
This little device reads current clamps and makes pulses; so the intermediate step to derive kWh and make pulses from it is the same...

gebhardm's picture

Basically it is as easy as this code snippet:

  1. #define N_KWH   1000    // Number of pulses per kWh
  2.  
  3. unsigned long pulseconst, energy;
  4.  
  5. pulseconst = 3600000000U;       // kWh in Wms
  6. pulseconst /= N_KWH;            // distributed to n impulses per kWh
  7.  
  8. if (energy >= pulseconst)
  9. {
  10.         send_pulse();
  11.         energy -= pulseconst;
  12. }
  13.  
  14. void send_pulse( void )
  15. {
  16.         // active on low
  17.         digitalWrite(PIN, low);
  18.         // use delay compliant to S0-specification of 30ms
  19.         delay(30);
  20.         // deactivate again
  21.         digitalWrite(PIN, high);
  22. }

hanskraayeveld's picture

There is a problem with my program and your code. I cant use delay because i used millis(). And using delay interrupt my program running and i am getting wrong data....

hanskraayeveld's picture

Maybe I am using kWh wrong.
I don't use seconds.
I use pulse time.
So pulsetime = time1 - time2;
So every pulse, I get an update in kw and kWh.

gebhardm's picture

This is an example code snippet; of course you have to use right metrics and correct delay functions - would it had helped if I wrote _delay_ms(30); as it is used in native AVR C?? (you may do a NOP loop; the only requirement is to get it up around 30ms, however you achieve it, to be in a detectable impulse length range)
A bit of transfer is always necessary, especially if you do not present your own code. This is a forum of inspiration, not necessasarily "direct solution"...

petur's picture

Step back and think how silly this is... you're converting a value to pulses, which are counted by the flukso to recreate the value.

Isn't there a way to send this to the flukso server directly?

gebhardm's picture

This approach is everything, but not "silly" as it indeed is a way to calculate energy transfer (and by that "efficiency") from a true temperature difference. This may also be applicable to detect the energy efficiency of solarthermic warm water installations on which you won't get a pulse out from the installation, if not provided by the control unit itself (which I am not aware of that it exists). Thus, as this is experimental, why not try it? I am thinking to supply my solarthermic water warmer also with exactly that...

petur's picture

Read back my comment... I'm talking about the mechanism to transmit the calculated value, not the calculation itself, or the reason for doing the calculation.

gebhardm's picture

Be sure, I read your comment - as there is no current solution to send data to the FLM server, but the one to use a given capability through interfacing with the FLM appliance's input options (pulse or analog), the approach is still more than fair and straight forward; your option is just another requirement to open up the FLM server for further data (e.g. direct MQTT interfacing, which IMHO raises the question for a different pricing model as well - which I assume must respectively will come with the Kube - if it comes one fine day)

hanskraayeveld's picture

Thanks gebhardm, optocoupler is the best way! I think its easier and safer then a relay! I don't know how many times a relay can switch and a optocoupler? But I think an optocoupler much more. That's what I need!

gebhardm's picture

There are also "reed relays" and as you do not have to switch high loads, the actual number of switch cycles is rather irrelevant (an optocoupler will be much quicker with respect to possible switch toggles, so higher frequency/shorter pulse lengths are possible); the only "issue" you have with an optocoupler in contrast to a (reed) relay is the fact that you need to get the connection correctly wired (poles of FLM pulse connector versus terminals of transistor in optocoupler) - but the chance to get is right the first time is always 50% ;-)

hanskraayeveld's picture

Okay... I have an optocoupler and there is a + and a - and 2 of the connections have ~
So I connected it good on the first time ( or it isnt a optocoupler)
It works fine.
Is it better to have the output pin HIGH and 30 ms LOW?
And why is it better?
Cost it more energy?
I have it LOW and 30 ms HIGH, but maybe I have some false counts...
???

gebhardm's picture

Look how the LED is connected and answer the question yourself; the FLM detects falling edge ( if I remember correctly)

hanskraayeveld's picture

Okay. Everyting is working fine now.
The count works great.
But I have another problem.
I measured the kW and kWh over 1 pulse. But the time from 1 to another pulse is everytime different. It varies from around 7 second (4 liter a minute) to 150 seconds (0.4 liter a minute). The energy from every pulse is at 50 degrees difference: 0,058 kWh.
But when the retour temp became higher, the difference became lower. So I give a pulse at 0,1 kWh and set in flukso it to 100. Most of the times it has 2 counts 1 pulse, 2 counts 1 pulse, but some times, 1 count 1 pulse. Or 3 counts 1 pulse.
It's hard to explain.
I want to give more pulses, e.g. 1 pulse per wattHour. But how can this be realized?

Thanks

hanskraayeveld's picture

See picture attached

gebhardm's picture

As sketched in above code snippet (and actually in your initial proposal): One variable takes the energy (unsigned long energy;) which you calculate from your temperature difference - actually you should directly convert it into Watt per millisecond (as in the sketch: 1 Wh = 1 W*60min*60sec*1000milliseconds = 3600000 Wms - kWh multiplied by 1000 respectively - never use float in an Arduino sketch (or any other microcontroller that has no floating point unit)); this variable is constantly increased. Another variable (unsigned long pulseconst;) takes the constant on which you want a pulse to be produced (in the sketch on each 1W - N_KWH equals, for example 1000 to produce one pulse per Watt); then you compare the energy to the pulse reference, send a pulse if it is larger and decrease the energy counter by the "pulse energy" transmitted... - you get the strange behavior as Arduinos are very bad on floating point numberd; thus, use "poor man's float", which is large integers... - from what I read, everything is fine already except for the number format...

gebhardm's picture

Wh - the missing "hour" on the 1000 pulses per kWh... - happy unit conversion :-)

hanskraayeveld's picture

This is too diffecult. I am a hobby designer, not a pro.

hanskraayeveld's picture

Maybe I can give you my code so you can see what's wrong?
If you like...

gebhardm's picture

http://github.com is the place to share code; by the way, there are "hobby designers" (hackers) that are much better than so called "professionals", so this is no criterium to think oneself into some stuff - be eager to learn!

hanskraayeveld's picture

Finally.... I did it!
The delay problem was a mind breaker to me....
But I did it with the while loop.

starttime = millis();
while (millis() < (starttime + 30);
{
}