Arduino RC transmitter

1.
2.
3.
4.
5.
6.
Small introduction
What we want to do is connect 4 potentiometers to the analog inputs of the arduino and send each input value to a receiver using the NRF24 module. We will create 4 radio channels, we will read each of the 4 analog inputs, map the values to the desired range and send each value using a 8 bits channel for each input.

Connections!
If you are using an Arduino NANO you won't need a FTDI module to program yor microcontroller. First of all we have to power up our Arduino. To do that we connect a 9V battery directly to the RAW input pin and ground of the arduino. The launchboard must have his own 5V or 3.3V regulator. The NRF24 module use a lot of curent so we won't power it from a 3.3V output of the arduino. In stead of that we will use an external 3.3 voltage regulator. Apply a higher voltage to this module and it will burn in a second so be carefoul. We have to share ground between the NRF24 module and the Arduino. The pin conection for the radio module is shown in the picture above. All we need to do is connect the middle pin of each potentiometer to a analog input of the arduino. COnnect 5V and ground to the other 2 pins of each potentiometer and we are done.
All we need to do now is program the microcontroller and start sending data.
You can download the

To install it we just go to Program -> inport library and we open the .zip file that we've just downloaded.
Transmitter code!
/*
//4 channels transmitter
*/
#include <
#include <nRF24L01.h>
#include <RF24.h>
//This same code should be in the receiver as well
RF24 radio(9, 10); //select CE and CSN pins
//We can have up to 32 channels of 8 bits
struct MyData {
};
MyData data;
{
//We define the start value of our data
data.throttle = 0;
data.yaw = 127;
data.pitch = 127;
data.roll = 127;
}
{
radio.
radio.setAutoAck(
radio.setDataRate(RF24_250KBPS);
radio.openWritingPipe(pipeOut);
resetData();
}
/**************************************************/
// We map the values from 0-1024 a 0-255,
//because we have 8 bits channels and 8 bits = 254,
//once we receive the values in the receiver we can map the values once again so don't worry
int mapJoystickValues(
{
val =
val =
val =
}
{
// We read the analog input values
//Set to "true" it will invert the value reading
//Set to "false" it will use values from 0 to 1024
//This part is just in case you connect the pontenciometers reversing the wires
//and to adjust the values
data.throttle = mapJoystickValues(
data.yaw = mapJoystickValues(
data.pitch = mapJoystickValues(
data.roll = mapJoystickValues(
radio.
}
See next tutorial:
