XBee transmitting own and remote data?

Hi all,

A very basic question, I suspect:

I have two XBee modules set up. One has an analog sensor attached to AD0, and transmits to the second, ‘base’ XBee, with IU enabled, which sends the data received to an XPort, which sends it on as UDP packets. This is all working ok.

I’ve now attached another analog sensor to the base XBee, again to pin AD0, in the hope that the XBee can transmit data from both the remote and the local sensor. Currently I’m getting nothing from the new sensor, and I think I need to do something with pin P0. Is this vaguely right, or is what I’m trying to do not even possible?

If the remote XBee is sending analog data from its pin AD0 to the base XBee, then isn’t the base XBee receiving those data through its pin AD0? If that’s the case, it cannot also be used for another sensor.

Even if you weren’t looking for remote data on that pin, I don’t think that it’s possible to send an analog signal into an XBee pin and expect the XBee to send a digital version out its UART (which is, I assume, what you were hoping would happen when you enabled IU). The UART enable is what makes the XBee send out its UART data that it receives through RF (that is, from another module). That’s very different from reading its own pins and sending those data out through the UART.

If you’re just trying to send the analog data collected at the base station out through the XPort, why connect it to the XBee at all? Have the analog data go through an ADC, into your processor, and out to the XPort that way.

If you haven’t seen this, you should take a look, though it doesn’t directly address what you’re asking here:

http://www.faludi.com/2006/12/03/xbee-d … -with-adc/

sylvie369:
If the remote XBee is sending analog data from its pin AD0 to the base XBee, then isn’t the base XBee receiving those data through its pin AD0? If that’s the case, it cannot also be used for another sensor.

Ok, I’m confused (you may have already realised that :slight_smile: ) I thought the input pins would only receive data from things physically connected to them, and thus pin AD0 wasn’t involved in the path of the remote data?

Could I enable a second analog pin for the local data? I’m guessing not, in view of your next point:

sylvie369:
Even if you weren’t looking for remote data on that pin, I don’t think that it’s possible to send an analog signal into an XBee pin and expect the XBee to send a digital version out its UART (which is, I assume, what you were hoping would happen when you enabled IU). The UART enable is what makes the XBee send out its UART data that it receives through RF (that is, from another module). That’s very different from reading its own pins and sending those data out through the UART.

So could the local data be sent to the UART in another format? PWM?

sylvie369:
If you’re just trying to send the analog data collected at the base station out through the XPort, why connect it to the XBee at all? Have the analog data go through an ADC, into your processor, and out to the XPort that way.

Yes, that was my original thought, but being a novice at this stuff, I’ve no idea where to start looking for a suitable ADC. (My knowledge currently consists of what I’ve read in the Tom Igoe book.)

sylvie369:
If you haven’t seen this, you should take a look, though it doesn’t directly address what you’re asking here:

http://www.faludi.com/2006/12/03/xbee-d … -with-adc/

Thanks, I’m having a look.

And thanks for your help.

I’m not sure how you’re sending the data from one XBee to another. I assumed - maybe too hastily - that you were using “line passing” (as described in that link I sent along). When you do that, the pins on the receiving XBee are (amazingly enough) receiving data from the corresponding pins on the transmitting XBee. If you get a chance, set up that little system on the faludi site that I sent - you’ll be amazed. These XBees are pure magic.

Are you using line passing, or are you sending the analog data in packets as described by the section in the XBee manual on “I/O Data Format” (section 2.2.1 of the version of the manual I’m using - yours may be different)? If you’re sending them that way, then the pin on the receiver is NOT tied in any way to the corresponding pin on the transmitter. But you still can’t use it as a plain old ADC.

When you ask if the local data could be sent to the UART in a different format (e.g., PWM), the answer is “no”. The IU command exists so that you can turn off the sending through the UART of data that come in through the “line passing” setup. Here’s why you might want to do that: I have a system that reads data coming in through the DIN pin from a serial device, and transmits those data. I also want to read the state of two of the digital I/O pins and have those statuses (on-off) reflected in the statuses of the two corresponding pins on the receiving module - but I do NOT want those data sent out through the UART on the receiver, because they’d mix up together with the received serial data and I’d have to write code to parse the data. So I turned IU off, so the data from the serial device are all that are sent from the XBee’s UART to my processor, and the processor reads the status of the two digital I/O pins separately, as though they were just on-off switches.

Re. local ADC, what processor are you using? An Arduino has 10-bit ADC built in, and it works fine. If you’re using a processor without ADC lines, you have a LOT of options for ADC, and they’re generally pretty inexpensive and easy to set up. You need to pay attention to the number of bits, which determines the “step”, or resolution, as well as to the voltages. You’ll want to match the rest of your setup. You can get multi-channel ADC chips for almost the same price as single-channel ones, so if you think you might expand, consider that. Different ADC chips have different interfaces to the processor: I2C is probably the most common, and is pretty straightforward.

Given what it sounds like you’re trying to do, I think your best bet is to look at ADC chips and set something up with that. It will mean a couple of additional parts, but it’ll be quite inexpensive (maybe an additional $6 on your project budget), give you some flexibility, and it will certainly work.

If you’re able to read analog data to an XBee, transmit those data to another XBee, and then send them out an XPort as UDP data, you’re not exactly a pure novice - that’s a pretty good feat. I’d love to learn from you about using the XPort. I’ve got a couple of them, but really haven’t done anything with them yet.

IainM:
Hi all,

A very basic question, I suspect:

I have two XBee modules set up.

Which XBee hardware and firmware versions do you have. There are subtle but important differences among the various XBees.

Some can do line passing, some can use the analog inputs on the “base” unit but not all.

sylvie369:
Are you using line passing, or are you sending the analog data in packets as described by the section in the XBee manual on “I/O Data Format” (section 2.2.1 of the version of the manual I’m using - yours may be different)?

I’m doing the latter - well I think so! What I’m actually doing is pretty much as described in ch.7 of ‘Making Things Talk’. The sensor XBee’s settings are:

MY - 1

DL - FFFF

D0 - 2

IR - 64

IT - 5

and the base XBee’s:

MY - 2

DL - 1 (but irrelevant)

IU - 1

The only major difference from the book example is that instead of a PHP script pulling the data from the XPort, I have the XPort push it to a server where a PHP script does the parsing.

(And now you force me to think about it, I’m not exactly clear about the format of the data as it passes through the XBees.)

In my experimental adding of a sensor to the base unit, I simply set D0, IT and IR to the same values as the sensor unit’s

sylvie369:
If you’re sending them that way, then the pin on the receiver is NOT tied in any way to the corresponding pin on the transmitter. But you still can’t use it as a plain old ADC.

Sorry for being so obtuse here, but I still don’t understand why not. Isn’t that what the Dn=2 setting is for?

sylvie369:
Re. local ADC, what processor are you using?

Just the XBee’s own ADC.

sylvie369:
If you’re able to read analog data to an XBee, transmit those data to another XBee, and then send them out an XPort as UDP data, you’re not exactly a pure novice - that’s a pretty good feat. I’d love to learn from you about using the XPort. I’ve got a couple of them, but really haven’t done anything with them yet.

Actually I’ve found the I/O on the XPort one of the more confusing things about it, and that’s one more reason why I’ve been trying to use the XBees as much as possible. The XPort has (IIRC) 3 GPIO pins (general-purpose I/O), but I’ve not really got far with the documentation.

Thanks again for your advice - it’s all being saved for reference.

Okay, I have “Making Things Talk” sitting right here, so I can see what you’re doing. Take a look at the very last paragraph on page 231. It ends with

“in other words, the monkey radio’s PWM0 output will be linked to the sensor radio’s analog input”.

That’s just like what is happening in that Faludi site I sent you: the XBee radios are linked so that the voltage on the transmitting XBee’s pin D0 is mimicked on the receiving XBee’s pin P0. You should be able to put a voltmeter on pin P0 of the receiver (with the other lead on the radio’s ground) and see changes in the voltage that reflect the changes in the D0 analog input from the sensor on the transmitting radio. You ARE using line passing.

On page 234 you’ll see the circuit for that receiving radio: it is set up so that the voltage coming out of pin P0 controls the monkey’s motor. It’s being used really just as an on/off switch, with the sensitivity controlled by that potentiometer, but it’s an analog output that matches the analog input to the pin D0 from the sensor on the transmitting radio.

You asked what the Dn=2 setting is for. That setting tells the transmitting XBee to treat that pin (D0, in this case) as an analog input (as you already knew). That tells the XBee to read the voltage on that pin, and convert it to a digital number, and transmit it by radio. It does NOT send that number out through the transmitting radio’s UART, which is what you’re wishing for, I think. It takes the number and transmits it as a radio signal.

Notice that you didn’t have to set IU to 1 on the transmitting radio, only on the receiving one. The digital representation of the analog voltage WILL be sent out the receiver’s UART, because you set IU=1 on that radio. On the transmitting one, it won’t be sent out the UART no matter what you do.

When you set D0=2 on the transmitting radio, you simply told that radio to do the ADC conversion on inputs to that pin, and send the result out by radio.

Your original question was about attaching another sensor to the base station, and transmitting those data. Where were you expecting to transmit them to? I’m not quite following what your goal here was (unless it’s just to learn how to use these things).

If you wanted it to send those data out to the other XBee (the one currently used as your remote), that might be possible. You’d connect the sensor to pin D1 on the XBee you’re planning to send from, and read the corresponding voltage on pin P1 (PWM1) on the receiving (Remote) XBee. Now, I haven’t carefully looked through the settings to be certain that you can do that. Remember that you also have to set some registers to tie one XBee’s output to the input of the other one, and I’m not sure you can do that bi-directionally at the same time.

As for confusion re. the XPort, if you have PHP scripts running properly, you’re a big step ahead of me. All of that web stuff confuses me, and I’ve put it aside for the time being.

Many thanks for that last post - I had several lightbulb moments while reading it!

And I should have explained that I didn’t include the ‘monkey radio’ part of the project in my own version, since I’m mainly interested in simply getting sensor data to a server, so I hadn’t implemented line passing (well, I’d read the Igoe description but not really registered it).

You asked where I wanted to send the base station’s sensor data: it would just go to the server along with the other data. But actually it’s not essential to what I’m doing; it just seemed as though it should be possible, and made me realise I didn’t really understand what I was doing. That’s now less true than it was :slight_smile:

Anyway, thanks again. Light at the end of the tunnel…

waltr:
Which XBee hardware and firmware versions do you have. There are subtle but important differences among the various XBees.

Some can do line passing, some can use the analog inputs on the “base” unit but not all.

Hi,

they’re the series 1 802.15.4 units - model XB24-AWI-001, with firmware 10CD.