Home Code GA1A12S202 light sensor example

GA1A12S202 light sensor example

by shedboy71

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 – 5v
Gnd – Gnd
Out – A0 (or you can use another analog in pin but you would need to change the code example)


This uses a library –¬†https://github.com/arduinolearning/Arduino-Libraries/tree/master/GA1A12S202

#include "GA1A12S202.h"
GA1A12S202 luxValue(A0);
void setup() 
void loop() 
    Serial.print("Raw value = ");
    Serial.print("Lux value = ");



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


Adafruit GA1A12S202 Log-scale Analog Light Sensor [ADA1384]


You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More