Starting to come together...
04 Dec 2009
Well, my "helicopter framework" (which I have dubbed "sonton" in honor of my patient wife who has put up with me working on this thing day and night) is finally starting to come together. Pretty much the only thing that doesn't work is the actual flying part. Now, most people probably think that's the most important thing about a helicopter framework, and I guess I'd have to agree with them. However, from the standpoint of a cool project, I think I've got some pretty cool stuff going on even without the flight:
- Wireless communication from a Linux machine to an AVR microcontroller using two XBee modules
- Accurate altitude reading with an AVR by reading the PWM signal coming out of a sonar sensor
- A semi-complex, multi-threaded control station capable of sending altitude commands to the helicopter while listening for data over a UDP socket
- Successful data link between a WiiMote controller and a Linux machine which talks to the control station
I'm using the cwiid python module to interface with the WiiMote controller. It's laughably simple to get data and do cool things with the WiiMote using cwiid. Could make for some fun little projects...
Here's a tiny example to read the pitch of the controller:
import cwiid
print 'place wiimote in discoverable mode (press 1 and 2)...'
wiimote = cwiid.Wiimote()
wiimote.rpt_mode = cwiid.RPT_ACC
#wiimote.state dict now has an acc key with a three-element tuple
print 'pitch: %d' % (wiimote.state['acc'][cwiid.Y])
5 lines of code and you're there. I love python.
Another video demo (with WiiMote pseudo-control):