Problem using a 74190 bcd counter to count an object inside the room

Thread Starter

vtc

Joined Apr 3, 2018
34
Hi all .

I am using 74190 bcd counter to count objects inside the room ..

I used two sensors on one gate, one of them to determine if the object in or out the room and the other to increment o decrement the counter.

The connection of the sensor with counter like this
20180524_155754.jpg

If I set the counter up using sensor2 then by clocking the counter using sensor1 the counter count up also if I set it down it will count down ..

But when I tried to pass an object through the two sensor in or out the room the counter doesn't count as expected ..

The following video describe what I mean ^^

 

danadak

Joined Mar 10, 2018
3,577
This leads naturally to a state machine design.

As an object passes one sensor that sensor should enable the
other to either count up or down when the object continues on.

So if first sensor hit is outside room then it should enable count up,
if however first hit is inside room it should enable count down.

Now you have the additional problem of sensor spacing and an object
partially entering/exiting and changing its mind.

That would mean if second sensor not tripped in some time period
count is negated. One way of doing it.

Of course you have two objects side by side problem as well.

There are chips out here that implement state machines, counting, display
with a fairly simple GUI tool, but some additional learning would be required.

One way to start is to create a flow chart to test logical cases as discussed above.
Then the logic will fall out of the understanding.

Design can be done logic only, code only, or a mix of both.

Regards, Dana.
 
Last edited:

Kjeldgaard

Joined Apr 7, 2016
378
The video is a little hard to follow.

But try with a piece of cardboard or similar, about twice as wide as the distance between the two sensors, like simulation of a person.
Move this "person" quietly in and out of the "room".
 

Thread Starter

vtc

Joined Apr 3, 2018
34
This leads naturally to a state machine design.

As an object passes one sensor that sensor should enable the
other to either count up or down when the object continues on.

So if first sensor hit is outside room then it should enable count up,
if however first hit is inside room it should enable count down.

Now you have the additional problem of sensor spacing and an object
partially entering/exiting and changing its mind.

That would mean if second sensor not tripped in some time period
count is negated. One way of doing it.

Of course you have two objects side by side problem as well.

There are chips out here that implement state machines, counting, display
with a fairly simple GUI tool, but some additional learning would be required.

One way to start is to create a flow chart to test logical cases as discussed above.
Then the logic will fall out of the understanding.

Design can be done logic only, code only, or a mix of both.

Regards, Dana.
I can't use code in this hw as my prof want .
He want the design using 74190 counter :(

The video is a little hard to follow.

But try with a piece of cardboard or similar, about twice as wide as the distance between the two sensors, like simulation of a person.
Move this "person" quietly in and out of the "room".
I have tried.. still not work :(
 

Thread Starter

vtc

Joined Apr 3, 2018
34
Can I use one sensor for counting up and the other for down using this counter as if I want to use 2 gates ?
 

Kjeldgaard

Joined Apr 7, 2016
378
I have been in doubt if we talk past each other, because I consider the task as a known quadrature detection of direction and distance?

You should get a set of signals as shown here:
Kvadratur_1.jpg

I have drawn the sketch so I suppose the signal is high when the sensor sees a "person".

However, regardless of the active level, the counter should count up or down at a time, when a "person" has come completely past both sensors.
 

dl324

Joined Mar 30, 2015
8,913
But when I tried to pass an object through the two sensor in or out the room the counter doesn't count as expected ..

The following video describe what I mean
Describe what the counter is doing and what you want it to do.

Show us a timing diagram for the signals you're generating for D/U# and clk.
 

danadak

Joined Mar 10, 2018
3,577
If you are counting objects/people passing in and out of a room you
need some form of state machine to address the problems discussed
earlier. That can be logic only and / or logic + CPU.

Just do a step by step "what happens" list when object enters or leaves,
then the logic will be intuitive. You have to fix prior discussed issues, even
what happens if object stops between sensors (clue a timeout), you need
to address that as well.

You have to decide is counter incremented when first sensor hit or object
passes both sensors. Just think about all the crazy things an object can
do if you want a complete solution. Then there is always multiple objects
staggered in time......arggh.....

Regards, Dana.
 
Top