433 MHZ UNO to UNO 9685 control 7 servo motors RC Airplane

July24,2020
Email to Arduino Form for Help on 433 HMZ UNO Wireless Communication
Hi
I hope some one can help me.
I am building a very simple R.C. model airplane and I want to control it from the ground with just a knob joystick.
I have a UNO R3 connected to a PCA 9685.
GND to GND VCC TO VCC on both boards
PCA 9685 SCL connected to A5 on the UNO R3 board
PCA 9685 SDA connected to A4 on the UNO R3 board
All servo motors are connected PCA 9685 0 to 06 slots
Knob controller GND to GND VCC to VCC URX to A0 and URY to A1
This set up operates correctly.
My problem is transmitting a UNO R3 board signal to the Receiver located on another UNO R3 board.
Pin 12 on both are programmed to receive and tansmit the signal(data)
The receiving UNO has only the receiver code and nothing else.
The transmitter UNO has all the information command instructions to operate the servo motors.
When I move the Knob no operation on the receiver UNO will active the servo motors.
Here is the code I copied and up loaded to each UNO R3.
Codes written for Receiver And Transmitter 2 UNO R3 boards control R.C.flaps on a airplane
Transmit 433mhz from UNO R3 to another UNO R3
//simple Tx on pin D12
//..................................
#include <VirtualWire.h>
char *controller;
void setup() {
pinMode(13,OUTPUT);
vw_set_ptt_inverted(true); //
vw_set_tx_pin(12);
vw_setup(4000);// speed of data transfer Kbps
}
void loop(){
controller="1" ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
digitalWrite(13,1);
delay(2000);
controller="0" ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
digitalWrite(13,0);
delay(2000);
}
Receiver UNO R3 code only

//simple Tx on pin D12
//Rx on pin D12
#include <VirtualWire.h>
void setup()
{
vw_set_ptt_inverted(true); // Required for DR3100
vw_set_rx_pin(12);
vw_setup(4000); // Bits per sec
pinMode(13, OUTPUT);

vw_rx_start(); // Start the receiver PLL running
}
void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;

if (vw_get_message(buf, &buflen)) // Non-blocking
{
if(buf[0]=='1'){

digitalWrite(13,1);
}
if(buf[0]=='0'){
digitalWrite(13,0);
}

}
}

CONTROLLER CODE FOR 6 SERVO MOTORS RC AIRPLANE
/* Arduino Multiple Servo Motors Control Using The PCA9685 PWM Module

This code is in the public domain...

You can: copy it, use it, modify it, share it or just plain ignore it!
Thx!

*/

#include "HCPCA9685.h" //

#define I2CAdd 0x40 // Default address of the PCA9685 Module

#define JoyX A0 // Joystick X pin connected to A0 on the UNO
#define JoyY A1 // Joystick Y pin connected to A1 on the UNO
#define JoySwitch 4 // Joystick switch connected to Pin 4 on UNO

// Variables used to store the Position of each Servos
int Servo0Position;
int Servo1Position;
int Servo4Position;
int Servo5Position;
int Servo8Position;
int Servo9Position;
int Servo12Position;

HCPCA9685 HCPCA9685(I2CAdd); // Define Library to use I2C communication

void setup()
{

HCPCA9685.Init(SERVO_MODE); // Set to Servo Mode
HCPCA9685.Sleep(false); // Wake up PCA9685 module

// Set Center value for the Servos
Servo0Position=250;
Servo1Position=250;
Servo4Position=250;
Servo5Position=250;
Servo8Position=250;
Servo9Position=250;
Servo12Position=250;

// Move all Servos at start to center position
HCPCA9685.Servo(0, Servo0Position); // Move Servo 0
HCPCA9685.Servo(1, Servo1Position); // Move Servo 1
HCPCA9685.Servo(4, Servo8Position); // Move Servo 4
HCPCA9685.Servo(5, Servo12Position); // Move Servo 5
HCPCA9685.Servo (8, Servo8Position); // Move Servo 8
HCPCA9685.Servo (9, Servo9Position); // Move Servo 9
HCPCA9685.Servo (12, Servo12Position); // Move Servo 12

pinMode(JoySwitch, INPUT_PULLUP);

}

void loop()
{
if (!digitalRead(JoySwitch)) { // If Joystick switch is clicked re-center all Servos
delay(500); // delay for debouncing the joystick switch

// Set all Servos position variable back to center values
Servo0Position=250;
Servo1Position=250;
Servo4Position=250;
Servo5Position=250;
Servo8Position=250;
Servo9Position=250;
Servo12Position=250;

// Move all Servos to center position
HCPCA9685.Servo(0, Servo0Position); // Move Servo 0
HCPCA9685.Servo(1, Servo1Position); // Move Servo 1
HCPCA9685.Servo(4, Servo8Position); // Move Servo 4
HCPCA9685.Servo(5, Servo12Position); // Move Servo 5
HCPCA9685.Servo(8, Servo8Position); // Move Servo 8
HCPCA9685.Servo(9, Servo9Position); // Move Servo 9
HCPCA9685.Servo(12, Servo12Position); // Move Servo 12

}

// if Joystick X axis in not in center move Servo 0 and 12 accordingly

if (analogRead(JoyX) > 800) {
if (Servo0Position < 420) { // Check if maximum movement of Servo reached
Servo0Position++; // Increase Servo 0 Position variable by 1
}
if (Servo1Position > 10) { // Check if minimum movement of Servo reached
Servo4Position--; // Decrease Servo 4 Position variable by 1
}

delay(10); // Decrease to make Servos move faster or increase for slower movement
HCPCA9685.Servo(0, Servo0Position); // Move Servo 0
HCPCA9685.Servo(4, Servo4Position); // Move Servo 4
HCPCA9685.Servo(8, Servo8Position); // Move Servo 8
HCPCA9685.Servo(9, Servo9Position); // Move Servo 9
}

if (analogRead(JoyX) < 300) { if (Servo0Position > 10) {
Servo0Position--;
}

if (Servo4Position < 420) { Servo12Position++; }
delay(10);
HCPCA9685.Servo(0, Servo0Position); // Move Servo 0
HCPCA9685.Servo(4, Servo4Position); // Move Servo 4
HCPCA9685.Servo(8, Servo8Position); // Move Servo 8
HCPCA9685.Servo(9, Servo9Position); // Move Servo 9
}

// if Joystick Y axis in not in center move Servo 4 and 8 accordingly
if (analogRead(JoyY) > 800) {
if (Servo5Position < 420) {
Servo5Position++;
}
if (Servo8Position > 10) {
Servo8Position--;
}
if (Servo12Position < 420) {
Servo12Position++;
}
delay(10);
HCPCA9685.Servo(1, Servo1Position); // Move Servo 1
HCPCA9685.Servo(5, Servo5Position); // Move Servo 5
HCPCA9685.Servo(12, Servo12Position); // Move Servo 12
}

if (analogRead(JoyY) < 300) { if (Servo1Position > 10) {
Servo5Position--;
}
if (Servo5Position < 420) {
Servo5Position++;
}
if (Servo12Position > 10) {
Servo12Position--;
}
delay(10);
HCPCA9685.Servo(1, Servo1Position); // Move Servo 1
HCPCA9685.Servo(5, Servo8Position); // Move Servo 5
HCPCA9685.Servo(12,Servo12Position); // Move Servo 12
}
}

Please add the PCA 9685 code that is completely missing from this sketch, and post in a new message. When you do that, read the sticky posts at the top of the forum to learn how to post and other important things about using the forum. Use code tags for any code that you post.

If you have a question, ask it. Don't let us puzzle over what you need to know.

July 26,2020

Thank you for the information

daviddb

July 26, 2020

You're welcome. Have you noticed that nobody has paid any attention to your post? That is mainly because you haven't followed any of the guidelines in the sticky threads yet.

By the way, are you aware that when sending packets of a typical size for your 433MHz system, it is illegal to transmit more often than approximately once every 30 seconds, in most countries? Won't that make for a somewhat slow flaps control?

You appear to have 3 programs and only 2 Unos. The transmitter program knows nothing about a joystick and the receiver program knows nothing about a PCA9685 or servos. The other program assumes both joystick and servos are connected to the same Arduino. You also haven't said what 433MHz modules you're using or if you have tested basic communication with them.

In short I have no idea what's going on and what help you need, if any!

Steve