I've developed a small system for acquiring images from the CCD element found in the GameBoy(tm) camera.
All information, code and circuitry provided here is copyright Andy Clark 1999.
I accept no liability for any damage arising from its use.
The actual CCD component is a Mitsubishi M64282 Artificial Retina Chip, information for which can be found at...
The CCD produces a 128*123 image and has onboard image processing functions such as edge enhancement.
It is relatively easy to drive, only requiring 8 registers to be set via a 3 wire serial link, once done, an analogue image matrix is clocked out continuously. With an 8MHz 8515, I could clock a frame out in about 20mS (allowing for exposure time) and this left heaps of spare time for some fairly complex image processing and image classification (bloody good these AVRs!!!).
The circuit is based around a standard 8518+Sram configuration and uses a 6 bit flash adc to convert the video signal. Here's a gif (suitable for printing, so save rather than view it) of the schematic and here are the Schematic and PCB (a few routes need completing, as I modified some of the schematic and didn't get around to updating the board as my next rev was already in the pipeline). Don't fret about the muddled ram address lines, this was intentional and simplified the board routing. In hindsight, I could have memory-mapped the adc as I don't need all the ram I thought I would (unless my code recursion runs away with itself!).
The circuit was designed using CadSoft's Eagle.
Port usage was a bit tight in the original circuit so I resorted to a couple of dirty tricks...
After the registers have been set in the camera, it requires a single start pulse to start frame capture, after this, the pulse is generated internally. I was damned if I was going to dedicate a general port pin to this so I utilised the OC1B pin which, with a bit of fiddling, can be set/cleared to order. The same goes for the READ signal from the camera, which indicates a new frame is ready; I used the ICP pin as a general purpose input.
The code was implemented in two parts; the main program shell was developed using Jack Tidwell's JavrBasic (www3.igalaxy.net/~jackt/) and the camera control was written in assembler as a JavrMod(c). The basic shell is very simple; it initialises the camera and continuously reads a frame and sends it out via RS232 (oneframe.bas). The assembly code has four main routines which a)initialise the camera, b)set the 8 register, c)send a reset/start command and d)read an image into an array (m64282.asm).
Here is a very "rough and ready" Delphi program that you can use to receive and display the camera images (ACARV). The slow frame rate is due to the serial port baud rate (56700baud was the fastest I could get away with releiably under windows). Clicking on the relevant COM button will connect the camera and continuously display the image, if you tick the save frame box, a sequence of images will be recorded with the prefix entered in the box. Click exit to stop the capture.
It's been a very good learning exercise for me and I am very impressed with the power of the AVR. My original system for this particular image processing task was a P90 with Win95 and Delphi, the highest reliable frame throughput using a standard ccd was 8fps (Video For Windows and the frame grabber card had a lot to do with that!), with the AVR, I can implement the same task at 10fps without optimisation AND I know what the timing is doing!!!
Here are a couple of rough images...
![]() |
One of the first images captured, scary???
The diagonal line is intentional. |
![]() |
An image of my new capture board, taken using the
old board. |
Hope this helps someone...