Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Login | Sign Up
share what you make
Featured:
3D Printing Class
Arduino
Sewing
With Instructables you can share what you make with the world, and tap into an ever-growing
community of creative experts.
The circuits are very simple and will only do two thigs:
This can be used as base for a more complex project. For example, it could easily be expanded to
send complex data streams.
Arduino board, I will be using an Arduino Nano with the ATmega328 chip.
nRF24L01 transmitter.
2 LEDs, one green and one red.
A button.
3 Resistors (depends on your LEDs, but probably about 200-1000 Ohm).
(Optional, but very helpful) Breadboard.
Step 2: Connection
IMPORTANT: You can use the normal 5V digital pins for the input pins of the nRF24L01,
but you must use the 3.3V pin as input power source. If you use 5V instead, you will
probably burn the chip, since 5V is outside of its 1.9 to 3.6V supply range.
The Arduino nano to nRF24L01 pin connection is as follows (note that you may need to connect
it differently if you use a different arduino board, refer to the RadioHead library):
VCC - 3.3V
GND - GND
CE - D8
CSN - D10
SCK - D13
MOSI - D11
MISO - D12
IRQ - Not connected
Further, I use D5 for the button, D4 for the red LED and D3 for the green one, each connected
with a 220 Ohm resistor.
To power the arduino boards, you can connect them to a USB port or to a 9V battery (Battery
negative to GND and positive to VIN).
Step 3: Code
Download the RadioHead Library and install it.
#include <SPI.h>
#include <RH_NRF24.h>
RH_NRF24 nrf24;
int greenLed = 3;
int redLed = 4;
int button = 5;
void setup()
Serial.begin(9600);
pinMode(greenLed, OUTPUT);
pinMode(redLed, OUTPUT);
pinMode(button, INPUT);
while (!Serial)
if (!nrf24.init())
Serial.println("init failed");
// Defaults after init are 2.402 GHz (channel 2), 2Mbps, 0dBm
if (!nrf24.setChannel(1))
Serial.println("setChannel failed");
if (!nrf24.setRF(RH_NRF24::DataRate2Mbps, RH_NRF24::TransmitPower0dBm))
Serial.println("setRF failed");
void loop()
if (digitalRead(button)) {
digitalWrite(greenLed, HIGH);
// Send a message
nrf24.send(data, sizeof(data));
nrf24.waitPacketSent();
digitalWrite(greenLed, LOW);
} else {
uint8_t buf[RH_NRF24_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
digitalWrite(redLed, HIGH);
digitalWrite(redLed, LOW);
Step 4: Result
can you show me how to read your library?, i want to use another Microcontrollers, thanks
GurielV 7 months ago
how can we just have open terminal to send any strings? rather than just sending set var strings.
DanielK82 (author) ZipDriveRT 11 months ago
Use the read function ( https://www.arduino.cc/en/Serial/Read) and use the result instead of the
`"aloha"` string. Then, above the line with `//something was received, turn the right LED on`
write `Serial.println(buf)` to print the received data
15,804views
75favorites
License:
Public Domain
DanielK826
More by DanielK82:
FEATURED CHANNELS
Woodworking
Paper
Kitchen Hacks
Puzzles
Laser Cutting
Space
Homesteading
3D Printing
Sewing
Newsletter
About Us
Who We Are
Advertise
Contact
Jobs
Help
Find Us
Facebook
Youtube
Twitter
Pinterest
Google+
Resources
For Teachers
Artists in Residence
Gift Premium Account
Forums
Answers
Sitemap
Terms of Service|
Privacy Statement|
Legal Notices & Trademarks|
Mobile Site
© 2016 Autodesk, Inc.