Introduction: NRF24L01+ With ATtiny85 3 Pins
ATtiny85 is a cheap and powerful alternate when u don't need too many PWM pins. For a project just to read and transmit some sensor data ATtiny85 was enough for me. With cheaper ATtiny85 in place I was looking for cheaper ways to transmit the sensor data. Which brought me to nRF24L01+ a cheap, low power RF transceiver. This seemed to be the better solution for me. But there was one problem, limitation in number pins in ATtiny85. I can't connect both nRF24L01+ and the sensor in it. So I was looking out for solutions and came across "nrf24l01+ control with 3 ATtiny85 pins". Here I discuss how I implemented it.
There will be two modules in here transmitter and receiver. The transmitter would be a ATtiny85 sending some data and the receiver would be Arduino Uno receiving the data via nRF25L01+. I utilize the RF24 library (http://tmrh20.github.io/RF24/). Follow the instructions given there and add it to Arduino IDE before getting started with this. I won't be explaining much about RF24 as there is a very good documentation on it.
Step 1: Transmitter
The transmitter transmits a incrementing number every second. The ATtiny85 will send the data via nRF24L01+ using only 3 pins. The components required would be
- Ceramic Capacitor - 10nF
- Carbon Film Resistor - 22kΩ
- Switching Diode - 1n4148
Upload the code in sender.ino to ATtiny85. (https://www.instructables.com/id/How-to-program-the-ATtiny85-with-the-Arduino-uno-b/) Connect the components as shown in the diagram. If its not clear refer the fritzing file (nRF24L01+(With Socket) Attiny85.fzz) attached here. When power source is connected, the transmitter will start sending sequence of number every 1 second.
Note: Though rest of the nRF24L01+ 's pins are 5v tolerant you should always give 3v3 power to the Vcc or else you will damage it.
Step 2: Receiver
The receiver receives the data sent by the transmitter and received data can be seen in the Serial Monitor.
The components required would be
- Arduino Uno
- nRF24L01+ Socket Adapter (Optional)
Upload the code in receiver.ino to Uno. Connect the components as shown in the attached images. If the image is not clear refer the fritzing file (nRF24L01+ Arduino Uno.fzz) attached here.
Please note that Vcc should be always 3v3. In some Arduino Uno clones the 3v3 power might not have enough current which results in nRF24L01+ not working. Any one of the below methods are recommended to resolve this
- Use a separate 3v3 power supply
- Add a 10uF capacitor between Vcc and Gnd in the module itself
- Use a nRF24L01+ Socket Adapter
With the transmitter and receiver ready now it time to test. Make sure the power supply to transmitter in ON. Connect the Arduino Uno to PC and open serial monitor in arduino ide. It should work as shown in the attached video.
Step 3: Making It Permanent
Here is the circuit soldered on the perf board.
This is a simpler module to demonstrate how the nRF24L01+ and how we can utilize only 3 pins of ATtiny85 to connect it so that the rest of the pins are available for reading sensor data.
Step 4: Power Consumption
nRF24L01+ draws ~900nA when powered down, and ~15mA when awake/sending. As for ATtiny85 it consumes 0.005mA at sleep state and 10mA when awake.
If you application doesn't require the ATtiny85 to be active always then you can bring ATtiny85 to sleep every now and then depending on your requirement which will save a lot of power. You can use a watchdog timer to bring ATtiny85 to sleep state.
Here is an article explaining it in detail https://learn.sparkfun.com/tutorials/h2ohno/low-power-attiny
Participated in the
First Time Authors Contest 2016
1 Person Made This Project!
- aniruddh.hs made it!