Author Topic: Help needed for Temperature sensor project  (Read 1648 times)


  • NewMember
  • *
  • Posts: 8
Help needed for Temperature sensor project
« on: September 09, 2018, 06:21:01 AM »
Hi all.

I've been tinkering around with Moteinos for a few weeks now as I'm wanting to create a battery operated temperature sensor based on a DS18B20 waterproof sensor but to be honest I'm struggling getting any kind of realistic battery life - hence the 'cry for help'

Key points:
- Must be able to run on a battery / batteries for over 12 months (batteries that are available in general stores) - using as little power as possible and going to sleep when not in use
- Must take a temperature (Celsius) reading every 30 mins and send to Pi Gateway as 'TIMESTAMP, NODE_ID, TEMP_READING'
- Will use Moteino R6 with RFM69HCW 433Mhz transciever and 4Mbit Flash - may look at a customised PCB design in future with easier connections for battery / sensor.
- With the Flash chip, the ability for wireless programming in future would be useful.
- I'm not sure if the Pi Gateway sends an acknowledgement once it receives data from a node but this would be useful if the Flash chip on sensor node stores the values until it receives acknowledgement from Pi Gateway - preventing readings from being lost in the event of radio problem.

I realise that there are a few projects out there that already do this. I've tried playing around with them but struggling to get a realistic battery life and first few readings from sensors are incorrect - I'm learning Arduino / Moteino code and still at the beginner level :(

Thanks for taking the time to read this post and I look forward to hearing from anybody who may be interested.


  • Hero Member
  • *****
  • Posts: 1929
Re: Help needed for Temperature sensor project
« Reply #1 on: September 09, 2018, 03:57:44 PM »
There are plenty of posts on this forum and examples in the LowPower library to enable you to do what you want.

If you want to save power there are two things you need to do:
 1. Sleep everything that is permanently powered (processor, radio, flash).  In all cases, the respective component needs to be initialized so it enters the sleep state in the proper configuration.
 2. Anything else should be powered off (usually by GPIO) and no component pins should be floating - they should either be pulled up or driven to a low power level (high or low depending on signal, eg CS pins should be outputs driven high).

You can use the LowPower.powerDown() function to sleep for 8Seconds and loop for 225 cycles (total 1800 seconds).  This will use the WDT timer and yield average current consumption in the 'teens' of uA.

You can use the ListenMode timer provided by the RFM69 radio instead of the LowPower library and this will get you into the single digit uA region.

Or, you can use a device like the TPL5110 timer breakout that LowPower labs offers which will totally turn off power to everything but the timer and get your average current to well below 100nA.

In either case, if you're using the 8MHz version of the Moteino, you can run off a pair of AA batteries for well over 1 year.


  • NewMember
  • *
  • Posts: 8
Re: Help needed for Temperature sensor project
« Reply #2 on: September 12, 2018, 09:21:15 AM »
Hi Tom,

Many thanks for your reply which was very helpful and has given me a lot of options to explore and try to learn.


  • NewMember
  • *
  • Posts: 26
Re: Help needed for Temperature sensor project
« Reply #3 on: September 12, 2018, 11:23:44 PM »
To give you an idea of what's possible, i have a bunch of DS18B20 temperature nodes that send a reading every minute. They run from a single AA 1.5V alkaline cell via a boost regulator to generate the 3.3V. With careful attention to sleeping the processor and radio, I get almost 2 years battery life.
Most of the sample code for reading the DS18B20 has a wait loop while the temperature reading is taken. That delay is 750ms for full 12bit resolution. You need to sleep the processor then too.

See also some discussion and code attached here:
« Last Edit: September 12, 2018, 11:58:25 PM by damonb »