Trouble with IR detector sending an output to another stamp.
sammieg
Posts: 4
Goal: I am using two BS2 stamps to flash a large amount of LEDs. On one board I am using the IR detector program that is used for the boe-bots to drive around. On the other board I am using an “IF…THAN” statement to flash the LEDs.
So far: Everything on the IR detector board is working. Debug acknowledges that objects are detected, and when tested with a DMM shows a tenth of a volt change on the IR receiver. I read somewhere that there needs to be a 1.4 to 5 volt input to the other stamp.
Question: How can I program a suitable output from the IR stamp to activate the LED stamp?
Code used for IR receiver stamp:
'Robotics! v1.5, Program Listing 5.1: IR Pairs Display.
' {$STAMP BS2}
'
Declaration
one_IR_det VAR Bit
'---- Initialization
OUTPUT 1
'---- main routine
main:
FREQOUT 1, 1, 38500
one_IR_det = IN0
DEBUG HOME, "one= ", BIN1 one_IR_det
PAUSE 20
GOTO main
Code used for LED stamp:
' {$STAMP BS2}
' {$PBASIC 2.5}
DO
DEBUG ? IN3
IF (IN3 = 0) THEN
HIGH 14
PAUSE 10000
LOW 14
PAUSE 100
HIGH 14
PAUSE 600
LOW 14
PAUSE 10000
ELSE
PAUSE 100
ENDIF
LOOP
So far: Everything on the IR detector board is working. Debug acknowledges that objects are detected, and when tested with a DMM shows a tenth of a volt change on the IR receiver. I read somewhere that there needs to be a 1.4 to 5 volt input to the other stamp.
Question: How can I program a suitable output from the IR stamp to activate the LED stamp?
Code used for IR receiver stamp:
'Robotics! v1.5, Program Listing 5.1: IR Pairs Display.
' {$STAMP BS2}
'
Declaration
one_IR_det VAR Bit
'---- Initialization
OUTPUT 1
'---- main routine
main:
FREQOUT 1, 1, 38500
one_IR_det = IN0
DEBUG HOME, "one= ", BIN1 one_IR_det
PAUSE 20
GOTO main
Code used for LED stamp:
' {$STAMP BS2}
' {$PBASIC 2.5}
DO
DEBUG ? IN3
IF (IN3 = 0) THEN
HIGH 14
PAUSE 10000
LOW 14
PAUSE 100
HIGH 14
PAUSE 600
LOW 14
PAUSE 10000
ELSE
PAUSE 100
ENDIF
LOOP
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Mike2545
This message sent to you on 100% recycled electrons.
I am using two stamps, one with the IR sensors to detect movement, and another stamp with the IF…THAN…ELSE code to flash the LEDs.
My problem is that the stamp with the IR sensor works in debug, I can see it change from 1 to 0 when I wave my hand over it. I need to take the output of the IR sensor to the input of the LED program. However when I connect the two of them, the LED input is not able to see the toggling of the IR sensor.
What I don’t know is if I am doing something wrong in trying to program the two boards to communicate. So far what I need is for the output of the IR sensor to send the 1 or 0/no detection or detection signal to the other stamps input to IF it sees a 0/detect to THEN run the flashing coded for the LEDs, ELSE it pauses and runs through the program again.
In your current code you·could drive 14 LED's "directly" (using appropriate current limiting hardware ).
Since you need ports to comunicate between stamps (and you want to have one stamp dedicated to LED's) how do you expect to operate more than that by tying two stamps together?
Rather than dwell of· very simple (on/off) coding let's·see a schematic of your whole setup.
Cheers Vaclav
·
I attached a drawing of my schematic.
It also has intensity control.
MAXIM is generous with free samples and I could send you my code.
Cheers Vaclav
·
I just finished an HO Train Display in which I used 5 IR emitters & 5 IR Receivers and had a similar
problem.
There would be a voltage change on the receivers when they were blocked and when they weren't.
The voltages ranged from 5 volts to around 2.45 volts - - both above the trigger threshold.
What I did was put a 1,000 ohm resistor in the +5 volt lead and 1,000 ohms in the receiver output
that returns to the stamp pin.· Upon measuring the voltage changes then, I was getting +5 volts "on"
or "1"·signal·and +2.0 volts for the "off" or "0" state.
Another thing, when tying several·things together, such as two power supplies or Stamps, there needs
to be a common ground.
Hope this helps.
Jim
·