Logic Design: Interpreting entering and leaving a room.

  • Thread starter Thread starter PrincePhoenix
  • Start date Start date
  • Tags Tags
    Design Logic
PrincePhoenix
Gold Member
Messages
116
Reaction score
2
Homework Statement
Hello. We have been given a project in our course "Digital Logic Design", which is an introductory course to Digital Logic. We are only allowed to use gates, multiplexers, flip-flops/latches, counters, comparators, simple displays (like seven segments) etc.

I am making an automatic room lighting system, for a room with one door.

The attempt at a solution
My logic is that there will be two IR transmittors and receivers, one each on either side of the door pane. Depending on the sequence in which the receivers go dark, the circuit will detect whether someone entered or left the room, increment/decrement a counter, counting the number of people accordingly. If the counter becomes zero, the light(s) are switched off. For greater than zero, it will be switched on.

So I thought it'd be two sequence detectors (made from different gates) (one for each sequence)(we've already built one in a lab, using flip-flops(so, synchronous)), with the two IR receivers acting as inputs to the sequence detectors. On detecting either of the two sequences one of them will increment and the other would decrement the counter through their outputs.

Now since it'd give an ouput in each clock cycle, the sequence of states that the detector will actually get will hardly ever match the ones for which I will make the sequence detector.

Any pointers on how this may be overcome? Is it possible to make it purely through a combinational circuit?
Can this logic work with an asynchronous circuit? (we haven't and won't be studying them this semester. We haven't studied counter yet. So I apologise for any weird assumptions made above about counters)
 
on Phys.org
Now since it'd give an ouput in each clock cycle, the sequence of states that the detector will actually get will hardly ever match the ones for which I will make the sequence detector.
I don't understand that.
Once the second detector gets interrupted, send a signal to the counter and reset both sequence detectors.
Can this logic work with an asynchronous circuit?
Probably.
 
What happens if two people enter the room together, and then only one leaves? You don't want to leave the other one person in the dark.
 
D H said:
What happens if two people enter the room together, and then only one leaves? You don't want to leave the other one person in the dark.
As long as they don't touch each other (in the projection of the sensors), the system can work.
 
mfb said:
I don't understand that...

What I meant to say was that each sequence detector would be looking for a particular sequence.
One sequence detector would output '1' for incrementing the counter when the input sequence for entering is detected. (lets say it would be 00->01->11->10->00), while the other does the opposite for the leaving sequence (sequences will be generated by the IR receivers, so depending on the sequence in which they get interrupted, two different sequences will be generated).

Being a synchronous circuit, it will be taking inputs every clock cycle. So if the clock is too fast, for the person's movement, it might take each input twice or maybe more, so it might not match the required sequence.

mfb said:
...Once the second detector gets interrupted, send a signal to the counter and reset both sequence detectors...

The second sequence detector gets interrupted? Or the IR receiver/detector?
 
Being a synchronous circuit, it will be taking inputs every clock cycle. So if the clock is too fast, for the person's movement, it might take each input twice or maybe more, so it might not match the required sequence.
Your clock (if you use one) has to be much faster than the persons, otherwise the system cannot work. The sequence detector needs a "wait" operation if nothing changes (it has to remember its state).

The second sequence detector gets interrupted? Or the IR receiver/detector?
The second IR detector.
 
  • Like
Likes   Reactions: 1 person
mfb said:
Your clock (if you use one) has to be much faster than the persons, otherwise the system cannot work. The sequence detector needs a "wait" operation if nothing changes (it has to remember its state).

What is the "wait" operation? Staying in the same state if the inputs from the IR receivers remain unchanged? Or is it something more complicated?
For the sequence detector to wait if nothing changes is exactly what I think I need.
 
There's a reason that typical room occupancy sensor systems use passive IR (PIR) detectors to detect occupancy. Counting bodies entering and leaving a room has too many problems, and can be too easily fooled. The PIR sensor is used to turn on the lights when motion is detected in the room, and a timer is used to turn off the lights some amount of time after no motion is detected.

Also, be sure to use a synchronizer circuit if you are detecting some asynchronous events for processing in a synchronous circuit. Are you familiar with synchronizer circuits? Why are they necessary?
 
No. Haven't studied any synchronizer circuit or their uses.
 
  • #11
PrincePhoenix said:
What is the "wait" operation? Staying in the same state if the inputs from the IR receivers remain unchanged?
Right.
For the sequence detector to wait if nothing changes is exactly what I think I need.
Sure.

@berkeman: It is a course about digital logic. IR sensors in the room are a nice solution for a product, but probably not so interesting in terms of digital logic.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
Replies
1
Views
4K
  • · Replies 7 ·
Replies
7
Views
8K
Replies
3
Views
8K
Replies
2
Views
2K
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
5
Views
2K