Presentation is loading. Please wait.

Presentation is loading. Please wait.

Light Sensors ECE 4437 Dr. J. Glover 10-15-2015 Team 9: Jitin George Zachary Freeman.

Similar presentations


Presentation on theme: "Light Sensors ECE 4437 Dr. J. Glover 10-15-2015 Team 9: Jitin George Zachary Freeman."— Presentation transcript:

1 Light Sensors ECE 4437 Dr. J. Glover 10-15-2015 Team 9: Jitin George Zachary Freeman

2 Overview QTR-1RC Reflectance Sensor Reflectance time Initialize Pins for I/O Timer Interfacing outputs to digital I/O Data Check Works Cited

3 QTR-1RC Reflectance Sensor Carries a single infrared LED and phototransistor pair The LED current-limiting resistor delivers approximately 17 mA to the LED when VIN is 5 V The phototransistor uses a capacitor discharge circuit and the discharge time is used to take an analog reading of the reflected IR   Shorter capacitor discharge time is an indication of greater reflectance

4 Reflectance Time Strong Reflectance (White) - decay time can be as low as several microseconds Strong Reflectance (White) - decay time can be as low as several microseconds No Reflectance (Black) – decay time can be as high as a few milliseconds No Reflectance (Black) – decay time can be as high as a few milliseconds

5 Initialize Pins for I/O void PortE_Init(void) { volatile unsigned long delay; SYSCTL_RCGCGPIO |= 0x00000010; // Activate clock for Port E delay = SYSCTL_RCGCGPIO; // Allow time for clock to start GPIO_PORTE_CR_R = 0x10; // Allow changes to PE4 GPIO_PORTE_CR_R = 0x10; // Allow changes to PE4 GPIO_PORTE_AMSEL_R = 0x00; // Disable analog on PE GPIO_PORTE_AMSEL_R = 0x00; // Disable analog on PE GPIO_PORTE_PCTL_R = 0x00000000; // GPIO on PE GPIO_PORTE_PCTL_R = 0x00000000; // GPIO on PE GPIO_PORTE_AFSEL_R = 0x00; // Disable alt funct on PE7-0 GPIO_PORTE_AFSEL_R = 0x00; // Disable alt funct on PE7-0 GPIO_PORTE_DEN_R = 0x10; // enable digital I/O on PE4 GPIO_PORTE_DEN_R = 0x10; // enable digital I/O on PE4}

6 Timer Initialize Timer Initialize Timer SYSCTL_RCGCTIMER = 0x00000001; // Initializing Timer0 Clear residual bits Clear residual bits TIMER0_TAMR &= ~ 0x00000000; TIMER0_TAMR &= ~ 0x00000000; Write the GPTM Configuration Register (GPTMCFG) with a value of 0x00000001 Write the GPTM Configuration Register (GPTMCFG) with a value of 0x00000001 TIMER0_CFG = 0x00000001;

7 Timer Set the TnEN bit in the GPTMCTL register to enable the timer and start counting Set the TnEN bit in the GPTMCTL register to enable the timer and start counting TIMER0_CTL |= 0x01; // Starts the timer TIMER0_CTL |= 0x01; // Starts the timer

8 Interfacing Outputs to Digital I/O Set the I/O line to an output and drive it high Set the I/O line to an output and drive it high

9 Interfacing Outputs to Digital I/O Wait 10 microseconds for the 10[nF] capacitor to charge Wait 10 microseconds for the 10[nF] capacitor to charge

10 Interfacing Outputs to Digital I/O Make the I/O line an input (high impedance) Make the I/O line an input (high impedance) volatile unsigned long start, end, meas; start = TIMER0_TAR; Wait for the I/O line to go low Wait for the I/O line to go low

11 Interfacing Outputs to Digital I/O Read end time Read end time end = end = TIMER0_TAR; Calculating discharge time of the capacitor meas = end – start;

12 Data Check

13 Works Cited [1] J. Valvano and R. Yerraballi. (2014). Chapter 6: Parallel I/O ports [Online]. Available: http://users.ece.utexas.edu/~valvano/Volume1/E- Book/C6_MicrocontrollerPorts.htm http://users.ece.utexas.edu/~valvano/Volume1/E- Book/C6_MicrocontrollerPorts.htm http://users.ece.utexas.edu/~valvano/Volume1/E- Book/C6_MicrocontrollerPorts.htm [2] J. Pham and C. Harder. (2014). Light Sensor [PowerPoint]. [3] Polulu Robotics & Electronics. QTR-1RC Reflectance Sensor [Online]. Available: https://www.pololu.com/product/959 https://www.pololu.com/product/959


Download ppt "Light Sensors ECE 4437 Dr. J. Glover 10-15-2015 Team 9: Jitin George Zachary Freeman."

Similar presentations


Ads by Google