I have tried using the xbee pro series 1, and I have the same problem as the 900 hp. The can communicate in the x-ctu terminals, but anything else that I try that involves inputs and outputs does not work. I have tried the push button example on the digi website with my series 1 and It seems the module does receive the the digital input from the push button.
I think there may be an issue with my parallax usb boards because I am not able to do a loop back test anymore. the Din and Dout are always high. But I am able to power my xbees and communicate between them
When idle DIN/DOUT should normally rest high. This is the normal state of these pins when nothing is being sent/received. When data is being transmitted from the module the DOUT should toggle appropriately, however you won't see this with a DVM/DMM. You would ned a scope, logic analyzer of logic probe to actually see the data. If you suspect a problem it is probably we won't be able to really troubleshoot the module without having you send it in, with the exception of what we have already covered.
Yes, and to repost what I said before, that document that thread links to is not related to the 900HP, but rather the series 1 XBee. FYI
I will look into it today while experimenting with the 900HP in a real application demo, which up until now I hadn't the chance to work on.
Yes the line passing is for series one, I know that. Sry if I'm a bit all over the place now because I recieved the series one today and I am having similar problems as I di with the 900 hp. I'm thinking its a problem with the parallax usb boards.
Yes the line passing is for series one, I know that. Sry if I'm a bit all over the place now because I recieved the series one today and I am having similar problems as I di with the 900 hp. I'm thinking its a problem with the parallax usb boards.
I'm not aware of anyone else having such issues, so it may be a problem with your board.
it seems that I can't manage to get my BS2sx to communicate with my xbees. I have tried the basic stamp examples on (this is on the series 1 xbee module now) pages 44 and 46.
I managed to get the push button example to work so far.
also managed to do the analog line passing with a pot.
The BS2sx uses different timing for the SERIN/SEROUT commands than the BS2 does. You need to adjust these values according to the help files or BASIC Stamp Manual.
The BS2sx uses different timing for the SERIN/SEROUT commands than the BS2 does. You need to adjust these values according to the help files or BASIC Stamp Manual.
K thx, good to know that. Ill let you know how it works out.
There are example baud rates in the BASIC Stampl Manual and Help Files. These shows the baud rate parameter for a given baud rate for each model of BASIC Stamp Module. Which baud rate ar you using?
'' ********************************************************' Simple_Debug.bs2
' Sends data to Remote terminal for monitoring
' ********************************************************
' {$STAMP BS2sx}
' {$PBASIC 2.5}
' *************** Constants & PIN Declarations ***********
#SELECT $STAMP
#CASE BS2, BS2E, BS2PE
T9600 CON 84
#CASE BS2SX, BS2P
T9600 CON 240
#CASE BS2PX
T9600 CON 396
#ENDSELECT
Baud CON T9600
Rx PIN 15 ' XBee DOUT - Not used in this example
Tx PIN 14 ' XBee DIN
RTS PIN 11 ' XBee RTS - Not used in this example
' ************** Variable Declarations ******************
Counter VAR Byte
' ************** Main LOOP ******************************
PAUSE 500 ' 1/2 second pause to stabilize comms
SEROUT Tx, Baud, [CLS,"Program Running...",CR]
PAUSE 2000 ' Pause before counting
FOR Counter = 1 TO 20 ' Count and display remotely
SEROUT Tx, Baud, ["Counter = ", DEC Counter, CR]
PAUSE 100
NEXT
SEROUT Tx, Baud, ["Loop complete.",CR]
END
This is the example that I was talking about, if you were talking about timing and baud rates, I believe it is taken care of in the constant & declarations section.
I am probably doing something wrong with the Basic stamp examples, but I managed to transmit serial data through the xbee with Din/Dout and display temperature on my serial LCD.
Yes, but if I am not mistaken that was posted after you solved the issue. When you first mentioned the code not running on the BS2sx I had to guess that it was a baud rate parameter issue because there was no code to verify. I'm trying to help you in future requests for help so that your problems are solved quicker.
Sry Ill try to be as clear as possible with what issues that I am trying to solve
***New issue
I am trying to send clock pulses from the BS2sx through a series 1 xbee pro to a SHt11 sensor and send back the data through the xbee to be read by the BS2sx so I can display the data on a LCD.
I have also gotten the sensor to work directly with the SHT 11, so it should not a program problem.
I have managed to do digital and serial line passing with different set ups.
Settings for Xbees
* anything not listed is default.
On the base side
My clock signal is being sent from pin 2 to IO 0
and
Recieve serial signal from Dout
on the remote Xbee I send out the clock to the sensor from IO 0.
and the SHT 11 should send back a serial signal
Using xbee usb adapter (5V inputs are not an issue) .
Base xbee (powered by 5V from the NX1000 stamp works experiment board):
ch: F
Pan ID: 1238
DL:FFFF
IO 0: 3 (digital in)
IC:10
sample rate:3E8
Remote Xbee (USB powered and in turn it powers the SHT11 from VCC (3.3V)):
Ch: F
Pan ID: 1238
IO 0: 4 (out low)
-IO line
IO input adress: FFFF.
The Clock is on/off, so I believe it should be fine to use digital input,
Then It should work to send the data through UART back to the BS2sx.
The Blue Light on the base does not turn on, meaning that there is not data being received from the remote xbee. Not sure if the remote xbee is receiving the Clock data.
Yes, attach the code you are using and tell us how SHT11 is connected (are you using a breakout board or a raw SHT11
Y I am using the sht11 from parallax,
D0 is the clock (going to pin 3)
and
Din is connected to Data (pin 1)
VCC is connected to pin 8 for power
pin 4 goes to ground.
This the code, I adapted it for one sht 11 sensor
' {$STAMP BS2sx}' {$PBASIC 2.5}
' -----[ Program Description ]---------------------------------------------
' SHT11 monitoring through Xbee
'------[changes]-----------------------------------------------
'------[Xbee Notes]---------------------------------------------------------
' Serial data from basic stamp to Xbee 1 Din , comes out as Dout from Xbee 2
' Pin 0 ---> Din (pin 4 on Parallax usb adapter board)
'Power LCD with 5V
' Clock pin set up from stamp to Xbee 1
' Pin 2 ---> I/O 0
'
'
' I/O ouotput on xbee 2 go to pin 3 (CLK)
' -----[ I/O Definitions ]-------------------------------------------------
'**** data pin 9, sens 6, clk pin 7, button pin 8
'sensor
TX PIN 0 ' serial output to LCD
Shtdata PIN 9 'SHT11 data line
' -----[ Constants ]-------------------------------------------------------
'Sensor
ShtTemp CON %00011 ' read temperature
ShtHumi CON %00101 ' read humidity
ShtStatW CON %00110 ' status register write
ShtStatR CON %00111 ' status register read
ShtReset CON %11110 ' soft reset
Ack CON 0
NoAck CON 1
No CON 0
Yes CON 1
DegSym CON 186 ' degrees symbol for DEBUG
'***************
'LCD
#SELECT $STAMP
#CASE BS2, BS2E, BS2PE
T2400 CON 396
T9600 CON 84
T19K2 CON 32
#CASE BS2SX, BS2P
T2400 CON 1021
T9600 CON 240
T19K2 CON 110
#ENDSELECT
' Commands/constants
LcdBaud CON T9600
LcdBkSpc CON $08 ' move cursor left
LcdRt CON $09 ' move cursor right
LcdMid CON $88 'Move to midle
Lcdend0 CON $8F 'End of line one
LcdLF CON $0A ' move cursor down 1 line
LcdCls CON $0C ' clear LCD (use PAUSE 5 after)
LcdCR CON $0D ' move pos 0 of next line
LcdBLon CON $11 ' backlight on
LcdBLoff CON $12 ' backlight off
LcdOff CON $15 ' LCD off
LcdOn1 CON $16 ' LCD on; cursor off, blink off
LcdOn2 CON $17 ' LCD on; cursor off, blink on
LcdOn3 CON $18 ' LCD on; cursor on, blink off
LcdOn4 CON $19 ' LCD on; cursor on, blink on
LcdLine1 CON $80 ' move to line 1, column 0
LcdLine2 CON $94 ' move to line 2, column 0
'custom character, only degree celcius **** degree symbol does not work
LcdCC0 CON $F8 ' define custom char 0 does not work
'****************
' -----[ Variables ]-- -----------------------------------------------------
'Sensor
'*******clock VAR Byte
Cdata VAR Word
Hdata VAR Word
Clock VAR Byte ' sensor data for clock switch
SenscntD VAR Nib' automatic counter / for loop
'PIN_symbol VAR Byte
senscnt VAR Nib ' counts button presses intended for selection of data for display
old VAR Bit ' for counter/switch sensor senscnt
new VAR Bit ' for counter/switch sensor senscnt
ioByte VAR Byte ' data from/to SHT11
ackBit VAR Bit ' ack/nak from/to SHT11
toDelay VAR Byte ' timeout delay timer
timeOut VAR Bit ' timeout status
soT VAR Word ' temp counts from SHT11
tC VAR Word ' temp - Celcius
tF VAR Word ' temp - Fahrenheit
soRH VAR Word ' humidity counts
rhLin VAR Word ' humidity; linearized
rhTrue VAR Word ' humidity; compensated
status VAR Byte ' status byte
'custom characters, EEPROM
CC0 DATA LcdCC0,$0C, $12, $12, $0C, $00, $00, $00, $00
' -----[ Initialization ]--------------------------------------------------
'Sensor
GOSUB SHT_Connection_Reset ' reset device connection
PAUSE 250 ' let DEBUG window open
'DEBUG CLS,
'"SHT11 Sensor count", CR,
'"-----------------", CR
'LCD
Reset:
HIGH TX ' setup serial output pin
PAUSE 100 ' allow LCD to initialize
' -----[ Program Code ]----------------------------------------------------
Main:
GOSUB sensor_select
GOSUB DataColect
GOSUB Getdata
GOTO Main ' do it again
' -----[ Subroutines ]-----------------------------------------------------
' sensor select ************************************************************select****
sensor_select:
old = new
RETURN
'****data collection ****************************
DataColect:
'sens 0
Clock = 2
GOSUB SHT_Measure_Temp
GOSUB SHT_Measure_Humidity
PUT 0,Word Tc, Word rhTrue
Clock = 3
GOTO Getdata
' -----------------------------------------------------------------------------------------------------------------
'Get Tc and rhline data/ temperature and humidity , through sensor selct. Choose the data required.
Getdata:
' get data is created to send data to lcd, create Cdata and Hdata
GET 0, Word Cdata, Word Hdata
SEROUT TX, LCDBaud, [ LCDCls]
PAUSE 5
SEROUT TX, LCDBaud, ["Addr:", DEC( senscnt), LCDMid, DEC (Cdata / 10), ".", DEC1 Cdata,"C",LCDLine2, "Humidity:",DEC(Hdata/10 ), ".", DEC1 Hdata,"%"] 'shows on screen
PAUSE 1000
RETURN
'---------------------------------------------------------------------
' connection reset: 9 clock cyles with ShtData high, then start sequence
'**************************************************** shift
SHT_Connection_Reset:
SHIFTOUT ShtData, Clock, LSBFIRST, [$FFF\9]
' generates SHT11 "start" sequence
' _____ _____
' ShtData |_______|
' ___ ___
' Clock ___| |___| |___
'
SHT_Start:
INPUT ShtData ' let pull-up take high
LOW Clock
HIGH Clock
LOW ShtData
LOW Clock
HIGH Clock
INPUT ShtData
LOW Clock
RETURN
' measure temperature
' -- celcius = raw * 0.01 - 40
' -- fahrenheit = raw * 0.018 - 40
'
SHT_Measure_Temp:
GOSUB SHT_Start ' alert device
ioByte = ShtTemp ' temperature command
GOSUB SHT_Write_Byte ' send command
GOSUB SHT_Wait ' wait for measurement
ackBit = Ack ' another read follows
GOSUB SHT_Read_Byte ' get MSB
soT.HIGHBYTE = ioByte
ackBit = NoAck ' last read
GOSUB SHT_Read_Byte ' get LSB
soT.LOWBYTE = ioByte
' Note: Conversion factors are multiplied by 10 to return the
' temperature values in tenths of degrees
tC = soT ** $1999 - 400 ' convert to tenths C
tF = soT ** $2E14 - 400 ' convert to tenths F
RETURN
' measure humidity
'
SHT_Measure_Humidity:
GOSUB SHT_Start ' alert device
ioByte = ShtHumi ' humidity command
GOSUB SHT_Write_Byte ' send command
GOSUB SHT_Wait ' wait for measurement
ackBit = Ack ' another read follows
GOSUB SHT_Read_Byte ' get MSB
soRH.HIGHBYTE = ioByte
ackBit = NoAck ' last read
GOSUB SHT_Read_Byte ' get LSB
soRH.LOWBYTE = ioByte
' linearize humidity
' rhLin = (soRH * 0.0405) - (soRH^2 * 0.0000028) - 4
'
' for the BASIC Stamp:
' rhLin = (soRH * 0.0405) - (soRH * 0.002 * soRH * 0.0014) - 4
'
' Conversion factors are multiplied by 10 to return tenths
'
rhLin = (soRH ** $67AE) - (soRH ** $83 * soRH ** $5B) - 40
' temperature compensated humidity
' rhTrue = (tc - 25) * (soRH * 0.00008 + 0.01) + rhLin
'
' Conversion factors are multiplied by 10 to return tenths
' -- simplified
'
rhTrue = (tC - 250) * (soRH ** $34) + rhLin
RETURN
' sends "status"
'------------------------------------------------------------------------------------
SHT_Write_Status:
GOSUB SHT_Start ' alert device
ioByte = ShtStatW ' write to status reg cmd
GOSUB SHT_Write_Byte ' send command
ioByte = status
GOSUB SHT_Write_Byte
RETURN
' returns "status"
'
SHT_Read_Status:
GOSUB SHT_Start ' alert device
ioByte = ShtStatW ' write to status reg cmd
GOSUB SHT_Read_Byte ' send command
ackBit = NoAck ' only one byte to read
GOSUB SHT_Read_Byte
RETURN
' sends "ioByte"
' returns "ackBit"
'****************************************************************shift
SHT_Write_Byte:
SHIFTOUT Shtdata, Clock, MSBFIRST, [ioByte] ' send byte
SHIFTIN Shtdata, Clock, LSBPRE, [ackBit\1] ' get ack bit
RETURN
' returns "ioByte"
' sends "ackBit"
' *****************************************************************shift
SHT_Read_Byte:
SHIFTIN ShtData, Clock, MSBPRE, [ioByte] ' get byte
SHIFTOUT ShtData, Clock, LSBFIRST, [ackBit\1] ' send ack bit
INPUT ShtData ' release data line
RETURN
' wait for device to finish measurement (pulls data line low)
' -- timeout after ~1/4 second
'
SHT_Wait:
INPUT ShtData ' data line is input
timeOut = No ' assume no timeout
FOR toDelay = 1 TO 250 ' wait ~1/4 second
IF (ShtData = 0) THEN EXIT
PAUSE 1
NEXT
IF (toDelay = 250) THEN timeOut = Yes ' loop completed = timeout
RETURN
'------------------------------------------------------------------------------
' reset SHT11/15 with soft reset
'
SHT_Soft_Reset:
GOSUB SHT_Connection_Reset ' reset the connection
ioByte = ShtReset ' reset command
ackBit = NoAck ' only one byte to send
GOSUB SHT_Write_Byte ' send it
PAUSE 11 ' wait at least 11 ms
RETURN
I program the xbees with the usb and not using commands from the BS2sx.
Do you think the 2nd xbee is not sending back data over uart because it is always receiving data from the first Xbee?
XBee digital line passing is meant for relatively slow changes, whereas the Stamp SHIFT commands toggle those pins at around 16 kHz. You are counting on the XBee to keep up with that -- I'm skeptical. Figure, the XBee has to form and transmit a packet and also decode it on the other end. And the first try might not get thru and it will have to do one or more delay and retry. It does happen in the blink of an eye, but, 16 kHz??
You might have to bitbang a SHIFT driver that runs at a lower rate, how low, I don't see an answer to that.
XBee digital line passing is meant for relatively slow changes, whereas the Stamp SHIFT commands toggle those pins at around 16 kHz. You are counting on the XBee to keep up with that -- I'm skeptical. Figure, the XBee has to form and transmit a packet and also decode it on the other end. And the first try might not get thru and it will have to do one or more delay and retry. It does happen in the blink of an eye, but, 16 kHz??
You might have to bitbang a SHIFT driver that runs at a lower rate, how low, I don't see an answer to that.
Ok, does that mean it is not possible to send a clock signal through the xbee?
I found this blog where a guy was able to. SHT11 with Xbee, but he did it with a different micro controller
I'm sorry but your statement isn't entirely accurate. What you're describing isn't what the other guy did. You're trying to send the pulses directly from the SHT11 through the XBee but in the project you linked those pulses are being read by at ATMega MCU and the data sent serially over the XBee, which is how it should be done. You can certainly do that, but it will require a microcontroller on both ends.
Ok, does that mean it is not possible to send a clock signal through the xbee?
It means that the clock signal has to be slow. How slow? It might be 10 bits per second. I don't know. I don't see a figure in the data sheet or app notes about how fast one could expect to update the remote signal lines in an XBee digital line-passing system. Can you rig up a test and let us know your results? Start with one update per second and speed it up by factors of two until it conks out. I'd expect the accuracy to depend somewhat on distance and interference, always chance of missed bits.
So I used a pulse generator because I don't know how to bitbang the shift. I put 1Hz to 1 KHz through and tested it with an LED. At 1 Hz the LEd flashes normally as if it was straight from the generator. But at 100Hz and 1kHz, the LED is not supposed to flash, and the pulse that I put through the Xbees to the LED flashes. IM going to trying 16MHz again just to see what it does.
I just realiazed the CLK from the stamp is a serial communication, so what I have been trying to do will not work.
Solution would be to to have 2 basic stamps, one remote with the sensors and the other local with an LCD display & alarm.
Comments
Yes, and to repost what I said before, that document that thread links to is not related to the 900HP, but rather the series 1 XBee. FYI
I will look into it today while experimenting with the 900HP in a real application demo, which up until now I hadn't the chance to work on.
When idle DIN/DOUT should normally rest high. This is the normal state of these pins when nothing is being sent/received. When data is being transmitted from the module the DOUT should toggle appropriately, however you won't see this with a DVM/DMM. You would ned a scope, logic analyzer of logic probe to actually see the data. If you suspect a problem it is probably we won't be able to really troubleshoot the module without having you send it in, with the exception of what we have already covered.
:blank:Just a bit frustrated that I havnt gotten the series 1 or the 900 hp to work during the 2 weeks or so that have had them
Yes the line passing is for series one, I know that. Sry if I'm a bit all over the place now because I recieved the series one today and I am having similar problems as I di with the 900 hp. I'm thinking its a problem with the parallax usb boards.
I'm not aware of anyone else having such issues, so it may be a problem with your board.
I managed to get the push button example to work so far.
also managed to do the analog line passing with a pot.
K thx, good to know that. Ill let you know how it works out.
I am unsure of what I require to use. I see that there is pace and Timeout. Do I use timeout to slow down the message to the speed of the BS2?
This is the example that I was talking about, if you were talking about timing and baud rates, I believe it is taken care of in the constant & declarations section.
But I did post the code just 2 posts up.
***New issue
I am trying to send clock pulses from the BS2sx through a series 1 xbee pro to a SHt11 sensor and send back the data through the xbee to be read by the BS2sx so I can display the data on a LCD.
I have also gotten the sensor to work directly with the SHT 11, so it should not a program problem.
I have managed to do digital and serial line passing with different set ups.
Settings for Xbees
* anything not listed is default.
On the base side
My clock signal is being sent from pin 2 to IO 0
and
Recieve serial signal from Dout
on the remote Xbee I send out the clock to the sensor from IO 0.
and the SHT 11 should send back a serial signal
Using xbee usb adapter (5V inputs are not an issue) .
Base xbee (powered by 5V from the NX1000 stamp works experiment board):
ch: F
Pan ID: 1238
DL:FFFF
IO 0: 3 (digital in)
IC:10
sample rate:3E8
Remote Xbee (USB powered and in turn it powers the SHT11 from VCC (3.3V)):
Ch: F
Pan ID: 1238
IO 0: 4 (out low)
-IO line
IO input adress: FFFF.
The Clock is on/off, so I believe it should be fine to use digital input,
Then It should work to send the data through UART back to the BS2sx.
The Blue Light on the base does not turn on, meaning that there is not data being received from the remote xbee. Not sure if the remote xbee is receiving the Clock data.
In theory it should work. Any Ideas?
Y I am using the sht11 from parallax,
D0 is the clock (going to pin 3)
and
Din is connected to Data (pin 1)
VCC is connected to pin 8 for power
pin 4 goes to ground.
This the code, I adapted it for one sht 11 sensor
I program the xbees with the usb and not using commands from the BS2sx.
Do you think the 2nd xbee is not sending back data over uart because it is always receiving data from the first Xbee?
You might have to bitbang a SHIFT driver that runs at a lower rate, how low, I don't see an answer to that.
SHT11 with Xbee, but he did it with a different micro controller
Ok, does that mean it is not possible to send a clock signal through the xbee?
I'm sorry but your statement isn't entirely accurate. What you're describing isn't what the other guy did. You're trying to send the pulses directly from the SHT11 through the XBee but in the project you linked those pulses are being read by at ATMega MCU and the data sent serially over the XBee, which is how it should be done. You can certainly do that, but it will require a microcontroller on both ends.
It means that the clock signal has to be slow. How slow? It might be 10 bits per second. I don't know. I don't see a figure in the data sheet or app notes about how fast one could expect to update the remote signal lines in an XBee digital line-passing system. Can you rig up a test and let us know your results? Start with one update per second and speed it up by factors of two until it conks out. I'd expect the accuracy to depend somewhat on distance and interference, always chance of missed bits.
Would it work if I used analog line passing instead of digital or would there be a similar issue.
I just realiazed the CLK from the stamp is a serial communication, so what I have been trying to do will not work.
Solution would be to to have 2 basic stamps, one remote with the sensors and the other local with an LCD display & alarm.