Arduino And The VC0706 JPEG Camera

An Arduino equipped with a camera sounds like a great start for a wide variety of projects. Unfortunately, the Arduino’s hardware is really not up to the data volumes and rates required for meaningful image processing. This problem has a few partial solutions. In this post I will present one of them – a serial-connection camera with the VC0706 chip, and the dedicated code library by Adafruit.

The camera module
The camera module

What does it do

This camera, which costs almost $40 (shipping not included), can serve as a real-time video camera in monochrome NTSC. What’s more important, at least in terms of Arduino integration, is that this module can also take snapshots, in color, up to 640×480 pixels. It saves the latest snapshot in its internal memory, in JPEG format, and can pass this image by request through its TTL serial connection (what we simply call “Serial” in the Arduino world). In addition, this camera detects motion and raises a flag, which can also be read through the serial connection.

Back side of the camera module
Back side of the camera module

What is it good for

All the above doesn’t really help you if you want to incorporate photography into your stand-alone Arduino project, because the average Arduino doesn’t have enough resources to interpret the JPEG format and do something useful with these images. At best, it can store them as-is on an SD card, that will be picked up manually and read on the PC later.

With this camera, it’s better to think of the Arduino as a smart mediator between it and the PC, for example in a home-made security system, or in a robot that takes pictures of its surroundings, sends them to the PC for processing and gets back appropriate commands for action.

Disadvantages

The picture quality you get from this camera module is relatively poor. There’s some blur, distortion, and the colors especially are bad. Part of the issue with the colors is that the camera is over-sensitive to infrared, and an IR filter can improve the results somewhat. Still, you don’t want this camera for, say, a machine that sorts candy by color.

Picture taken in a room lit by (indirect) sunlight
Picture taken in a room lit by (indirect) sunlight. The surface is actually white.

The module transfers data at a default rate of 38,400 bits per second, and in 32-byte “packets”. In theory you could increase both, but the documentation of the code library and in the Adafruit website warns against such attempts, claiming they can harm stability and even the hardware itself. In other words, you probably don’t want to play such games with a $40 camera. Now, considering that a typical photo weighs a few dozen kilobytes, its transmission time can be as long as twenty seconds or more, depending on the resolution and compression ratio (which affect picture quality too, of course).

Even so, this bit rate is too high for the Arduino’s SoftwareSerial library. Therefore, despite the option to do so in the camera’s library, if you want reliable transfer you’ll have to work with a hardware serial.

Added direct light from an incandescent light bulb
Added direct light from an incandescent light bulb. The squares in the mouse pad (top) are actually purple and green.

Important note: although the module takes 5V for operation, its serial communication is done at 3.3V. Therefore, you have to pass the communication line from the Arduino to the camera – the line that goes into the camera’s RX pin – through an appropriate voltage divider.

Advantages

As you may have noticed, I’m not a big fan of ready-made Arduino libraries. When I have no choice but to use them, I definitely prefer those made by Adafruit; They are well written, well documented, and they get the job done. In this case, too, the library provides easy access to the camera’s features and saves the users lots of work. So far, the only problem I’ve noticed is the one I mentioned already, of SoftwareSerial usage.

Surprisingly, the camera works rather well in poor light. The picture quality does not match what you get in full light, but you can still see good details in conditions that would challenge even digital cameras.

In relative darkness
In relative darkness (only light is from a laptop monitor)

In summary

The VC0706 camera module is a nice toy with some interesting uses, but it doesn’t justify the price tag. I suggest investing in it only if there’s a significant discount, or if you are aware of all the disadvantages and still need exactly this for some important project.

Note: I am not affiliated with Adafruit in any way.

Leave a Reply

Your email address will not be published. Required fields are marked *

five + 7 =