Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:examples:sensor:color [2012/06/07 00:11] raivo.sellen:examples:sensor:color [2020/07/20 12:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== Color sensor ====== ====== Color sensor ======
  
-//Necessary knowledge: [HW] [[en:hardware:homelab:sensor]], [HW] [[en:hardware:homelab:lcd]],  [AVR] [[en:avr:adc]], [LIB] [[en:software:homelab:library:adc]], [LIB] [[en:software:homelab:library:module:lcd_graphic]], [LIB] [[en:software:homelab:library:module:sensor]]//+//Necessary knowledge: [HW] [[en:hardware:homelab:sensor]], [HW] [[en:hardware:homelab:digi]],  [AVR] [[en:avr:adc]], [LIB] [[en:software:homelab:library:adc]], [LIB] [[en:software:homelab:library:module:lcd_graphic]], [LIB] [[en:software:homelab:library:module:sensor]]//
  
 ===== Theory ===== ===== Theory =====
Line 26: Line 26:
 Sensor outputs a voltage, proportional to all the light that it sees weighted by the curve on the figure. Therefore, when a subject is illuminated with a red LED only it will respond with a voltage proportional to the red component of the subjects color and similarly with blue and green. When there is ambient light mixed in with the LEDs illumination, its effect can be eliminated by sampling first without any LEDs turned on and then subtracting this reading, in turn, from each of the red, green, and blue components. This reference measurement should be taken before each color measurement to eliminate any effects from varying ambient conditions. Sensor outputs a voltage, proportional to all the light that it sees weighted by the curve on the figure. Therefore, when a subject is illuminated with a red LED only it will respond with a voltage proportional to the red component of the subjects color and similarly with blue and green. When there is ambient light mixed in with the LEDs illumination, its effect can be eliminated by sampling first without any LEDs turned on and then subtracting this reading, in turn, from each of the red, green, and blue components. This reference measurement should be taken before each color measurement to eliminate any effects from varying ambient conditions.
    
-{{:en:examples:sensor:colorpal_wiring.png?200|}}+ColorPAL sensor requires only three connections+5 V supply, ground and serial data. It can be plugged into Robotic Homelab communication board EXT_UART connector. Separate TxD and RxD pins needs to be connected together using diode. Communication with the ColorPAL takes place using serial I/O transmitting and receiving at between 2400 and 7200 baud using a non-inverted open-drain protocol
  
-ColorPAL sensor requires only three connections+5 V supply, ground and serial dataIt can be plugged into Robotic Homelab communication board EXT_UART connector. Communication with the ColorPAL takes place using serial I/O transmitting and receiving at between 2400 and 7200 baud using a non-inverted open-drain protocol. +[{{  :examples:sensor:color:colorpal_wiring1.png?580  |ColorPAL wiring schematic}}]
  
-[{{  :examples:sensor:color:colorpal_wiring.png?580  |ColorPAL wiring schema}}]+Example code enabling to read the RGB values which is printed on the screen using hex formatMeasurements with ColorPAL sensor will be made automatically.
  
 <code c> <code c>
Line 38: Line 38:
 #include <homelab/usart.h> #include <homelab/usart.h>
  
-// 
 // Determining USART interface. // Determining USART interface.
-// 
 usart port = USART(0); usart port = USART(0);
  
-// +// Main program
-//MAIN +
-//+
 int main(void) int main(void)
 {  {
Line 103: Line 99:
  data[i-3] = c;  data[i-3] = c;
  }   }
-  
  }   }
   
en/examples/sensor/color.1339017110.txt.gz · Last modified: (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0