Advertisement
Advertisement

Acquire images with a sensor and a microcontroller

Ioan Ciascai, Technical University of Cluj-Napoca, Cluj-Napoca, Romania, and Liliana Ciascai, Babes-Boylai University, Cluj-Napoca, Romania; Edited by Martin Rowe and Fran Granville -September 23, 2010

 View as PDF

The TAOS (Texas Advanced Optoelectronic Solutions) TSL1412S image sensor, IC2, can acquire a linear image of 1536×1 pixels, or 400 dpi (Figure 1). It uses a single voltage supply, and you can control it with just a few digital signals. Thus, you can design an image-acquisition system that uses the sensor and an AVR ATmega328 microcontroller, IC1.

Acquire images with a sensor and a microcontroller figure 1Figure 1 shows how you can connect the sensor to the microcontroller. You program the microcontroller to generate the control signals for the sensor. The design uses a 16-MHz clock frequency. The microcontroller’s 8-bit Timer 2 generates the command signals. In Mode 2, the timer generates hard clock signals CLK1 and CLK2 and soft strobe signals SI1, HOLD1, and HOLD2. The TSL1412S uses serial connections. The SO2 signal connects to the ICP input of TSL1412S when you activate flag ICF1.

Timer 2 generates a handler interrupt, which ensures the correct phase of the clock signal, generates the strobe signal, and acquires and saves the TSL1412S’s output analog data. You can see a model for the interrupt subroutine here. The code sets the microcontroller’s stack, register, ADC, Timer 2, and interrupt functions. To save image data, you must set the T bit in SREG to 1 and set pointer X=0×0200. You can do these settings in the last clock of time integration (R25, R24=0×0001).

 Read More
Design Ideas

By modifying the data from the register, you can set the sensor’s integration time at 2.5 to 50 msec, or 100 msec with the prescaler of T2. Knowing that the sensor acquired the data in the previous cycle, you can perform a data-acquisition design using the microcontroller’s internal ADC. The integration time must be greater than 50 msec.

The conversion time for a 16-MHz-frequency clock is approximately 16 μsec, which corresponds to an integration time of approximately 25 msec. Because the conversion frequency is 1 MHz—higher than that of IC1’s recommended frequency of 200 kHz—you reduce the ADC’s precision from 10 bits to 8 bits. The microcontroller saves a byte for each pixel, which lets you save the data to the microcontroller’s internal memory for one frame. The rest of the microcontroller’s 2-kbyte memory performs stack and data-acquisition tasks.

The system quickly processes the sensor’s analog output signal through the analog comparator of the microcontroller’s internal schematic. You can make a comparison with a fixed voltage using an internal voltage reference of 1.25V and a resistive divider or a variable voltage you can obtain from a DAC or a PWM (pulse-width-modulated) signal the microcontroller’s timer generates.

Loading comments...

Write a Comment

To comment please Log In

FEATURED RESOURCES