Introduction: LDR Object Counter

About: I am an electrical engineer and an Arduino and electronics enthusiasts. I believe working with electricity should be fun as well as beneficial to engineers and the world at large. Twitter handle: @arduinohack…

I had several LDRs lying around in my room so i decided to do a simple project with one of them. I made an LDR object counter. By the way for those who do not know, LDR stands for light-dependent resistor. If you have never used it before, take a few minutes to learn how to connect and use it with an arduino. Moreover, your knowledge of voltage dividers will come in handy when working with the LDR.

Step 1: Controlling an LED

To get started i controlled an LED using analog input from the LDR.

The setup included:

· Light dependent resistor (LDR)

· 22k resistor

· Led

· Arduino uno

You can view the video here.

Step 2: Video

Step 3: LDR Counter

The LDR counter was a little bit complex than the led control setup. This is because i used a neopixel matrix to display the number of objects that had passed through.

The setup works on a simple principle. The LDR's resistance increases when there is no incident light shining on it. So, every time an object passes by and blocks light to the LDR we get a lower reading on the analog pin. Every time this happens the counter increases by one, just as shown in the video.

Step 4: Requirements

· LDR

· 22k resistor

· Arduino uno

· WS2812b neopixel matrix

Step 5: Setup

The setup is as shown in the photo. You can learn how to connect the neopixel matrix to the arduino board here.

The rest of the setup is similar to the one shown here or the one for LED control using the LDR with the exception of the LED. The full tutorial, including the set up, and code can be found here.

Step 6: Video