0
$\begingroup$

I want to design a data logger for my quadcopter using the Arduino Mega board. I want to record the roll, pitch and yaw angles each second or 5 seconds, so they can be viewed later after a flight has ended. There's just one thing I don't understand, and that's how to translate the pitch/roll/yaw angles into a pulse of a specific length that the flight controller receives.

For example, when I press the control for the pitch, the transmitter sends out a pulse to the receiver of the drone and the speed of the drones' motors change accordingly for it to pitch either forward or backward. I can tap into these commands between the flight controller and the transmitter, and be able to record the length of the pulse that was sent out. However, what is the link between the pitch angle and the size of the pulse? Basically, how can I convert the pulse that was recorded by the Arduino board and convert it into the pitch angle in degrees?

Generally, for the transmitter I use, a 1500us-pulse means zero pitch; from 1501-2000 means pitch forward, and from 1000-1499 means pitch backwards (of course, the actual values vary slightly, but this is just a general reference for this question). So for instance, if I sent a pulse of 1400us, how would that translate into an angle in degrees? What's the formula to convert it?

I hope I'm clear, and if this question sounds stupid, please excuse me, but I haven't been able to find good information on it!

Thanks!

$\endgroup$
2
$\begingroup$

There isn't exactly a predictable correspondence of the two. I mean, you've already said that 1500us is the mid point. Values above or below that are really just amounts of pressure to apply to the model in order to move it. The actual angle will depend very much on how you have tuned your PID, but will also be influenced by the wind and the weather.

All you can really do is log the values of the width of the pulse which you can translate to how far the stick has been moved. Beyond that I wouldn't rely too much on 'angles'.

$\endgroup$
1
$\begingroup$

The pulse you're talking about is pulse position modulation. Whether this is being used to set the throttle speed of each of your motors (separately), or to convey some other meaning to your flight controller is unclear from your question (i.e. I'm not sure if the PPM signal is being evaluated as a "desired forward thrust" which is in turn being converted into separate motor signals).

In any case, the pitch angle will depend on the motor speeds (relative to each other) over time, and the motor speeds come from the flight controller (which may or may not be doing its own calculation) and the flight controller gets its data from your transmitter pulse.

So you may not be able to log this by looking at your transmitter pulses. I would instead look into an IMU to directly measure the pitch angles.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.