Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Cascading Up/Down BCD Counter with 7 segment displays and IR sensors

Status
Not open for further replies.

Jennifer Wilson

New Member
Hi everyone,
I'm making a school project on a car parking sensor that counts the number of cars that will go in or out of a car park (22 cars max). I know that there are several other threads for similar things like this but they have not been overly helpful. There will be 2 IR sensors on a single entrance/exit. I am unsure on how I will be able to tell my circuit whether a car has entered or exited, such as when the car passes sensor A then B to enter, and passes sensor B then A to leave. There are a number of chips that ive been researching, such as 4010, 4510, 4026, 4017 but I was wondering which would be best. I know that for some I need a decoding chip afterwards to allow the seven segment display to work. My idea is that if there are spaces in the car park, a number of LEDs in the shape of a tick will latch on, and if there are 22 (no spaces left available) a cross made from LEDs turns on. I was thinking of using some sort of bistable for this that used logic gates like NAND and AND which are connected to some of the 7 segment display outputs which means I can latch the tick or cross on. I have also been told to use some type of barrier to prevent any more cars entering, which would mean a relay (possibly transistor relay) would need to be used but this presents the problem of the IR sensors whereabouts such as they wont work if placed one on either side, or both on one side. If you were wondering, I am not allowed to use microcontrollers (programmable chips). My project is just in the research stage at the moment but some advice and help would be greatly appreciated. Also my knowledge in electronics is decent, I am nowhere near an expert in this
Thanks x
 
hi,
The 1st IR beam path would be offset say 1metre from the 2nd IR beam path.

The IR beams would be across the width of the drive way, so any can entering or leaving would have to break both beams in succession.

A car entering the car park [ entrance/exit] would break the 1st beam and then the 2nd beam. so 1 then 2 = entering.
A car leaving the car park [ entrance/exit] would break the 2nd beam and then the 1st beam. so 2 then 1= exiting.

E
 
The solution proposed by Eric is the way to go, however, doing that without MCU will be a pain..

Here is how i would do it:
 

Attachments

  • Generator - New Page.png
    Generator - New Page.png
    9.3 KB · Views: 1,442
what type of chip have you used ikalogic to allow that to happen? and is that just for the entering? so would that mean I would need a second for the exit?
 
what type of chip have you used ikalogic to allow that to happen? and is that just for the entering? so would that mean I would need a second for the exit?
what i sent you was anything but a complete circuit, and i never built that! However, it's a good hint to point you in an interesting direction.. IMHO...

To answer you, the chip used is a flip flop, a D type flip flop.

For the Exit, you need to repeat the circuit in a different way.. if you dig into this circuit, and understand it, you should be able to do the Exit detector.

Also, you may need to reset the output after each detection..

let me know if you see what i mean, and if you need more help :)
 
hi Jenny,
For explanation purposes, assume Left to Right is IN and Right to Left is OUT and to start off the park is empty.

IRA is 0.5mtr to the left of the GATE and IRB is 0.5mtr right of the GATE

A car breaks IRA, IF the number of cars in the park is <23 then lift the GATE, the car will enter and break IRB, WHEN IRB becomes unbroken [ and of course IRA will be unbroken] the gate comes DOWN and a counter is incremented [ the counter has a >22 detect]

ANY car leaving the park will break IRB and the GATE will ALWAYS open, as the leaving car breaks IRA and then unbreaks IRA the GATE will close and the counter will decrement.

So you need a fair amount of logic to achieve this operation.
Do you need more help.?
Eric
 
When I get home after school il start brainstorming logic gate ideas and researching the d flip flop, but thanks a lot for the help. Your idea Eric is a lot more complicated than what I had kind of origionally planned, but I think if I put a load of logic ideas together il figure out a way to do that. If I have any problems il post up, and if I think ive found a solution would it be ok for me to upload a scan of my brainstorming?
Jen (please refer to me as Jen by the way, thanks x)
 
hi Jen:)
The D F/F will only latch a State, you need some Control logic also.
I will also draw a layout.
Eric
EDIT:
This is a block diagram of the IR's and Gate
 

Attachments

  • Park1.png
    Park1.png
    14.1 KB · Views: 532
Last edited:
In addition to the great information provided you may want to look at this circuit of a Bidirectional Photoelectric System:
https://www.redcircuits.com/Page90.htm
The same concept is used for example to count the number of people entering or exiting a room. I know it has shown up in the forums as a people counter.

Below is an example, you can change the ICs used to newer versions. :)
People Count.gif
 
k so I had a go at brainstorming logic gates and I kept running into brick walls.
Such as I only want a HIGH input from a logic gate when Q1 = 0 (from the 7 segment displays when g is high on both displays, using a NAND to get a LOW output) but Q2= 1 (from the IR sensor) then the output from the logic is HIGH. but of course no logic gate exists to do this so I have a headache from trying to find other logic solutions.
Someone has suggested using a quadrature clock converter. Ive looked at datasheets for the LS7184 chip and to me it looks like with a few logic gate add ons for the barrier and such, it would work. But I would like your opinion considering anyone reading this probably has a greater knowledge of electronics than me.
The Bidirectional photoelectric system looks good, yes, but you forget that my knowledge isn't the best, so I ended up confusing myself trying to understand it because I think its out of my understanding zone for the time being. Also the d flip flop didn't look appropriate really for what I want to do. It would need a lot of other stuff with it to make it work, or at least that's my logic
Jen x
 
"Also the d flip flop didn't look appropriate really for what I want to do. It would need a lot of other stuff with it to make it work, or at least that's my logic"

There is no D flip flop in the circuit I posted?

The circuit I posted uses a 7400 quad AND gate for the enter / exit logic. There is an Enter photo diode and an Exit photo diode. A car entering the lot will first pass the enter photo diode then the exit photo diode (the sensors are spaced close together like maybe 6"). A car exiting the lot will first pass the exit sensor (the photo diodes can just be any "sensor" you want). So Enter (Count Up) or Exit (Count Down) logic comes from the AND gate part of the circuit. The 74193 is a programmable up / dn counter a 74192 would count 0 to 9 and could be cascaded. Either a 74192 or 74193 up / dn counter can be cascaded and they each provide Q0 - Q3 outputs to drive a 7 segment decoder chip or whatever you choose for a display. If you want to understand driving 7 segment (common anode or cathode) displays Google BCD to 7 Segment Decoder Driver.

There are other circuits that will do what you want, I just tossed that one out for review. Likely best you find a circuit you are comfortable with.

Ron
 
I only want a HIGH input from a logic gate when Q1 = 0 ......... but Q2= 1.
You get four 2-input NAND gates in one IC (e.g. CD4011). One of them can be used with its two inputs connected together to invert Q1, then a second gate can NAND the result with Q2. So when Q1=0 and Q2=1 the output of the second gate will be LOW. You can then invert the LOW with a third gate to get HIGH.
 
UpDown.png

you may use the counter 4510
Here what I did for a wire winding machine that count both ways winding up and un-winding - down
place the IR sensors only few cm apart so that the object (car) will hide them both together but in sequence
now remember that the pin 10 is HI for up and LOW for down so if the car was going from IR1 to IR2, it will clock (edge triggered) first then will not matter to change the up/Down pin 10 later, but if going other way around it will change up/down first reversing the count direction then clock while that change is still acting, that is why it must hide them both together.
I did it with 4029's which only adds binary/hex counting, 4 chips to count up to 9999
to detect the 22 max count , you may decode the 2 pin 11 off the two counters, or use 4063 a 4 bit magnitude comparator (2 chips)
 
does anyone know where i can buy an LS7184 (or LS7183) in a DIL package? I'm ordering components for my circuit soon so I can breadboard it x
 
Just a thought, but would a reflective opto switch be a good idea for my input sensors? At the moment I have designed the majority of my circuit on circuit wizard, bar the part that requires an LS7183/4 because it doesn’t have those chips in its gallery and I’m pondering on either using a 40110B (again circuit wizard doesn’t have this in its gallery, so I can’t model it) or a 4510, (which I have modelled in circuit wizard, however they require 4511's connected to them which takes up more room, but I am more familiar with them). The only part that hasn't been designed yet is the motor section which will somehow make a barrier rise as the next project is all about motors, so I was pondering waiting till I’ve learnt more about motors before continuing on that section in this project
Just want to say a big thanks to everyone who has tried to help me x I couldn't have got as far as I have without your knowledge
 
Just a thought, but would a reflective opto switch be a good idea for my input sensors?

A regular reflective opto IR sensor will have a range of millimetres.?

On your parking built to scale model, what is the distance across the entrance/exit [ width.??]
E
 
im not sure, it's just a model probably using toy cars but the LS7183/4 works in that it triggers a clock pulse only when both sensors are triggered one after the other, and depending on which sensor was triggered first, depends on whether it will let the chip after it count up or down. So when a car approaches my barrier, it will pass A, the barrier will raise if there are less than 22 cars in the car park and it will then pass B, causing the counter to count up one. When the opposite happens, sensor B is triggered first then A is, causing the counter to count down by 1. It's the only component that does exactly what I need, however I am having trouble locating one that is a DIL/through hole chip
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top