Object Counter Using IR

4,530

17

18

Introduction: Object Counter Using IR

About: I am a electronics engineer as well as a hobbyist is many other areas. My Instructables are based on engineering and electronic circuits. I also like to do DIY projects involving some electronics.

In this small project, we will create a completely automatic object counter with a simple segment display. This project is rather simple and only incorporates simple electronics. This circuit is based on Infrared to detect objects, to find out more about how IR functions, visit my IR Instructables. You can learn all about the basic concepts of IR there.

Supplies:

Raw materials: A4 CardBoard (To build the body and base)

Circuit:

Breadboard x1

CD4026BE x2

LM358 x1

2n222/BC547 x1 (or any equivalent transistor)

2pin push-button x1

10k potentiometer x1

220ohm resistor x2

680ohm resistor x2

10k resistor x2

2x Common Cathode 7-segment display

IR LED x1

Photodiode x1

Lots of jumper wires

9v power supply

Tools: Soldering Iron, Wire stripper/cutter, Cutting knife, PVA Glue, Protractor, Ruler etc.

Step 1: Preview

The idea of this project is to create an object counter to count small things such as components, Lego bricks, beads etc. Objects would be dropped onto a ramp, it would roll down into a container at the bottom but will be detected by a pair of IR detectors.

The output of the Photodiode will go through a NOT gate and then into the comparator. The images above show how the IR pair detect an object.

Step 2: The Circuit

The circuit used for this project is not complicated, it uses an OP amp (LM358) as the input regulator for the 7-segment display chip (CD4026BE). I designed the circuit so it has 2 7-segment displays which give it 99 digits or 99 possible objects to count. That should be plenty, but if it's not, then you can link another display which will give you 999 digits, definitely enough.

The button in the circuit is for reset.

The potentiometer is to adjust the sensitivity of the photodiode.

The circuit diagram above is the same as the breadboard circuit. It might be a little difficult to read as it is compressed into a confined space.

NOTE: The transistor in the breadboard circuit image is the wrong way around, but it should still work. I would advise on flipping it around even though some transistors work both ways. Follow the wiring of the transistor in the circuit diagram if you are confused.

Step 3: Circuit Test

Before you build the circuit into the project, testing it is a smart idea. I have modified the circuit a tiny bit (by changing the IR LED onto a different breadboard to create the IR beam between it and the photodiode). Connect the circuit to a 9v power supply and the digits would light up with two 0s. Next break the IR beam between the IR LED and Photodiode by blocking it with a finger or an object, now one of the digits would turn from 0 to a 1, repeat the process and the circuit will count the number of times the IR beam was broken (objects).

The smart thing to do now is to make this circuit into a PCB, unfortunately, I hade problems with ordering mine so for the rest of this project, I will use the breadboard.

Troubleshoot: If your circuit malfunctions, check:

Wiring,

Component direction (polarity or the way the chips are facing) (Especially the Photodiode)

Power supply,

IR Pair (see if they work together with a simple circuit from my " All about IR" Instructables)

Step 4: The Body

My design is probably not the most visually pleasing one but it works fine.

Cut everything out, size does not really matter but I would recommend the angle of the slope to be between 20 and 45 degrees. The base plate would have the breadboard or PCB mounted on it so there is a minimum size.

The material of the body does not really matter but I would choose something thin and strong such as compressed cardboard.

Step 5: Stick It!

Assemble the structure once everything is cut out. Use tape to hold it together in shape and apply glue. PVA glue is perfect but it takes a while to dry. Now, wait.

Once it is confirmed the glue has dried, peel the tape of and your structure is finished.

Step 6: Add the Circuit

Stick the breadboard with the circuit onto the empty space on the base of the structure. Make sure the 7-segment displays are facing you so you can read the numbers the right way around.

Step 7: Connect the IR Pair

Bend the terminals of both the IR LED and Photodiode at 90 degrees. Solder some wires to the end of the terminals (the wire must be long enough to connect the diode form its mounting place to the breadboard). Next, connect the IR pair to the Breadboard.

Run your circuit again just to make sure your solder joints work.

Step 8: Final Touches

Glue the IR pair onto the slope, make sure they are on both sides and facing each other to create the beam of IR.

Hide the wires by glueing it into the edge of the slope.

Then cut two pieces of cardboard, around 5cm in length and the height of the walls of your slope. Put it in as shown in the last image, hold it down with tape as you apply glue to stick it down.

Once that is done, remove all tape, run the circuit to check it still functions correctly. If you want to decorate it, then this is the time to do it.

Circuit troubleshoot:

If the counter does not count when you break the IR beam (but it was working earlier), then it might be because of the IR beam not been completely blocked, this is caused by some irregular reflections the cardboard creates. This can usually be solved by sticking a tiny strip of black paper under the IR LED so it absorbs any reflecting IR. If this isn't the problem, check if you have short-circuited any of the diodes when glueing them.

Step 9: Finish!

Now it is finished!

Power it up and start counting!

Sensors Contest

Participated in the
Sensors Contest

Be the First to Share

    Recommendations

    • Battery Powered Contest

      Battery Powered Contest
    • Plywood Challenge

      Plywood Challenge
    • Plastic Contest

      Plastic Contest

    18 Discussions

    0
    OmkarG22
    OmkarG22

    Question 10 months ago

    Your connection is wrong. It is not like the circuit diagram you gave

    0
    OmkarG22
    OmkarG22

    Question 10 months ago

    Sir is it necessary to make cardboard?

    0
    OmkarG22
    OmkarG22

    Question 10 months ago

    Sir are some wires going inside cardboard?

    0
    OmkarG22
    OmkarG22

    Question 10 months ago on Step 7

    Sir please share your tutorial video on making object counter using IR

    0
    Hammad Butt
    Hammad Butt

    1 year ago on Step 1

    sir please upload/send the circuit diagram

    0
    OmkarG22
    OmkarG22

    Reply 10 months ago

    Circuit Diagram

    IMG-20200107-WA0003.jpg
    0
    Nawielectron
    Nawielectron

    Reply 1 year ago

    I have added the circuit diagram in step 2.

    0
    Hammad Butt
    Hammad Butt

    Reply 12 months ago

    SIR DO YOU HAVE ITS PCB LAYOUT
    SIR IN OUR PROJECT WE SHOULD PRESENT IT ON PCB BOARD .
    SIR PLEASE SEND IT OR UPLOAD IT.URGENTLY
    THANKYOU

    0
    Hammad Butt
    Hammad Butt

    Reply 12 months ago

    sir there are 9 volts across ir led(white one)
    and 3 volt are across ir recevor (black one)
    but both are not working.

    20191204_144536.jpg20191204_144525.jpg
    0
    Nawielectron
    Nawielectron

    Reply 12 months ago

    From what I can see from the image, you haven't connected the output of the photodiode to base of the transistor. And I don't think you have connected the collector of the transistor to ground. Plus make sure the photodiode and IR LED are facing each other. Try this

    0
    Hammad Butt
    Hammad Butt

    Reply 12 months ago

    SIR AN OTHER THING TO ASK THAT HOW MANY AMPARES OF POWER SUPPLY SHOULD BE CONNNECTED.
    9V 1A
    OR
    9V (HOW MANY AMP?)

    0
    Nawielectron
    Nawielectron

    Reply 12 months ago

    Hey, so I have been powering it with an AC to DC wall adapter that outputs 9v 3a. But a normal 9v battery is also fine.
    The chips don't use that much power, its the diodes/LEDs.

    0
    adhith94
    adhith94

    1 year ago

    hey.. nice project. Is there a way to add a small buzzer which beeps each time during the count increase?

    0
    Nawielectron
    Nawielectron

    Reply 1 year ago

    Hello, I have attempted to add a buzzer into the circuit before but the buzzer interferes with the clock signal causing the decoder to go haywire, putting diodes in doesn't help so I gave up the idea. If you have a working circuit for this then please post it! :)

    0
    adhith94
    adhith94

    Reply 1 year ago

    Unfortunately I don't have the components to test it out but I think using a transistor or a mechanical relay may solve the issue. I' not 100 percent sure though...

    0
    DIY Geek
    DIY Geek

    Tip 1 year ago

    Use peanuts to count because it rolls better!!!

    1
    DIY Geek
    DIY Geek

    1 year ago

    Cool Design for teaching about sensors!