2014-11-29

Temperature & Humidity monitoring

Started to build a temp & humidity monitoring system. Yes, it's a ton of them out there already but I didn't make them so they don't count.

The requirements are multiple (more than standard 3) remote temp and humidity sensors that can be inside or outside. A central console connected to computer that receive the data and can log it somewhere.

Starting with remote sensor part I now figured out the parts needed, put them together and done some coding for it.
For initial round I'm going with all off the shelf stuff. Arduino pro mini as the brain, DHT22 as sensor and the dime a dussin 315MHz transmitters from ebay. Did find a case in a local store that seems to be perfect for the remote sensors at least.
Box to be filled
Since I want to run this off 2xAA batteries I also need a booster (the sensor requires at least 3.3v).
Remote Sensor

Coding is simplified by using VirtualWire lib and DHT22 lib. Was going to use jeelib for power saving sleep but for unknown reason jeelib doesn't like the other two (any one of them seems to work, strange) so I ended up grabbing some pieces from internet to make the arduino power down completely for 8 seconds wake up long enough to see that it's not yet time to send and keep sleeping.
Need to remove the power led but with that one still installed I'm down to 3.5mA during sleep and about 22mA when sending data.

Coding I done so far has defined a protocol that is <27 bytes (VirtualWire lib default limit) and still contain all I think I currently need.
Protocol:
  • 1 byte: Type of transmitter, 1=temp/humidity, 2=water level, 3-127=reserved for future use
  • 1 byte: Protocol format, depends on sensor but format 2 follows (1 is missing mV)
  • 4 byte = unit no of the device, basically a random 64bit number (don't think I need the 128bit uuid)
  • 2 byte = Sequence number so receiving side know it's same msg
  • 2 byte = vcc in mV
  • 2 byte = batt mV
  • 1 byte DHT22 status of the data
  • 2 byte temp*10
  • 2 byte humidity*10
  • 2 checksum - 2 bytes
I know length is missing but the first two bytes does define format and with that length can be added if the size is dynamic.
Vcc is calculated reading internal 1.1v ref
batt is a separate wire from before the booster

On the receiving side I got it to receive data, separate the different sensors and show a csv or human readable output on the serial port.
Receiver
My current issue is current and presentation.
The remote sensor is taking to much power for to long, considering changing so it only sends the data once and only if status is ok. If that transmission is lost we get it next round.

On the receiving side I'm wondering how to best present the info (besides serial output). The csv output is pretty simple
#Unitno,unitId,msgCnt,vcc mV,batt mV,stat,temp c,humid %
0,13C76FE0,11,4693,4092,0,22.60,42.60
1,2585C230,63,5051,2152,0,21.00,43.30
1,2585C230,65,5096,2076,0,21.00,43.30
0,13C76FE0,12,4693,4092,0,22.60,42.40
No time since then I would need a rtc somewhere and the time is when it's coming so the receiving app can time stamp itself.
I could add a 4x20 lcd but with more than 4 sensors it gets hard to present anything useful.
Thinking of sending it to an raspberry pi where I add it to a database and then have a website that can do the presentation.

One more thing to figure out is distance, how far away can a sensor be and what can be done to increase the range.


Update1: Managed to put it all inside the box
But I think I may have to find another sensor/add 1 battery, the stepup- converter is killing my battery even when idle.



Update2:
Done some testing and decided that the stepup converter must go. Running it on 5V means higher current to start with and the converter does use some power also. I have removed the power LED in the arduino so now it's only on when sending. I also improved the sleep part so it's doing a full power down and let the watchdog start it up every 8 seconds, so time between transmissions need to be a multiple of 8sec.
Some numbers measured with a cheap multimeter.
The battery lifetime is based on 2400mAh batteries, a sampling of about 4 sec (have to check on why so long) and with a rest of 72sec:

Running on 5v from booster, mA after booster:

Active: 15-18ma
Rest: 0.58mA
Batterylife: N/A (70 days - but not really relevant since that's after booster)

mA before boster:

Active: 42-44mA
Rest: 1.49mA
Batterylife: 27 days

Power usage during using 3xAA and no step-up

Active, 3-4 sec, 11mA
Resting - 78sec, .46-.47 mA
Batterylife: 98 days

So if I run on 2 batteries it takes 3x more power during rest than if I run on 3 batteries and no booster (partly because it's then running on 3.6v instead of 5v) and that means 3.6 times longer between battery replacements. While the arduino can run of 2 batteries the sensor requires at least 3.3V so I need 3x.


Version - 0.4 of the remote sensor code, still need a lot of cleanup but it works
 



Update3:
See http://lpaseen.blogspot.ca/2015/07/temperature-humidity-monitoring-update.html

No comments: