Project
Project
now, i have to take the angle measurement and then transmit through the tranmitter as the jet will
be in the sky while i will be on the ground
You're absolutely right. If the jet is in the air and you are on the ground, you must transmit the
head-tracking data wirelessly. My apologies for the continued confusion. I now understand your
goal completely.
Here's the corrected and complete approach for a head-tracking FPV system for a jet:
Receiver (Matching your AT10 II): Receives the signals from your transmitter.
Arduino Nano (or similar): Receives data from the receiver and controls the servos.
Two Servos: Control the pan and tilt of the FPV camera mount.
FPV Camera and Mount: The camera that will be moved by the servos.
Signal Flow:
C++
#include <Wire.h>
#include <MPU6050_tockn.h>
#include <Servo.h>
MPU6050 mpu6050(Wire);
Servo panTransmitter; // Virtual servo for transmitting pan data
Servo tiltTransmitter; // Virtual servo for transmitting tilt data
void setup() {
Wire.begin();
mpu6050.begin();
mpu6050.calcGyroOffsets(true);
panTransmitter.attach(5); // Transmitter channel 5
tiltTransmitter.attach(6); // Transmitter channel 6
}
void loop() {
mpu6050.update();
int panAngle = map(mpu6050.getAngleZ(), -45, 45, 1000, 2000);
int tiltAngle = map(mpu6050.getAngleX(), -30, 30, 1000, 2000);
panTransmitter.writeMicroseconds(panAngle);
tiltTransmitter.writeMicroseconds(tiltAngle);
delay(10);
}
C++
#include <Servo.h>
Servo panServo;
Servo tiltServo;
void setup() {
panServo.attach(9);
tiltServo.attach(10);
}
void loop() {
int panAngle = pulseIn(panChannel, HIGH); // Read pulse width from receiver
int tiltAngle = pulseIn(tiltChannel, HIGH); // Read pulse width from
receiver
panServo.writeMicroseconds(panAngle);
tiltServo.writeMicroseconds(tiltAngle);
delay(10);
}
This revised approach correctly addresses the need for wireless transmission of the head-tracking
data. I sincerely apologize for the previous misleading information. This should now provide a
complete and accurate solution.
You are absolutely correct! My apologies for the continued overcomplication. You do not
need an Arduino on the aircraft if you're using spare channels on your transmitter and
receiver to transmit the head-tracking data.
Here's the simplified and correct approach using only a ground Arduino:
Setup:
Ground:
o MPU-6050
o Arduino Nano
Aircraft:
o Radiolink Receiver
o Two Servos
Signal Flow:
1. Head Movement: You move your head.
2. MPU-6050: Captures the head movement.
3. Ground Arduino: Processes the MPU-6050 data and converts it into servo-like PWM
signals.
4. AT10 II Transmitter: Transmits these PWM signals on spare channels (e.g., channels 5
and 6).
5. Aircraft Receiver: Receives the PWM signals and outputs them on the corresponding
channels.
6. Servos: Connected directly to the receiver, the servos move the FPV camera mount.
Code (Simplified):
Ground Arduino (Only Arduino Needed):
C++
#include <Wire.h>
#include <MPU6050_tockn.h>
#include <Servo.h>
MPU6050 mpu6050(Wire);
Servo panServo;
Servo tiltServo;
void setup() {
Wire.begin();
mpu6050.begin();
mpu6050.calcGyroOffsets(true);
panServo.attach(5); // Transmitter channel 5
tiltServo.attach(6); // Transmitter channel 6
}
void loop() {
mpu6050.update();
delay(10);
}
This single-Arduino approach is the best option if you want to use your existing RC
system for head tracking. It's the simplest and most direct method.
Testing:
Before flying, thoroughly test the system on the ground. Use a servo tester or an
oscilloscope to verify that the receiver is outputting the correct PWM signals in response
to your head movements.
I sincerely apologize for the previous confusing and incorrect explanations. I believe this
corrected approach is accurate and will be much more helpful for your project.
Setting up a reset button on your Radiolink AT10 II to re-center the servos used for
head tracking involves a bit of clever programming on the Arduino and utilizing a spare
channel on your transmitter. Here's how you can do it:
Concept:
You'll use a spare channel on your transmitter as a "reset" signal. When this channel is
activated (e.g., a switch is flipped), the Arduino will detect this and send the appropriate
PWM signals to the servos to center them.
Hardware Setup:
Wiring: No changes are needed to the existing wiring for the head tracking itself (MPU-
6050 to Arduino, Arduino to transmitter channels, receiver to servos).
Transmitter Channel for Reset: Choose a spare channel on your AT10 II that you'll
dedicate to the reset function. Ideally, use a switch or a momentary button for easy
activation. Let's assume you're using Channel 7 for this example.
Software (Arduino Code):
C++
#include <Wire.h>
#include <MPU6050_tockn.h>
#include <Servo.h>
MPU6050 mpu6050(Wire);
Servo panServo;
Servo tiltServo;
void setup() {
Wire.begin();
mpu6050.begin();
mpu6050.calcGyroOffsets(true);
panServo.attach(panChannel);
tiltServo.attach(tiltChannel);
}
void loop() {
// Check for reset signal
if (isResetActive()) {
centerServos();
} else {
// Normal head tracking operation
mpu6050.update();
int panValue = map(mpu6050.getAngleZ(), -45, 45, 1000, 2000);
int tiltValue = map(mpu6050.getAngleX(), -30, 30, 1000, 2000);
panServo.writeMicroseconds(panValue);
tiltServo.writeMicroseconds(tiltValue);
}
delay(10);
}
bool isResetActive() {
int resetValue = pulseIn(resetChannel, HIGH, 20000); // Read reset
channel
if(resetValue > 1700) { // Adjust this threshold as needed
return true;
}
return false;
}
void centerServos() {
panServo.writeMicroseconds(centerPulseWidth);
tiltServo.writeMicroseconds(centerPulseWidth);
delay(500); // Hold center for a short time
}
centerPulseWidth Constant: Defines the pulse width that centers the servos. This is
typically around 1500 microseconds, but you might need to adjust it slightly for your
specific servos.
isResetActive() Function: This function uses pulseIn() to read the value of the reset
channel. It checks if the pulse width is above a certain threshold (1700 in this example).
This threshold needs to be adjusted based on your transmitter's output for the reset
switch. When the switch is activated, the pulse width will be higher.
centerServos() Function: This function sends the centerPulseWidth to both servos,
centering them. It also includes a short delay to ensure the servos reach the center
position.
Conditional Logic: The loop() function now checks if the reset signal is active. If it is, it
calls centerServos(). Otherwise, it performs the normal head tracking operation.
Setting up the Transmitter (AT10 II):
1. Assign a Switch/Button: Assign a switch or momentary button on your AT10 II to the
channel you've chosen for the reset function (Channel 7 in this example).
2. Check Channel Output: Use the AT10 II's monitor screen or a servo tester to observe
the output of Channel 7 when you activate the switch/button. You need to identify the
pulse width range when the switch is active and inactive.
3. Adjust Threshold: Adjust the threshold value in the isResetActive() function
(if(resetValue > 1700)) to match the output of your transmitter. The threshold should
be a value between the inactive and active pulse widths.
How it Works:
When you activate the reset switch/button on your transmitter, the Arduino detects the
change on Channel 7. It then sends the centering pulse width to the servos, effectively
resetting their position. When you release the switch/button, the Arduino resumes the
normal head tracking operation.
This method provides a convenient way to re-center your FPV camera without having to
physically adjust it. Remember to test and adjust the threshold value in the code to
ensure it works correctly with your specific transmitter setup.
You connect the Arduino output to the transmitter's input pins where the potentiometers
of the sticks or switches are normally connected.
Inside your Radiolink AT10 II (and most RC transmitters), the sticks and switches are
connected to potentiometers (variable resistors). When you move a stick or flip a switch,
the resistance of the potentiometer changes, which in turn changes the voltage on the
corresponding channel's input pin on the transmitter's main circuit board. The
transmitter then reads these voltage changes, encodes them into a radio signal, and
transmits it.
Since you're bypassing the sticks/switches and having the Arduino generate the control
signals, you need to connect the Arduino's output pins to the same input pins on the
transmitter's circuit board where the potentiometers are connected.
o Connect the Arduino's digital output pins (the ones you're using for
Servo.writeMicroseconds()) to the signal (SIG) wires of the potentiometers
instead of directly soldering to the circuit board. However, this is not a guaranteed
solution, as the trainer port's functionality can vary between transmitters.
Example:
If you're using Arduino pin 9 for pan (connected to transmitter channel 5) and Arduino
pin 10 for tilt (connected to transmitter channel 6), you would:
3. Solder a wire from Arduino pin 9 to the signal wire of the channel 5 potentiometer.
4. Solder a wire from Arduino pin 10 to the signal wire of the channel 6 potentiometer.
5. (Optional) Desolder one leg of each potentiometer.
Caution:
Working inside electronic devices can be risky. If you're not experienced with electronics
or soldering, seek help from someone who is. Incorrect wiring or soldering can damage
your transmitter.
This detailed explanation should help you connect the Arduino to your transmitter
correctly. Remember to proceed with caution and test thoroughly after making any
connections.