Thoughts on cameras for Arduino/AVR based micromouse and other robots

349 views
Skip to first unread message

Mike Thompson

unread,
Jul 25, 2011, 11:13:49 PM7/25/11
to HomeBrew Robotics Club
Hi everyone,

It's been quite a while since I've been to an HBRobotics meeting, but
after a few years of life taking me in a few other directions, I'm
turning my attention back towards building a few new robots. Yeah!!!
Below are some thoughts I would like to share regarding my next robot
and see if anyone has comments.

I'm collecting all the pieces for what I hope will be a fairly
competitive micromouse -- ie. able to run about and solve the maze
sooner than its batteries run out. To keep things simple, but not too
simple, the mouse will be controlled by at least two Atmel AVR
ATmega168s with one doing motor quadrature decoding/control and the
other devoted to sensor management and actual maze solving. I'll be
using two good quality Faulhaber gear motors with built-in encoders
that I hope will give the mouse decent dead-reckoning positioning
within the maze. In thinking about how the mouse will avoid walls and
sense openings and turns, I'm leaning towards using small CMOS cameras
whereby the mouse will be able to sense the strongly contrasting
boundaries between the maze floor and maze walls. I may or may not
use a additional IR proximity sensors depending upon how successful I
am with the cameras.

As for the camera, some people may remember, I have used an AVRcam on
a tablebot I built to locate colored objects and push them off the
table. However, the AVRcams are no longer available and they are
relatively big compared to the size of a micromouse. Instead, I've
found a few clever person in the Aurdino community who figured out how
to interface the now ancient Nintendo Gameboy Camera (a Mitsubishi
M64282FP Image Sensor) to an Arduino AVR ATmega328 chip. As luck
would have it, a number of years ago I purchased a handful of such
cameras for cheap on eBay thinking one day they would find their way
into robots. I guess that day has arrived. Having just a resolution
of 128x128 in gray scale, these 10+ year-old camera's aren't much
compared to what's available now, but they are very well suited for
minimal processing power of 8-bit AVR chips. There is probably just
enough additional processing power to implement simple image
processing algorithms. Making a blob detector for following a laser
pointer would be trivial. A little more challenging would be
algorithms for reliably detecting when the mouse strays from the
center of the path and for detecting openings in the walls in the
cells ahead.

I've attached a few sample images of a toy helicopter and a business
card taken with the camera and an ATmega168. The major limiting
factor is that using the relatively slow on-board ADC capabilities of
the AVR MCU, it takes about a second to decode and capture the image.
Much too slow for a robot. Instead, I'll be designing a custom board
with a dedicated ATmega168 using an external ADC chip to decode the
camera output and do simple image processing. That should allow me to
run the image sensor full throttle at 30 fps which hopefully will be
fast enough to keep up with the robot running at a modest, maze
running speed. The master MCU on the mouse will use the I2C interface
to query the floor/wall boundary information detected by the camera.

Another issue is that these cameras have fairly narrow fields of view
-- about 60 degrees. To overcome this, the mouse will use two
cameras, one looking left/forward and the other looking right/forward.
That should be enough, but I can throw in a third camera if the mouse
needs an even wider field of view. Another upgrade may be projecting
a laser line on the walls from the robot -- the vertical position of
the laser line in the camera image indicating the distance of an
obstruction. I believe detecting the vertical position of the bright
line will be even easier and more reliable than the contrast between
the black floors and white walls of the maze.

My next steps are to create the small 1" square PCBs for the M64282FP
Image Sensor with an onboard ATmega168 (or ATmega328 with more RAM),
an external ADC chip and IC2 and serial interfaces. If others are
interested, I would be willing to create extra boards so others can
experiment with these nifty cameras on their own robots. Creating an
Arduino shield would also be possible if others are interested. For
now, you can still buy Nintendo Gameboy cameras on eBay for about $10
to $12 which isn't too bad for something that can be relatively easily
hacked to work with AVR microcontrollers.

I would love to hear thoughts others might have on such an approach --
particularly any pitfalls I might be missing.

Mike

sample.jpg
sample2.jpg
sample3.jpg

KM6VV

unread,
Jul 25, 2011, 11:41:58 PM7/25/11
to hbrob...@googlegroups.com
Hi Mike,

Would you consider more up-to-date-cameras and processor?

The Faulhaber gear motors are quite expensive!

Alan KM6VV

Mike Thompson

unread,
Jul 26, 2011, 12:27:11 AM7/26/11
to hbrob...@googlegroups.com
The Faulhaber gear motors I'm using are surplus for about $12 each.
They are described here.

http://www.robotroom.com/FaulhaberGearmotor.html

It's a little hard to explain, but there is something that appeals to
me about trying to solve the problem of mouse navigation using a
minimal camera and AVRs. I know I could use a more expensive, off the
shelf camera and a much more powerful processor, but that would be
less fun from a hacking perspective. Of course, it won't be fun if it
just can't be made to work.

Mike

> --
> You received this message because you are subscribed to the Google Groups
> "HomeBrew Robotics Club" group.
> To post to this group, send email to hbrob...@googlegroups.com.
> To unsubscribe from this group, send email to
> hbrobotics+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/hbrobotics?hl=en.
>
>

Alan

unread,
Jul 26, 2011, 2:52:29 PM7/26/11
to hbrob...@googlegroups.com
OK, yes, I know those motors! I bought a few probably a year ago when they
were mentioned on one of my lists. Cheap, and a good match price-wise to
the cameras and processors you are suggesting. Thanks for the reminder!

I also have a TSL1401 "Linescan detector module", which I think could be
used to see walls and passageways, a "slice" of the view, so to speak.
Might be faster to analyze the data from it.

Alan KM6VV

> -----Original Message-----
> On Behalf Of Mike Thompson

Mike Thompson

unread,
Aug 24, 2011, 4:16:09 PM8/24/11
to HomeBrew Robotics Club
A few weeks ago I discussed using the M64282FP camera sensor found in the obsolete Game Boy Camera module.  Since then I've progressed quite a bit and now have a working prototype.  Some information on this is below:

The PCBs ordered from Seeed Studio can be seen below.  They cost $13 including delivery for 10 (well, they sent me 12).  That works out to about $1.30 per PCB.

http://home.comcast.net/~michael.p.thompson/hbrobotics/gameboycamera/pcbs.jpg

The module itself mounted on an assembled PCB can be seen here:

http://home.comcast.net/~michael.p.thompson/hbrobotics/gameboycamera/front.jpg
http://home.comcast.net/~michael.p.thompson/hbrobotics/gameboycamera/back.jpg

I created a Windows based client application for experimenting with the register settings on the camera sensor which can be seen here:

http://home.comcast.net/~michael.p.thompson/hbrobotics/gameboycamera/gameboyapp.jpg

With a sample image created from the application/sensor here:

http://home.comcast.net/~michael.p.thompson/hbrobotics/gameboycamera/sample.jpg

This design uses an AVR ATmega168 with an external ADC chip capable of 1 million samples per second.  This is because the AVR on-board ADC is only capable of about 20 thousand samples per second which is insufficient of keeping up with the full 30 frames/sec frame rate of the camera.

With everything combined, the total cost of each camera module is about $20 -- about $10 for the camera modules pulled from Game Boy Camera cartridges bought on eBay and $10 in components for the interface module.

So, what can this do? Well, I don't have a complete answer at this time.  It certainly can be used for some of the things the AVRCam could do such as blob tracking, but only on bright/dark objects as this camera is monochrome rather than color.  On the other hand, this camera is a heck of a lot cheaper and the AVRCam is no longer available for purchase.  For instance, creating a laser pointing chasing robot or a line following robot should be well within the capabilities of this module.  I'll also be looking using the camera for extracting depth information from a laser line projected onto objects in front of the camera.  I don't know if it will make it onto my Micromouse as my IR sensors will likely be sufficient, but we'll see.

I'm already contemplating creating another version of this camera using the AVR ATmega128 with an additional 64KB of external SRAM to buffer multiple images (about 16K each) and do rudimentary image processing.  This would add about $4 to $6 to the cost of each camera.  Or perhaps something with an integrated ARM processor if I'm feeling a little more ambitious.  The 16MHz processor speed of the ATmega128 would probably be a bottleneck, but the image buffers created with this camera module are relatively tiny.

If other people are interested in exploring the minimalist approach to vision processing with AVR devices on a robot I would be more than happy to share my hardware and software designs so you can create your own cameras.  The firmware for this thing is really easy to understand and is probably much simpler to work with than anything else if your application can live within the constraints of the device.

Mike Thompson

James M.(Jim) Geidl

unread,
Aug 24, 2011, 4:38:58 PM8/24/11
to hbrob...@googlegroups.com
Mike,
 
Since you are using  a ATmega168, couldn't one use a Arduino?
 
Jim, K6JMG
 


From: hbrob...@googlegroups.com [mailto:hbrob...@googlegroups.com] On Behalf Of Mike Thompson
Sent: Wednesday, August 24, 2011 1:16 PM
To: HomeBrew Robotics Club
Subject: [HBRobotics] Re: Thoughts on cameras for Arduino/AVR based micromouse and other robots

Mike Thompson

unread,
Aug 24, 2011, 5:36:03 PM8/24/11
to hbrob...@googlegroups.com
Yeah, it would be pretty simple to connect everything up to an Arduino -- the firmware would work practically unchanged.  I was inspired by the work of the following person who started out with an Arduino and a Game Boy Camera module. 

http://www.bot-thoughts.com/2010/04/gameboy-camera-prototyping.html

His work was based on:

http://sophiateam.undrgnd.free.fr/microcontroller/camera/index.html

I just moved it up a notch by making it a dedicated MCU and using an external ADC chip to operate the camera at full speed.  Also, my board utilizes the proper connector for the camera module so you don't have to cut any wires to make it work with .1" headers or such.  It would be a trivial project to create an Arduino shield with the right connector.

The nice thing about dedicating an MCU to the camera is that it frees the Arduino to do other things while the dedicated MCU deals with the image information.  I put an I2C interface to facilitate such a connection to another processor such as the Arduino.

Mike

Reply all
Reply to author
Forward
0 new messages