IR sensor with the BS2 PX24
Gumby
Posts: 24
Hello,
I am using the same schematic as in the BOE bot IR sensing for a project (IR LED, IR sensor) but using the BS2 PX 24. I know my sensor is functional, as it picks up button press from my DVD remote and my IR LED worked on my last project.
I am using the program on page 273-4 'testing left frequency sweep'. I tried using a value of 6 instead of 1 as in 'Freqout 8,6, irFreq' as the time delay, to approximate 1mS but that did not work. Maybe 6 is not the correct value. Would the irdetect mode need to be done differently?
Does anyone have any idea on how to make this work? Thanks for your replies.
I am using the same schematic as in the BOE bot IR sensing for a project (IR LED, IR sensor) but using the BS2 PX 24. I know my sensor is functional, as it picks up button press from my DVD remote and my IR LED worked on my last project.
I am using the program on page 273-4 'testing left frequency sweep'. I tried using a value of 6 instead of 1 as in 'Freqout 8,6, irFreq' as the time delay, to approximate 1mS but that did not work. Maybe 6 is not the correct value. Would the irdetect mode need to be done differently?
Does anyone have any idea on how to make this work? Thanks for your replies.
Comments
There is no such Parallax Stamp Product as a "BS2 PX 24" so I have included both the BS2p24 and the BS2px, along with the BS-2 in the information provided below. Just use whichever line fits the actual Stamp that you have.
The general format of the PBASIC FREQOUT Commnd is as follow:
FREQOUT pin, duration, frequency1 {, frequency2}
The duration parameter is measured in terms of timer units. Timer units vary, based on which Stamp platform you are using. Here are a few of those values, most or all of which can be found in the PBASIC Help File or the PBASIC Stamp Manual:
/code
Stamp····· Seconds Per
Platform···· Timer Unit
··
BS-2······· ·· 1 mS
BS-2p24· .265 mS
BS-2px··· .166 mS
code/
By way of example, if a program is written for the BS-2 each timer unit is 1 millisecond in duration. If a program is written for the BS-2px then each timer unit is 166 micro-seconds in duration. All you need to is to mathematically extrapolate the values from the BS-2 Stamp program to "fit" the faster, BS-2px program, simple as that. All time based commands (PULSIN, PULSOUT, PAUSE, SLEEP, COUNT, etc) will need the same change of duration considerations during conversion.
Regards,
Bruce Bates
Post Edited (Bruce Bates) : 12/31/2005 5:51:04 PM GMT
Thanks for the reply and info. Also sorry for the confusion about the micro., it is the BS2 PX that I am referring to. I was trying to be very specific, on the module (chip) itself it is labeled/printed as BS2px24.
Anyway the BOE BOT manual states that the key to make the IR LED/detector work is to send a 1ms of 38.5 kHz FREQOUT harmonic and then immeddiately store the IR detector input in a variable. So, I figured that since the PX has a .166ms FREQOUT you need to multiply by 6 to bring that value to close to 1ms. (1ms/.166ms=6.024..). I tried using 6 as a duration value with no luck. Also the frequency range of the PX is from 0 to 197585 Hz but the BS2 range is 0 to 32767. Does this change anything in how we handle the 'frequency1' value in the FREQOUT command? Finally Because the PX is faster do we have to poll the IR reciver somehow to 'wait' for a return signal?
Regards,
Gilles
·· The BS2px is the BS2px24, as the BS2p is also known as the BS2p24.· In fact, the BS2p24 modules are marked as such, as are the BS2px24 modules.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Perhaps the Parallax web site should be so updated. It refers to it as the BS-2px, as does the update document that was published when it was first announced. I only know what I read
Regards,
Bruce Bates
·· No need to update.· There is no incorrect information being presented.· For simplicity the BS2px24 is being referred to as a BS2px.· This is okay since we have no BS2px40.· With the BS2p there is a 40-pin module, so many folks refer to the BS2p as a BS2p24 or BS2p40 (Depending on the module being referred to).· Simply calling it a BS2p is not incorrect.· Take care!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Does anyone have any insight on this. Chris.....?
Thanks
·· I don't know if the value of 6 is correct or not, because I don't know what you used on the previous Stamp Module you had to calculate the difference.· A value of 6 corresponds to a frequency of 36.18 Hz, which won't do much of anything.· What was your previous value before the BS2px24 was used?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
I did make this work with my BS2 module, currently I used with the LED a 1K ohm R and 220 ohm R, the IR detector has a 220 ohm R on it's input lead. The spec. sheet says that the receiver has a centre frequency of 38kHz and could pick up + - a few thousand Hz. When I try a program to detect 5 values bw 37500Hz and 41500Hz I get some hit when I use my DVD remote but not from my IR LED!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Thanks!
Bruno
·· Those values sound right...What do you mean by inconsistent results?· You could also try a 2 in place of your 3 for the duration to see if that helps.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Thanks DougMM
Post Edited (DougMM.com) : 1/21/2006 2:20:42 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax