Create a simple lux meter using a GA1A12S202 sensor

In this example we will create a lux meter using a GA1A12S202 sensor and display the readings on an LCD shield

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

 

Parts List

Description Link
Arduino Uno 1pcs UNO R3 CH340G+MEGA328P for Arduino UNO R3 (NO USB CABLE)
LCD Keypad shield 1PCS LCD Keypad Shield LCD 1602 Module Display For Arduino
GA1A12S202 module GA1A12S202 module&lt
connecting wire 40pcs Dupont jumper wire cable 30cm male to male,female to female,male to female Dupont jump wire line 2.54mm breadboard cable

 

Connection

lcd keypad and GA1A12S202

lcd keypad and GA1A12S202

 

Code

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

#include <Wire.h>
#include <LiquidCrystal.h>
#include "GA1A12S202.h"
 
//setup for the LCD keypad shield
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
 
GA1A12S202 luxValue(A1);
 
void setup() 
{
  //init serial for some debug
  Serial.begin(9600);
  Serial.println("Light Sensor Test"); 
 
  //init LCD
  lcd.begin(16,2);
  //line 1 - temperature
  lcd.setCursor(0,0);
  lcd.print("Raw: ");
  lcd.setCursor(0,1);
  lcd.print("Lux: ");
}
 
void loop() 
{
  // put your main code here, to run repeatedly:
 
  lcd.setCursor(6,0);
  /* Display the results (light is measured in lux) */
  lcd.print(luxValue.getRaw());
  lcd.setCursor(6,1);
  lcd.print(luxValue.getLux());
  delay(500);
}

 

Link

Related