[ARDUINO + RASPBERRY PI] Switching light with NRF24l01+


To test the wiring we suggest you to use the ping/pong test you can find  in the RF24 libraries (both, of the raspberry and the arduino).

Raspberry Pi

The connection between the Raspberry Pi and the NRF24l01+ module was a little bit tricky, so you have to double ( or triple) check the wiring before giving up. Here is the wiring scheme, the Raspberry Pi is a revision 2, and the module is the + (plus) version.

[ARDUINO + RASPBERRY PI] Switching light with NRF24l01+


The setup is easy and similar to a mix of our tutorials about Irrigatorino and NRF24l01+ Tests.
Just keep in mind that you are playing with dangerous voltage, so if you get struck, it’s only your fault. I would suggest, anyway, to check if everything (especially the relay board) is working with a multimeter, before connecting to a real lamp.


Our plan to communicate between all this stuff is to use a Node.js application to run a binary ‘sudo ./remote  -m 81‘ and ‘sudo  ./remote -m 80‘  sending a message to the Arduino with the text 81 and 80 . The message is composed by pin identifier (8) and action to perform (0|1|2). After the action has been  read, all the other numbers identify the pin which the action refers to.

[ARDUINO + RASPBERRY PI] Switching light with NRF24l01+ DiagramWhen the arduino receive it, it then sends back an acknowledgment packet to the raspberry with the same message (yeah, like a parrot), except for action 2, which will not perform any action, but will reply with actual state of the pin. In the meantime, if the message the arduino receive is 1  it will close a relay (turning on a light, like a good parrot), 0 will open it (I doubt a parrot could be so clever).


The sketch for the Arduino Nano is nothing more than a Getting Started demo of the RF24 library. We just modified it to switch the relay on in case it receive a message with 1 as text, or open it otherwise. Of course you’ll need the RF24 library to make it work.


For more detail: [ARDUINO + RASPBERRY PI] Switching light with NRF24l01+

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top