For as long as I can remember, I’ve been following (to some extent or another) Sparkfun’s Autonomous Vehicle Competition – the AVC. I always thought building a GPS guided vehicle was reasonably complicated. And it is, but I’ve been realizing it’s well within the realm of doable as I begin to look into it more. The inspiration for this came with my successful application to SFU’s UAV team, Team Guardian. Planes are super cool, and UAVs are one of the things that kickstarted my interest in engineering. Our system is GPS guided of course, but I think building my own GPS guided vehicle would be an interesting challenge to attempt outside of the team environment.
I haven’t started the hardware for this project yet. But I’ve been doing extensive research on hardware and software, so I’m going to post it up. This series won’t really be a tutorial, though I’ll have the code and other documentation available since I haven’t been able to find much myself, so I’ll put it out there for anyone else who wants to attempt something like this. Posting about it will also help keep me accountable, and stop the project from dying in the idea phase or dying mid way through on the workbench.
Hobby GPS units have been around for as long as I can remember. There are only a few different modules available, but I’d like to pick the one with the best support, and price/performance ratio. In other words, I want everything!
I’ve settled on the Adafruit Ultimate GPS breakout board as my GPS solution. It offers quite a suite of features for a reasonable price of $42 CAD. And I can get it at Lee’s Electronics! I’m using it as an excuse to visit the store.
- 10 hZ update rate
- External Antenna Connector
- Breadboard friendly
- 5v! Yes!
- Wicked good documentation
Since it’s my first GPS, I don’t want to use anything too obscure. Using libraries and code snippets is fine by me for this project. Check out the documentation though, it’s very extensive. I’ll probably write my own GPS library in the future (see the phases section below). It operates at 10Hz which will be reasonably easy to process, as well as providing enough data to get reasonable estimates of speed for the system if it’s moving at robot-speeds. The external antenna connector will be great if I decide to upgrade the antenna, and being 5V and breadboard friendly it’ll be easy to develop with.
The SeeedStudio Grove 3-Axis compass is going to keep the system heading in the right direction. While it’s too bad I couldn’t get a plain breakout board for the Honeywell HMC5883L (the compass itself), this board is available at Lee’s. And as I mentioned, I’m dying to go in there, and this way I won’t have to pay for shipping. I’ll just solder wires right to the connector.
This module is 3-axis so I should be able to get some interesting data about slope as the robot moves around. I could probably calculate elevation change more accurately than with GPS. That could be an interesting extension! It communicates with I2C so that’s easy to deal with.
Of course, GPS guidance can be as complicated as you want it to be. I’ll start out with the Haversine formula which sounds scary but is actually just simple trig. It calculates a distance and heading angle given a waypoint and the current position. It’s simple and effective. PID and other control algorithms will come later. I’ve also found a few people offering Arduino sketches that do this. I tend not to like using other peoples’ code if I know I can write it myself, and other code will rarely work without mods. But it’s there for reference, which can always be helpful. A few links are below.
This will be Arduino powered for the first phase. I’ll likely use my Ardweeny from Solarbotics. This bad boy is basically a backpack for the 328 that provides the pin 13 LED, a reset circuit and a resonator. It pops right into a breadboard so one doesn’t have to deal with the mess of wires coming off an Uno going into a breadboard to coordinate everything. Side note: Solarbotics is fantastic, I’ve been using them for years. You know I love my Canadian companies!
The motors will be driven by an L293D chip. It can handle 600mA per channel which is fine for the small motors I’ll be starting with. I’ve been using this chip for years in my projects. I probably have one wired up and ready to go on a random breadboard somewhere!
There are so many extensions to this project. I’ve broken it up into some rough phases based on the parts I have around, and the difficulty. Eventually, I can see powering it with a Raspberry Pi and maybe doing some computer vision for obstacle avoidance.
- Get GPS to talk to Arduino
- Get GPS and compass working simultaneously
- Get robot to drive to one pre-selected waypoint
- Be able to go to multiple waypoints
- Set waypoints by positioning robot and hitting a button. Be able to return to them.
- Add basic obstacle avoidance along path to waypoint
- Remote kill switch
- Write my own GPS library
- More advanced obstacle avoidance
- Mapping, elevation gradients, stuff like that.
- Repeat with Raspberry Pi or bare AVR
- RF link to send waypoints to the rover
- GUI control for RF waypoint selection
- Solar power (now we’re in mars rover territory)
I should have the GPS and compass in-hand fairly soon. Currently, all of my motors and other drive hardware are in Winnipeg. I’ll pick that stuff up over during the break (won’t be able to drive in Winnipeg since the ground will be covered in snow). Between buying the GPS and flying back home, I’ll try to get the Arduino talking to the GPS and compass.
There’s also a cool book coming out: http://www.amazon.ca/Make-Raspberry-Pi-Controlled-Robot-Building/dp/1457186039