Could someone tell me how to receive data from XBee series 1 on Arduino Leonardo ? (Sorry I may aslo put this topic on arduino project section)I can receive any data from my xbee transmitter which is connected with a potentiometer, and totally get lost... Any correction on my code would be sincerely appreciated.

two Xbees are well configured using X-CTU software (from digiKey) and has been tested without using leonardo. Right now I have my xbee receiver connected to leonardo through xbee shield. I would like to use a code to achieve voltage readout from my potentiometer which is connected with my xbee transimtter. Potentiometer voltage signal sends to DIO pin in xbee transmitter. 3.3V DC power is supplied to both Xbee trasmitter and potentiomter. And 3.3V pin and RES on my xbee transmitter has been wired together.

I followed the advice from this thread ( http://arduino.cc/forum/index.php/topic,114936.0.html). physically connect a 100uF capacitor (monolithic type, no polarity issue involved) the 3.3v pin and RES on my xbee receiver (which is what they call the shield's xbee) and run a IDE code looking like below:

Somehow, I doubt that the suggestion that you have some patience is going to be appreciated. Bumping a thread after 4 hours is silly.

Quote

Let me know what I should do next.

That really depends on what you want to do. What is it you want to do?

Why are you echoing everything that the transmitter receives? If there is any reason for the sender to be sending the data, you should be reading it and doing something about it. Those first 6 lines in loop() are fine for determining that the XBee is configured properly. Once you know that they are, delete them.

Thanks alot. As a newbie here, I will definitely take your advice to be a little more patient.

What I try to do right now is to try read out voltage signal from my potentiometer. As mentioned previously, my pot is attached to a Xbee transmitter. I want to use the xbee communication system and arduino leonardo to readout the voltage. If I can make it work, what I want to do next is to use the xbee and arduino system to achieve remote mouse control.

Just make sure if I did it right:

1. Do I need to physically connect or solder a 100uF capacitor between 3.3V and RES at the Shield's Xbee (Xbee receiver)?

Just want to update what I have done. I removed the capacitor from the Xbee receiver (on Xbee shield) and switch the Xbee shield from Dline back to UART. And run the following code. I start to receive some thing from my serial monitor on IDE software. But apparently that is not voltage value.

If the sender is sending ASCII data, why are you using Serial.write() to echo it back out? Serial.write() is for sending binary data.

More importantly, though, why are you printing unidentified stuff to the Serial port? Everything printed to the serial port should have some kind of identification associated with it, so you can KNOW what was printed.

It looks, though, like the baud rate of the serial monitor does not match the baud rate of the sketch, or the two XBees are not using the same baud rate.

Thanks a lot. Feel grateful to you for always providing constructive suggestion technically and morally. As you pointed out, the voltage singal I would like to deliver from one-to one Xbee communication system should be ASCII type data, I modified my code.

Just made a change as you recommened. The seria monitor shows the following. It looks a little familiar to me. I once used a matlab code to parse out the actual data information. But in arduino code, do I still need to parse? Essentially, i want to use the voltage signal to achieve remote control of PC mouse.

The output you are showing does not make sense. The values should be the ASCII codes for the numbers in the float being sent, so most of them should be in the range 48 to 57, with 10, 13 and the value for the decimal point in there, too.

The potentiometer is providing the voltage that the xbee sender is measuring. The voltage signal goes to the Pin DIO0 on the Xbee sender.

How is that voltage going to be useful for moving a mouse?

I once did a little project that follows the example on the arduino website. By phyiscally connecting a potentiometer signal line to pin A0 on Arduino leonardo board. I can achieve the mouse control by controlling the voltage of potentiometer. I try to see if I can do it remotely by sending the voltage through the xbee wireless system to still control the mouse.

The output you are showing does not make sense. The values should be the ASCII codes for the numbers in the float being sent, so most of them should be in the range 48 to 57, with 10, 13 and the value for the decimal point in there, too.

Should I use analogread() or any other syntax to make the serial data back to ASCII codes?

But, the Arduino doesn't know anything about stuff attached to the XBee. If you are not going to use an Arduino on the sending end, you need to use API mode and Andrew Rapp's XBee library on the receiver.

It would be a difficult process for me to grasp API in a short time. The reason i didnt group leonardo with the sender side of Xbee is because I want to have the sender size as simple and small in terms of volume as possible. I have read some API informtion on Xbee manual and not quite understand so far. What I need to do is only to have some way to convert the serial data to voltage value (recognized by Leonardo) and then control the mouse.

What I need to do is only to have some way to convert the serial data to voltage value (recognized by Leonardo) and then control the mouse.

The sender code you showed initially was for an Arduino. The Arduino is reading data from an analog pin, converting that to a voltage value, and sending the value as a string.

Now, you say that the sensor is connected to the XBee's digital pin, not the Arduino. So, what the Arduino is reading is noise. Surely, you don't want to move your mouse based on noise.

It's time for you to post a schematic showing what is connected to what on the sending end.

If the analog sensor is really connected to a digital pin on the XBee, then there is no way in hell you are going to get or send good data from it.

If the sensor is connected to an analog pin on the XBee, AND the XBee is configured to read and send that pin's data, then on the receiver you must use API mode, no matter how hard it is, because API mode is the ONLY way that the XBee sends digital and analog pin data that it reads.