SoftSerial battery drain
I've built an oil tank level sensor, using the US100 ultrasonic sensor. The sensor, when communicating via serial protocol, has the capability to compensate for temperature variations, and is a lot more accurate than the traditional "ping" method.
My problem is the current drain.
When I enable the software serial port, the current drain during sleep goes from a few nA to 2mA, and the 2 AA batteries powering the node, only last for a couple of weeks.
I take measurements only every 3 hours, but I have the battery reporting it's level every 30 minutes, and it is dropping like rock.
Any suggestions for implementing a serial port for a battery powered sensor? (Pro mini @3.3V/8MHz, with NRF24L01+, powered by 2 AA batteries).
@kted could you post your sketch?
If you do serialport.end() before going to sleep and serialport.begin() after waking up, does that lower the power consumption?
OK, problem solved.
First of all, I stopped using SoftSerial, and I am now using the regular serial port.
I can't debug the node any more, but it is working.
And the drain dropped to 1.9 mA.
This is the US100 idle current, so that was also a problem.
So I chose to power the sensor from pins 3 & 4, as VCC and GND, since just using pin 3 and GND kept the drain to 1.9mA
I turn pin 3 to output high and pin4 to output low, wait 5 seconds to let the sensor stabilize, since it gave erratic readings with anything less, take the measurement, and turn pins 3 & 4 to inputs, so there is no drain.
Seems to work so far, after a whole day of taking readings every minute, I am down by 10mV. I intend to take readings every 2 hours in normal operation, so I figure the batteries will last for about a year.
I am writing this from my phone, so I cannot post the source if anyone is interested, but let me know...
@mfalkvidd Haven't tried that.
I'll give it a chance just in case.