Gray scale sensor is a electronic module to distinguish colors by detecting blackness. It outputs continous analogue signals, which is then changed by A/D connector into readings displayed via RCU. Users can distinguish colors by comparing the readings. It acts well in line-tracking game, with wide range of working voltage, when there is no serious environmental light interference.

The real module is as follows.


1 Reduce the influence cansed by environmental lights, such as sunlight, lighting.
2 Wide working voltage range of 4.5V-5V
3 Output continuous analog signal.
4 The lighting indicator marks out the port with maximum data.

Emitting Tube (white light)  
Receiving Tube   X Yellow signal wire (Output 0- 5V)
Product Label   V Red power supply (Input +4.5 - +5V)
Standard Connect Port   G Black GND  (0V)

Example Use

Like other scale sensor, connect hardware, define the hardware type , then the module can be used by icon  to control, get value of blackness. Because gray scale returns analog level, it can only be plugged in the 8 analogue ports (A1~A4). To get accurate result, place the sensor right opposite to the object with distance less than 1cm.

Install the module, add a hardware instance by choose "_GrayADTest__" "Gray scale sensor", in the"Hardware Information" menu of RoboExp software. Name the new hardware instance, and the gray scale sensor can be programmed, read and controlled via module icon.

Gray scale sensor save the return module value in type of "unsigned char", and then make the counting and judgment according to the return value of the variable. Example programm which is detected objects to the beam light, displayed its current reflection value on the LCD screen. The programm lies in "Examples \ PhotoElectricity \ GrayADTest \ GrayADTest.rcu."of the RoboExp Installation directory.

The photodiode of Gray scale sensor emit a beam of white light, emit on different colors object, as the absorption effection according to different colors of light (In one word, the deeper color the more absorption, the lighter color, the less one), so it leads to the different of light reflection. Pay attention that there is certain angle between the emitting tube and receiving tube of gray scale sensor,  the longer distance being made, the lesser light-wave signal, so if opposite to the same object, the output level will be changed as the distance between the gray scale sensor and object is changing. Usually, the distance between gray scale sensor and object is 0.5 - 1 cm, it will be accurate results. User can take some of different color objects, test in different colors before using gray scale sensor, record measure data for the actual use for reference.

In addition, the sensor does not have the ability to identify colors, not a color sensor.

Working Theory

Gray scale sensor emit light-wave to detected objects, and then measure object reflectivity by the reflected signal intensity. For deeper color object, such as black color, reflecting signal is weaker, and the output level is lower; for the lighter color object,such as white color, reflecting signal is stronger, thus output level is higher. The robot will be able to distinguish shade of color after comparing measure output level. The working power is widely as the circuit includes steady voltage, etc. and it can overcome the result of the circuit caused by power supply voltage fluctuations.

Working Parameter

ParameterSymbolTesting conditionMinimum valueTypical valueMaximum valueUnit
Power voltage VSS   4.5 5.0 9 V
Working Current ISS VSS=5V   6.0 7.0 mA
Output voltage Vout   0   3.3 V
Valid Distance D   0.5   2.5 cm


Prev:Flame Sensor
Next:Gray Scale Sensor (V3 Blue Lighting)