Directional door buzzer

moey

Member
This is driving me nuts!

We have a "directional" door buzzer on the front door at work. It's a handful of relays and a timer that works with two sets of IR beams aimed across the door.

Basically, when you walk IN (beam1 followed by beam2) the buzzer sounds until we reset it by pushbutton.
When you walk OUT (beam2 followed by beam1) there is no alarm.

I thought I would replace the rats nest of relays with a Picaxe.

The code below does what I want BUT if two people exit one after the other, the buzzer sounds and it shouldn't.

What is happening is that the first person going out trips beam2 then beam1 - this is ok. Then when the second person exiting trips beam2 the buzzer incorrectly sounds because the previous person had of course tripped beam1 on their way out and "primed" the circuit to trigger on the next activation of beam2.

Two people exiting (beam2, beam1, beam2, beam1) should not sound the buzzer.
The only thing I can think of is perhaps to flag the last trigger of beam2 and ignore a "beam1, beam2" sequence if the beam2 flag is set.
Trouble is, that's beyond my basic Basic skills.

This is the working code. Works great if only one person exits though.

'18X
'Directional door buzzer nov05
'Beam1 then beam2 = buzzer
'Beam2 then beam1 = no buzzer
'Beam2 then beam1 then beam2 then beam1 = buzzer (wrong)

symbol beam1 = pin2
symbol beam2 = pin0
symbol reset_sw = pin7

main:
if beam1 = 1 then timer
goto main

timer:
if beam2 = 1 then buzzer
if reset_sw = 1 then turnoff
goto timer

buzzer:
high 0
if reset_sw = 1 then turnoff
goto buzzer

turnoff:
low 0
if reset_sw = 1 then turnoff
goto main
 
Last edited by a moderator:

manuka

Senior Member
Mmm - interesting one! Quite aside from code tweaking, there'll be other approaches & insights that need considering too. Initially-
* How close together are the beams?
* Never mind 2, how about 3 or more leaving at once?
* Consider a human slow down- the classic of course is a large mirror for grooming pre happy hour etc
* Can you move the beams further appart so some seconds "time out" delay results between beam breaking - you could set a an interval window for a typical walker
* Another beam or angled mirrors ?
* Other issues may include folks in both beam 1 & 2 simultaneously, AND also folks leaving while others are entering...

Stan
 

moey

Member
The beams are about 1m apart. It doesn't really matter if the system gets confused if both beams blocked etc. When there are many people milling about, we're always at the counter and can easily push the reset button. That's what we do with the current system anyway, (well, what we did until the relay circuit failed). The real reason I'm coding this is because none of us can work out how the original rats next worked.
 
Last edited by a moderator:

moey

Member
I meant to say... it doesn't really matter if the system gets confused if both beams blocked etc. as long as it doesn't trip when two or more people leave sequentially.
 
Last edited by a moderator:

adub

New Member
Sorry, untested code. I just finally got back on the internet.

Just adding a routine and if statement in main may do the trick.

have fun!

'18X
'Directional door buzzer nov05
'Beam1 then beam2 = buzzer
'Beam2 then beam1 = no buzzer
'Beam2 then beam1 then beam2 then beam1 = buzzer (wrong)

symbol beam1 = pin2
symbol beam2 = pin0
symbol reset_sw = pin7

main:
if beam1 = 1 then timer
if beam2 = 1 then leaving
goto main

leaving:
if beam1 = 1 then main
if reset_sw = 1 then turnoff
goto leaving

timer:
if beam2 = 1 then buzzer
if reset_sw = 1 then turnoff
goto timer

buzzer:
high 0
if reset_sw = 1 then turnoff
goto buzzer

turnoff:
low 0
if reset_sw = 1 then turnoff
goto main
 

mikek

Member
I believe that Arvin's solution fails if someone breaks beam1 as if leaving, then changes their mind and goes back inside. When the next person entering breaks beam2, it will sound the buzzer (if I got the beams backwards, sorry).

To make this even remotely foolproof, the beams need to be closer together (so you can't easily break just one beam and so you can't stand between the beams w/o being in the line of either of them). Three beams are harder to confuse, but if a body can stand between two of them, I think it could still get out of sync.

Mike
 

hippy

Ex-Staff (retired)
Moving the beams closer together will improve things, but there is no entirely perfect solution which can be found for this problem.

Arvin's solution resolves the flaw in the original code. Entry detection normally starts when beam 1 is broken. On exit though, beam 2 is broken ( and ignored ), then the beam 1 break as exit is completed is mistakenly seen as the precursor to an entry, and the next person leaving breaks beam 2 which sets the buzzer as if it were an entry.

There is always a possibility of ambiguous sequencing when mutiple entries and/or exits occur, but with low visitor traffic that is less likely. Presumably whatever 'unavoidably deficient design' was in place as created by relays, it was considered satisfactory, so it is just a case of replicating that, rather than worrying about the impossibiity of creating a perfect system.
 

moey

Member
Sorry Arvin,
Just tried it, has the same problem. If 2 people in a row exit, the buzzer sounds.
Beam1 on exit is being treated as someone entering, so the next person leaving sounds the buzzer as sson as they hit beam2.
 
Last edited by a moderator:

mikek

Member
Yeah, I thought about the 3-beam solution for a while, and I realized that although it is a bit more robust, there are cases where it does get it wrong.
 

bobrayner

Member
A solution might be to move the beams quite close together and treat it like an A B direction decoder like say a mouse wheel. If beam B is broken while beam A is blocked the person is entering and if beam A is broken while beam B is blocked the person is leaving. This could probably be fooled if a crowd were entering or leaving but as you say if this is the case the counter is manned anyway. Should be fairly foolproof if single entry is considered
cheers BobR
 

moey

Member
Unfortunately moving the beams is not an option. They're recessed in the wall.

Just need to stop it triggering on multiple exits.
 
Last edited by a moderator:

adub

New Member
I think that when beam2 is hit first that just waiting for beam1 to be crossed isn't enough. Please, try the code and see it it will do the trick. Basically when beam2 is hit we want to wait till beam1 is hit then wait till beam1 is not hit before going back to main. Is my reasoning sound? Try this.

'18X
'Directional door buzzer nov05
'Beam1 then beam2 = buzzer
'Beam2 then beam1 = no buzzer
'Beam2 then beam1 then beam2 then beam1 = buzzer (wrong)

symbol beam1 = pin2
symbol beam2 = pin0
symbol reset_sw = pin7

main:
if beam1 = 1 then timer
if beam2 = 1 then leaving
goto main

leaving:
if reset_sw = 1 then turnoff
if beam1 = 1 then WaitForNoBeam1
goto leaving

WaitForNoBeam1:
if beam1 = 1 then WaitForNoBeam1
goto main

timer:
if beam2 = 1 then buzzer
if reset_sw = 1 then turnoff
goto timer

buzzer:
high 0
if reset_sw = 1 then turnoff
goto buzzer

turnoff:
low 0
if reset_sw = 1 then turnoff
goto main

 

manuka

Senior Member
Mirror bouncing for DOUBLE break of beam 1 -in quick succession- pre beam 2? This'd make a great student brains trust desktop challenge c/w Lego men etc! It's rather akin to classic 2 & 3 way light switch wiring, which numerous electrical students still have trouble working out I'e found. Most only really grasp it after actually looking at the switch contacts & trialling things. Stan
 

moey

Member
Stan, I can see this being an excellent student project.

I whipped up a quick veroboard circuit thinking the program would be easy... until the "false triggers" on exit stumped me.

Arvin, your WaitForNoBeam1 idea works! thanks. It still gets confused if you loiter and repeatedly trigger beam1, then the next person to exit triggers the buzzer on beam2, but I think I can fix that with a timer loop.
 
Last edited by a moderator:

mikek

Member
What if you break beam2 as if you're leaving, but change your mind and don't break beam1? The next person to come in breaks beam1, which makes the code think that the first person finally left. Then, the entering person breaks beam2, the buzzer doesn't sound, and you're back at the point where the code thinks someone is halfway out the door.
 

moey

Member
You're right Mikek. I will have to include a timer to cancel any beam if not followed by another beam within xx seconds.
 
Last edited by a moderator:

moey

Member
The short timer did the trick. This now works fine. Although in simulation it sometimes refuses to trigger on the correct beam sequence, (admittedly only after I deliberate trip the beams at random to confuse it).

'18x
'Directional door buzzer nov05
'Beam1 then beam2 = buzzer
'Beam2 then beam1 = no buzzer
'allows loitering in either beam


symbol beam1 = pin2
symbol beam2 = pin0
symbol reset_sw = pin7
symbol buzzer_out = pin0

main:
if beam1 = 1 then timer
goto main

timer:
b0 = 0
for b0 = 1 to 20
if beam1 = 1 then main
if beam2 = 1 then buzzer
if reset_sw = 1 then turnoff
pause 50
next b0
goto main

buzzer:
high buzzer_out
if reset_sw = 1 then turnoff
goto buzzer

turnoff:
b0 = 0
low buzzer_out
if reset_sw = 1 then turnoff
goto main
 
Last edited by a moderator:

skyv

New Member
OK I've decided to ad my 50c worth.
Here's something i dreamt up at lunchtime.
the code is obviously converted from flowchart.
the simulation works well.

main:
label_91: if pin2=1 then label_11C
if pin0=1 then label_C7
goto label_91

label_C7: if pin2=1 then label_E4
goto label_C7

label_E4: let b1= 1
label_F6: if b1= 1 then label_D2
goto label_F6

label_D2: if pin2=1 then label_F6
let b1= 0
goto label_91


label_11C: if b1= 0 then label_A7
goto label_91

label_A7: if pin0=1 then label_DD
goto label_A7

label_DD: let b0= 1
if b0= 1 then label_B2
let b0= 0
let b1= 0
goto label_91

label_B2: high 0
label_163: if pin7=1 then label_150
goto label_163

label_150: low 0
let b0= 0
let b1= 0
goto label_91


would be interested to see if it works in the real world.


skyv
 

moey

Member
Pretty good skyv.
Multiple exits - ok.
Multiple entries - ok
Multiple beam1 trigger followed by beam2 - ok
But... multiple beam2 trigger followed by beam1 "locks it up" meaning the next entry fails to trigger. I'll have a bash later. Thanks.
 
Last edited by a moderator:

andrewpro

New Member
I've been following the thread sinc it's inception, trying to think of some novel tidbit to add...so here's an idea, though not really along the same lines..

Are you absolutely stuck on the IR beams? I've in the past used sonar modules to detect comming and going and turn lights on and off. It was a nightlight sort of thing for a 3rd floor bedrooms stairs. There was a landing in the middle of the flight. I put the module on the landing so that it could face both sets of stairs. If it detected someone comming towards it, it turned on the light (a spiffy row of red ultra bright LED'S). when it detected someone moving away from it, it started a counter and turned the lights off after a pre-determined amount of time. There was some in-built hysterises in the program to filter out small movements or lingering on the stairs, and in the end worked rather well. It wasn't done with a picaxe, so I cant offer any direct code or circuits, but the idea should be easily tansferable.


--Andy P
 

moey

Member
Andy, the IR beams are already in place, we'll have to use them.

You got me thinking though. A microwave sensor might also do it. Just need to read the doppler shift to tell whether the target is moving away from or towards the door. Microwave sensors for alarm use are quite cheap, (we make them, although they're dual microwave&PIR).
 
Last edited by a moderator:

hippy

Ex-Staff (retired)
Won't doppler shift give you similar problems to what you already have if one person is entering while another is leaving ? And what happens when someone appears to be leaving but turns round and 're-enters' ?

One solution which could work well is CCTV object and motion detection. Situated above the entrance, a decent system should be able to individually acquire multiple simulataneous locks on individuals and tell if htey entring or leaving.
 

moey

Member
Suppose the microwaves would have to fairly narrowly tuned. I remember when most automatic doors in shops used microwaves, doors would open when cars drove past (and other times you bang you nose on the door when it didn't open.) It was all in the placement and adjustment.
 
Last edited by a moderator:

skyv

New Member
i think this is becoming addictive.
i've had another go .it now ignores multiple beam 2 breaks (people leaving)but ultimately someone has to leave (and break beam 1)to reset the code.
the only thing left is a timer to reset everything if nothing happens for a while as previously mentioned i think.



main:
label_9F: if pin2=1 then label_121
if pin0=1 then label_16A
goto label_9F

label_121: if b1= 0 then label_B5
goto label_9F

label_B5: if pin0=1 then label_E4
goto label_B5

label_E4: let b0= 1
if b0= 1 then label_C0
let b0= 0
let b1= 0
goto label_9F

label_C0: high 0
label_176: if pin7=1 then label_C7
goto label_176

label_C7: low 0
let b0= 0
let b1= 0
let b3= 0
goto label_9F

label_16A: let b3= 1
label_CE: if pin2=1 then label_EB
if pin0=1 then label_150
goto label_CE

label_EB: let b1= 1
label_FD: if b1= 1 then label_D9
goto label_FD

label_D9: if pin2=1 then label_FD
let b1= 0
goto label_9F


label_150: let b3=b3+ 1
if b3= 2 then label_162
goto label_16A

label_162: let b3= 0
goto label_CE


give it a go and see what you think.

skyv.
 

moey

Member
Thanks skyv. Just tried it, works quite well.
(I just can't get over all the labels created by the flowchart - never used it).

As you pointed out, it does need a timeout for beam2. The only condition that fails is loitering in beam2 without actually exiting. Then next entry fails to trigger because the beam1 break is treated as the loiterer finally exiting.
_______
 
Last edited by a moderator:
Top