SparkFun Forums 

Where electronics enthusiasts find answers.

All things pertaining to wireless and RF links
By hamduino
#161807
I need to get a remote temperature sensor (Dallas DS18B20) working with XBee S2 and Arduino--with BATTERY POWER! How should I use sleep modes? The Arduino can sleep. So can the XBee. Pin sleep? Cycle sleep? How do you do that? Should the Arduino wake up the XBee? Or the other way around?

I'm new to Arduino and XBee, but have some C background. I have successfully set up S2 XBee coordinator (at PC) and arduino-XBee (router) to send 2 way serial. The router is out by the pool controller, set to trip on or off the pool controller's pump/heater relay (hacked into a commercial pool controller board) depending on the pool temperature (one-wire waterproof Dallas unit DS18B20). It works...

But for safety reasons I want the temperature sensor SEPARATE from the main pool controller. So I'll get another arduino/XBee unit and run it off a battery, if I can get the battery drain reasonable. As long as the battery doesn't need replacement too often, I'll be satisfied. What I need to do is find a way to have the pool temperature sensor endpoint sleep and then wake up for a moment every, say, 15 minutes (maybe a low-drain timer? a 555?) and send a few temperature readings, then hibernate again.

I figure this must be a basic practice for wireless remote projects, yes? Could someone please post a link to an instructive example?

Thanks!
By UNTEngineer
#161852
If you want to use a timer, then you dont need the Arduino. Instead, you can reprogram the XBee uC for the data acquisition, sleep modes and power on with an interrupt.

If you dont want to go that route, and you want to work with an Arduino, I suggest looking at the Arduino Fio. If all you are doing is reading temps, then a battery with low power or sleep modes enabled can last in the months.

I have to ask, which XBee will you be using?
By hamduino
#161972
I'm using the S2 XBees. Programmed with XBee explorer, and the SainSmart XBee shield at the the pool controller. Currently the temperature sensor is hardwired to the Arduino/Xbee shield, as router. The XBee coordinaor is on the Xbee Explorer and connect USB to the PC in the house.

I notice 3 odd behaviors:

1) the serial feed to the PC Xbee (using X-CTU terminal) shows each received line with a leading "."
2) the Arduino sketch does not recognize ascii "10" as a newline. neither does "\n" work. So I'm defining another character as an end-of-string delimiter (I'm using "/")
3) I don't receive serial data over the wireless link at the XBee/PC, and the Arduino/XBee doesn't receive characters sent from the PC/XBee, unless I do the following:
A) momentarily move the XBee shield jumpers from "XBee" to "USB" position and then back to "XBee" position, and then
B) press the RESET button on the Arduino Uno.

Has anyone seen this sort of thing? Is there a workaround?
By waltr
#161999
1) A '.' indicates an 8bit value that is not printable ASCII (google to learn the ASCII codes). So have X-CTU display the HEX value of receiver data to see what the value of the byte is.
2&3) are Arduino questions that I don't know to answers to.
By waltr
#162057
0x0A (10 decimal) is an ASCII 'line feed' character.
Where is the data coming from that you are seeing in X-CTU?

2) if the Arduino code doesn't recognize a 'line feed' character then change to the so it does.