Mouse trap

hax

New Member
I am looking at building a mouse trap which operates when a beam is broken.

No problems with the motor control, just wondering how an infra red beam could be set up with the 08M

The infrain command will only respond to individual sony commands as far as I can tell, and hence won't really work in this instance.

I think the answer would be to use the PWM command to modulate the infra red LED but what command to use for the IR receiver?

If anyone has done this, could you share some code?
 

westaust55

Moderator
Hi Haxby,

Are you trying to get too complicated with IR signals?

Could you just use an IR emitting Diode with series resistor to permanently power the IR LED.
http://www.jaycar.com.au/productView.asp?ID=ZD1946&CATID=&keywords=Infrared&SPECIAL=&form=KEYWORD&ProdCodeOnly=&Keyword1=&Keyword2=&pageNumber=&priceMin=&priceMax=&SUBCATID=


Then use a simple IR detector onto a PICAXE 08M input to detect a broken beam.
http://www.jaycar.com.au/productView.asp?ID=ZD1950&CATID=&keywords=Infrared&SPECIAL=&form=KEYWORD&ProdCodeOnly=&Keyword1=&Keyword2=&pageNumber=&priceMin=&priceMax=&SUBCATID=
Might need a transistor as a buffer/amplifier for the detector signal.

Could add some small diameter tubing around both parts as a "light guide" to help prevent extraneous IR light from acting on the detector.
 
Last edited:

MFB

Senior Member
You could use a 555, or Schmitt (HEF4014), based 36Khz astable oscillator to drive an IR emitter diode and receive this beam with an IR receiver chip (e.g. the LED020 sold by REV-ED). So simple you may not even need a PICAXE.
 

moxhamj

New Member
westaust55 - I agree. If you are looking for a beam being broken and you used a modulated beam, that assumes that the signal gets there with no break, but doesn't get there when there is a break. The problem is that modulated beams are designed to get the signal through no matter what, so it is just as likely that the signal will still get there even when the beam is broken, from reflections around the room etc.

Presumably the beam is only a bit wider than a mouse. So not very wide. I'd get a bit of metal tubing like westaust suggests. Don't modulate the beam. Then on the receiver phototransistor, I'd experiment with different resistors - 1k, 10k, 100k etc and see where you get the most meaningful change in volts as the beam is broken.

Then what you are looking for in the picaxe code is a sudden change in the signal. This makes it immune from, say, the changes you might get in daylight vs dark, as those changes will be gradual. Just sample it 10x a second and compare the adc value with the previous sample.

And then you can start getting clever with what you do with the mouse.

Remember, the early bird may get the worm, but the second mouse gets the cheese.
 
Last edited:

hippy

Ex-Staff (retired)
The advantage of using a PICAXE over a pure hardware circuit is that you have more design flexibility, adding delays and double-checking that the IR beam has been broken, plus the ability to do other things when the mouse has been captured; flashing LED's, sounding a Piezo, updating an LCD count of mice caught :)
 

Michael 2727

Senior Member
Commercial units modulate the IR Beam at 2KHz to 4KHz
You could use PWM then the "count" command on an input for
a short sample, if the input count was out of range by too much
that is the tripped trigger.
You will have to play around with PWM, input sample timing
to get the best result. A very speedy mouse/object past the sensor
may get through but you should be able to get a reasonable result.

I prefer the 10µF capacitor @ 300V method myself :)
 
Last edited:

Technical

Technical Support
Staff member
We have deleted a couple of posts as they describe a very dangerous activity, and, as pointed out, are not PICAXE related.
 
Top