Community
OpenEnergyMonitor

OpenEnergyMonitor Community

EmonTH with Flukso water probe

Tags: #<Tag:0x00007f1bd7065d20> #<Tag:0x00007f1bd7065bb8> #<Tag:0x00007f1bd7065a50>

I’ve got an emonTH v2 with an external DS18B20, and I was looking to connect up the Flukso water probe sensor.

I’ve looked through the emonTH wiki page about adding a pulse sensor.
However, the Flukso sensor cable only has a red and black wire, and I’m conscious that the DS18B20 is already using the GND terminal pin.
i rarely get round to doing any electronics, so have to relearn everything each time, but is it possible to have both external temperature sensor and water probe wired in at same time?

I’ve also got issues with range, where EmonHub is only getting data from EmonTH intermittently, due to thick stone walls and I’m getting the metal shelving. However, the EmonTX v3 is only a couple of meters from EmonTH and thanks to it’s big antenna has no problem getting data to EmonHub.

I thought I read somewhere there was a way of using EmonTX for example as a relay for the EmonTH signal, but I got lost in the details of the old forum post comments. Would this be possible?

I assume that the Flukso water probe can work with EmonCMS as it was mentionned in this thread https://openenergymonitor.org/emon/node/11754, and I have the exact meter from the flukso shop page.

Has anyone else had any luck/experience doing this?

Many thanks

The clue is “This tubular reed switch…”

You will connect the probe to the pulse input of your emonTH - pin 4 on the screw terminals, which is not the inputs that the two sensors use. That input uses the internal pull-up so the switch needs to be wired between 4 and 3 (GND).

In theory, you should be able to use the emonTx as a relay. Unfortunately, I don’t know of a sketch that does that. If you’re up for modifying/writing a sketch, I think the starting point will be your emonTx sketch. The first job will be to remove the 10 s sleep and instead put a timer into the main loop so that it runs continuously but only measures however often you want (say every 10 s); then I’d suggest getting the emonGLCD sketch and using the receive section of that to check for a message from your emonTH each time it runs around the main loop (just as the GLCD sketch itself does), and then if there is one, retransmit it. (Or, of course, the emonTx could merge the data from the TH with its own and send it all as one message, which is probably a much easier way to do it.)

Since a couple of days, I have this sensor hooked up to a EmonBase. (I also added an external pull up resistor.)

I have the same water meter as the one on the Flukso shop page. It emits two pulses per l, which is 4 state changes (so my measurement is accurate up to 0.25l).

I had to improve the existing pulse handling interrupt to work with the CHANGE interrupt and debounce the signal correctly, but now it appears to be running perfectly over the short span I have it working. I can share the code if you like.

Although the emonBase is different beast to the emonTH and the emonTx (it’s a Raspberry Pi, not an Atmel328P), it might be helpful, to anyone coming across this thread in the future, to post the code anyway.

Thanks for the response @Robert.Wall I was just blindly following the wire colours!

That would be really helpful @bvrslypp thanks, I might be able to make some sense of it…
I was thinking I would do the pulse settings in the graphs, but it might make sense to somehow match it on the emonTH.
However, if I can’t get any data from the emonTH to the emonBase there’s not much point :frowning:

I did get it connected up to the emonTH last night, not sure if it counted pulse at all as I got one reading, and then nothing since, but that might have been before it was in it’s final position.

It’s annoying as signal comes through clean from emonTX with an rssi of -78, but the emonTH, I’d say 2 metres along doesn’t. Antenna difference probably has a lot to do with it.

If can’t easily use emonTx as a signal relay, is it possible to improve emonTH antenna?
I did come across this http://www.instructables.com/id/433-MHz-Coil-loaded-antenna/ but unsure of correct length and wavelength.
I assume https://github.com/openenergymonitor/Hardware/tree/master/emonTH/emonTH_V1_5 is still relevant even if it’s now v2

Actually I’ve just found that it does get a signal, I just pulled battery out and put it back in a data was received by emonBase, but it only lasted a few minutes, then nothing again.

You’ll find the pcb layout and schematic are different, and available on GitHub. I’ve not had my hands on a V2 so I can’t say what else, apart from the obvious sensor change, is different.

The emonTH transmits on 433 MHz normally, if you look at Resources > Building Blocks, you’ll find pictures of the various RF modules from which you can identify which, hence the frequency, you’re using. Obviously, all nodes on your system will and must be the same. You can try the different antenna, but be aware that the RFM69CW data sheet cautions against using the module to transmit at maximum power with a mismatched antenna.

I hooked my reed sensor to the RFM2Pi module in the EmonBase, and updated the RFM2Pi firmware. As my understanding RFM2Pi is similar to emonTH as they both have ATmega328 and RFM module. Their context and how they fit in the system is different however!

You can use the debounce ideas from my
updated RFM69CW_RF12_Demo_ATmega328_Pulse_DS18B20.zip (27.0 KB) version of https://github.com/openenergymonitor/RFM2Pi/tree/master/firmware/dev/RFM69CW_RF12_Demo_ATmega328_Pulse_DS18B20

I am using the digital interrupt to count the switch state changes. I discovered that the reed switch tends to trigger multiple subsequent interrupts almost immediately (<1ms) after each other. When reading the digital value in those successive interrupts, I get the same digital value (meaning that the interrupt can confirm itself).
The included code also contains support for short peaks, if they are too short, they are not counted (subtracted from the count total; the sending loop waits until it is sure it can send the count total).

Important difference to the case of @waako is that he will need to modify the way the packet is sent (in the RFM2Pi firmware it is sent over the serial interface and @waoko would need to send it over the radio transmitter).

If that is correct, you have an emonPi, not an emonBase! They are different animals.

I am sure it is an emonBase :slight_smile:

(In fact, I have both an emonPi and an emonBase. I live in an apartment building and the emonBase is located in the basement, near the water and gas meters. The emonPi is located in my flat on the top floor, next to my fuse box. There is no wireless contact, but I managed to set up a wired network connection using powerline adapters :slight_smile:

I think the difference between the emonPi and emonBase is next to the display and enclosure that the emonBase can not measure current?

1 Like

Yes, that’s it. The emonPi has what is in effect a 2-channel current and single-voltage emonTx inside the case, along with a display and of course the Raspberry Pi. The emonBase is a Raspberry Pi with a RFM69Pi radio module sitting on it, instead of the cut-down emonTx. So as you say, no voltage and current monitoring is possible with the emonBase.

To receive pulses on the emonPi, you can use the same as for an emonTx, because the pulse input goes to the Atmel 328P processor on the cut-down emonTx. To do it on the emonBase, you need to go straight in to the Raspberry Pi itself, and handle the pulses there.

I connected my sensor to the RFM2Pi module and modified its firmware to count pulses, as inspired by
http://openenergymonitor.blogspot.be/2015/09/pulse-counting-with-rfm69pi-and.html.

This is how it looks now:

.

In any case, this set up works, and I see my pulse count in emoncms. However, confused by what is said above, I wonder if I did something wrong? Is there a new way of counting pulses using the emonBases Raspberry Pi pins?

If it works, it is correct. Those input pins are a recent addition, which I’d missed. They are not present on the RFM12Pi.

Whilst I don’t disagree with Robert’s answer, to answer your question about whether pulses can be counted directly on the RPi, yes you can, for example in this Directly connecting to Optical Pulse Counter with RPi? thread. I have used the same or similar code to count pulses from a generation meter’s SO contacts too.

Although if you are receiving RF data and need the rfm69pi there anyway, there is probably little to gain by shifting the pulse counting to the RPi.

Sorry for the slow reply, been away for a few weeks.

Got it all working in the end, of course it was just a range issue, and I was unashamedly being stupid and not having the EmonBase antenna out of the box…

I think I’ve got it calculating properly by doing a x0.25 process on the pulsecount input before the Wh Accumulator process.

I pretty much had it giving the same value as meter, but then batteries died unexpectedly (need to set up nodered alert emails) so will have to tweak that again. It’s currently too cold and late to go out and do a meter reading to update emoncms input processes.

I’ve still got a lot to understand on how to setup and visualise water usage in emoncms, but I’m slowly getting there. I at least have a daily water usage graph, as well as another two with 10 and 30 minute increments.

Thanks for all the support so far.