PDA

View Full Version : IR sensor with the BS2 PX24



Gumby
12-31-2005, 11:39 PM
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.

Bruce Bates
01-01-2006, 12:48 AM
Gumby -

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

Gumby
01-01-2006, 03:18 AM
Bruce,
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

Chris Savage
01-01-2006, 03:22 AM
Bruce Bates said...(trimmed)
Gumby -
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.

Bruce,

·· 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 (mailto:csavage@parallax.com)

Bruce Bates
01-01-2006, 04:33 AM
Chris -

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 http://forums.parallax.com/images/smilies/smile.gif

Regards,

Bruce Bates

Chris Savage
01-01-2006, 05:44 AM
Bruce,

·· 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 (mailto:csavage@parallax.com)

Gumby
01-01-2006, 11:11 PM
OK now that we have the name all taken care of van we go back to the main issue of timing for the IR sensor.
Does anyone have any insight on this. Chris.....?

Thanks

Chris Savage
01-02-2006, 02:03 AM
Gumby,

·· 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 (mailto:csavage@parallax.com)

Chris Savage
01-02-2006, 02:24 AM
Just went back and re-looked at your first post...6 is the duration, and your frequency is in a variable.· Which property are you having trouble with?· The Duration or the Frequency or both?· In any event, please list what you had in your old program, and what Stamp Module you used, and that will make it easy to calculate the new values.· Thanks.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

Gumby
01-02-2006, 02:44 AM
Chris,

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
01-02-2006, 03:33 AM
Okay, given that your duration of 6 is correct.· As for the frequency value, that should be 6385, from my calculations.· Let me know if that works.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

brunovianna
01-11-2006, 09:27 PM
What would be these values for the basic stamp sx? I'm using 3 and 15400, but I get inconsistent results.

Thanks!
Bruno

Chris Savage
01-11-2006, 11:05 PM
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 (mailto:csavage@parallax.com)

DougMM.com
01-21-2006, 09:14 AM
Please help? How do I convert the normal Boe-Boe comands to use the BS2PX stamp?? I can't get anything to work...· It would be nice to see a pulse out, freqout chart???
Thanks DougMM

Post Edited (DougMM.com) : 1/21/2006 2:20:42 PM GMT

Jon Williams
01-21-2006, 02:16 PM
The easiest way is to use conditional compilation -- that lets the program adjust itself to whatever module you decide to use. The manual and help file have several examples.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax