Learn how to use Arduino 37 in 1 sensors kit LDR (light dynamic resistor) sensor. It includes instructions for assembling LEGO pieces, connection to Arduino and textual and graphics (Ardublock) programming.
The sensor’s description:
The LDR sensor sensors of Arduino 37 in 1 kit is a resistive sensor whose resistance (resistivity to the flow of electric current) varies depending on the amount of light received. The sensor is shown in the following figure:
The pin with the sign “-” corresponds to the signal GND (ground), the middle pin is + 5V used to power the sensor and the pin with the sign “S” corresponds to an analog signal that varies depending on the amount of light received 0-5V.
The following file is the Lego Digital Designer file for assembling the housing of the sensor:
The appearance is as follows:
For correct installation, we will fix the electronic circuit parts using a thermo-sealing gun, as shown in the figure.
The connection of the sensor to the Arduino is very simple, we just need to be sure to provide signals of + 5V and GND pins of the Arduino and connect the “S” signal to any analog Arduino pin, e.g.: Arduino pin A0.
The following is a sample code for programming for LDR sensor. It reads the analog value and displays this value on the console of the Arduino IDE. When the value of light is lower than a given value (600 in this example), then turns on an LED on pin 13 of Arduino:
The following file is the equivalent Ardublock code: