Multiple IR leds on Stamp BS2
Hey Guys,
New to the Forums so I hope this is the right place.
I have the Sumobot competition kit and have worked my way through the book.
I'd like to have 5 IR sensors and a ping(( on my 'bot but I need to free pins up.
Can I put IR leds in parallel on the BS2?, can it handle the load?
cheers,
ferrit37
New to the Forums so I hope this is the right place.
I have the Sumobot competition kit and have worked my way through the book.
I'd like to have 5 IR sensors and a ping(( on my 'bot but I need to free pins up.
Can I put IR leds in parallel on the BS2?, can it handle the load?
cheers,
ferrit37
Comments
So, your setup: 5 pairs of IR LEDs and Recievers, Fire all the LEDs at once, read from one reciever, repeat 4x more. Correct?
Thanks for the reply, I've been using the search function digging through.
Yep, that was the general idea or split them into left and right pairs maybe
fire left, read LF, fire right, read RF, repeat for LS and RS.
cheers,
ferrit37
·
It shouldn’t be a problem…the BASIC Stamp2 can only do one thing at a time anyway so there would never be a need to light up multiple IR LEDs anyway. You would have to sequence through them. One thing you might want to do is trim your PAUSE in the main loop to account for additional code-overhead so that there is no lag in the sensors of servo refresh. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
I know it's possible to fire a bunch of IRLEDs simultaneously (like with a MOSFET), but I'll swear it's possible to grab the state of multiple pins with one command.
No? Am I having another senior moment?
Edit: Ok. Maybe it was two commands?:
DIRL=%00000000
X = INL
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm not a complete idiot! Some of my parts are missing.
Post Edited (Steve in NM) : 9/18/2008 10:46:42 PM GMT
If you do a read of an "INL", you'll only read the IR-decoders at that moment in time. This MIGHT work, but is a little iffy.
...
"The key to making each IR LED/detector pair work is to send 1 ms of 38.5 kHz FREQOUT
harmonic, and then, immediately store the IR detector’s output in a variable."
...
FREQOUT 8, 1, 38500
irDetectLeft = IN9
Since that works, it seems an "INL" should, too. Unfortunately, I only have one loose detector·so I can't verify whether· this is the case.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm not a complete idiot! Some of my parts are missing.
Okay, so you want to FREQOUT to a MOSFET and generate the IR on multiple LEDs. Then you want to read the state of the pins connected to the detectors. Assuming that your arrangement is such that there is no IR interference from the other sensors, it could work. I guess you’ll have to try it and follow-up here with your results. Good luck.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
Since I only have one detector, here's what I currently have running:
STATUS VAR INB
start:
FREQOUT 15, 10, 38000
DEBUG HOME, "STATUS = ", BIN STATUS
GOTO start
What I see·in the debug window is -REALLY- erratic.·Does the code lack something? Since I only have the one detector, it can't be interference. Though I *did* note a hint of sage wisdom seeping through your comment.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm not a complete idiot! Some of my parts are missing.
If you have only one detector then the other lines are floating and their values could be anything at anytime including oscillating. You’re going to need 4 detectors to get a true 4-bit input.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
Anyway, IT WORKS!·With INx, you can report the logic state of any bit, nibble, byte, or word.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm not a complete idiot! Some of my parts are missing.