Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Arjun Ganesan
Published © GPL3+

nRF24L01+ with ATtiny85 3 Pins

Sending and Receiving data with nRF24L01+ using only 3 pins of ATTiny85.

IntermediateFull instructions provided92,898
nRF24L01+ with ATtiny85 3 Pins

Things used in this project

Hardware components

nRF24L01+
×2
ATtiny85
×1
Arduino UNO
Arduino UNO
×1
Ceramic Capacitor - 10nF
×1
Carbon Film Resistor - 22kΩ
×1
Switching Diode - 1n4148
×1
Power Source - 3v3
×1
nRF24L01+ Socket Adapter
Optional
×1

Story

Read more

Schematics

nRF24L01+ with ATtiny85 3 Pins

nRF24L01+ with Arduino Uno

Code

Transmitter

C/C++
#define CE_PIN 3
#define CSN_PIN 3 //Since we are using 3 pin configuration we will use same pin for both CE and CSN

#include "RF24.h"

RF24 radio(CE_PIN, CSN_PIN);

byte address[11] = "SimpleNode";
unsigned long payload = 0;

void setup() {
  radio.begin(); // Start up the radio
  radio.setAutoAck(1); // Ensure autoACK is enabled
  radio.setRetries(15,15); // Max delay between retries & number of retries
  radio.openWritingPipe(address); // Write to device address 'SimpleNode'
}

void loop(void){
  payload++;
  radio.write( &payload, sizeof(unsigned long) ); //Send data to 'Receiver' ever second
  delay(1000);
}

Receiver

C/C++
#define CE_PIN 7
#define CSN_PIN 8

#include <SPI.h>
#include "RF24.h"

RF24 radio(CE_PIN, CSN_PIN);

byte address[11] = "SimpleNode";
unsigned long payload = 0;

void setup() {
  Serial.begin(115200);
  radio.begin(); // Start up the radio
  radio.setAutoAck(1); // Ensure autoACK is enabled
  radio.setRetries(15,15); // Max delay between retries & number of retries
  radio.openReadingPipe(1, address); // Write to device address 'SimpleNode'
  radio.startListening();
}

void loop(void){
  radio.stopListening();
  radio.startListening();
  radio.read( &payload, sizeof(unsigned long) );
  if(payload != 0){
    Serial.print("Got Payload ");
    Serial.println(payload);
  }
  delay(1000);
}

Credits

Arjun Ganesan

Arjun Ganesan

5 projects • 145 followers
27. Web, Mobile and Desktop Developer. Hacker. Gamer. IoT Enthusiast. Electronics for Hobby and Fun.
Thanks to Ralph Doncaster.

Comments