Intro: Laser Tripwire With 4 Digit 7 Seg Display for Counting People
Ok its not really Purple but the rest it accurate. The EYE is the LDR " Light Dependent Resistor" and it counts people.
A laser beam is directed across a doorway. The LDR is on the receiving end of the laser on the other side of the doorway.
When a person goes through the doorway and breaks the beam the counter is incremented by a count of 1.
Scene it counts the person coming and going, that's 2 counts for 1 person i just divide by 2 at the end of the day, or at anytime to get the true count of people.
It is not fool proof, sometimes it double counts. But sometimes 2 people go out at the same time and only counts as one. So i figure it averages out.
First and foremost this Instructable would not be without the help and coding expertise of frollard .
He is amazingly quick and precise.
There is a lot of knowledge here and they are willing to share that knowledge to help us learn.
Some of the people i have personally been involved with are: iceng , He was the first one to follow my page. Him and steveastrouk were the first to help me through an electronics question. I was happily surprised when they both answered my questions clear to the very end of the discussion. Others include: maewert who has some 30 years of coding experience and it shows, ignoblegnome, Goodhart, pfred2 , Phil B. These are not in any particular order and if i have forgotten somebody i am sorry.
OK on with the build.
Step 1: Bread Boarding
The test circuit. It uses no resistors. How can that be? Well its compensated for in the code.
This is what SparkFun has to say about it, this is from the code:
This is an example of how to drive a 7 segment LED display from an ATmega
without the use of current limiting resistors. This technique is very common
but requires some knowledge of electronics - you do run the risk of dumping
too much current through the segments and burning out parts of the display.
If you use the stock code you should be ok, but be careful editing the
This code should work with all colors (red, blue, yellow, green) but the
brightness will vary from one color to the next because the forward voltage
drop of each color is different. This code was written and calibrated for the
This code will work with most Arduinos but you may want to re-route some of
12 pins required for full control
Step 2: Laser
I used one of those cheepo pen lasers. But instead of the battery power as it comes i decided to power it from 12v line from my computer. Now 12v will kill one of these little lasers, yes i did! So i put it together on a small perf board with a 78L05 voltage regulator.
The tact switch pins needs to be soldiered together to make an electrical connection. To determine the pins to be soldiered together , use your ohm meter and check if there is continuity between to pins. If no then check the same two pins with the switch press, if it has continuity at that point then those are the pins to be soldiered. Soldier them to make a solder bridge or use a short piece of wire to bridge the pins.
That way the switch will be as if the button was pressed all the time.
To be able to attach power wires to this thing it needs to be torn down, the outer shell removed. Attaching the POS wire was easy, just solder it to the PCB at the same point the battery POS connected to.. The ground is more difficult, beings the housing is aluminum, can not soldier to it. I wrapped about 20 turns of i believe 22awg jumper wire around the aluminum housing, tight as i could. Same wire used for bread board jumper leads. I just stripped about 3' of insulation off and used it like that. Start wrapping no not hip hop rap. I hooked the wire around it self half way though and wrapped the remainder the other direction. Them twist the wire so it wont unravel. The idea is to get the wire tight to the housing to make as best an electrical connection as you can. Then cover the winding's and pcb with hot glue.
Step 3: Display
I used this 4 digit 7 segment display from one of my local electronics store. Most everything here is copy or knock off of parts from the other parts of the world. So the part number would be meaningless to give, its only there local numbering system.
It has 27 pins because they are not multiplexed internally. One row of 13 pins and one row of 14 pins. It is actually a clock display so it has 5 DP, decimal points.
i wasn't sure how the display would take the heat from soldering so i mounted it in female headers, also i would be able to remove it if needed.
All that is mounted on the same perf board as the ATmega328, set up as a stand alone Arduino.
There is an LED on pin 13 that blinks every time the display counts, i have used a jumper to be able to disable it if needed.
The board power comes from my computer through an LM7805 voltage regulator. The power for the LDR circuit is also supplied from the same 5 volts.
The seven segments of the display use white wires for, a,e a,b,c,d,e,f,g.
Then each of the 4 digits use the green wire.
The programming header uses blue wires. Reset, TX, RX,.
The pos and neg for the programming header it soldiered under neath the board.
The actual multiplexing of the display was wired on the under side of the board. For that wire i like to use small wire. I use the wire that comes with a new mother board, the add on LPT attachment cable. Cut and peal one wire off at a time. They are strong for there size,easy to bend into shap and easy enough to strip the insulation with your thumb nail.
The wooden shelf is from one of my other related Instructables.
Step 4: Eye to Eye
I failed to continue taking pictures for the LDR and laser assemblies at some point, so the pictures are a little sketchy through here. Note the laser shinning in.
Not a lot of dialog here, most is in the picture comments already.
I may remove the clear window covering the inlet hole. Seems to have a certain amount of reflection.
Step 5: Code and Programing
The code is originality from Spark Fun.
Was hacked to pieces by me.
Luckily frollard came to to rescue and repaired all the coding nonsense by me and made the code do what it is supposed to do.
For Boot loading i use this, wired to the ISCP header on the Arduino. That's the 6 pin header.
There a lot of info and ibles on programming. i just give you a quick over view of what i am currently using for programming.
I hope this can be use full to some people looking to build this or something similar. If you decide to build one i would love to see it in the comments.
Step 6: Reference