I am working on my first drone using a E-Flite UltraStick. I have built up my code for retrieving data from accelerometer/gyroscope, and have constructed PID loops to set the plane to the necessary attitude as determined by the GPS. However, I am having difficulty switching the plane from radio control to autopilot.
Currently, I am using 4 5v SPDT relays to throw the signal from the receiver to the arduino PWMs. I connected the a signal wire from the radio receivers 5th channel (typically used as a landing gear toggle) and used the arduino board to monitor its change in states using the PulseIn () function. When the arduino reads that I have enabled the autopilot it using four output pins to throw the four relays. I am working on making a small amplifier so that I can throw all four relays with one output pin.
Is there a better way to set this up??? I was trying to use a PNP transistor to connect the servo to the receiver and a NPN to connect it to the arduino board so that if the voltage drops the servo would automatically reconnect to the receiver. However, I have been unsuccessful in setting this up. What does the ArduPilot use for radio/autopilot switching??
Thanks for the help!