Shop OBEX P1 Docs P2 Docs Learn Events
Wireless XBee Sensors Just Won't Work! — Parallax Forums

Wireless XBee Sensors Just Won't Work!

Chris CChris C Posts: 50
edited 2010-12-17 05:59 in BASIC Stamp
I've tried everything I can think of and read the syntax manual, conversion tips, and application notes more times that I can count.

The sensor node is sensing the value properly.· I don't know if it's actually sending the data through the AppBee or not.· All I can tell is that the TX LED on the sensor module is blinking when it should, which leads me to believe it's sending the data.

'·· {$STAMP BS1}
'·· {$PBASIC 1.0}
'
[noparse][[/noparse] I/O Definitions ]
SYMBOL· Ping··········· = 7
SYMBOL· TX············· = 2
SYMBOL· RX············· = 0
SYMBOL· SLP············ = 4
SYMBOL· RTS············ = 6

'
[noparse][[/noparse] Constants ]
SYMBOL· Trigger········ = 1···················· ' 10 uS trigger pulse
SYMBOL· Scale·········· = 10··················· ' raw x 10.00 = uS
SYMBOL· RawToIn········ = 889·················· ' 1 / 73.746 (with **)
SYMBOL· IsHigh········· = 1···················· ' for PULSOUT
SYMBOL· IsLow·········· = 0

'
[noparse][[/noparse] Variables ]
SYMBOL· rawDist········ = W3··················· ' raw measurement
SYMBOL· inches········· = W4··················· ' inches conversion

'
[noparse][[/noparse] Program Code ]
Main:
· PAUSE 2000
· HIGH SLP······ ' Put XBee to sleep
'· SLEEP 15······· ' Put Stamp to sleep for approx 15 seconds
· GOSUB Get_Sonar······························ ' get sensor value
· inches = rawDist ** RawToIn·················· ' convert to inches
· DEBUG CLS···································· ' report
· DEBUG "Time (uS)..... ", #rawDist, CR
· DEBUG "Inches........ ", #inches, CR
'· IF inches > 22 OR inches < 2 THEN Main
· LOW SLP···················· ' Wake XBee
· PAUSE 10··················· ' Give XBee time to stretch and yawn
· SEROUT TX, T2400, (#1, 13)·· ' Transmit notifier
· PAUSE 10
· GOTO MAIN
END
'
[noparse][[/noparse] Subroutine ]
Get_Sonar:
· LOW Ping····································· ' make trigger 0-1-0
· PULSOUT Ping, Trigger························ ' activate sensor
· PULSIN· Ping, IsHigh, rawDist················ ' measure echo pulse
· rawDist = rawDist * Scale···················· ' convert to uS
· rawDist = rawDist / 2························ ' remove return trip
· RETURN

The receiver module just flat out doesn't work, and I have no idea how to make it.· It has to sense the value coming from the sensor node, but it doesn't.· I assume it's just staying at the SERIN command.

' {$STAMP BS1}
' {$PBASIC 1.0}
SYMBOL· RX· = 2 ' Receive Pin
SYMBOL· TX· = 0 ' Transmit Pin
SYMBOL· In· = B3
HIGH TX
Main:
· SERIN RX, T2400, In· ' Accept and view as character
· DEBUG "RECEIVED", CR
· GOTO Main
· END

I configured the XBees with different MY addresses, receiver as 0 and sensor as 1, set the receiver's destination address to 0 and FFFF (neither worked), set the sensor's destination to DL = 0, and set the baud rate to 2400 on both.

Any ideas might help, I'm completely at my wits end and I have no idea what to do.· I've been trying to make this work for entirely too long now.

Thanks.

Comments

  • pwalkerpwalker Posts: 1
    edited 2010-12-17 04:58
    Stupid question, but did you get the units to work in loopback mode before trying this? It took me a while to figure it out, but I am planning on doing something
    along the lines of what you're trying. If you would like, I'll keep you advised as to my progress (or lack thereof)
  • sylvie369sylvie369 Posts: 1,622
    edited 2010-12-17 05:59
    Pwalker - I responded to your post, but then noticed that the post you're responding to was made in April of 2008. I'm not sure how you got to that one, but it's generally not helpful to respond to posts that are that old.

    If you have questions about XBees in your own project, though, please post them (preferably in a new thread).
Sign In or Register to comment.