Remote control construction with 6 Channels, proportional controls for model vehicles.
Necessary materials:
2 x Arduino Nano
1 x NRF24L01 + PA Wireless Module
1 x NRF24L01 Wireless Module
2 x Arduino joystick
2 x 100uF Capacitor (16V or above)
1 x 13 * 6 cm PCB Board
1 x 5 * 3.5 cm PCB Board
Arduino Nano: https://www.banggood.com/custlink/vvGKUFyfT9
Arduino Nano & USB Cable: https://www.banggood.com/custlink/vDDGkGyA0y
RC Joysticks: https://www.banggood.com/custlink/DK3mzj2lCw
NRF24L01 + PA Wireless Modul: https://www.banggood.com/custlink/33GGqGhQbZ
PCB Boards:
https://www.banggood.com/custlink/v33vUGYsUd
https://www.banggood.com/custlink/3vGmz3yNqC
100uF Capacitor: https://www.banggood.com/custlink/DKDvMvyQUe
Headers:
https://www.banggood.com/custlink/m3vGqKdnfN
https://www.banggood.com/custlink/vG33zGYUmd
680R Resistor: https://www.banggood.com/custlink/KKmmqOUaLl
5mm LED: https://www.banggood.com/custlink/vmKvMa2lL0
Rocker Switch : https://www.banggood.com/custlink/vDmv2ozlBY
5mm kraft foam board (50×70 plate): https://amzn.to/2oE2vOK
JST Connector: https://www.banggood.com/custlink/DDKmzB5DMG
Other materials:
SG90 Servos: https://www.banggood.com/custlink/Kv3DS6stKo
20A Brushed ESC: https://www.banggood.com/custlink/mvvDggsH4C
7.4V 450Mah 2S LiPo: https://www.banggood.com/custlink/KKKGU3EqE3
DC 180 Motor 39000 RPM: https://amzn.to/35rD8Ar or bit.ly/2L62JqC
Transmitter Circuit:
Transmitter Code :
// 6 Channel Transmitter | 6 Kanal Verici #include <SPI.h> #include <nRF24L01.h> #include <RF24.h> const uint64_t pipeOut = 0xE9E8F0F0E1LL; //IMPORTANT: The same as in the receiver 0xE9E8F0F0E1LL | Bu adres alıcı ile aynı olmalı RF24 radio(9, 10); // select CE,CSN pin | CE ve CSN pinlerin seçimi struct Signal { byte throttle; byte pitch; byte roll; byte yaw; byte aux1; byte aux2; }; Signal data; void ResetData() { data.throttle = 12; // Motor stop | Motor Kapalı (Signal lost position | sinyal kesildiğindeki pozisyon) data.pitch = 127; // Center | Merkez (Signal lost position | sinyal kesildiğindeki pozisyon) data.roll = 127; // Center | merkez (Signal lost position | sinyal kesildiğindeki pozisyon) data.yaw = 127; // Center | merkez (Signal lost position | sinyal kesildiğindeki pozisyon) data.aux1 = 127; // Center | merkez (Signal lost position | sinyal kesildiğindeki pozisyon) data.aux2 = 127; // Center | merkez (Signal lost position | sinyal kesildiğindeki pozisyon) } void setup() { //Start everything up radio.begin(); radio.openWritingPipe(pipeOut); radio.setAutoAck(false); radio.setDataRate(RF24_250KBPS); radio.setPALevel(RF24_PA_HIGH); radio.stopListening(); //start the radio comunication for Transmitter | Verici olarak sinyal iletişimi başlatılıyor ResetData(); } // Joystick center and its borders | Joystick merkez ve sınırları int mapJoystickValues(int val, int lower, int middle, int upper, bool reverse) { val = constrain(val, lower, upper); if ( val < middle ) val = map(val, lower, middle, 0, 128); else val = map(val, middle, upper, 128, 255); return ( reverse ? 255 - val : val ); } void loop() { // Control Stick Calibration | Kumanda Kol Kalibrasyonları // Setting may be required for the correct values of the control levers. | :Kontrol kolların doğru değerleri için ayar gerekebilir. data.throttle = mapJoystickValues( analogRead(A0), 12, 524, 1020, true ); // "true" or "false" for signal direction | "true" veya "false" sinyal yönünü belirler data.roll = mapJoystickValues( analogRead(A3), 12, 524, 1020, true ); // "true" or "false" for servo direction | "true" veya "false" servo yönünü belirler data.pitch = mapJoystickValues( analogRead(A2), 12, 524, 1020, false ); // "true" or "false" for servo direction | "true" veya "false" servo yönünü belirler data.yaw = mapJoystickValues( analogRead(A1), 12, 524, 1020, false ); // "true" or "false" for servo direction | "true" veya "false" servo yönünü belirler data.aux1 = mapJoystickValues( analogRead(A6), 12, 524, 1020, true ); // "true" or "false" for servo direction | "true" veya "false" servo yönünü belirler data.aux2 = mapJoystickValues( analogRead(A7), 12, 524, 1020, true ); // "true" or "false" for servo direction | "true" veya "false" servo yönünü belirler radio.write(&data, sizeof(Signal)); }
Receiver Circuit:
Note: Servos receive the necessary power via ESC. The BEC feature of ESC provides the necessary 5V support. So, the VCC line in the channel ports is not connected with Arduino. If you are not going to use the Receiver with an ESC, a 5V power supply will be required externally.
Receiver Code:
// 6 Channel Receiver | 6 Kanal Alıcı // PWM output on pins D2, D3, D4, D5, D6, D7 (Çıkış pinleri) #include <SPI.h> #include <nRF24L01.h> #include <RF24.h> #include <Servo.h> int ch_width_1 = 0; int ch_width_2 = 0; int ch_width_3 = 0; int ch_width_4 = 0; int ch_width_5 = 0; int ch_width_6 = 0; Servo ch1; Servo ch2; Servo ch3; Servo ch4; Servo ch5; Servo ch6; struct Signal { byte throttle; byte pitch; byte roll; byte yaw; byte aux1; byte aux2; }; Signal data; const uint64_t pipeIn = 0xE9E8F0F0E1LL; RF24 radio(9, 10); void ResetData() { // Define the inicial value of each data input. | Veri girişlerinin başlangıç değerleri // The middle position for Potenciometers. (254/2=127) | Potansiyometreler için orta konum data.roll = 127; // Center | Merkez data.pitch = 127; // Center | Merkez data.throttle = 12; // Motor Stop | Motor Kapalı data.yaw = 127; // Center | Merkez data.aux1 = 127; // Center | Merkez data.aux2 = 127; // Center | Merkez } void setup() { //Set the pins for each PWM signal | Her bir PWM sinyal için pinler belirleniyor. ch1.attach(2); ch2.attach(3); ch3.attach(4); ch4.attach(5); ch5.attach(6); ch6.attach(7); //Configure the NRF24 module ResetData(); radio.begin(); radio.openReadingPipe(1,pipeIn); radio.setAutoAck(false); radio.setDataRate(RF24_250KBPS); radio.setPALevel(RF24_PA_HIGH); radio.startListening(); //start the radio comunication for receiver | Alıcı olarak sinyal iletişimi başlatılıyor pinMode(6,OUTPUT); } unsigned long lastRecvTime = 0; void recvData() { while ( radio.available() ) { radio.read(&data, sizeof(Signal)); lastRecvTime = millis(); // receive the data | data alınıyor } } void loop() { recvData(); unsigned long now = millis(); if ( now - lastRecvTime > 1000 ) { ResetData(); // Signal lost.. Reset data | Sinyal kayıpsa data resetleniyor } ch_width_4 = map(data.yaw, 0, 255, 1000, 2000); // pin D5 (PWM signal) ch_width_2 = map(data.pitch, 0, 255, 1000, 2000); // pin D3 (PWM signal) ch_width_3 = map(data.throttle, 0, 255, 1000, 2000); // pin D4 (PWM signal) ch_width_1 = map(data.roll, 0, 255, 1000, 2000); // pin D2 (PWM signal) ch_width_5 = map(data.aux1, 0, 255, 1000, 2000); // pin D6 (PWM signal) ch_width_6 = map(data.aux2, 0, 255, 1000, 2000); // pin D7 (PWM signal) // Write the PWM signal | PWM sinyaller çıkışlara gönderiliyor ch1.writeMicroseconds(ch_width_1); ch2.writeMicroseconds(ch_width_2); ch3.writeMicroseconds(ch_width_3); ch4.writeMicroseconds(ch_width_4); ch5.writeMicroseconds(ch_width_5); ch6.writeMicroseconds(ch_width_6); }
Library Files:
Files with “.h” extension in the “include lines in the code are library files. Search for them with their names. Download it to your computer and copy it to the “Arduino / Libraries” folder. You must do this before uploading the code to the arduino).
Example: Necessary library link for NRF24L01: https://github.com/maniacbug/RF24 (Different version library files may be required depending on the Arduino board. It can be found by trying)
_______________ OPTIONAL PDF & GERBER FILES _____________________ :
6 Channel Recevier:
6 Channel Receiver with 3.3V voltage regulator:
NRF24L01 module works more stable thanks to the 3.3V regulator.
PDF & Gerber Files Download Link: https://drive.google.com/file/d/1VyXv-6hAfo4b46m2h7WYzhAJbsuA_ZBU/view?usp=sharing