Gray Scale Sensor

From VEEROBOT » Wiki
Jump to navigation Jump to search

Introduction

These are tiny non-contact grayscale sensors which includes a 5mm photo resistor (light-controlled variable resistor) and an integrated 5mm White LED. Once the module is powered on, the analog pin can be connected to analog read of an Arduino or any other microcontroller board and can measure the ambient light falling on the photo resistor. The digital output can be tuned using the trimpot and can be connected to digital input pin of the microcontroller. The combination of both analog output and digital output in a single module is great for obstacle avoidance or for color detection (grayscale values)

Most automatic street lights include a grayscale sensor like this which turns on the light when it is dark and turns off when there is enough light. Other applications include connecting analog pin to read ambient light values and display it on an LCD. The digital output can be connected to trigger an activity when the light source falls below a threshold value (set by the pot). These are also useful when an IR based obstacle avoidance method fails due to IR rays reflecting from bulbs and sunlight.

Features

Flame Sensor footprint
  • Outputs both analog and digital values
  • Onboard LED indicates if the module is connected properly
  • Another onboard LED indicates when threshold values are touched (turns on)
  • Great for DIY projects and Arduino beginners
  • M3 Mounting holes to mount the module on your desk or project

Specifications

Model Gray Scale Sensor
Number of Pins 4 (AO, DO, VCC, GND)
Output Type Analog and/or Digital Output
Operating Voltage 4.5V to 6V
Lead Pitch 0.1th inch (2.54 mm) Breadboard compatible
Dimension 0.6" x 1.3" x 0.5" inch (15.25 mm x 33mm x 12.7 mm)
Operating Temperature 0C to 60C (± 10%)
Range 0.5cm – 5 cm
LED Indicator SIG (Orange or Red), PWR (Green)
Weight 20 Grms

Interface

Pin Definition

  • AO : This is the analog output pin from the sensor and should be connected to Analog input pin of microcontroller. If you are using an Arduino, this can be connected to any of the analog pins A0 through A5 (on UNO for example). On a Draco board, this can be connected to any of the pins PC0 through PC5. If you are using LCD, then the module can be connected to PC4 or PC5 and sensor values can be displayed on LCD. Analog output from gray scale sensor can be used to identify different levels of gray and act accordingly.
  • DO : This is the digital output pin from the sensor. The pin is connected to a pull-up resistor and will read high. You can adjust the pot to set a threshold value. A comparator continuously checks if the analog pin has hit the threshold value. When it crosses the threshold, the pin goes low and signal LED turns on. This setup is very useful when you need to trigger an action when certain threshold is reached. For example, when the light intensity crosses a threshold, you can turn off a relay. When the distance to the nearest obstacle reaches a threshold, you can signal your robot to reverse and change direction.
  • VCC : Positive power pin and this should be connected to VCC (or +5V) of your microcontroller.
  • GND: Ground pin and this should be connected to GND(or 0V) of your microcontroller.

Usage

Code for Arduino

/*
 * Product: Gray scale sensor
 * SKU    : VEE00052
 * Description: The example demonstrates usage of connecting a gray scale sensor
 * to an Arduino board. AO (Analog Output) from Sensor is connected to 
 * A0 (Analog 0) pin of Arduino. Sensor outputs analog values according to the
 * the color detected which are sent to Arduino's serial port and displayed 
 * on your serial monitor
*/
void setup()
{
  Serial.begin(9600); // initiate serial port
}
void loop()
{
      int grayscalevalue;
      grayscalevalue=analogRead(0);   //connect grayscale sensor to Analog 0
      Serial.println(grayscalevalue,DEC);// display analog values on serial port        
      delay(100);
}

Application Ideas

This sensor is used for following purposes:

  1. Gray Scale approximation
  2. Obstacle Avoidance
  3. Light detector

Demonstration

  • Coming soon...

Resources

  • Schematic - Coming soon...

Support

If you have any questions or queries, contact us

Get this

SEN-SNS-CNTP-52