Missing value from emonTH - SOLVED

Hi - I bought an emonTH with a DS18B20 temperature sensor and an external DS18B20 sensor, together with a Raspberry Pi Base station, back in early October, but have only just got around to setting it up.

I've attached a screenshot of the inputs (from a local copy of emoncms 8.4.0 and emonhub running on the Raspberry Pi) that I am getting. I can see the onboard temperature, and the battery level, but I can't see the external temperature input anywhere.

Any ideas what I need to do to get this please?

 

Robert Wall's picture

Re: Missing value from emonTH - SOLVED

I don't know, but my (saved) emonTH sketch doesn't transmit the external temperature. However, two sketches that I've looked at on GitHub do, emonTH_DHT22_dual_DS18B20 and emonTH_DHT22_DS18B20, and the rest might do too, so without checking both that and the change notes, I think you need to load a (later) sketch to your emonTH.

engeeaitch's picture

Re: Missing value from emonTH - SOLVED

Thanks for the suggestion.  I looked at the emonTH_DHT22_dual_DS18B20 sketch, and this appears to do what I want.  But first it says that I need to find out the addresses of the two sensors.  So I loaded the sensor test sketch, and I am confident that I have got the addresses.

However, when I compile the emonTH_DHT22_dual_DS18B20 sketch, it uses the RFu_JeeLib: https://github.com/openenergymonitor/RFu_jeelib library, which the documentation says is "(OLD emonTH V1.4)".

I have got an emonTH V1.5  Any idea what needs to be done to upgrade the sketch?

Also, I tried to upload a 'factory' sketch, and chose emonTH_DHT22_DS18B20_RFM69CW, but it doesn't work.  I notice that there is a new firmware planned for units shipped from December, but this also requires changes to the base station.  Any idea which sketch I can load to get me back to where I was?

Robert Wall's picture

Re: Missing value from emonTH - SOLVED

I've had a look at emonTH_DHT22_dual_DS18B20, and all I think you need to do here, if you have a V1.5 with a surface-mount processor on the main board and not the RFu328 piggy-back board, is replace "#include <RFu_JeeLib.h>" with "#include <JeeLib.h>".

If you're using "emonTH_DHT22_DS18B20_RFM69CW" and you have the RFM12B radio (see "RFM Radio Modules - Identifying different types" in Resources), then change "#define RF69_COMPAT 1" to "#define RF69_COMPAT 0" like it says in the comment.

engeeaitch's picture

Re: Missing value from emonTH - SOLVED

Thanks again for your suggestions, but I've not had much success....

I've made the following changes to emonTH_DHT22_dual_DS18B20

  • Changed Rfu_JeeLib.h to JeeLib.h
  • ​Added #define RF69_COMPAT 1
  • Added the addresses of the two temperature sensors
  • Changed MINS_BETWEEN_READINGS to 1 (to make debugging easier)

I've attached a screen shot of the serial monitor output.

- Why am I getting all the corrupt characters? (When I run the sensor test sketch, I don't get any of these, so I think it must be to do with the sketch.  I've also played around with BAUD rates, but it made no difference)

- The sketch pauses for a minute after displaying sensor 1 and before displaying sensor 2.  Looking at the sketch, this doesn't make sense to me.

- None of the readings are getting back to my Raspberry Pi. :-(

Also, I can't seem to find a 'factory' sketch that works.

Thanks for any help.

 

P.S. I'm using Arduino IDE 1.6.6 - don't know if that is significant - but everything compiles OK.

engeeaitch's picture

Re: Missing value from emonTH - SOLVED

I have now solved the problem (with some help from Glyn and Robert).

The 'factory' sketch is here:
https://github.com/openenergymonitor/emonTH/blob/master/emonTH_DHT22_DS18B20_RFM69CW/emonTH_DHT22_DS18B20_RFM69CW.ino
 
However, I was still not receiving anything on the RPi until I did a reboot, and it magically started working.
 
I then used this sketch:
https://github.com/openenergymonitor/emonTH/tree/master/emonTH_DHT22_dual_DS18B20
and changed RFu_JeeLib.h to JeeLib.h, added RF69_COMPAT 1 and added the addresses of my two sensors.  This then started working - sort of.
 
I still had the corrupt characters on the serial monitor screen.  Looking at the corruption, it seems as though the corruption always starts after a pause - it's as if there needs to be some sort of delay before starting to send to the serial interface.
 
The sketch also appears to stop after the first reading and wakes at the start of the second reading.  However, looking at the inputs, both were being sent in the same update.  It's as if something goes to sleep before it's had a chance to send the characters to the serial port.
 
It wasn't very reliable - only 50% or so of the packets were getting through.  However, by reading some of the posts and comparing with the factory sketch, I added a delay after the two rf12_sleep calls and this has made a huge difference - all seems to be working now.
 
As an aside, I've spent a lot of effort on this - I bought the emonTH with the two temp sensors from the shop, and would have expected working firmware that read the two sensors to have been loaded on the chip - my guess is that a lot of people would have given up on this long before I did.
 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.