Interfacing Xbee wireless modules with BS2
Dileep
Posts: 4
Hii all,
· As part of our project, we have to interface Xbee· wireless modules with BS2...
But we couldnot able to communicate successfully through these Xbee modules..(may be the problem lies in source codes)
Iam attaching the source code files for BS2. Please check it out and Could anyone please help·us out with proper basic stamp codes so that we can accomplish BS2 to BS2 wireless communication. Waiting in anticipation
with Thanks,
Dileep Kumar,
Grad Student,
Univ of Kansas
dilk@ku.edu
· As part of our project, we have to interface Xbee· wireless modules with BS2...
But we couldnot able to communicate successfully through these Xbee modules..(may be the problem lies in source codes)
Iam attaching the source code files for BS2. Please check it out and Could anyone please help·us out with proper basic stamp codes so that we can accomplish BS2 to BS2 wireless communication. Waiting in anticipation
with Thanks,
Dileep Kumar,
Grad Student,
Univ of Kansas
dilk@ku.edu
Comments
Or describe how it is connected?
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Martin Hebel
StampPlot - Graphical Data Acquisition and Control
AppBee -·2.4GHz Wireless Adapters & transceivers·for the BASIC Stamp & Other controllers·
Dilip and I are doing this project. Want to mention that in the sat_xbee_compass_tx.bs2, we are trying to send the Electronic compass data to another BS2 using XBee. We will try to send the hardware setup by tonite.
satish
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Martin Hebel
StampPlot - Graphical Data Acquisition and Control
AppBee -·2.4GHz Wireless Adapters & transceivers·for the BASIC Stamp & Other controllers·
Today I received AppBee modules. I am working on it right now. I was running the Config_XBee_Example.bs2 program to see if i can receive "Hello Node!".
DO
SEROUT TX,Baud,[noparse][[/noparse]"Hello Node!",CR]
PAUSE 1000
LOOP
On the other end i am receiving HloNd!.......means its skipping every 2nd character. why is that? I tried with Baud 396, 188 for which I dont even see those alternative characters...its showing some garbage at constant rate. Plz help!!!
--satish
Glad you received them.
On the receiving end I assume you are using flow control and a loop to grab each character one at a time?· What happens is when RTS goes high to request a byte, it gets it, but the second one is on the way before the BASIC Stamp brings RTS low again, so every other byte is missed.
When you say you changed Baud rates, did you change the XBee's baud rates too?
String manipulation is never real smooth with BASIC Stamps, it's easier to send decimal values and such, but you can use the STR modifier to catch a series of characters into an array.
Sounds like you are getting there though.
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Martin Hebel
StampPlot - Graphical Data Acquisition and Control
AppBee -·2.4GHz Wireless Adapters & transceivers·for the BASIC Stamp & Other controllers·
Though one day shipping for AppBee costed some money..its worth it. I will try with STR later as I dont need to use any strings now. I tried sending compass data wirelessly and its working perfectly [noparse]:)[/noparse] now trying to send GPS data wirelessly.
Do you have any sample codes for simultaneous communiation between two appbee's ?? Means lets say one module is constantly sending some data as the other module listening to that and sending some commands/data back? It will be great help to our project and I guess we can do some fun stuff (serious stuff) with tht.
--satish
This is the code at the receiving end....
RFin VAR Byte
DO
SERIN RX\RTS,Baud,[noparse][[/noparse]RFin]
DEBUG RFin
LOOP
And in your reply you asked if I changed the XBee's Baud rate....what exactly do you mean by that? I changed the Baud value in both the codes as 84/188/396 . I guess this is the XBee baud rate !!!
Have a general question....what difference it makes in sending a byte variable and word variable wirelessly? How much buffer that an AppMod can store before processed by BS?
--satish
Am I correct this is a college project? You need to start reading documentation a little deeper and researching. Parallax has a program for bringing data into Excel, StampDAQ. I'm sure a google search would have turned it up.
The Xbee holds around 200 bytes in the buffer I think, so between a byte and word it is neglible. The XBee uses a real protocol, so what little data you send is emcompassed around many other bytes.
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Martin Hebel
StampPlot - Graphical Data Acquisition and Control
AppBee -·2.4GHz Wireless Adapters & transceivers·for the BASIC Stamp & Other controllers·
Satish,
Since the Xbee's (AppBee's are just the board they plug into) use a full protocol, clear channel assessment, etc etc, their is no special code needed for 2 to talk back and forth. The units check before sending, do error checking and retries for high reliability of comms.
A project I am currenty involved with is montioring 5 units and collecting data from the real time. When told to, they all start sending data back to unit 0, 5-10 times a second. At any time I can tell them all to stop from the base unit (0). Each has their own address so I can wake up any or all. And all the data gets dumped directly into Excel.
Read the docs,
Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Martin Hebel
StampPlot - Graphical Data Acquisition and Control
AppBee -·2.4GHz Wireless Adapters & transceivers·for the BASIC Stamp & Other controllers·
--satish
I hope I've put this in the right place, I'm new to using forums.
dennis@htshvac.com
How are you connecting that you would expect to see loopback using the Stamp Editor?
I have some documentation on this page at the bottom that may help:
http://www.selmaware.com/appbee/
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
StampPlot - GUI and Plotting, and XBee Wireless Adapters
Southern Illinois University Carbondale, Electronic Systems Technologies
What am I missing here?
Thanks
Dennis
You can use the xBee (and other wireless links) for data transfers using SEROUT/SERIN (works nicely), but you can't use it for programming.
I really wanted to be able to program and make changes to the stamp with the xbee, that would have been nice.
I thought I saw something for sending the debug back to the stamp on here, but not really sure where it was.
Is that easy or there many timing problems?
I wanted to be able to put the stamp in a plane to get info back from the stamp or propeller chip.
Also is the anything that could be used to program the stamp wirelessly?
And I really wish the stamp tech people told me this last week, I would have thought they knew about this. What I called they were no help at all. Just said it was the xbee problem and they couldn't help me at all.
Also there is a problem with the stamp being 5 volts· and the xbee at 3.3volts, any easy quick fixes for this that you know of that I can do with out buying more things right now?
Thanks
Dennis
Am I just asking for too much here?
I guess you can talk 2 way with the xbee too, right?
I'm new to the basic stamp and just not too sure what I can really do with it yet.
I'm getting the propeller to work with too. That would control the servos better. I got the BS2 controlling 2 servos now and that is working good. It can't do more than 2 without causing problems as far as the servos moving smoothly.
I want to end up with gps in a air plane and an internet thermostat using ds1620 or ds1820. Now to find the time to learn this and to do it. LOL
Thanks
Dennis
Thanks
Dennis
Selmaware's AppMod xBee adapter takes care of regulating the 5V down to 3.3V and buffering the Stamp signals so they're compatible with the xBee. They also have another adapter that does the same, but has a slightly different form-factor. If you haven't, look at their website (www.selmaware.com).
Wireless USB should work, but it depends so much on the timing of the wireless link. You'd just have to try it and be prepared for it not to work or not work reliably.
I'm not aware of any attempts to program a Stamp using another Stamp. I don't think it's possible (because of timing and speed requirements). You could use an SX or a Propeller. There's a commercial device (the Stache) used for field updating of Stamps, but it's not wireless. You could use a Propeller since it has enough memory to store several "slots" of Stamp program. You could use the Propeller with a wireless link like an xBee, send the compiled Stamp program, and then program the Stamp from the Propeller once the whole Stamp program has been received.
A Stamp ought to be able to handle 4 servos without problems as long as you're not trying to do a lot of other stuff between servo pulses. You'd have to post your code to see why it doesn't work better. With a servo pulse taking up to 2.5ms, 4 takes only 10ms. You've got another 10ms to read a sensor or two and do a little bit of computation before you run out of the 20ms between servo pulses.
xBee provides a full duplex channel. That means it can send and receive.
So the BS2p should be good to even to may be 6 servos I think.
As far as the 5 to 3.3 volt problem it looks like I can use a 74ls244 to fix this or save time and get something from selmaware.
I would like to find more drawings for stamps that have been used to control things to get ideals from. I've ordered book and kits from parallax to look at and learn more on how to do what I want to.
I've had this old stamp sitting around for years and played with it a few times, now they have them that will read the 1-wire parts easier so I may be able to do more things with Building automation or home control. And even the gps air plane.
I wanted to make a plane fly from my house to a friends and drop off something and come back or evn fly over and take some pictures and come back. I'm sure I'll have a lot of testing to try and make sure that nothings wrong will happen bad and even thinking of it, it may be a bad ideal in case something went wrong, but its a start.
I guess in the longrun I'll need wireless link that will go 2 or 3 mile with a good connection and send video back.
But its going to take some learning, time·and playing to make all this work.
Again thanks for your help.
Can I ask what you do with the stamps?
Dennis
·
' PULSIN.bs2
' {$STAMP BS2}
' {$PBASIC 2.5}
Pulse1·········· PIN···· 0 ' pulse input pin
Pulse2·········· PIN···· 1
Pulse3·········· PIN···· 2
Pulse4·········· PIN···· 3
PIN4············ PIN···· 4
PIN5············ PIN···· 5
PIN6············ PIN···· 6
PIN7············ PIN···· 7
PIN8············ PIN···· 8
PIN9············ PIN···· 9
time1··········· VAR···· Word
time2··········· VAR···· Word
time3··········· VAR···· Word
time4··········· VAR···· Word
Main:
· PULSIN Pulse1, 1, time1···· ' measure positive pulse
· PULSIN pulse2, 1, time2
· PULSIN pulse3, 1, time3
· PULSIN pulse4, 1, time4
········· HIGH 10········ 'LED test
········· LOW 10
········· PULSOUT 4, time1
········· PULSOUT 5, time2
········· PULSOUT 6, time3
········· PULSOUT 7, time4
· GOTO Main
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support