Flying Android Project Ardupilot
From GT RoboJackets
The purpose of this board is to simply interface between the G1 and the servos/ESC. Per competition requirements, this board is dumb. It has no sensors, it contains no controller. This board only converts serial commands from the G1 to PWM commands for the servos. In addition, this board acts as a safety fail over in the event of an emergency by allowing a human safety-pilot to take command at any time.
For the first cut of the hardware we co-opted the Ardupilot. This seemed like a good idea, but it's not. We ended up completely re-writing the Ardupilot firmware and soldering many additional wires to their PCB. Many notes follow about this process.
Contents |
Hardware Modifications
First, it is best to link to the schematic. Note on the schematic, only TWO PWM channels are connected to ATMEGA for both reading and writing PWM positions (S1A and S2A respectively). This necessitates modifications. The modified Arduino pinout is as follows (taken from easystar.h in the headers directory).
- Pin 0: RX
- Pin 1: TX
- Pin 2: PWM1_IN_PIN - from radio
- Pin 3: PWM2_IN_PIN - from radio
- Pin 4: MUX_PIN - indicates what state the MUX is in. HIGH = Phone, LOW = Safety Pilot
- Pin 5: MODE_PIN - MONITOR safety pilot or phone. Output from ATTiny. HIGH = Switch (on RC) is in HIGH position. LOW = Switch (on RC) is in MIDDLE or LOW position.
- Pin 6: PWM4_IN_PIN - from radio
- Pin 7: PWM3_IN_PIN - from radio
- Pin 8: PWM3_OUT_PIN - from phone
- Pin 9: PWM1_OUT_PIN - from phone
- Pin 10: PWM2_OUT_PIN - from phone
- Pin 11: PWM4_OUT pin - from phone
- Pin 12: BLED_PIN - Blue led
- Pin 13: LED_PIN - LED pin
In particular, the following changes must be made.
- Pin 6: PWM4_IN_PIN - from radio, connect to S4A
- Pin 7: PWM3_IN_PIN - from radio, connect to S3A
- Pin 8: PWM3_OUT_PIN - from phone, connect to S3B
- Pin 11: PWM4_OUT pin - from phone, connect to S4B
Programming
Setup
- Install the latest Arduino dev kit.
- Patch Arduino for 64 bit Linux if needed
- I like to make a soft link between my my checkout of the repo and where Arduino expects projects to be. In Linux, Arduino projects hide in ~/sketchbook and the headers hide in /usr/local/bin/arduino-XXXX/hardware/libraries (at least they do on my system)
Compile
- Open Arduino IDE
- Open ser_bridge (or whatever) from the dropdown
- Press the "validate" or compile button
Flash
This is an involved process. Read all instructions then start. Incorrect actions here WILL DAMAGE HARDWARE
- Build or buy a programmer that is compatible with the FTDI Basic
- Disconnect all serial devices from the Ardupilot (for example, the GPS header is electrically connected to the serial port)
- Turn on the RC radio
- MAKE SURE THE RADIO IS IN MANUAL MODE That is, the switch which controls the autopilot should be LOW or OFF. Failure to perform this step WILL DAMAGE THE HARDWARE
- Connect receiver to ESC
- Connect receiver to Ardupilot
- Plug in the battery to the ESC
- Connect the programmer to the Ardupilot through the serial port
- Connect the programmer to the computer through the USB port
- Press the "upload" button on the GUI