@tutorial: Arduino radio controller - NRF24

You see, I’ve already made a few Arduino projects that used this NRF24 modules and I’ve already made a few Arduino based radio controllers. But you see, I never explained in detail how to make only the radio controller because it was always part of a bigger project such as the Arduino drone, or the 3D printed tank and also the Arduino radio controlled plane. So, a lot of you guys had problems establishing the radio connection or understanding th

External Link: https://electronoobs.com/eng_arduino_tut25.php

by: ELECTRONOOBS on 2026-06-17

~Arduino radio controller - part list

2 x Arduino NANO/UNO LINK eBay

2 x NRF24 LINK eBay

2 joysitck LINK eBay

2 x toggle switch: LINK eBay

1 x Potentiometer: LINK eBay

2 x 3.3V voltage regulator: LINK eBay

1 x 9V battery connector: LINK eBay

1 x 9V battery: LINK eBay

2 x 10uF cap: LINK eBay


Resistors: LINK eBay

Wires LINK eBay

Female PCB pins LINK eBay

Male PCB pins LINK eBay

Drilled PCB LINK eBay



Wire, soldering iron, solder, etc...

~PART 1 - Testing NRF24 connection

Before we build our radio controller, first let's test the radio connection between two NRF24 modules. On a breadboard connect the transmitter and the Arduino with only one potentiometer connected to analog pin A0. Use this example schematic for that. Make sure that the SPI connections it’s as in the schematic. You could also wind ground around the MOSI and MISO wires for less noise.


So this above will be the transmitter schematic that will send the data from the potentiometer. Now we do the same for the receiver but without the potentiometer. To print the received data we will use the serial monitor of the arduino with a baud rate of 9600. Now mount the next scheamtic for the receiver.


Ok, so now we have the transmitter with a Potentiometer connected to A0 on one breadboard and the receiver on the other. Let's upload some test code and see if we receive the data from the transmitter and print it on the serial monitor.

~Test Codes

Now, download the next two codes. They are very simple. One reads the value of the potentiometer, creates a byte of data and send it. The other receives the data and print the value on the serial monitor. If you receive the data everything is ok. If you don't receive data, the value on the serial monitor is always the same, even if you rotate the potentiometer.


Transmitter Code

Receiver Code

Ok, so upload the codes above, one to the transmitter and other to receiver. Make sure to open Arduino IDE two times so you could have two COM connected at same time. Go to receiver code and open serial monitor. It should have the value of the potentiometer printed with values from 1000 to 2000. If not, the connection isn't working.


To improve connection you should do:

-Add 10uF capacitor to 3.3V.

-Wind GND around the SPI pins.

-Solder small copper wire to the PCB radio module

~PART 2 - The TRANSMITTER

So, let’s start building this project. My transmitter will have 7 channels but it could have more if you want. I will have 4 analog channels for two joysticks. Then I'll use two toggle switches for 2 more digital channels and finally another analog channel for a potentiometer. On a drilled PCB I solder all the components as in the schematic below. For the transmitter you should use a power amplified one so we will have more range. You see, the transmitter needs a powerful radio module, but the receiver should work ok with a normal one as well. If the signal gets to it, it should work just fine.

I take the piece of drilled PCB and I first solder in place the joysticks. They have a thick metal pins, so you will probably have to enlarge 4 holes for each in order to be able to fit it in. Next, I solder the radio transmitter module in the top center position of the board so it won’t have too much interference. Now, a very important step is to solder the Arduino quite close to the radio module. You see, the longer are the wires or PCB connections from the Arduino to the module, the higher the noise will be. So, make sure you have very short connections.


Next, I add the two toggle switches, one on each side and finally the extra potentiometer. To power on and off the board, I’ve added this kind of sliding switch. The battery will be connected to this switch so when we slide it on, the entire board will be supplied.

Finally, I solder the 3.3V voltage regulator with the coupling capacitors and make all the connections between, joysticks, radio module, Arduino and all the components, following the schematic. Now the board is ready. All is there to do is to program it.

~EXTRA - Make my board

If you want a better-looking board, feel free to download my design from below of this board. You have the GERBERS files in a zip below. Just download it and send it to JLCPCB and order your board for a very low price and give your project this professional look and also with a gyro control so you could move your radio control device just by moving the controller. Check the link below for more.

[ESPERANDO CARGA...]

[3D_READY]
Download: Radio Controller GERBERs
~PART 3 - The RECEIVER

Well, we have the transmitter. Now let’s build the receiver. That should be quite easy. All we need is the Arduino NANO, a NRF24 receiver like this one, another 3.3 voltage regulator and a small PCB. We will use the schematic below. You will see two schematics. They are more than the same but one has 7 PWM outputs and the other only one PPM output. Depending on the project that you want use one or the other.

Ok so I’ve soldered everything in place. The Arduino and the voltage regulator and made connections to the radio module. The receiver won’t need a battery supply, since just as any other commercial receiver, it will be supplied with directly 5V as you can see below on the commercial receiver that has ground, 5V and signal. Now, you see, the commercial receiver has 90 degrees pins for each channel. I don’t have that now so I’ve used normal straight pcb pins. Place 3 pins for each channel. Ground, 5V and signal. This kind of connection could have up to 32 channels, which is the maximum supported by the NRF24 modules, but the Arduino doesn’t have that much digital pins. Now we are ready to program both the transmitter and receiver.

~PART 4 - Codes

Transmitter code

Now, download the transmitter and receiver codes. Be careful, there are two receiver codes, one for PWM and the other for PPM. I’ll use PWM for now. First let's talk a bit about the transmitter code. It will send 7 channels. We read the analog and digital values from the radio controller, create 7 bytes and sent that data.


Ok, let's talk about the transmitter code. Let me explain it to you step by step. First, we import the library that we need. Make sure you have the NRF24 library installed. If not download if from a link below, then go tothe Arduino IDE to Sketch, include library add .zip library and select the zip file that you have just downloaded. And now we are good to go. You could also use the library manager to install it. Next, we define the radio pipe. This code should be the same in the transmitter and receiver since it is a unique code for the radio connections. Having multiple receivers with this same pipe code, they will all receive the same data from the transmitter.

Next, we define the chip select and chip enable pins for the SPI communication. This two could be any digital pin of the Arduino. In this case are pins 9 and 10. The other SPI pins must be digital 11, 12 and 13 since those are the clock, MOSI and MISO ports of the Arduino and they can’t be other pins.

Now, we create a structure type variable and store each channel value in this structure. This could have up to 32 channels, each of 8 bits or better said one byte. I name each channel, from channel 1 to 7. Now we create a variable with that structure and name it sent data and this will be the package that we will send.

Ok, in the setup void we begin the radio communication using the begin function that the NRF24 library already has. We set the radio communication configuration and open the radio pipe, with the variable: my radio pipe defined before. The next lines will reset the channel values.

In this case, all 4 potentiometers of the joysticks will be in the middle position. Since we can only send 8 bites per channel, which in decimal is 255, well the middle of 255 will be 127, that’s why I reset channel 1 to 4 with these values. Next, we have two digital channels, channel 5 and 6 with values of 0 or 1. And finally another analog channel but with value 0 since it will be connected to a potentiometer that will have its initial position to 0.

Finally, in the void loop, we read each analog and digital inputs, which in this case are Analog pins A0 to A4 and digital pins D2 and D3. We map the values to a range between 0 and 255 since we can only send 8 bits and store the value in our sent_data variable and we send the entire structure using the radio.write function.


Ok, so the code was very simple. Now let’s take a look on to the receiver side. It is a bit longer but that is because each line is repeating for each channel.


Receiver code

Once again import the needed libraries, in this case the servo library as well for the PWM signals. Define the pipe as in the transmitter code and the chip select and enable pins.

Again, we create the 7 bytes structure for the received values. Now, we create 7 servo types and define the PWM initial value for each channel. In the setup loop we attach the PWM signal to pins from digital D2 to D8. Finally, we configure the radio connection and start listening.


Next, we have this function called receive_the_data. This function will receive the data and store it in our structure created before. In the void loop we use the receive data to get the values. Then we will map the received values from 8 bits to values from 1000 to 2000us since those are usually the values that any commercial radio receivers use for the PWM signal. We read the received data, map the values to a range of 1000-2000us and then using the writeMicroseconds function, we create each of the 7 PWM signals as you can see below and we are done. Now we can upload the codes to the receiver and transmitter and test the connection.

~PART 5 - Test the radio controller

Now upload the codes before to the transmitter and receiver. I connect the battery to the transmitter and power it on. I supply 5V to the receiver and connect two of its channels to my oscilloscope and there you go. I perfectly receive the data from the transmitter. If the values are not exactly in the correct range, which is from 1000 to 2000 microseconds, then go to the received code and change the values here in order to match the minimum and maximum values for each channel.

So, there you go my friends. We have build our own radio controller that work’s exactly as any other commercial one but for way less money. You also have the code and schematic for a PPM receiver that will create a 8 channel PPM signal on digital pin D2. The rest of the project is the same.


What is left to do is to probably 3D print a case for this project. Or maybe live it like it is so it should have a more DIY look. Remember that below you have the GERBER files for the transmitter board if you want to send it to JLCPCB and print it. That board has 4 analog channels with two joysticks, and two more digital channels with some sliding switches. You could also add a gyro module and send that data and control RC machines only by moving the controller, but that is for a future project so stay tuned.


Well guys, you have all codes and schematics here on my webpage also on my Patreon page. If you would like to support me, check my Patreon page as well. I would really appreciate that guys. It would help me a lot and I’ll have more and more awesome projects. I hope that you’ve enjoyed this project.


Leave a comment

Please login in order to comment.

Comments

ADVERTISERS
ADVERTISERS
PCBWAY