Home » Lego » Integrating a LDR Arduino 37 in 1 sensor with LEGO pieces

Login with your Social Account

Integrating a LDR Arduino 37 in 1 sensor with LEGO pieces

  •  
  •  
  •  
  •  
  •  
  •  

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:

ldr_arduino_37in1

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.

Assembly:

The following file is the Lego Digital Designer file for assembling the housing of the sensor:

The appearance is as follows:

ldr_37in1_LDD

 

For correct installation, we will fix the electronic circuit parts using a thermo-sealing gun, as shown in the figure.

ldr_37in1_step1 ldr_37in1_step2

Connection:

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.

ldr_arduino_nano_37in1_bb

Programming:

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:

ldr_37in1_Ardublock

 

 

 

%d bloggers like this: