GA1A12S202 light sensor example

In this example we will connect a GA1A12S202 Log-Scale Analog Light Sensor to an Arduino.

The features of this sensor are as follows

Output voltage increases with light on the sensor
Logarithmic response not only gives more sensitivity in low light, its also almost impossible to “max-out” the sensor
Dynamic range of 3 to 55,000 Lux
Use indoors and outdoors without needing to recalibrate!

Again these are typically best used in breakout/module form. Here is a picture of the module

You connect the sensor as follows

Vcc – 3v3
Gnd – Gnd
Out – A0

Code

This uses a library – https://github.com/wgbartley/GA1A12S202-sensor

[codesyntax lang=”cpp”]

#include "GA1A12S202.h"

GA1A12S202 luxValue(A0);

void setup() 
{
    Serial.begin(9600);
    delay(2000);
}

void loop() 
{
    Serial.print("Raw value = ");
    Serial.print(luxValue.getRaw());
	Serial.println();
    Serial.print("Lux value = ");
    Serial.println(luxValue.getLux());
	Serial.println();
    delay(1000);
}

[/codesyntax]

Results

Open the Serial monitor and you should something like this

Raw value = 315
Lux value = 2.42

Raw value = 314
Lux value = 2.42

Raw value = 27
Lux value = 1.09

Raw value = 28
Lux value = 1.08

Raw value = 339
Lux value = 2.61

Raw value = 338
Lux value = 2.59

 

Links

Adafruit GA1A12S202 Log-scale Analog Light Sensor [ADA1384]

LEAVE A REPLY

Please enter your comment!
Please enter your name here