Infrared wireless communication
Dear BS2 users,
I'm lookig into a solution were I want to use a wireless connection.
I'm looking into infra red as this is cheaper and should be easier than zigbee, appbee, xbee, etc. However I can't find any info on connecting it to a BS2. What I want is I have·2 pushbuttons who give a signal about a maximium of twice a second. Each time a button is touched I want to send info wireless via infrared to the BS2. Are there any application notes available regarding this?
Thank you in advance.
·
I'm lookig into a solution were I want to use a wireless connection.
I'm looking into infra red as this is cheaper and should be easier than zigbee, appbee, xbee, etc. However I can't find any info on connecting it to a BS2. What I want is I have·2 pushbuttons who give a signal about a maximium of twice a second. Each time a button is touched I want to send info wireless via infrared to the BS2. Are there any application notes available regarding this?
Thank you in advance.
·
Comments
Serial will be very hard and very slow, as an LED actually takes a long time (compared to other forms of communication... faster than we can see to humans) to turn on and off.
If its just maybe one byte you may be able to come up with an IR communication protocol that can transmit the data in 1 second or less.
Chapter 11 of the Basic Stamp 1 application notes.
http://www.parallax.com/Portals/0/Downloads/appnt/stamps/bs1Appnotes.pdf
You should be able to apply this to the BS2. You can use the parallax IR receiver for this application.
I hope this helps.
SJW
The way remotes work is more stable -- send a long start bit, followed by some data bits. In my own 'bots, I use a protocol (copied from Andy Lindsay at Parallax) where a start bit is a 3ms IR pulse, followed by a 1ms "rest", followed by 12 data bits -- a 1 bit is a 2ms pulse, a 0 bit is a 1ms pulse. I leave a 70ms pause between messages to allow other 'bots to "talk", so the max time between messages is about 100ms. This can be cut to less than 20ms if you have fewer bits and aren't allowing for other platforms to IR comm. too.
In any case, see the document below which details using IR remotes (and sending and decoding the codes) with a Stamp. Given that you only need to send two bits (the states of your buttons) it shouldn't be too hard.
www.parallax.com/Portals/0/Downloads/docs/prod/sic/WebIR-%20v1.1.pdf
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
However it looks like IR is no more less expensive then RF communication, howcome? Is RF more difficult? Why not use RF and forget whole IR part?
Kind regards
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
IR is wayyyyyy cheaper than RF (and led and a detector might cost < $2). But IR is relatively slow, will only work over short distances, is subject to vicious interference (esp. from other IR devices) and depends on line-of-sight. Plus you can't really "network" it.
What about laser?· Are components readily available?
JJ
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
Also as much as Xbee appeals to me $19 is way to expensive and I think (not sure therefore I am lokking for shelp over here) overdone.
The specs of my application are:
-communication over 2 meters is oke
-there is line of sight
-of 2 pushbuttons I want the microcontroller to know (via wireless communication) when they are pushed. They are pushed only a few times per second at the max, they also can be pushed at the same time but not always
Any recommendations of components to start with?
Thanks for all the help, again.
Then make your communication protocol SIMPLE. See the IR "how-tos" from Parallax as mentioned. I would do it like this:
"Buttons" Stamp:
1. Read buttons
2. send "start bit" -- 3ms IR FREQOUT followed by a 1 ms "rest" (led off)
3. send two data bits -- one for each button -- 2ms is "high" or one, 1ms is "low" or zero. Follow each with a 1ms pause.
4. pause 10ms to let the other stamp deal w/the results
5. go to step 1.
If both buttons are pressed then your maximum time to transmit the data will be:
3ms start + 1ms rest + 2ms "one" bit + 1ms rest + 2ms "one" bit = 9ms
+ 10ms pause = 19ms or about the time of servo pulse. That's 50 times a second, plenty fast. If neither button is pressed, or only 1, the transmission time will be slightly faster as the "zeros" are shorter.
"Receiver" Stamp: (see Parallax IR notes regarding using of RCTIME rather than pulsin so as not to miss repeating pulse edges)
1. PULSIN on the detector
2. pulse ~ 3ms? yes -- go to step 3; no -- go to step 1
3. two data bits received yet? yes -- go to step 8; no -- go to step 4
4. RCTIME next pulse. pulse > 1.8ms and < 2.2 ms ? yes, bit = 1
5. pulse < 1.2 and > .8 ? yes, bit = 0; no, bad pulse, clear data and back to step 1
6. number of pulses = number of pulses + 1
7. go to step 4
8. button data received; do something with it
9. go to step 1
Last, there IS AN ACTIVITY like this (desktop communication between two Stamps) in the IR book (available as a download) from Parallax. Same protocol (3ms start, 2ms = 1, 1ms = 0).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
I've just ordered the parts at farnell. as soon as I get the parts I will write the code and keep you informed.
Thanks again.
Also, for the original poster, Parallax has a book and/or set on "IR Control for the Boe-Bot" that has a lot of projects of IR signals, including 2 Stamps talking to each other.·
http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/txtSearch/infrared/List/1/ProductID/149/Default.aspx?SortField=ProductName%2cProductName