Wireless PING Network
Chris C
Posts: 50
Long story short,·two PS1 Project Boards with a PING and an AppBee-SIP sending a value to one PS1 Project Board with an AppBee-SIP.· Both are hooked up to 12 1A wall supplies.
The wireless nodes are sending the value right, but watching the receiver through debug, nothing is outputting.
Node code (for only one of them)
'·· {$STAMP BS1}
'·· {$PBASIC 1.0}
'
[noparse][[/noparse] I/O Pins ]
SYMBOL· Ping··········· = 7
SYMBOL· TX············· = 2
SYMBOL· SLP············ = 4
'
[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········ = W1··················· ' raw measurement
SYMBOL· inches········· = W2··················· ' inches conversion
SYMBOL· nodeInfo······· = W3··················· ' node presence
'
[noparse][[/noparse] Code ]
Main:
· PAUSE 2000
· HIGH SLP······ ' Put XBee to sleep
'· SLEEP 15······· ' Put BS2 to sleep for approx 15 seconds, uncomment later
· GOSUB Get_Sonar······························ ' get sensor value
· inches = rawDist ** RawToIn·················· ' convert to inches
· DEBUG CLS···································· ' report
· DEBUG "Time (uS)..... ", #rawDist, CR
· DEBUG "Inches........ ", #inches, CR
· nodeInfo = 1000
· nodeInfo = nodeInfo + inches
· IF nodeInfo > 1022 OR nodeInfo < 1002 THEN Main
· LOW SLP······· ' Wake XBee
· PAUSE 10······ ' Give XBee time to stretch and yawn
· SEROUT TX, T2400, (#nodeInfo) ' Transmit value
· PAUSE 10
· DEBUG "Node........ ", #nodeInfo, CR
· 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
'
Receiver Code (dunno if this would even work)
' {$STAMP BS1}
' {$PBASIC 1.0}
SYMBOL· RX· = 0 ' Receive Pin
SYMBOL· TX· = 2 ' Transmit Pin
SYMBOL· RFin· = W3
Main:
· SERIN RX, T2400, #RFin ' Accept and view as character
· DEBUG "nodeInfo = ", #RFin, CR
· GOTO Main
· END
The "nodeInfo = " doesn't show up in the debug window.· The sensor nodes show everything in the debug window as desired.
Is the XBee not receiving the info properly?· One weird tidbit to add, the receiver XBee's RX LED does blink everytime the TX LED on the sensor node blinks.
The wireless nodes are sending the value right, but watching the receiver through debug, nothing is outputting.
Node code (for only one of them)
'·· {$STAMP BS1}
'·· {$PBASIC 1.0}
'
[noparse][[/noparse] I/O Pins ]
SYMBOL· Ping··········· = 7
SYMBOL· TX············· = 2
SYMBOL· SLP············ = 4
'
[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········ = W1··················· ' raw measurement
SYMBOL· inches········· = W2··················· ' inches conversion
SYMBOL· nodeInfo······· = W3··················· ' node presence
'
[noparse][[/noparse] Code ]
Main:
· PAUSE 2000
· HIGH SLP······ ' Put XBee to sleep
'· SLEEP 15······· ' Put BS2 to sleep for approx 15 seconds, uncomment later
· GOSUB Get_Sonar······························ ' get sensor value
· inches = rawDist ** RawToIn·················· ' convert to inches
· DEBUG CLS···································· ' report
· DEBUG "Time (uS)..... ", #rawDist, CR
· DEBUG "Inches........ ", #inches, CR
· nodeInfo = 1000
· nodeInfo = nodeInfo + inches
· IF nodeInfo > 1022 OR nodeInfo < 1002 THEN Main
· LOW SLP······· ' Wake XBee
· PAUSE 10······ ' Give XBee time to stretch and yawn
· SEROUT TX, T2400, (#nodeInfo) ' Transmit value
· PAUSE 10
· DEBUG "Node........ ", #nodeInfo, CR
· 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
'
Receiver Code (dunno if this would even work)
' {$STAMP BS1}
' {$PBASIC 1.0}
SYMBOL· RX· = 0 ' Receive Pin
SYMBOL· TX· = 2 ' Transmit Pin
SYMBOL· RFin· = W3
Main:
· SERIN RX, T2400, #RFin ' Accept and view as character
· DEBUG "nodeInfo = ", #RFin, CR
· GOTO Main
· END
The "nodeInfo = " doesn't show up in the debug window.· The sensor nodes show everything in the debug window as desired.
Is the XBee not receiving the info properly?· One weird tidbit to add, the receiver XBee's RX LED does blink everytime the TX LED on the sensor node blinks.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen