What I’m trying to do is fairly simple - I want an arduino to be able to read the value of a resistor remotely (continuously and in real time). It seems that using an xbee (series 1) is the easiest way to do that, but I’m open to suggestions.
It looks like I should create a voltage divider from V+ to ground between a “dummy” resistor and the one I want to read, and then send Vout to an “analog in” pin (i.e. AD0) on the xbee (or use the integrated pull-up resistor for the voltage divider?). I’ll set that pin as an Analog to Digital Converter, then send that signal to another xbee, which will be read by the arduino. This arduino will run on it’s own, not hooked up to a computer.
I’ve been looking through the documentation but still have a few questions:
First, the xbee datasheet says “Minimum connections: VCC, GND, DOUT & DIN” on page 7. From the remote xbee all I want to send is an analog signal, which I have to attach to AD0, and it shouldn’t be receiving any data (which it needs to send anywhere, at least). What do I do with DOUT and DIN? why do they need to be connected to anything? How do I make it just send the data that’s coming from AD0? It looks like xbee’s were meant to interface with microprocessors - but I don’t want the expense/bulk/complexity if possible.
Writing to the xbee appears to be pretty simple - I just use an xbee explorer board (http://www.sparkfun.com/commerce/produc … ts_id=8687) to connect to my computer, install the drivers and run XCTU, make sure the BAUD rates are right and then connect to the xbee.
for the remote xbee:
+++ #Enter AT Command Mode
ATDL=1234 #set the 16-bit destination address (address of the other device)
ATMY=5678 #set the 16-bit local address (address of this device)
ATD0=2 #Set AD0 to the Analog/Digital Converter mode
ATIR=32 #Set read rate as 50ms (32 in hexadecimal = 50 in base 10).
ATIT=1 #Sets the buffer to hold only one data sample before sending
ATPR 4 #Enable pull-up resistor on AD0/Pin 20 (if this will work?)
ATWR #Write changes to non-volatile memory
ATCN #Exit command mode
for the Base xbee:
+++ #Enter AT Command Mode
ATDL=5678 #set the 16-bit destination address (address of the other device)
ATMY=1234 #set the 16-bit local address (address of this device)
ATP0=2 #sets pin 6 to output a PWM signal. (not sure if this is necessary)
ATIU=1 #sets I/O data received to be sent out UART as serial data
ATIA=5678 #binds the outputs to the module with MY=5678
ATWR #Write changes to non-volatile memory
ATCN #Exit command mode
On the arduino, it looks like I can get a header board that plugs the xbee into the arduino, or just use wire to connect DO to TX and DI to RX. Then within the arduino code I have while loop checking if serial data is available (Serial.available>0), and if it is, read it (IncomingByte=Serial.read() ), then process it and extract the info I want from the data stream. Alternatively, I could attach xbee pin 6 to an arduino PWM pin and read this signal, ignoring the serial data - if I don’t do this I think I don’t need the ATP0=2 command above, right?
Sources:
http://www.sparkfun.com/datasheets/Wire … asheet.pdf
http://www.instructables.com/id/Changin … tes/#step1