At present I've now totally assembled Nomad and all the hardware works however it has no software glue to actually make it useful - I've managed to put this together in 1 week so its very messy and I've cut so many corners its embarassing. So please take this project as an example of what is actually achievable with a gumstix and waysmall board using bits that are lying around not as the way to actually approach a project.
This was probably the most important thing to achieve. The R/C vehicle that I'm using has 2 servos, one to move the position of the front wheels and therefore controls steering and the other controls a mechanical speed controller (push it forwards and you go forwards, backwards and you reverse with an zone in the middle of not moving).
Servos are driven by a PWM signal which allows accurate positioning of the servo "arm". Now I'm using a gumstix connex 200xm and a STUART waysmall board, the gumstix has 2 methods of producing a PWM signal, either through its hardware onto GPIO 16 (Jonathan Brandmeyer has a driver here however 16 isn't avaliable on the waysmall board) or by the mpwm driver produced by Pascal A. Brisset which allows the signal to be produced on any GPIO.
The first thing I did was rewire the servo/reciever system, removing the radio receiver and sorting out the position of the switch (some cable ties and glue did the job nicely). The servos are powered by 4 AAs which sit at the back of the buggy and are powered in parallel. The third wire (white in this case) I then extended and attached to the I/O pads on the bottom of the waysmall. Steering servo is connected to GPIO61 on pin 18 while drive servo is connected to GPIO62 on pin 20. Also GND (pin 16) is connect to the common ground of the servos. See here for a description of the I/O pads.
Next I intergrated the gumstix, I took one of the nice transparent cases gumstix use to ship their products, drilled 2 large holes for the MinDIN8 connectors to fit through and some smaller holes to attach the gumstix to the case. As i couldn't find any suitable screws I actually used plastic wire to tie the gumstix to the case, theses hold it nicely but not to rigidly which I think is a good thing considering the risk of crashes. In between the GPIOs and servos there is a large Molex connector to allow seperation (I've learnt that its best to have methods of detaching things or it gets exceedingly complicated)
Now that everything is wired its a matter of getting the software to work. I spent quite a while shifting through Pascal's example software but my programming is awful especially in c. So i finally gave up and sent him an email and he replyed rapidly and revealed all ( I hope he doesn't mind me quoting me!):
"You can also do a quick test without writing any code. Try this on the gumstix shell:
# insmod pxa_mpwm.ko gpio=-1 servo=61 nchans=1 tmin=500 tmax=1500 tpause=500 tsync=12000
# (/bin/echo -ne "\377"; sleep 10; /bin/echo -ne "\200"; sleep 10; /bin/echo -ne "\014"; sleep 10; /bin/echo -ne "\377"; sleep 10) > /dev/mpwm0
"This should configure the driver for single-channel servo pulses on pin 61, and generate waveforms for 40 seconds.
The commands simply write a sequence of bytes to /dev/mpwm0. "echo -ne" expects numbers in base 8, so "\377" stands for 255 (i.e. 100% pulse duration), "\200" is 128 (50%) etc.
For two channels you would need to write nchans=2, servo=61,62 and echo -ne "\377\377" instead."
So I quickly put together a shell script, uploaded it, plugged everything and took nomad outside and voila (warning movie!)
Now of couse I forgot that the buggy has reverse and after a few crashes learnt the important lesson that its best to set a default state of not moving but at least it was moving.
The plan was to get all the hardware assembled before working on the software so the next challenge was to get the radio modems working.
Now not many people have an aerocomm 868mhz 250mW radio modem development kit lying around. I got one as I thought it could be useful as a communication system for Pegasus however it turns out that its not allowed on airbourne vehicles. However it is perfect for Nomad.
One of the reasons why I like it so much is that it acts as a serial cable, on Linux you can echo some data into the serial port its connect to and it pops out the other side making testing really easy. However there was one problem, these radio modems run at TTL levels not rs232 and the 2 serial ports on the waysmall are rs232, connecting them up would probably be the death of the radiomodem (rs232 involve much higher voltages).Now the gumstix itself runs at TTL levels and the signals go through a converting chip to achieve the higher voltage levels however before they reach the chip they appear as 2 pads on the I/O pads on the bottom of the waysmall IRRXD and IRTXD (ttyS2). Excellent, with some guidance from Dave Hylands and Alexandre Pereira Nunes I found that I could use these pads at the lower level if I cut the traces that then lead on to the convertor chip (to avoid both the radiomodem and the convertor trying to "drive" the same line. I grabbed the eagle file of the waysmall board(its a diagram of the layout), identified the two traces and with a sharp knife cut them. Now this is a pretty permenant hack so please don't attempt this without making sure you know what you are doing. If in doubt either email me or the gumstix mailing list! (Though I don't take any responsibility!)
These radio modems are great, the pins that need to be connected are:
|2||O||TXD||Transmitted data out of the transceiver|
|3||I||RXD||Data input to the transceiver|
|10||PWR||VCC1||AC4868-250: 3.3-5.5V, +- 50mV ripple|
Remember that Txd from the transceiver needs to go to IRRXD on the gumstix.
Next I edited the file /etc/inittab and changed the "respawn" line to got to ttyS2 and to have a baud rate of 57600 (the speed of the modems). Now on boot up I can login over the modems from my laptop (using kermit on my laptop as the serial terminal).Also remember to connect up the signal ground or your not going to get any data - its probably the mistake I make the most
The GPS unit is a cheap serial (rs232) unit (BR-304 which has a Sirf-II chipset)I got off ebay. Its pretty damn tough considering it flew in Pegasus I so has been to 66,000ft and then managed to survive the (parachute assisted) fall back to earth. It use to have lots of cables etc such as a DB9 connector and also a PS2 connector (for power) however I got rid of these a long while ago. All that is left is a short cable with 4 wires sticking out. Red is +, Black is - and theses are connected to 4xAAAs battery pack mounted on the side. Green is Txd and White is GND (for some reason I forgot this and spent a very long time trying to work out why everything wasn't working.) So all that is required is to set up the power supply and attach the green Txd line to the Rxd socket on the waysmall's first (FFUART) serial port (one nearest the power supply) oh and don't forget GND to the central socket of the port
Testing can either be done with a serial terminal emulator such as wermit or even by:
stty -F /dev/ttyS0 speed 4800
You should see a nice stream of data. Now there are lots of methods of actually obtaining data from this stream. In this project we are going to probably use gpsd though on the Pegasus Missions I have a nice perl script to log the data from defy.
Well to tell you the truth most of the devices actually don't need that much power however cause I'm exceedingly lazy and it allows things to be easily added and removed all the systems have their own power packs. Yes I know this is an exceedingly wasteful system but its the quickest way. I even haven't got them running on rechargable batteries yet though its the next step.
So the situation at present (19/08/06) is that i have working:
On the hardware front I've run out of things to add that I have avaliable though I'm beginning to plan a seriously cheap homebrew laser range finding device (though its still in the planning stage and I haven't got a clue how I could interface it - perhaps I2C?)
After a little work, I removed the front battery pack and instead ran both the gumstix and the radio modem off the same battery pack. This also meant that I could put the front "bonnet" on to the buggy making it look a bit better but also giving some protection to the electronics.