Many embedded systems today require several aspects of digital and analog electronics to create an end product. Depending on the application and product volume, specialized hardware such as ASICs/CPLDs are used when high speed signal processing is required, especially when timing is critical to the performance product.
A good example of this would be a digital scanner. Scanners utilize a CCD element (either full or fractional width) that capture an image by exposing a pixels for a given time (Tint - Integration Time) which is converted to a voltage that represents black (or white) intensity. When scanning a document in grey scale or colour, Tint becomes a critical parameter in obtaining uniformity and image quality. Slight variations in grey/colour levels between pixels are easily visible by the human eye.
With that said, I thought that it would be interesting to see if I could design a scanner that would be able to reproduce photographic quality pictures using only scrapped parts.
CCD Sensor
I was able to salvage the image portion of an old photocopier. Unfortunately, the mechanism for moving the image scanner across the page was damaged, so all I was able to salvage was the CCD portion.
On older units like this one, a small CCD like this one is positioned behind a lens that reduces the actual width of the image to the size of the CCD viewing area (approx 3-4cm). In order to maintain the correct size, two or three mirrors are used to obtain the correct focal distance. To make things even more complicated, the focal distance is maintained across the page by moving the mirrors at different rates. So, needless to say, correcting the transport on my unit was not going to be an easy task.
On newer scanners and photocopiers, the CCD is stretched across the width of the page (1 to 1 ratio). This eliminates the need for mirrors and lenses, thereby making the optical design less complicated. However, in order to make the scanner portion cost effective, the CCD lens is usually integrated directly on the PCB, along with the other electronics needed for image capture. This makes isolating the CCD or finding a functional description more difficult.
So, I decided to use the small CCD at a 1 to 1 ratio. This allows me to get around the image focus problem, but now reduces my effective scanning width to 3.5cm. Oh well, if I ever find another unit, I could always connect the board to the CCD and obtain full size images. Until then, I will be able to take amazing scans of stamps :)
The CCD used in this photocopier is a TCD1502C. It is a linear image sensor with a single row of 5000 photodiode elements. It is capable of producing 400dpi across an A3 page (lens system), and each element is 7um x 7um x 7um. When I operate this CCD at a 1 to 1 ratio, the effective scanning resolution is:
5000 elements * 7um per element = 3.5cm of viewing area.
3.5cm / 2.54 cm per inch = 1.378 inches
5000 elements / 1.378 inches = 3628 elements per inch (or > 3600dpi). Good enough for stamps :)
In order to use the CCD at a 1 to 1 ratio, you will need to provide a way to straighten the incoming image onto the CCD. This is done by using a SELFOC™ lens. This lens is basically made up of optical light pipes that "straighten" the light before it reaches the CCD.
The lens is positioned above the CCD at a fixed distance determined by the properties of the lens. The image (on the top side of the glass) must also be a predetermined distance away from the top of the lens in order to maintain focus.
Here's where I put my machining skills to the test... Time to create a transport system for the scanning element. Since the pixel dimensions are 7um x 7um, I will need to move the image transport 7um at a time in order to maintain the correct aspect ratio. Using a lead screw linear table and a stepper motor, I am able to achieve this resolution.
Below is a picture of the completed scanner with some key components highlighted:
Stepper Motor Driver (Full and Half Step Mode)
Block Diagram
ALTERA MAX 7064
As I mentioned earlier, Tint (Integration Time) is critical to uniformity and image quality since the exposure time of each element will determine the level of brightness it views. In order to properly control the exposure time, I used a MAX7064 to generate the timing for the CCD, as well as a built in address generator and multiplexer to store the A/D result to SRAM.
The principal of operation is as follows; the MAX chip will constantly scan the CCD, thus ensuring that Tint is maintained. The SRAM is shared between the microcontroller and the MAX chip, so it is the responsibility of the the microcontroller to signal when it has relinquished the bus, allowing the MAX chip to save the current line data directly to the SRAM. The microcontroller waits for the MAX chip to signal completion, then transfers the data to the PC.
Image of the CCD Sensor timing waveform taken from a Logic Analyzer:
The test pattern consisted of three parallel vertical lines centered around 60 degree angled chevron lines.
Atmel AT90S8515 microcontroller
The microcontroller is responsible for synchronizing the scanning, advancement of the stepper motor and transfer of image data. Control of the MAX chip is managed by a pair of signals which indicate when to begin scanning, and when scanning has completed. The "START" signal (microcontroller -> MAX) indicates that the microcontroller has relinquished the SRAM bus and is waiting for MAX chip to write the current line data to SRAM. Once this has completed, the MAX chip raises the "DONE" signal. The microcontroller then begins to transfer the data out of SRAM to the PC. The stepper motor then advances the CCD by one line, and the cycle repeats until the requested number of lines have been scanned.
PC Application (CCD Mini Scan)
The sole purpose of the PC application is to compile and view the scanned image (along with some other manual functions). The application was written in LabWindows CVI v5.5. Data transfer between the microcontroller and PC is performed serially using a PAR protocol. To test the resolution of the scanner, I scanned the micro print found on the American $10 and $20 dollar bill, here are the results:
$10 - Above the name "Hamilton" reads "THE UNITED STATES OF AMERICA" and inside the "20" on the bottom left hand side reads "USA20".
The CCD scanner board is also capable of performing image adjustments in real time before passing the image data to the PC application. Below is a sample of the possible image adjustments that can be made:
Original Image (Actual Size): Magnified View of Original Image:
22mm x 26mm
Scanned Image on PC Application Screen:
No image adjustment is preformed by the PC application, the application displays the raw data as sent from the scanner board.
Normal Brightness High
Brightness Low Contrast Low
Contrast High Edge Enhancement
Engrave Negative
Emboss Black and White
Outline
After seeing the results, all of the work seemed well worth it. This project covered aspects of: embedded programming, WindowsTM programming, protocol development, VHDL design, analog /digital electronics and finally mechanical design.
Scanning micro print on a US $10 dollar bill:
August 20th 2004
Normal Brightness High
Brightness Low Contrast Low
Contrast High Edge Enhancement
Engrave Negative
Emboss Black and White
Outline
After seeing the results, all of the work seemed well worth it. This project covered aspects of: embedded programming, WindowsTM programming, protocol development, VHDL design, analog /digital electronics and finally mechanical design.
Scanning micro print on a US $10 dollar bill:
August 20th 2004
No comments:
Post a Comment