3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Autonomous, Wirelessly Controlled Hovercraft

Step 7Firmware and Software

Firmware and Software
Wireless control
We decided that having wireless control of the hovercraft was an absolutely essential feature, so we acquired two XBEE wireless modules. We set up two circuits, the host circuit and the onboard circuit. Using the PICs' ability to send and receive signals, we set up the host PIC to send a pulse width specification to the onboard PIC. Once we were able to send signals from the host PIC to the onboard PIC, we added the XBEE modules. The XBEE modules required no additional code modifications; we could send and receive signals as if the PICs were connected by invisible wires.
Receiving signals
We wanted to be able to receive data from sensors mounted on the hovercraft. We decided to use PORTA for analog sensor inputs and PORTB for digital pulse width outputs. This decision was motivated by the fact that only PORTA ports could act as analog inputs. We set up five pulse width outputs and controlled them with five sliders on the computer. Once this was working, we added an analog input that could send its signal from the onboard PIC to the host PIC and finally to the computer. When we added additional analog inputs, however, we ran into problems. The first problem was that it simply took too long for the PIC to read from all of the inputs and send the signals to the host PIC. The delay was long enough to affect the pulse width outputs. We fixed this problem by limiting how often the PIC would read from the analog inputs. The second problem was that the analog inputs seemed to be reading and sending the wrong signals. We found out that we needed to wait longer in between reading different analog inputs. After implementing this delay, we still struggled to effectively read multiple analog inputs. We settled for the ability to only read from one sensor at a time.
For sensors, we experimented with an accelerometer and a sonar sensor. We found that we could sense tilt with an accelerometer, but we could not sense enough tilt for the accelerometer to be useful for our purposes. We found that the sonar sensor was effective for measuring distances greater than six inches, and was accurate to within about three inches. We calibrated the sonar sensor and set up the computer to output its reading in inches.
User interface
Up until the final week, the user interface consisted of five sliders, one for each pulse width output. In the final week, we thought more about how the user might want to control the hovercraft. We settled for a slider to control the speed of the lift fan, sliders to control the speed of each propulsion fan, and sliders to control the pitch of each propulsion fan. For the user, controlling all of these sliders was a difficult experience, so we added key combinations. G and H controlled the speed of the lift fan, 1 and 2 controlled the speed of the left propulsion fan, and 9 and 0 controlled the speed of the right propulsion fan. Up and down moved the pitch controls in the same direction (for backing up and moving forward), and left and right moved the pitch controls in opposite directions (for steering).


Here's how you can get this up and running yourself. First of all, you need libusb installed on your computer, so that the host PIC and your computer can communicate. I won't go into how to install libusb, as it varies between different operating systems. Also, you'll need a way to flash the PICs with the firmware provided. Microchip's Pickit 2 is what we used, along with their MPLAB software.
« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
14
Followers
3
Author:bradpowers(bpowers.org)