Home Code Arduino Uno and ALS-PT19 ambient light sensor

Arduino Uno and ALS-PT19 ambient light sensor

by shedboy71

In this example we connect a ALS-PT19 ambient light sensor to an Arduino Uno. This is the sensor I used for this.


First lets look at some information about the sensor

Description

The ALS-PT19-315C/L177/TR8 is a low cost ambient light sensor, consisting of phototransistor in miniature SMD. EVERLIGHT ALS series product are a good effective solution to the power saving of display backlighting of mobile appliances, such as the mobile phones, NB and PDAs. Due to the high rejection ratio of infrared radiation, the spectral response of the ambient light sensor is close to that of human eyes

Features

Close responsively to the human eye spectrum
Light to Current, analog output
Good output linearity across wide illumination range
Low sensitivity variation across various light sources
Guaranteed temperature performance, -40oC to 85oC
Wide supply voltage range, 2.5V to 5.5V

Applications

Detection of ambient light to control display backlighting
Mobile devices – mobile phones, PDAs
Computing device – TFT LCD monitor for Notebook computer
Consumer device – TFT LCD TV, plasma TV, video camera, digital camera, toys

Automatic residential and commercial management
Automatic contrast enhancement for electronic signboard
Ambient light monitoring device for daylight and artificial light
– Street light, CCD/CCTV

 

Parts Required

 

Name Link
Arduino Uno UNO R3 CH340G/ATmega328P, compatible for Arduino UNO
ALS-PT19 ALS-PT19 Analog Light Sensor Breakout Module
Connecting wire Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire
sensor shield Expansion IO Board Sensor Shield

Schematic/Connection

An easy sensor to connect, I connected the out to A0

Arduino and ALS-PT19 layout

Arduino and ALS-PT19 layout

 

Code Example

No libraries required, a very simple example which will output the analog value to the serial.

You would need to take an action based on the value you read in, for example when the value is low switch a light on

[codesyntax lang=”cpp”]

void setup() 
{
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}


void loop() 
{
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // print out the value you read:
  Serial.println(sensorValue);
  delay(500);        // delay in between reads for stability
}

[/codesyntax]

Output

Here is what I saw in the serial monitor window

38
34
15
7
8
7
9
9
963
961
961

Links

http://www.everlight.com/file/ProductFile/201407061531031645.pdf

Share

You may also like

Leave a Comment