Ultra-Low-Power Sensor Hub Using nRF24L01 Modules

Somnath Bera is an avid user of open source software. Professionally, he is a thermal power expert and works as additional general manager at NTPC Ltd

- Advertisement -
 

Presented here is an ATmega328P microcontroller-based ultra low power sensor hub using nRF24L01+ radio frequency (RF) transceiver modules having transmitter and receiver units.

The transmitter sends humidity and temperature values of a place to the receiver kept at a remote location for display on an OLED module.

The nRF24L01+ module used in the receiver unit is a 2.4GHz transceiver suitable for ultra-low-power wireless applications. It is designed for operation in ISM band (industrial, scientific and medical radio band) of 2.400-2.4835GHz.

- Advertisement -

The nRF24L01+PA and LNA module used in the transmitter unit is similar to nRF24L01+ but has built-in power amplifier (PA) and low-noise amplifier (LNA) circuits, which help transmit the signal to a longer distance and achieve more stable performance for industry-standard applications.

The search for a low-power system started when some EFY readers questioned a DIY of mine, saying that ATmega328P processor would not sustain 3.3/5 volts. But it worked well because of the extreme low power capability of the ATmega processor. More detail is provided under extreme low power sub-head of this article.

Ultra low power sensor circuit

The heart of the sensor hub is the low-power ATmega328P, which runs at internal 4MHz speed. A DHT22 sensor is used to pick up the relative humidity and temperature of the area. Low-power radio transceiver module nRF24L01+PA LNA (Fig. 1) transmitter transmits the signal.

nRF24L01+PA LNA module
Fig. 1: nRF24L01+PA LNA module

You can add more sensors as lots of GPIO pins of the transceiver module are unused. A 470µF capacitor acts as the stabiliser, while the sensor (radio) module draws power on burst.

Parameters for radios in both the transmitter and receiver modules are set as follows:

  • Data Rate = 250kBps
  • RF_CH = 0x6c [108]
  • Model = nRF24L01+
  • CRC Length = 16 bits
  • PA Power = PA_MAX

RF_CH = 0x6c is the 108th channel. Normally, the 2.4GHz band is divided into a variety of channels as shown in the table.

The 108th channel is at around 2.508GHz, which is well above Wi-Fi LAN frequency and legal to use. You can set the module to operate on 250kBps data rate and at different channels. Chances of dissemination are fairly high at 250kBps data rate. Interestingly, almost all microwave ovens operate at 2.4GHz. Therefore channels 0-82 are very noisy. The script for this project is designed such that first all the radio details are printed on the serial terminal and then the data starts appearing.

Principle of operation

The ATmega328P processor is a low-power version of ATmega328 chip. Its supply current vs frequency graph, as per the datasheet, is shown in Fig. 2. As can be seen, the processor is quite tolerant from 1.8 volts up to 5.5 volts at 1MHz, 1.8V, 25ºC.

Supply current vs frequency
Fig. 2: Supply current vs frequency

The processor works in active mode at 0.2µA, power-down mode at 0.1µA and power-save mode at 0.75µA (including 32kHz RTC). Getting a 0.2µA current for deep-sleep power-down mode, however, is tricky. At the same time, getting around 1µA in deep-sleep mode is easy, with the help of the chip’s watchdog timer (WDT) and brown-out detection fuse.

First, turn off the brown-out detection fuse so that low-voltage operation becomes possible without resetting. As the voltage goes down, so does the current (refer the graph in Fig. 2).

Interestingly, as the frequency goes down, so does the power consumption. That means if the chip is designed to work on a lower resonating frequency, the power consumption will further reduce. To reduce the frequency of operation, we divide the 8MHz frequency internally by commands. At 3.3V operation, power consumption goes down as follows:

  • clock_div_1-3.1 mA clock_div_2 – 1.8 mA
  • clock_div_4-1.1 mA clock_div_8 – 750 μA
  • clock_div_16-550 μA cock_div_32 – 393 μA
  • clock_div_64-351 μA clock_div_128 – 296 μA
  • clock_div_256 – 288 μA

To reduce the frequency of operation, here’s a very simple command to use inside setup( ):

slow clock to divide by 256
clock_prescale_set (clock_div_256);

As per Fig. 2, at 4MHz, the chip will continue to work off 1.8V supply.

If the WDT is turned off, the chip will get sleep current to the tune of 1µA, but it will not wake up on its own—unless you give it a shock through interrupter (0) from pin 4 of ATmega328P, momentarily making it ground.

However, in this project we want it to send signals periodically (once every 42 minutes). Therefore we don’t set the WDT ‘off.’ The sleep current will be more than 30µA but the operation will be periodic on its own. The WDT clock is not very precise as compared to other methods of time keeping. However, at low power, the WDT clock does not differ much from real-time clocks. The entire operation is accomplished with the help of a library file called lowpower.h, which can be downloaded from the following link

Transmitter unit

Fig. 3 shows the transmitter circuit. It can be powered by a 3.7V Li-ion cell or two 1.5V pencil cells. Theoretically, the devices used here are capable of running at up to 1.8 volts, but at less than 2 volts the nRF24L01+PA&LNA radio stops working and at less than 2.8 volts the DHT22 sensor will not function. Small capacitors are added to the supply bus of the DHT22 and the nRF24L01 for stability. Vcc supply for the DHT22 is taken from port PD4 (pin 6) of ATmega328P, whereas the nRF24L01+ is directly connected with 3.7V supply. To reduce power consumption by the radio in idle state, we use powerDown( ) command of the radio in the code.

Transmitter circuit
Fig. 3: Transmitter circuit

Before burning the code (nrf24l01_tx6.ino) into a fresh ATmega328P chip, burn the bootloader code for the inbuilt internal 8MHz clock. For details, see under AVR programmer sub-head.

Receiver unit

Fig. 4 shows the receiver circuit. The nRF24L01+ radio is designed to operate between 1.9-3.6 volts only. Connecting the module to 5 volts may damage it permanently; it overheats in case of reverse connection or high-voltage connection. Connect a small capacitor (say, 10µF) between Vcc and GND leads of nRF24L01+ radio. Pin details of nRF24L01+ (shown in Fig. 5) and nRF24L01+PA and LNA modules are the same.

Fig. 4: Receiver circuit

The nRF24L01+ module is connected to an I2C 64×128 OLED through an ATmega328P. The humidity and temperature data received by the module is displayed on the OLED. You can also see this data on the serial monitor of Arduino IDE. All the nRF24L01+ radios are capable of transmitting six channels simultaneously. Unique pipe addresses or IDs selected here for both the transmitter and receiver modules are 0xE8E8F0F0E1LL.

Pin details of nRF24L01+ module
Fig. 5: Pin details of nRF24L01+ module

AVR programmer

To make this project work, you need an AVR programmer. You can make one yourself as described under ‘Arduino as AVR Programmer’.

This small setup requires an Arduino board, a ZIF (zero-insertion force) socket, a blank ATmega328P and a few passive components. With these, you can create as much Arduino as you want on the fly.

First, burn the bootloader for the internal 8MHz oscillator of the ATmega328P chip. To do this, in any latest Arduino IDE, select ToolsBoardsArduino LilyPad and then burn the Arduino bootloader onto the ATmega328P chip. LilyPad is the simplest Arduino board on internal 8MHz clock. In case the chip is already burnt as Arduino Uno (16MHz clock), it will not burn the 8MHz internal clock bootloader, unless the 16MHz quartz is connected to it. Once the internal 8MHz clock bootloader is burnt, remove the 16MHz quartz and proceed to burn the main sketch.

Extreme low power

A small lithium-ion button cell is good enough to run the small sensor hub and transmit signals up to 500 metres away for more than 25 days non-stop. On a 3.7V cell, the transmitter takes just 6-7mA current for two seconds and then sleeps for 40 seconds drawing 30µA current. The battery runs for weeks together.

The receiver draws 32mA current for ten seconds and then sleeps for 32 seconds on 8mA current.

Here’s the calculation:

Current consumption (transmitter)=(2×7)+(40×0.030)=15.2mA seconds in 42 seconds

Therefore, in 1 second = 15.2/ 42 mA seconds=0.3619mA seconds

In 1 minute = 0.3619×60

In 1 hour = 0.3619×60×60 mA seconds

In 24 hours=0.3619×60×60× 24 mA seconds
=(0.3619×60×60×24)/3600 mA hours
=8.68571mAh

On a 3.7-volt, 150mAh battery it will last for 150/8.68571 = 17 days

Current consumption (receiver) is {(10×32)+(32×8.0)}/42 = 13.714mA seconds
=(13.714×60×60×24)/3600
=329.143mAh

On a 3.7-volt, 150mAh button cell, it will last for about 150/329= 27 minutes.

Display consumes more current.

Note that nRF24L01 radios operate off at maximum 3.6 volts. Sometimes, when the Li-ion battery is fully charged, the voltage may go as high as 4.01 volts, so the radio may not work. Put a diode in series with the battery connection so that the voltage drops by 0.7 volt and the radios start working again.

Construction and testing

An actual-size PCB layout for the transmitter circuit is shown in Fig. 6 and its components layout in Fig. 7. PCB layout for the receiver circuit is shown in Fig. 8 and its components layout in Fig. 9. After assembling the circuits on respective PCBs, enclose these in suitable cabinets and place them some distance apart.

Fig. 6: PCB layout of the transmitter
Fig. 7: Components layout for the PCB in Fig. 6
Fig. 8: PCB layout of the receiver
Fig. 9: Components layout for the PCB in Fig. 8

Download PCB and component layout PDFs: click here

Download source code

Connect the battery to the transmitter unit and measure the current. The current withdrawn is 6-7 mA while transmitting for two seconds and 30µA for the remaining 40 seconds. For periodicity, we used the WDT of the MCU, which is not very precise. It provides five incremental steps of 250ms, 500ms, 2, 4 and 8 seconds. That means, it will transmit once every 5×8+2=42 seconds. The DHT22 sensor requires a minimum of 2.8 volts to operate. Therefore put a fairly big capacitor (100-470µF) across its Vcc and GND pins. Else, you will get temperature and relative humidity values as zero. The sensor takes two seconds between readings.


Feel interested? Check out more electronics projects.

- Advertisement -

SHARE YOUR THOUGHTS & COMMENTS

Please enter your comment!
Please enter your name here

 
 

What's New @ Electronicsforu.com

Most Popular DIYs

Electronics Components

Design Guides

Truly Innovative Tech