micro:bit and 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 – P3



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

I recieved a compilation error reagrding application.h so the following seemed to fix this issue – ga1a12s02

[codesyntax lang=”cpp”]

#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]

Leave a Comment

This div height required for enabling the sticky sidebar
Ad Clicks : Ad Views : Ad Clicks : Ad Views :