Arduino + Xbee + Sensor Communicate to Xbee + PC Problem

Hello,

I'm new to Arduino, and try to send a temperature sensor data to my laptop by Xbee 802.15.4 (Series 1) modules, but there are too many problems.

For the arduino serial monitor, the sensor program worked itself, but when I open the X-CTU terminal on my laptop, it doesn’t show any data for me.

My setup is as follows:

Transmitter:
Arduino UNO with Xbee Shield (iteadstudio Version 1.1)
Tiny RTC DS1307 Shield with DS18B20 Temp Sensor
Arduino Powered using Laptop's USB port
Xbee S1

Laptop:
Xbee connected to FT232RL Tiny Breakout – Foca (iteadstudio Version 2.2)

My Xbee Configurations:
ArduinoXBEE
(XB24, 802.15.4, 10E8)
ID = 1111
DH = 13A200
DL = 4081B858
SL = 4081B859
BD = 9600

LaptopXBEE
(XB24, 802.15.4, 10E8)
ID = 1111
DH = 13A200
DL = 4081B859
SL = 4081B858
BD = 9600

===========================================
My Program copied by internet

#include <OneWire.h>
#include <DallasTemperature.h>

• // Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS 2

• // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
• OneWire oneWire(ONE_WIRE_BUS);

• // Pass our oneWire reference to Dallas Temperature.
• DallasTemperature sensors(&oneWire);

• void setup(void)
• {
• // start serial port
• Serial.begin(9600);
• Serial.println("Dallas Temperature IC Control Library Demo");

• // Start up the library
• sensors.begin();
• }

• void loop(void)
• {
• // call sensors.requestTemperatures() to issue a global temperature
• // request to all devices on the bus
• • sensors.requestTemperatures(); // Send the command to get temperatures

• Serial.print("Temperature is: ");
• Serial.println(sensors.getTempCByIndex(0));
• }

========================================
Arduino Serial Monitor Result:
Temperature is 29.45
Temperature is 29.65

====================================
I would like to show this data on laptop side and I would like to delay the print serial time (5000). First of all, Is my Xbee configuration correct and how to set the BD of Xbee?
Or
Is my design not suitable for Xbee communication?

I think I need to re-configure the Xbee and Programe, but I lost my mind.

Any help will be appreciated.
Thanks

Please find the attachment for your information of the shield which bought from internet

Foca.pdf (388 KB)

XBeeShield.pdf (419 KB)

RTC With DS18B20.jpg

How are the XBees connected to the Arduino and whatever else? What is the 2nd XBee connected to?

one connected to Arduino by xbee shield
second one connected to laptop by FT232RL usb broad

Please help :drooling_face:

When I use X-CTU and select Function Set XBEE 802.15.4, Version 10E8, I see that the relevant things to configure are PAN ID, MY, and DL. You have set PAN ID the same on each XBee, and set DL (though I don't see how you set it to that value). But, you said nothing about setting MY on the two XBees. MY on one must be DL on the other.

My MY setting is 0

MY on one must be DL on the other.

please tell me which xbee should be setting the MY on one must be DL on the other?(Arduino side/Laptop side)?

i don't know my problem is due to Wrong Xbee setting or program??

You have two XBees. If DL on one is 37, MY on the other one must be 37. If MY on one is 8729, DL on the other one must be 8729.

MY being set to 0 is not a good thing.

First Thanks PaulS!!
I think xbee problem is solved

Now i think my program is the problem

While i add the following code at the end of original program

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  while (Serial.available() > 0)
  {
    char serialByte = Serial.read();
    Serial.print(serialByte);
  }
}

the arduino's serial monitor is show the "Temp" which i wanted
but the XCTU side is still nothing,
but i input something in serial monitor,
the XCTU side can show that i input from serial monitor

Also i simplified the program

    #include <OneWire.h>
    #include <DallasTemperature.h>
    #define ONE_WIRE_BUS 2
    OneWire oneWire(ONE_WIRE_BUS);
    DallasTemperature sensors(&oneWire);
     
    void setup(void)
    {
      // start serial port
      Serial.begin(9600);
      sensors.begin();
    }
     
    void loop(void)
    {
      sensors.requestTemperatures(); 
      int temp = sensors.getTempCByIndex(0);
      serial.print(temp);
      delay(1000);
  
      while (Serial.available() > 0)
       {
          char serialByte = Serial.read();
          Serial.print(serialByte);
       }
}

but how to let the Arduino Xbee's side get the data from the program which connected by Xbee Shield?

Any help will be appreciated.

but the XCTU side is still nothing,

So, quit using X-CTU for something it is not intended for. It is a tool to configure the XBees. Use it just for that.

but how to let the Arduino Xbee's side get the data from the program which connected by Xbee Shield?

I failed to parse this sentence to obtain any meaning.

You can open two instances of the Serial Monitor - one for each Arduino. The data being sent/received by the XBees will appear in the other serial monitor.

PaulS:

So, quit using X-CTU for something it is not intended for. It is a tool to configure the XBees. Use it just for that.

Which software can be used for monitoring the serial monitor seem like arduino software ?
Also i would like to export the result to excel,etc..

I failed to parse this sentence to obtain any meaning.

You can open two instances of the Serial Monitor - one for each Arduino. The data being sent/received by the XBees will appear in the other serial monitor.

Sorry for my poor english :expressionless:
I mean i have no idea for the xbee shield, in my project, i just want to receive the temperature data from sensor,so i wrote the sensor program in arduino,but i don't know the program and detail of trasmit the data to other xbee by xbee shield.

As using the library of NewSoftSeria for simple wire the 3.3v tx rx and gnd.
But xbee shield doesn't required,so i can't transfer the data to my laptop...

Does any example for transfer data by API mode?
Is it suitable for me for usb explorer and xbee shield?

Now I rewrite the program of Sensor Side and remove the Xbee Shield,
just connect the following wire
Xbee <----> Arduino
Vin 3.3V
Dout RX0
Din TX0
GND GND

with following Code

    #include <OneWire.h>
    #include <DallasTemperature.h>
    #include <SoftwareSerial.h>

    SoftwareSerial mySerial(0, 1); 

    #define ONE_WIRE_BUS 2
    
    OneWire oneWire(ONE_WIRE_BUS);
     
    DallasTemperature sensors(&oneWire);
     
    void setup(void)
    {
      Serial.begin(57600);
      sensors.begin();
    }
     
    void loop(void)
    {
      sensors.requestTemperatures();
      int tempA = sensors.getTempCByIndex(0);
      Serial.print(tempA);
      Serial.println();
      delay (2000);
    }

Also i reconfigure the Xbee
Coordinate End Device
CH = 11 CH = 11
ID =AAAA ID = AAAA
DH = 13A200 DH=13A200
DL=4081B858 DL = 4081B859
MY=0 MY=0
SH=13A200 SH= 13A200
SL=4081B859 SL= 4081B858
CE=1 CE=0
BD=6(57600) BD=6(57600)

Now, i can receive the temp from Sensor Side and show in X-CTU
(Please find the attachment)

i would like to improve my project,
i have 2 Arduino , 2 Xbee
if the sensor part arudino remain unchange,
the PC side change to a Arduino + Xbee
with the following code

#include <SoftwareSerial.h>

SoftwareSerial mySerial(0, 1); // RX, TX

void setup()  
{
 // Open serial communications and wait for port to open:
  Serial.begin(57600);  
  Serial.println("Test");
  mySerial.begin(57600);
}

void loop() // run over and over
{
  mySerial.listen();
  if (mySerial.available()>0)
  {
Serial.println(mySerial.available());
delay(500);
  }
}

I cant receive the temp at serial monitor
and just deplay the "Test"
and 5,5,5,5,10,10,10,,15,15.....63
((Please find the attachment)
how can i receive the temp
because i would like to use the temp to trigger the fan if the temperature too high

Serial Monitor.bmp (1.76 MB)

Temp with AT mode.bmp (694 KB)

    SoftwareSerial mySerial(0, 1);

Why are you trying to do software serial on the hardware serial pins?

      Serial.begin(57600);

Which instance is really in control of those pins?

Why are you trying to do software serial on the hardware serial pins?

I search the methods of xbee communication in internet,and then i try this
ibrary(softwareserial) can transmit data to PC,but i dont know this is wrong.

Which instance is really in control of those pins?

I would like too control a led
light,lcd monitor and a relay .
Because
I change my xbee BD from 9600 to 57600, so i change here too

Suppose I do this:

int ledPin = 3;

int relayPin = 3;

digitalWrite(relayPin, LOW);
digitalWrite(ledPin, HIGH);

Now, can I really connect a relay AND an LED to the same pin, and expect them to be on and off independently? Of course not.

For the same reason, you can not expect SoftwareSerial and HardwareSerial to sand and receive data using the same pins.

Use different pins for the software serial instance, and connect the XBee to those pins.

Thanks PaulS

Your Suggestion is very good

i deleted the Software Serial parts of the two Arduino A & B

void setup()  
{
  Serial.begin(57600);  
  Serial.println("Test");
}

void loop() // run over and over
{

  if (Serial.available()>0)
  {
Serial.println(Serial.read());
delay(500);
  }
}

but on the ArduinoA + Xbee (Receive the temp)
it was still receive the data" 50...55...13...10...50...55...13...10..."
the correct data should be the temperature "27...27...28..." from the Arduino B +Xbee+ Sensor

because i can receive the right temperature
when i connect the Xbee +PC, and use the X-CTU to get the data

Please find the attachment

it was still receive the data" 50...55...13...10...50...55...13...10..."
the correct data should be the temperature "27...27...28..." from the Arduino B +Xbee+ Sensor

You need to look at an ASCII table.

You are getting "2727...".

It is up to you to collect the character data and interpret it as integer data, IF that is what it is.