I am trying to read some signals form the transmitter. (Graupner MX-12 and Orona CR8D)
Right now this is what i have done
#include <Servo.h>
Servo AileronServo;
Servo ElevatorServo;
Servo ThrottleServo;
Servo RudderServo;
Servo AileronTarget;
Servo ElevatorTarget;
Servo ThrottleTarget;
Servo RudderTarget;
unsigned long pwmin;
int throttle=0;
int elevator=0;
void setup() {
Serial.println("Initializing motors...");
Serial.begin(9600);
AileronServo.attach(9);
ElevatorServo.attach(10);
ThrottleServo.attach(6);
RudderServo.attach(11);
AileronTarget.attach(4);
ElevatorTarget.attach(3);
ThrottleTarget.attach(5);
RudderTarget.attach(2);
ThrottleTarget.writeMicroseconds(1000); // MIN Throttle
RudderTarget.writeMicroseconds(2000); // Full Left Rudder (use 2000 for Full Right Rudder)
delay(4000); // Wait for the flight controller to recognize the ARM command
RudderTarget.writeMicroseconds(1500); // Return rudder to center position.
Serial.println("Sync completed...");
}
void loop() {
pwmin = pulseIn(5, HIGH, 20000);
Serial.println(pwmin);
/*throttle = ThrottleServo.read();
Serial.println(throttle);
elevator = ElevatorServo.read();
Serial.println(elevator);*/
}
and the output in the serial monitor is 981 or 982.
The basic idea is to read the signals, read the throttle that i give with the left stick and then so some stuff like controlling it, some advance algorithms for stability etc. Ill appreciate if anyone could help me out
I used the following program to change the pulse length going into a Naze32 Flight Controller by putting the Arduino between the RC receiver rudder and throttle outputs and the Naze rudder and throttle inputs.
As it happened I then found out how to set the Naze parameters so it was not needed, but it worked.
For much more comprehensive code look at the ArduCopter site. APM uses an Arduino Mega based board to provide control of multirotors and the software is open source.
Thank you for you answer, do you have any idea what should i do to READ and not write to the FC? I just dont know if i must connect the Transmitter into PMW pin, Analog pin, tha only one TX pin etc...
Look at the code that I posted. It reads data from 2 channels of the Rx, changes them and passes on the changed data to the FC.
I am trying to READ from the transmitter and just pass the values to the FC. Read the signals eg. throttle 1100 throttle 1120 etc...
If you don't want to change the values then either pass them on unchanged or connect the channels directly from the Rx to the FC.
However in your first post you said
The basic idea is to read the signals, read the throttle that i give with the left stick and then so some stuff like controlling it, some advance algorithms for stability etc.
Have you got a Flight Controller, if so which one, or are you aiming to use the Arduino as the FC ?
Hi, I have KK multicopter flight controller v5.5 i think. I am using right now a direct connection and everything is fine. However i want to have my arduino in the middle!!! so...yep i was trying to just pass the values that i read and write them to the FC but i was not working.
You use pulseIn to read the duration of a pulse. Lets say a small throttle. I did the same, tried to read and the value that i have read is static. something like 98 i guess Any ideas?
You use pulseIn to read the duration of a pulse. Lets say a small throttle. I did the same, tried to read and the value that i have read is static. something like 98 i guess Any ideas?
grabs a HIGH duration value from thrInPin when it goes HIGH(size of PW)
remaps the value for thrDuration when it is a range of 1000-2000 it becomes 980-2020 instead
then it turns thrOutPin to a HIGH state
keeps it held high for the thrDuration
after the delay, it sets thrOutPin to LOW
That explanation is spot on.
My RC transmitter was not providing long or short enough pulses on throttle and rudder to arm the FC so I needed to extend the limits at both ends.