Intro: Intel Edison Smart Camera Trigger for Pixhawk Based Drones
The Intel Edison is a very small and powerful computer. It has the perfect size to be used as a companion computer for Pixhawk based drones. Capable of running linux and doing some image processing. It can be used to control different cameras and send feedback to the autopilot or ground stations. It can also be used as a gateway to a celular network for long range telemetry and Control. This tutorial will show you how to hook up an Edison to a Pixhawk and setup Mavproxy to implement a Smart Camera trigger for Sony Cameras using a module I wrote.
Step 1: Install Ubilinux on the Edison
Working with Debian is a lot easier than working with Yocto, and the fact being that Ubuntu is what most of the ArduPilot Dev team members run and use for development makes a Debian based image more suitable for this project. Ubilinux is a distribution for the Edison based on Debian and is what the Ardupilot Dev team recommends for use.
To install follow this excellent tutorial from Sparkfun:
Step 2: Connect the Edison to Your Wifi
In order to install the rest of the needed packages on the Edison, you will need to connect it to your network. Do this by editing the file "/etc/network/interfaces". After changing the file run "ifup wlan0" It should look like this (make sure to put your network credentials):
# interfaces(5) file used by ifup(8) and ifdown(8)
iface lo inet loopback
iface usb0 inet static
iface wlan0 inet dhcp
# For WPA
wpa-ssid "Put your network name here"
# For WEP
# And the following 4 lines are for when using hostapd...
#iface wlan0 inet static
# address 192.168.42.1
# netmask 255.255.255.0
Step 3: Install Dronekit and Mavproxy
In order to interact with the Pixhawk you should install Mavproxy and Dronekit, 3D Robotics API to make it easier to work with the ardupilot systems.
Run the following commands:
apt-get install git sudo python-pip python-numpy python-opencv python-serial pbython-pyparsing screen
pip install droneapi
Step 4: Setup the Edison to Run MAVProxy at Startup
Now we need to setup MAVProxy to run every time we startup our Edison. And in order to login to the MAVProxy console in an easy way we will set it up with screen. You will need to modify the file "/etc/rc.local", add these lines right before the line "exit 0":
screen -d -m -s /bin/bash mavproxy.py --master=/dev/ttyMFD1,57600 --source-system=1 --source-component=100 --aircraft MyCamera
} > /tmp/rc.log 2>&1
We also have to setup MAVProxy to load the smart camera module I wrote at startup. Create a file "/root/.mavinit.scr" with the following contents:
module load smart camera
set shownoise 0
And we need to add a file to configure the smart camera module to tell it we have a WiFi Sony camera, create a file named "/root/smart_camera.cnf" with the contents as shown here.
Step 5: Connect the Intel Edison to the Pixhawk
Now that we have setup the Edison, we need to make the connections to your drone. The Intel Edison by itself needs a carrier board to interface with anything. There are several options to use but the most practical and with the most options and form factor are in my opinion the Sparkfun Edison Blocks you will need at least one UART Block and one Console Block.
The diagram above shows you what we are trying to accomplish.
Step 6: Pinout on the UART Block
Step 7: If You Are Using the 3DR Solo....
The Solo has a special accessory bay on the bottom with access to Serial port 2. You can get the pinout and the connector information on the 3DR Developers Guide
Step 8: Connect the Edison to the Sony Camera WiFi
In order for the Edison to connect to the Sony camera it needs to be connected to the Wifi network from the camera. In the case of the Sony QX1 you can find the WiFi credentials inside the battery cover. Modify the "/etc/network/interfaces" file accordingly and reboot the whole system. When the system comes back up the Edison should be connected to the camera, MAVProxy Running and connected to the pixhawk.
Step 9: You Are Done!
You should now be able to trigger the camera using the pixhawk. If you set up a mapping mission the camera will automatically trigger when commanded by the pixhawk. You can find more information on creating missions with the pixhawk in the APM Wiki.