TINKER PiEDESIGN IN INDIA

Light sensor module (LDR) with TinkerPie

A light-dependent resistor: street lights, sunrise alarms.

TypeAnalog sensors
Connect toP10-P13
Gives0-100 % (bright = high)
SimulatorYes: a control appears under the simulated board

How it works

An LDR (light-dependent resistor) has a material whose resistance falls when light shines on it. The module puts it in a voltage divider, so brighter light gives a higher reading.

How to wire it

Plug the module's A0 / OUT into P10 (or P11-P13 when Wi-Fi is off), VCC to 3.3 V, GND to GND.

Code

In blocks: Accessories category in TinkerPie Studio. As code:

// JavaScript
sensors.lightSensor(Pin.P10)

// Arduino C++
sensors::lightSensor(Pin::P10)

Good to know

Projects with the Light sensor module (LDR)

Smart street lightA light sensor and a relay: when it gets dark, the lamp turns on by itself.Sensor projects

Similar modules

More projects to try

Questions

Can I try the Light sensor module (LDR) without buying one?

Yes. In TinkerPie Studio the simulator shows a control for it under the board, so you can test your program before you build it.

How do I make a night light with an LDR?

Read the light level in a forever loop. If it is lower than your threshold, switch the LED on; otherwise switch it off. Try it in the Night light project.