The grayscale sensor is an analog sensor. It can be used in combination with the for Arduino sensor expansion board v5.0. It can sense different colors on the ground or desktop and generate corresponding signals. It can realize interactive works related to colors, and can also be used as a line patrol car. Line sensor or soccer robot's field grayscale recognition. The power supply needs to be consistent with the controller, usually 3.3V or 5V.
Parameter:
Working voltage: 3.3V or 5V
Working current: <20mA
Operating temperature range: -10℃~+70℃
Detection resolution: 10%
Interface type: analog signal output
Interface definition:
OUT: signal output
VCC: Power (VCC)
GND: Ground (GND)
Instructions:
working principle:
The grayscale sensor includes a white high-brightness light-emitting diode and a photoresistor. Since the light-emitting diode illuminates the paper with different gray levels, the return light is different, and the photoresistor receives the returned light. According to the different light intensity, the photoresistor The resistance value is also different, so as to realize the gray value test.
Programming principle:
The grayscale sensor has three pins, namely the power supply positive Vcc, the power supply ground GND, and the signal terminal OUT. In actual use, you can directly connect the sensor to the analog interface of the for Arduino controller, such as analog port A0. After powering on the for Arduino, The white high-bright LED of the sensor lights up, put the sensor on the paper with different gray levels, read the data through the AD conversion of the for Arduino controller, and then print out the measured analog quantity through the serial port.
Connection diagram:
The OUT port is connected to the analog input pin of the controller. 5V and GND are respectively connected to +5V and GND of the power supply.
Program effect:
When you detect different gray values, feedback the measured value at that time.
![](https://ae04.alicdn.com/kf/Ha73ed693d89744a494028ce7634ba287h.jpg)