IR pulse input/output trouble
dimatt
Posts: 5
Hello! I am having trouble sending and receiving ir signals between two basic stamps. Im planning on using one stamp to send pulses to the other. The second stamp will then recognize and have outputs for different legthed pulses that are sent. I have a basic code set up at the moment for each stamp to make sure that the second stamp is recieveing and then making an action accordingly.
this is the bs2 code:
recieving stamp:
value·· VAR···· Word
Main:
· COUNT 0, 1000, value
· DEBUG ? value
· GOTO Main
· END
·transmiting stamp:
· Loop:
· FREQOUT 6, 20000, 5
· GOTO Loop
I was basically just using this code and the debug menu to check whether the correct pulse was being sent across to the other but it doesn't seem to be working for me. Insteading recieving the correct count in the debug menu it is sending mixed signals. It used to show numbers in the 100 range but then when i restart the program or cover the circuit with something it sometimes shoots up to 1000. Could this possibly be due to interference or what else could be doing this?
this is the bs2 code:
recieving stamp:
value·· VAR···· Word
Main:
· COUNT 0, 1000, value
· DEBUG ? value
· GOTO Main
· END
·transmiting stamp:
· Loop:
· FREQOUT 6, 20000, 5
· GOTO Loop
I was basically just using this code and the debug menu to check whether the correct pulse was being sent across to the other but it doesn't seem to be working for me. Insteading recieving the correct count in the debug menu it is sending mixed signals. It used to show numbers in the 100 range but then when i restart the program or cover the circuit with something it sometimes shoots up to 1000. Could this possibly be due to interference or what else could be doing this?
Comments
Main:
· DO
··· FREQOUT ModPin, 5, 38500
··· PAUSE·5
· LOOP
· END
Note that I added a bit of a delay between pulses.· It also occurs to me that the IR receivers we use have a bit of hysteris, so they don't shut off as soon as the IR modulation source goes a way.· The PAUSE should help that.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
http://www.parallax.com/dl/docs/prod/audiovis/InfraredEmittingDiode.pdf
Pages 15 to 17 demonstrate communication between two BASIC Stamps with IR LEDs and detectors.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Along with the schematic, please let us know which parts you are using.· The parts that Jon and I have been referring to are these:
IR Transmitter w/ heat shrink tubing
Infrared Receiver
If you are using an Infrared Transistor or an infrared diode instead of the infrared receiver, it's a different ballgame.·
There is a problem with your circuit, too.· You should have the 220-ohm resistor between the BASIC Stamp pin and the LED.· Right now you have a direct drive and it you leave the pin as an output high you're likey to damage the BASIC Stamp.· Also keep in mind that you cannot toggle the LED control pin while watching the output of the phototransistor.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Here are modified versions of your test programs that should work with Jon's circuit provided the I/O pins are still working.· Make sure to shield the components from ambient light while you are testing.· ·
Regards, Andy