Arduino Mega2560 and XBee PRO series 1

Hi,

I am using ArduinoMega 2560 as a sensor node for my project and raspberry pi 3 as data Coordinator. I am trying to make them communicate via Xbee Pro radios series1. Now I can communicate Xbee From XCTU from PC to raspberry pi3 but not with Arduino mega. Could anyone help me out, please? I am using XBee shield to connect Arduino with XBee PRO series1.

I have uploaded this program to Arduino which is connected Xbee pro by using Xbee Shield:

#include <XBee.h>
XBee xbee;
ZBTxRequest zbTx;
void setup() {
  xbee = XBee();
  Serial.begin(9600);
  xbee.setSerial(Serial);
  uint8_t payload[] = { 'H', 'i' };
  XBeeAddress64 addr64 = XBeeAddress64(0x0);
  zbTx = ZBTxRequest(addr64, payload, sizeof(payload));
}
void loop() {
  delay(5000);
  xbee.send(zbTx);
}

Reciever side (raspberry pi Python code):

#! /usr/bin/python

from xbee import XBee
import serial

PORT = '/dev/ttyUSB0'
BAUD_RATE = 9600

# Open serial port
ser = serial.Serial(PORT, BAUD_RATE)

# Create API object
xbee = XBee(ser,escaped=True)

# Continuously read and print packets
while True:
    try:
        print "waiting"
        response = xbee.wait_read_frame()
        print response
    except KeyboardInterrupt:
        break

ser.close()

I can communicate Xbee pro1 with XCTU from PC to Raspberry pi3 but not with Arduino Could anyone help me out, please ?

MODERATOR: ADDED CODE TAGS

jisha:
Hi,

I am using ArduinoMega 2560 as a sensor node for my project and raspberry pi 3 as data Coordinator. I am trying to make them communicate via Xbee Pro radios series1. Now I can communicate Xbee From XCTU from PC to raspberry pi3 but not with Arduino mega. Could anyone help me out, please? I am using XBee shield to connect Arduino with XBee PRO series1.

I have uploaded this program to Arduino which is connected Xbee pro by using Xbee Shield:

I can communicate Xbee pro1 with XCTU from PC to Raspberry pi3 but not with Arduino Could anyone help me out, please ?

The next questions I ask because I may need to replicate your setup.

Your using an Arduino Mega2560
Is the Mega2560 a clone or an original Arduino Mega2560?
Which Version of Arduino IDE are you using?
What operating system?
Linux, MacOSX, MS Windows, other
What Version of Raspbian is the Raspberry Pi 3 running?

Which XBee shield are you using?
I have several XBee shields from different vendors.

Please re post the sketch using the proper code tags and formatted for the forums using the Arduino IDE.

Do you have a block diagram of your project?

I have everything to probably replicate your setup.

Hi,

Thanks for your response.

I am using Arduino mega 2560 original.
I am using Raspberry pi 3 Model B and using NOOBS operating system which contains raspbian downloaded from this site [u]Raspberry Pi OS – Raspberry Pi
Arduino IDE- 1.8.5
XBee radios - XBee Pro 60mW Wire Antenna - Series 1 (802.15.4)
Arduino Xbee shield- ZigBee/XBee module shield V3.0 bought from the site [u]https://www.geeetech.com/zigbeexbee-module-shield-v30-p-565.html[/u]
Operating system - Windows 7 were my Arduino is connected with one Xbee pro(coordinator) with the shield.
Raspbian Os- Raspberrpi pi is connected to a sperate monitor where Xbee Pro(router) is connected via USB.

Arduino Xbee Code:

#include <XBee.h>
XBee xbee;
ZBTxRequest zbTx;

void setup()
{
xbee = XBee();
Serial.begin(9600);
xbee.setSerial(Serial);
uint8_t payload[] = { 'H', 'e', 'l', 'l', 'o' };
XBeeAddress64 addr64 = XBeeAddress64(0, 0);
zbTx = ZBTxRequest(addr64, payload, sizeof(payload));
}

void loop()
{
delay(5000);
xbee.send(zbTx);
}

Raspberry Pi Python code receiver.py code:

import serial

from xbee import XBee
serial_port = serial.Serial( '/dev/ttyUSB0', 9600)

xbee = XBee(serial_port, escaped=True)

while True:
try:
print xbee.wait_read_frame()
except KeyboardInterrupt:
break
aerial_port.close()

Please find the attached copy of my basic block diagram.Thanks!

Please update your second post and add code tags.

Hi,

Arduino Xbee Code:

#include <XBee.h>
XBee xbee;
ZBTxRequest zbTx;

void setup() 
{
  xbee = XBee();
  Serial.begin(9600);
  xbee.setSerial(Serial);
  uint8_t payload[] = { 'H', 'e', 'l', 'l', 'o' };
  XBeeAddress64 addr64 = XBeeAddress64(0, 0);
  zbTx = ZBTxRequest(addr64, payload, sizeof(payload));
}

void loop() 
{
  delay(5000);
  xbee.send(zbTx);
}

Raspberry Pi Python code receiver.py code:

import serial

from xbee import XBee
serial_port = serial.Serial( '/dev/ttyUSB0', 9600)

xbee = XBee(serial_port, escaped=True)

while True:
          try:
               print xbee.wait_read_frame()
          except KeyboardInterrupt:
                    break
aerial_port.close()

jisha:
Hi,

You still have not answered the question as to what version of Raspbian the Raspberry Pi 3 is running.
Is it Wheezy, Sketch, Jessie?

cat /etc/debian_version

will give you the Debian version that Raspbian is based on.

I do not have a any MS Windows 7.
I have Linux Debian Wheezy, Jessie & Sketch
I have MacOSX Snow Leopard, Mountain Lion, Yosemite & Sierra.

I will look at it more later.

Hi,

Many Thanks for getting back. Please find the attachment.

I tried $ cat /etc/debian_version

My version is 9.1

I also tried $ cat /etc/os-release

It shows the following:

PRETTY_NAME=”Raspbian GNU/Linux 9 (stretch)”
NAME=”Raspbian GNU/Linux”
VERSION_ID=”9″
VERSION=”9 (stretch)”

Thank you for your help on this.

Debian.PNG

jisha:
Hi,

Many Thanks for getting back. Please find the attachment.

I tried $ cat /etc/debian_version

My version is 9.1

I also tried $ cat /etc/os-release

It shows the following:

PRETTY_NAME=”Raspbian GNU/Linux 9 (stretch)”
NAME=”Raspbian GNU/Linux”
VERSION_ID=”9″
VERSION=”9 (stretch)”

Thank you for your help on this.

You really need to run update on that Raspberry Pi.

as root:
apt-get update or aptitude update
aptitude

cat /etc/os-release should return:

PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

jisha:
Hi,

I am using ArduinoMega 2560 as a sensor node for my project and raspberry pi 3 as data Coordinator. I am trying to make them communicate via Xbee Pro radios series1. Now I can communicate Xbee From XCTU from PC to raspberry pi3 but not with Arduino mega. Could anyone help me out, please? I am using XBee shield to connect Arduino with XBee PRO series1.

Okay, i had to update Digi Internaltion XCTU on my laptops.

How is the Raspberry PI 3 connected to the Xbee pro radio series 1?

How do you have the Xbee Pro Series 1 Radio Configured?

I have the Arduino Mega2560 with an Arduino Wireless Shield with the Xbee Pro Series 1 radio.
I have an Arduino Leonardo with another Arduino Wireless Shield with another Xbee Pro Series 1 Radio.

Just need the Raspberry Pi 3 with the Xbee connected.

I will post photographs later .

I have:
3 Xbee series 1 radios
3 Xbee Pro Series 1 radios
2 Xbee Series 2 radios

I am using Xbee PRO series1 and I have configured them by using XCTU software which was downloaded from Digi International. I have also got Xbee FTDI breakout board for configuring XBee module with XCTU software.

I used to connect Xbee PRO series1 to Raspberry pi3 using USB cable, not with Jumper wires.

Is there a possibility that there would be a problem with Arduino Xbee shield v3? Would that be a reason why they are unable to communicate?

Thanks!

jisha:
I am using Xbee PRO series1 and I have configured them by using XCTU software which was downloaded from Digi International. I have also got Xbee FTDI breakout board for configuring XBee module with XCTU software.

I used to connect Xbee PRO series1 to Raspberry pi3 using USB cable, not with Jumper wires.

Is there a possibility that there would be a problem with Arduino Xbee shield v3? Would that be a reason why they are unable to communicate?

Thanks!

When you used XCTU to configure the Xbee what did you configure them?
Do you understand what I am asking?
I am not sure that you oo.

I can not do anything until you tell me how you configured the xbee modules with XCTU.