Infrared Wireless

Brettw3317

New Member
Hi . . .
working with the 08m im trying to create a circuit that has a infrared beam across a driveway and when that infrared is broken e.g. by a car it realises this and will send a signal wirelessly to another chip that will pick this signal up and sound an alarm

Inrared Trannsmitter
main:
infraout 1,1
pause 500

goto main

Infrared Reciever / wireless transmitter
main:
b13 = 0
low 2
low 1
low 4
infrain2
debug
if b13 = 1 then flash:
goto main


flash:
high 2
pause 500
low 2
low 1
b1 = 1
serout 0,n2400,(85,85,85,"growl",b1)
high 1
pause 222
goto main

Wireless Reciever
main:
b1 = 0
serin 3, n2400, ("growl"),b1
pause 222
if b1 = 0 then go
if b1 = 1 then blue
goto main

go:
high 4
pause 500
low 4
pause 500
'ILikeTo
tune 0, 3,($01,$3C,$01,$3C,$01,$3C,$01,$08,$06,$3C,$06,$04,$06,$03,$08,$01,$3C,$01,$3C,$01,$3C,$01,$08,$3C,$06,$04,$03,$06,$03,$08,$01)
goto main

blue:
high 1
pause 222
low 1
pause 222
goto main


The Problem is in the line if B1=0 then go because the reciever will stop at the serin 3, n2400, ("growl"),b1
and wait until it recieves the signasl before it will continue.
i have tried to fix the problem at the infra red reciever aswell by adding the code main:
b13 = 0
low 2
low 1
low 4
infrain2
debug
if b13 = 1 then flash
if b13 = 0 then light
goto main


flash:
high 2
pause 500
low 2
low 1
b1 = 1
serout 0,n2400,(85,85,85,"growl",b1)
high 1
pause 222
goto main

flash
high 2
b1 = 1
serout 0,n2400,(85,85,85,"scream",b1)
high 1
pause 222


But That doesnt work either as it will wait for the infrared to send an actual 0 . . . i would like some help with figuring out the code i could use to get this to work . . . any help appreciated :):)
 

lanternfish

Senior Member
Hi Brett

A quick comment on your question. Can you supply a cct diagram or comment the program(s) so that we know what each inpu/output pins do?

Anyway, something similar has been done before. A quick search of the forums for doorway brought up these results. Another search for driveway brought up these results.

I haven't read the threads outlines but have a couple of suggestions:

1. You could use the PWM command to modulate an IR LED at 38kHz/40kHz. This is the beam that is received by and IR Receiver (with built in demodulator).

2. You can save one 08M by having the IR beam bounce off a reflector to the same 08M. This way the 08M only has to monitor for an active outout from the IR Receiver.

3. Is there a problem with the RF Receiver 08M waiting for a serial input? It doesn't appear to be doing anything significant while waiting for serial input.

Cheers
 

Michael 2727

Senior Member
Most of those IR Beam Detectors operate on a pulsed signal of around 2 to 4 KHz.
If you have the TX part PWM a continuous signal out then use "count" on the reciever
to compare it to a value of similar pulses/time (within a couple of, +/- cycles) you won't
need to use infrain-out.
It is fairly hard to run through a beam and not block out at least a few pulses.
The smaller the gaps in your code while comparing a fixed number to the count input
variable the harder it will be to defeat the system.

Edit:
I should have mentioned, The TX is into a standard IR LED and the RX is an IR Photo
Transistor or something similar. An LDR may react a little too slowly.
(even an IR LED in reverse can work over short distances as a detector)
So no need for fancy IR Detectors/Decoders/Demodulators etc.
You could even use a MOSFET, 12V and a 5% duty or so PWM pulse to cover very
long distances. Many IR LEDs can easily handle 50mA Forward current, some 100mA,
if pulsed for a very short duration you can put half an Amp or more into them.
Some Data Sheets will even give you a spec.

Now I've done it, gone and said the "D" word ~ 'o)
 
Last edited:

Haku

Senior Member
1. You could use the PWM command to modulate an IR LED at 38kHz/40kHz. This is the beam that is received by and IR Receiver (with built in demodulator).
I've been tinkering with this just recently, I found if you send a continuous 38khz PWM signal to an IR LED the IR receiver will only trigger once as the output goes low for a very short amount of time, so to keep a continuously monitored 'beam' you'll have to pulse the output to keep the IR receiver continually triggering.

But that way will be easier to deal with than using the built-in IR signalling because the receiving Picaxe just has to count the incoming pulses from the IR receiver over a certain amount of time or count the gap time between the pulses. Using the built-in 08m's built in IR commands means the device will wait until it receives an IR signal and there's no way of determining how long it waited until it received the signal.

2. You can save one 08M by having the IR beam bounce off a reflector to the same 08M. This way the 08M only has to monitor for an active outout from the IR Receiver.
This might be possible; switch on the PWM signal to the IR LED then immediately check the IR receiver for a triggered signal.

I bought a bunch of older generation iPod remote controls from a 99p store for the IR & other parts, might have to try making my own IR 'tripwire' :)
 
Last edited:

Dippy

Moderator
You haven't described any of the components you have used so I'm going to rub my C balls vigorously.
Those (typical) 38kHz IR modules don't like continuous (many data sheets highlight this if you investigate), so I'd agree with the 'missing pulse' method described above. Easier and more reliable.

As far as vehicle detection is concerned, you have 3 basic options.
1. Break-beam with separate IRTx and IRRx.
2. A reflector method as mentioned - IRTx and IRRx in a single box so wiring easier. And coding will be easier as the IRRx knows when the IRTx is being sent.
3. Target Reflective. More powerful IR pulse required and bounce the IR off the vehicle. Electronic/code advantage as (2) plus no reflector to get knocked around.

Ball back to standby.
 

Haku

Senior Member
I've just had a tinker with a 38khz IR receiver, IR LED & 08m, and managed to come up with this:
Code:
#picaxe 08m

' IR tripwire
'
' white LED on 1 
' IR LED on 2
' IR receiver on 3

input 1
output 2

do
 pwmout 2,25,53
 b0=0
 for b1=1 to 10
  if pin3=0 then:b0=1:endif
 next b1
 pwmout 2,off
 if b0=0 then high 1:else:low 1:endif
 pause 5
loop
Most of the time the 08m is waiting for the IR receiver, the b1 loop simply makes it wait a short time for the IR receiver to 'kick into gear' and receive the signal from the IR LED, and the 'pause 5' gives the IR receiver time to 'warm down' from the IR signal.
The white LED on pin 1 goes high when the beam is broken.

For short distances of a couple of feet it works fine with a bike reflector, but larger distances you may need lenses in front of the IR LED & IR receiver to focus the beam. Using a camcorder with nightvision to see the IR LED's beam can help testing/setting things up.
 

Brettw3317

New Member
thanks

thanks for the advice . . . got the IR RX to send a signal when it is recieving a code from the IR TX. Now im really stuck with getting the wireless to send a signal when the IR RX is not recieving any sort of code from the IR TX. This is the point at which my electronics knowledge is being strained. I have no idea how the code should look to get the wireless TX to realise that the IR RX isnt getting any sort of signal. So in Detail I Can't get the IR RX to realise its not recieving any sort of code from the IR TX and when this happens i need the picaxe 08m to realise also that the IR RX isnt getting any code and therfore it will send a little code to the wireless TX and send a unique code to the wireless RX ECT I could really use some help i am completely lost:confused: :eek:.

Thanks Guys :D
 

Dippy

Moderator
Post a neat drawing of your system. All this Tx and Rx wibble is doing my head in.
You've got it sitting in front of you - we haven't.

The principle should be quite easy and it sounds like you're getting yourself into a mess.
If you draw it out then it might make things a bit clearer to you and certainly to us.:rolleyes:
 
Top