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|
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.
- 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
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.
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 %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
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
Batterylife: N/A (70 days - but not really relevant since that's after booster)
mA before boster:Active: 42-44mA
Batterylife: 27 days
Power usage during using 3xAA and no step-upActive, 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