Skip to main content

Simple Light Sensor - How it works

Both the regular and Qwiic versions of the sensor use a LDR to measure the intensity of light. The difference between them is the onboard IC that processes the data provided by the LDR. The regular version uses a simple LM393 voltage comparator by Texas Instruments, while the Qwiic version uses an ATTiny404 MCU to process the data and implement I2C communication.

ATTiny404 MCU on board of Qwiic version
ATTiny404 MCU on board of Qwiic version
LM393 on board of regular version
LM393 on board of regular version

Datasheet

For an in-depth look at technical specifications, refer to the official LDR / ATTiny404 / LM393 Datasheet:

LDR Datasheet

Detailed technical documentation for the Light dependent resistor.

ATTiny404 Datasheet

Detailed technical documentation for the LM393 Voltage Comparator.

LM393 Datasheet

Detailed technical documentation for the ATTiny404 microcontroller.


How the sensor works

The Light Dependent Resistor, or LDR, is a transducer (a device that converts one form of energy to another) that senses light intensity and converts it into electric current. The resistance of the LDR is inversely proportional to the light intensity to which it is exposed. That means that as the intensity increases, the resistance decreases.

LM393 on board of regular version
LM393 on board of regular version

I2C communication - Qwiic

Qwiic versions of the product use onboard ATTINY404 MCU to implement I2C communication. Breakout board operates with a default I2C address of 0x30 but can be changed with onboard switches,to change breakout board's address, check the Address selection. When detected, ATTINY404 recives data from sensor and passes it to the main MCU using I2C data line. To check in detail how to ATTINY404 is preprogrammed, check firmware github page.