Project

General

Profile

jeenode + powerboard + onewire, battery empty in two days

Added by gjniewenhuijse almost 2 years ago

Hello,

I have a jeenode with powerboard to read my temperature every 15 minutes from a onewire sensor. I send them also to another jeenode every 15 minutes.

This works all great, but my battery is empty every 2 days.

How to solve this? Please see my attached code.

I have the following power code:

// Power down radio:
rf12_sleep(RF12_SLEEP);

// Sleep for Nminutes:
for (byte i = 0; i < intervalSleep; ++i)
  Sleepy::loseSomeTime(60000); //0..65535 value, so a for statement is needed when you need to wait longer

// Power back up radio:
rf12_sleep(RF12_WAKEUP);

TempSensor.ino (4.18 KB)


Replies (15)

RE: jeenode + powerboard + onewire, battery empty in two days - Added by JohnO almost 2 years ago

You appear to keep the power applied to the DS continuously, have you considered using an output pin to power the DS and turn it off between samples?

RE: jeenode + powerboard + onewire, battery empty in two days - Added by gjniewenhuijse almost 2 years ago

How/where to turn this on and off?

Now i power down the rf12, but do i need to power down more? Maybe the whole jeenode?

Thanks

RE: jeenode + powerboard + onewire, battery empty in two days - Added by JohnO almost 2 years ago

I think you are using a one wire temperature sensor DS18S20 or the like. I expect you will be feeding 3.3v into the wiring to the temperature sensor. My suggestion would be to use a spare I/O pin on your JeeNode to supply power to the temperature sensor then write the pin high or low depending if you want to power the sensor or not. If you don’t power the sensor during the sleep time (15 minutes) you will save battery power.

RE: jeenode + powerboard + onewire, battery empty in two days - Added by gjniewenhuijse almost 2 years ago

I connected a led to the power and ground pin (same pins as the onewire sensor) and see that in my Original code also the led is powering on and off. So i think the DS is also already powered down at sleep.

RE: jeenode + powerboard + onewire, battery empty in two days - Added by AndreasZoeller almost 2 years ago

i am running a similar configuration for nearly 1 year with one battery. I don’t power off the DS18B20. I am reading the temperature every 2 minutes and sending the data if temperature has changed.

Andreas

RE: jeenode + powerboard + onewire, battery empty in two days - Added by gjniewenhuijse almost 2 years ago

can you please upload your code, so i can see the differences?

RE: jeenode + powerboard + onewire, battery empty in two days - Added by damonb over 1 year ago

I also have several sensor nodes running a single DS18B20. They are standard JeeNodes powered by the JeeLabs AA Power Board and they report temperature and battery voltage every minute.
My oldest one has been running on a single AA alkaline cell for 1053 days (that’s 2.88 years). It is down to 1.05 volts now so I think it may just make it to 3 years.
The sketch first wakes up and sets the DS18B20 conversion running, then sleeps again for another 800ms. Then it wakes up again, reads the temperature result and the battery voltage, transmits the packet, and goes back to sleep for the rest of the minute. Timing logic uses @jcw’s scheduler class.
The DS18B20 is powered the whole time as it draws very little current in standby mode (typical 0.75µA, max 1.0µA according to the Maxim datasheet).
I use the recommended 4.7kΩ pull-up on the DS18B20 data line. The DS18B20 and its pull-up are soldered directly to a 6-pin header plugged into the JeeNode port.
Because the power source is 1.5V the battery voltage can be measured directly with an analogue pin. I use a low pass filter of 10kΩ / 0.1µF to get rid of the noise from the boost regulator chip and thereby stabilise the voltage reading.
Sketch is attached.
OneWire library I used is from http://www.pjrc.com/teensy/td\_libs\_OneWire.html

tempNodeV4.ino - sketch (5.26 KB)

20150728_203938_30_.jpg View - photo (328 KB)

2351

RE: jeenode + powerboard + onewire, battery empty in two days - Added by gjniewenhuijse over 1 year ago

Thanks, nice piece of code.

I see in my code that i missed the following line:
#include

Can that be the problem?

RE: jeenode + powerboard + onewire, battery empty in two days - Added by damonb over 1 year ago

Oops, reference to avr/sleep.h is not needed. It was probably a remnant from an early version of the sketch.
I have not read your code in detail but I can see you leave the radio and the µC powered up while the DS18B20 processing is going on, including the 1 second delay while the DS18B20 does its reading. However this should not make much of a difference if you are sleeping for 15 minutes.
Perhaps your loop logic is not right, and it does not do the long sleep every time. You should be able to see this from the serial output.
Also I note you have the parasitic power option set on the DS18B20 conversion… this is not needed if you are powering the DS18B20 directly.

ds.write(0x44,1);         // start conversion, with parasite power on at the end

If you have the capability to measure the current drain, this should give you some clues. It should be about 4 or 5 µA when sleeping.

RE: jeenode + powerboard + onewire, battery empty in two days - Added by gjniewenhuijse over 1 year ago

damonb wrote:
> Perhaps your loop logic is not right, and it does not do the long sleep every time. You should be able to see this from the serial output.

Can you please explane that? When i use the serial output i see every 15 minutes a temperature packet, and thats allright i think?

RE: jeenode + powerboard + onewire, battery empty in two days - Added by damonb over 1 year ago

Ok then, if you’ve proved it is sleeping for 15 minutes, the problem must be the current drain while sleeping. You should try to measure, do you have multimeter? Try to isolate which component is causing the drain: could be the DS18B20 or the JeeNode, if JeeNode, could be the MPU or the radio, but then it is harder to measure directly.
Try loading my code and see if that works, as it could be a hardware or wiring fault. Have you checked the DS18B20 pull-up resistor is wired correctly? Are you using 2-wire parasitic power mode? (Your sketch indicates you are)

RE: jeenode + powerboard + onewire, battery empty in two days - Added by gjniewenhuijse over 1 year ago

damonb wrote:
> Ok then, if you’ve proved it is sleeping for 15 minutes, the problem must be the current drain while sleeping. You should try to measure, do you have multimeter? Try to isolate which component is causing the drain: could be the DS18B20 or the JeeNode, if JeeNode, could be the MPU or the radio, but then it is harder to measure directly.
> Try loading my code and see if that works, as it could be a hardware or wiring fault. Have you checked the DS18B20 pull-up resistor is wired correctly? Are you using 2-wire parasitic power mode? (Your sketch indicates you are)

I used your code and it works fine, no downtime/battery empty failures now. Mmmm i think there is a failure in my original code, but where :) So i used your code now, it looks nice.

RE: jeenode + powerboard + onewire, battery empty in two days - Added by damonb over 1 year ago

I think I jinxed myself by posting… the long-running temperature node in my cellar died at 15:44 on 22 August, which was day 1078 - only made it to 2.95 years :(
glad my code works for you :)

    (1-15/15)