What are our liabilities…and our assets? 02/09/2009Posted by aliasmrjones in The Build.
We’re building an autonomous vehicle to compete in a competition sponsored by Sparkfun Electronics. The goal of the competition is to have a vehicle make 1 lap around Sparkfun’s building in Boulder, CO in the fastest time. The trick is, it must make that lap on its own with no interaction from any human. You can read all the details about the competition here. One of the rules for the competition is that you document your build. That is what this blog is for. We’ll be posting about what hardware we’re using, how the build is going, our programming strategy, pics and videos, the thrill of victory and the agony of defeat all through the process.
We are building our vehicle largely with parts we already have. The base of the vehicle is an r/c car called the Duratrax Evader ST. Here is a photo of the bare car base:
We like this car base because:
- We already own it so it cost us $0
- It is battery powered so we can run the car and the controller from the same power source
- Steering and speed are controlled using r/c pulses which are easily generated by a microcontroller
- It goes up to 21 mph
If we can get everything working well with this car at 20 mph, we may try to use a friend’s nitro car that can go up to 50 mph.
The rest of the parts are in this box:
We have a Garmin Legend handheld gps with a display that cuts in and out that we will use to provide navigation data. Because the display is so flaky it doesn’t work well any more as a normal handheld gps, but it does have a serial cable, which makes it really easy to connect to any computer or microcontroller. It will output standard nmea data over the serial line, which is 4800 bps and includes things like latitude, longitude, heading and speed. The only downside to this gps is it only outputs location information about once every 2 seconds. At 20 mph, this might be too slow to provide effective navigation. At 20mph, the 2 second delay = 29 feet between updates. That’s pretty far. But, like the car base, we’re going to see what we can do with what we have and if we can get the car working well at some slower speed and then realize the gps refresh rate is a problem for pushing to faster speeds, we’ll look at an upgrade.
Also in this box of spare parts is the brain of our car: The Atmel AVR Atmega32. This is a very cool general purpose microcontroller with everything we need in one package. It has a risc microprocesser running at 8 mhz, 32K of flash memory to store our program, 2 K of RAM, 1K of EEPROM, 32 i/o pins, a UART serial port, SPI and I2C synchronous serial, and timers with the capability of generating the r/c pulses (PWM) with hardware which makes it very easy and efficient to control steering and speed. There is also a free gnu C compiler and libraries to help handle most of the basic tasks we want to accomplish like reading data from the serial line, parsing the gps data and printing diagnostic info. I already had one of these and a little development board you can also see in the picture left over from another project. Because we are using the serial port for reading the gps, we need another way to get information from our controller.
I had a little 2 line LCD that I bought and hadn’t used so we will use this to display debug information and a simple user interface. LCD displays are easy to drive from an AVR. We just need to hook up 13 wires and the C library will provide functions for printing to the LCD. The dev board has a single pushbutton that combined with the LCD will be our user interface.
Finally, before getting out the soldering iron, we will use an STK-500 board from Atmel to prototype the whole thing and get the programming working. It is much easier to debug problems if you know the software is working. You can then pretty much be sure it is something with the wiring if things don’t work. We’ll wire everything up to the STK-500 using breadboard wires. A bit fragile, but quick to set up and get working. The STK-500 has connections for all the pins of the Atmega32 for easy connection with breadboard wires. We can wire everything up, try out all the peripherals with test programs, then work on the navigation software. After the software is working well we will solder together the final board, connect everything and move over the programmed AVR. Hopefully everything will work just like it did on the STK-500.
In the next post, we’ll connect the LCD, an important step as it is our only view into what is happening in our controller brain, and connect the gps to the serial port and hopefully start seeing some live data!