Introduction
This is an example program on how to capture pictures with the CR328R serial camera using an xBee module hooked to your PC and an xBee module hooked to the CR328R camera. In theory you shoudl be able to use a serial interface from you PC directly hooked into the camera and be able to use this software.
Background
I am buidling a tank robot that can be driven with a Wii Mote interfaced with my PC, and my PC then relays the commands to my tank using the xBee Pro, which has a 1 mile range. When I did that I wanted to upgrade the range of the camera I was using because my old camera's range was only 100' or less. So I decided to use a serial camera and the xBee module so the range of my camera would be the same range of my tank.
I built my work on this application based on the great work of Pavel Bánský, who created a class to get pictures from the CR328R camera from a hardware device called the Tahoe development board that used the .NET Micro Framework. Because he used the .NET Micro Framework I only had to modify the code to use the SerialPort class and to account for the small buffer size the xBee has.
Hardware Connections
I hooked the TX pin of the camera to the DIN pin of the xBee. Then I hooked the Rx pin of the camera to the DOUT of the xBee. Because the camera and xBee module both work at 3.3 volts I used a 3.3V voltage regulator to power the camera and xBee. I also hooked a resistor in series with an LED between the PWM0 pin and ground. This will let you know when your xBee is receiving information.
My xBee Pro is set to 57600 baud.
Software
When the program starts hit "Init" so the camera can start up and initialize to the baud rate of the xBee. After that you can hit "Get Now" which uses the GetJpegPicture function to take the picture and immediatly start transfering it to your computer. Or you can hit "Snapshot" which stores the JPEG image on the built in memory on the camera, then start transfering it to your computer. Once these work for you hit "Movie" to display a clip of 10 sequential pictures.
Points of Interest
I was only able to get the JPEG options for this camera working so the GetRawPicture function doesn't work. I believe this is due to the small buffer size of the xBee. Because the GetRawPicture function doesn't work framerate is limited. In 80X64 I have only been able to get 1 frame every 1.14 seconds, in 160x128 I can only get a frame every 2.5 seconds, and it gets progresevly worse from there. I am hoping in the fugure to figure out a way to get GetRawPicture working.
It's can befrustrating working with this camera. Sometimes it seems it doesn't want to take pictures so you have to hit Reset or Init Camera. It seems like if you don't constantly take pictures the camera or xBee goes to sleep so I have to hit Reset to wake it up. Other times I have to restart the application.
Outstanding Tasks
1. Make it more reliable.
2. Speed. Try to get GetRawPicture working to see if I can get the framerate up by reducing the color depth.
History
4/4/2009 - First Release