Introduction: LDR Light Level Detector: Opening and Closing Eyes

Hello everyone, I hope this instructable is of your liking. Any doubt, comment or correction will be well received.

This circuit was realized as a control module to provide information about how much light there is in the surroundings, in order to control the opening of the eyes through a servomotor.

This circuit has 4 outputs, which give 5V or 0V each, depending on the intensity of the incident light. Assuming that we have an intensity measured in percentage, we will have the following cases:

  • When the light is between 0% and 20%, the 4 outputs will give 0V
  • When the light is between 20% and 40%, the first output will give 5V and the others will give 0V
  • When the light is between 40% and 60%, the first two outputs will give 5V and the others will give 0V
  • When the light is between 60% and 80%, the first three outputs will give 5V and the last will give 0V
  • When the light is between 80% and 100%, the 4 outputs will give 5V

Note: these percentages mentioned are just an example to save explanations. In next steps it is explained how to calibrate that.

Knowing the conditions, a program is made in Arduino with these 4 inputs, and as output we will have a PWM signal sent to the servo that will control an eye opening mechanism.


What will you need?

(circuit stuff)

  • 1 LM324
  • 1 Protoboard
  • 6 Trimmer resistors (10kOhms each one)
    1 LDR (Light-Dependent Resistor)
  • Some breadboard jumper wires or just wire and cutting pliers
  • 1 servomotor
  • Voltmeter

(head and mechanism stuff)

  • Creativity (the most important)
  • A head foam
  • Cardboard
  • Glue
  • Wooden sticks
  • Another things that will help you to make it more aesthetic


  • Welding station or soldering iron
  • Tin solder
  • A 5x5 dot pcb

Step 1: Planning Our Circuit

First of all, we need to have all the components before making the mechanism.

It is important to know that if you don't get the exact components, you can use alternatives, maybe you don't get exact value trimmers, but it doesn't matter: you will use trimmers as a voltage divider, so, if you have a value between 10kΩ and 100kΩ, you can use it. Or if you don't get a LM324, you can use a MC34074 (as an example, there are a lot), the only requirement is to have 4 opamps that can use an non-simetric 5V power (arduino 5V power source).

So, given that, let's start.

Step 2: Circuit Assembly

To create the module, we have the following schematic diagram, and the LM324 diagram

Each number between the opamps represents the pin number of the LM324, so, pins with the same number IN THE OPAMPS are common nodes.

NOTE: on the top, there is a header representing external connections, i.e., the connections with an Arduino UNO. Do not confuse the pins of the header named J1 with the pins of the LM324.

Here, you have two options:

  1. Make it in a protoboard. It is the easiest way to assembly and test, but the design is not the best at all.
  2. Use a perfboard (also named DOT PCB). This option will give you the option of reduce the circuit to a 5x5cm square (just the module), but you need to weld. If you are a minor, ask for help from an adult.

In 3rd picture, it's the circuit assembled in protoboard.

In 4th and 5ft picture, it's being assembled the same circuit, but in a perfboard.

The 6th picture has the circuit complete.

In summary, the circuit will have 4 outputs. These outputs will be used to connect to the Arduino UNO.

Step 3: Calibrate the Circuit

Once assembled, we have to connect our circuit, and check the voltage given by each trimmer resistance: we must set 0.5V, 1V, 1.5V and 2V to RV1, RV2, RV3 and RV4 respectively.

To do this, you have to supply the circuit with the 5V and GND of the arduino, and measure each voltage in the trimmer. You connect a voltmeter between the center pin of a trimmer (one by one), and to GND. Then, you rotate the trimmer until you get the desired voltage.

You voltmeter has 2 cables, one red and one black.

  1. Put the black cable in a GND node.
  2. Put the red cable in 3rd pin of LM324. Rotate the trimmer until it has 0.5V.
  3. Change the the red cable to 5th pin of LM324. Rotate the trimmer until it has 1V.
  4. Change the the red cable to 10th pin of LM324. Rotate the trimmer until it has 1.5V
  5. Change the the red cable to 12th pin of LM324. Rotate the trimmer until it has 2V.

All of these steps must be done with all connected (the Arduino and the circuit made by us).

Maybe you will need more than 2 hands, ask for help from someone else if needed.

The 5th trimmer serves as a sensitivity calibrator (the one which is between LDR, i.e., the one named RV5)

As you can see, in the video there is a test with the outputs, i used green leds to do it more didactic and easy to appreciate (i put my hand closer to block light, and the circuit makes the leds to turn of or turn on depending of the incident light).

Step 4: Assembling Servomotor

Here you need to blow your mind: you need to put the eyes into a mechanism which can open and close the eye, simulating an eyelid.

In the 1st picture, you see the real model implemented by me.

in the 2nd picture, there is a drawing that represents the basic mechanism.

Use the foam head, wooden sticks and glue to make the mechanism.

As you see in 3rd picture, the LDR is in the nose

Step 5: Coding

Finally, you must connect the circuit to pins 3, 4, 5 and 6 of the Arduino, and the servo will be connected to 9th pin.

The code is below. It has the comments to explain each important section.

Step 6: Enjoy

Zoom in and out your light to the LDR to appreciate the changes in the eyes.

Thanks for watching. I hope you like it.

Sensors Contest

Participated in the
Sensors Contest