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

Discussion in 'The Projects Forum' started by Noobcake, Nov 6, 2013.

  1. Noobcake

    Thread Starter New Member

    Nov 5, 2013
    2
    0
    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
     
  2. elec_mech

    Senior Member

    Nov 12, 2008
    1,513
    193
    Welcome to AAC.

    Interesting project. I'm curious though, is this for a school project, a company, or something in-between like a community project?

    Hmm, sounds like you need a quadrature encoder to clock converter. Quadrature encoders work like you describe. Picture two sensors and call them A and B. For your application, let's say both sensors are the same distance from the ground and x distance apart. Then say sensor A is on the outer perimeter of the lot and B is on the inner perimeter. Thus, when a car enters the lot, sensor A will trip before sensor B. When a car leaves the lot, B will trip before A. This principle is used in mobile robot motors to determine speed and direction (just one example).

    This assumes there is only entrance and exit and only one vehicle can pass either in or out at a time. If not, this becomes easier or harder depending on the lot.

    Now you need a way to send a count up signal when a car enters and a count down signal when a car leaves. Normally this is simply done with a microcontroller (uC). Since you cannot use one, you can either come up with a clever logic system using assorted ICs or you can use a quadrature to counter IC. I had a similar need for one of these on a project - I was using a microcontroller if memory serves, but it was easier to use a dedicated IC to decode the quadrature than fuss with timing routines on the uC. US Digital makes a handful of different quadrature ICs. For your application, I'd suggest this one connected to a CD40110. Look at the datasheet, specifically the timing diagram for the LS7183. These ICs have different speeds - I suggest x1 as you don't want to send 2-4 clocks (2-4 counts) per vehicle that passes.

    The CD40110 takes up and down clock signals and outputs directly to a 7-segment display. You'd then have to run the outputs through some logic to send a signal indicating when the count was at 22 or not.

    You could do something to disable or ignore the sensors when the barrier is down so your count does not go above 22. If the barrier is always going to be down whether the lot is empty or full, then disable the sensors simply when the count reaches 22.
     
  3. Noobcake

    Thread Starter New Member

    Nov 5, 2013
    2
    0
    This is part of my controlled assessment for my schoolwork for my A levels (A levels are the exams for year12-13 here in England, or grade 11-12 if your American). The general title is a counting system but other than that we are left to create our own projects pretty much from scratch. At the moment I am just in the research stage, looking at chips, block system diagrams, etc.
    Chips so far that I have been looking at are 4026, 4017, 4510, 4518 and 4011B. Someone suggested adapting a bidirectional photoelectric system but I think it might be a bit out of my understanding zone for the time being.
    I have been trying to brain storm logic gate systems to do the job, but I have come into a few 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 or to get a LOW output) but Q2 is high (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
    Your suggestion has been really helpful. I scanned the data sheet and pin outs and it seems to do what I need it to, I would probably use the
    LS7184 because the UP/DOWN comes off the one pin and the majority of chips I have been researching only have the one UP/DPWN input, but I think it would need a slight bit of adapting using some logic gates to add on the barrier part
    Thanks x
    Jen
     
  4. elec_mech

    Senior Member

    Nov 12, 2008
    1,513
    193
    Certainly, it depends on the IC you end up using. If you decided on the 40110, the LS7183 would be the ideal fit, but if you use a 4510, then the LS7184 is the way to go.

    If the only issue is reversing the signals, you can use an inverter or NOT gate or simply a transistor. Do you want to read a BCD signal or the 7-segment to determine when 22 is reached? I like your idea for seeing if both g segments are high indicating quite simply if 22 is reached or not. If I follow you, you also mentioned doing the same for the BCD side by looking at Q1 (out of Q0-Q3).

    So you have two methods to read 22. One is to use two ICs per digit, something like a 4510 and a 4511/4543. The 4510 accepts a clock signal, counts up or down, and outputs BCD to the 4511/4543 which converts the BCD to 7-segment output. The 4510 also accepts presets - this is good for applications were you need to start or reset the display to something other than zero (going from 59 to 60 for clock as an example). Between the 4511 and 4543, I like the latter because it lights up segment 'a' for six and segment 'd' for 9 - the 4511 does not - just a matter of preference though.

    The 4026 and 4518 only appear to count up, not down, so I do not think they will work for your application. If you were to forego the display, the 4017 could work, but unfortunately, it too only counts in one direction.

    The second method is to use something like the 40110 which takes the place of a 4510 and 4511. One IC per digit - only caveat is it does not have presets, only a reset to zero. Doesn't sound like you need that feature though, so I'd suggest this IC to keep the design and wiring simple.

    There are all sorts of sensors you can use. I can't think of a much better way than using two sensors in a quadrature fashion though - not to say there aren't other ways. You could use two IR beams, two lasers, two motion sensors (if you limit the detection area to vehicles only, not passersby), two weight sensors, etc. You could even use light detecting resistors if there is a light source always on that a vehicle can block when it passes.

    You say you're in the research stage - does this mean ultimately you'll be making a small scale prototype with something like Hot Wheels cars or a real life version? This may help steer your sensor choices.
     
Loading...