Arduino camera and geotagger
This projects demonstrates how to attach a c328 camera to an arduino microcontroller (atmega328),
take geo-tagged pictures continuously, and write them to an SD card.
Here are the features:
- Continuous pictures taken at 640x480 resolution using an attached c328 camera (serial)
- The pictures are geo-tagged using the current position, altitude and time obtained from an attached gps unit
- Pictures are written to an attached micro SD card
- Small enough for many different applications, robot cam, car, bike, etc.
Flickr set of the arduino on a quick tour of
Valley Forge National Park.
Construction
Materials
Pretty expensive where you might be able to hack up a gps enabled cellphone, this is more fun though!
Circuit
The arduino is attached to the GPS and SD card. All of the pricey components are in sockets so they can
be re-used for something else later. ;) I'm a big fan of trying to kill myself by cramming everything
in as tight as possible on a prototype board.
Prototype
In the pictures above there is the arduino microcontroller with a GPS module and an SD
adapter stacked on top of each other. There are two connectors used for power and
the camera unit which is not attached to the prototype board.
To attach the SD adapter and the gps module to the prototype board right angle
male headers were soldered to the connection pads.
Container
An ipod nano container was used as the project box to protect the components
from outside elements. It's a little big for everything but it does the job.
A hole in the front was drilled for the camera and circuit foam was used to keep
the lense in place.
Software
The following software is compatible with avr-gcc version 4.3.4 and Arduino 0017
A few existing libraries were combined to interface to the SD memory and the camera:
There is already a
NMEA parser lib for helping to decode the NMEA messages off
the GPS unit. For this project a custom parser was used instead however to conserve flash memory.
There is no easy way to write out an exif header to geo-tag images on a microcontroller.
Free libs available for this are too large to run on the very limited resources available. The solution for this
was to simply write out a raw header with information filled in for the position, altitude, date and time.
c328 camera
The c328 camera uses a very simple serial interface to setup its configuration and retrieve images.
If you are having trouble getting it to work first try this
python script if you have an
FT232R breakout to talk to it over
usb.
LS20031 GPS 5Hz Receiver
Because the gps receiver is interfaced without a uart the speed needs to be slowed down to something the
8MHz arduino can keep up with. It is initally configured to send messages at 1HZ at 4800bps.
Program Flow
Error Reproting
There are many different stages of operation for this device so to make troubleshooting easier a large
enum of error codes was used. These codes are read off an attached LED if there are any problems reading
from the camera, sdcard or gps unit.
Once an error is detected the device needs to be reset to resume operation.
EXIF data
A basic exif header is used to store the GPS coordinates from the attached gps receiver,
date, time, altitude and position are recorded. EXIF tags can be viewed using gthumb or
any other program that can view extended image data.