bend94
Posts: 7
Joined: Wed Dec 30, 2015 9:30 pm

raspberry interface xbee S2

Wed Dec 30, 2015 9:37 pm

hi
i try to connect Xbee to Raspberry pi but nothing works.
my /boot/cmdline.txt looks like this:

pi@raspberrypi:~ $ cat /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

i haven't go /etc/inittab but not getty process on /dev/ttyAMA0:

pi@raspberrypi:~ $ ps aux | grep AMA0
pi 819 0.0 0.4 4252 1884 pts/0 S+ 21:35 0:00 grep --color=auto AMA0

i try to open /dev/ttyAMA0 with minicom but still offline :


Welcome to minicom 2.7

OPTIONS: I18n
Compiled on Jan 12 2014, 05:42:53.
Port /dev/ttyAMA0, 21:24:01

Press CTRL-A Z for help on special keys

CTRL-A Z for help | 9600 8N1 | NOR | Minicom 2.7 | VT102 | Offline | ttyAMA0

I have not idea, please help

regards

danjperron
Posts: 3508
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: raspberry interface xbee S2

Thu Dec 31, 2015 2:00 am

Are you on raspbian Jessie?

Did you try to disable the debug and inittab using

Code: Select all

sudo raspi-config 
advanced options, disable serial shell and debug.

Also on Jessie you could manually disable the agetty with

Code: Select all

sudo systemctl disable serial-getty@ttyAMA0.service
sudo systemctl mask serial-getty@ttyAMA0.service
Ok you have 2 Xbee series2 . where each one of them connected!

Looks like one is connected to the Raspberry Pi using the ttyAMA0 and where is the other one connected ?

How did you setup the device ? do you have an usb to serial adapter for it ?

A post on how to connect series 1 on the PI ( series 2 will be the same). Just check the first part, not the ppp stuff
viewtopic.php?p=827762#p827762

viewtopic.php?p=600981#p600981

bend94
Posts: 7
Joined: Wed Dec 30, 2015 9:30 pm

Re: raspberry interface xbee S2

Thu Dec 31, 2015 6:12 pm

Hi thanks to help

> Are you on raspbian Jessie?
yes i have "Raspbian GNU/Linux 8 (jessie)"

> Did you try to disable the debug and inittab using
i disabled the debug with sudo raspi-config , unfortunatly i don't have a file in /etc/inittab

> Also on Jessie you could manually disable the agetty with
> sudo systemctl disable serial-getty@ttyAMA0.service
> sudo systemctl mask serial-getty@ttyAMA0.service

i did this too

> Ok you have 2 Xbee series2 . where each one of them connected!
i tryed to connect xbee with tx(xbee) -> rx(pi) and rx(xbee) -> tx(pi)
with also ground and 3,3v

i rebooted but minicom stay offline
(minicom -b 9600 -o -D /dev/ttyAMA0)
first and just want to type +++ in order to received ok , but still offline

then i try to connect on USB on the pi
i rebooted but minicom stay offline
(minicom -b 9600 -o -D /dev/ttyUSB0)
i typed +++ in order to received ok , but still offline

What do you think?
regards

ghp
Posts: 1518
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: raspberry interface xbee S2

Thu Dec 31, 2015 6:24 pm

Hello,
if you own an usb-serial adapter for xbee, then use xctu-utility (from digi website) to connect to the xbee-device. This tool allows you to replace firmware, choose whether you use API or transparent mode, and controller/router/end point type.
When the device successfully connects to xctu, then try to connect to pi by either hardware serial or usb-serial.
Keep in mind that when sending, these devices use some 350mA on 3.3V extra, so it might be that you need an additional LDO regulator for the xbee.
Good luck,
Gerhard

danjperron
Posts: 3508
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: raspberry interface xbee S2

Thu Dec 31, 2015 6:46 pm

As me and Gerhard specified , you should connect the Xbee to a PC with xctu and link them together with the AT protocol.
One will be the coordinator and the other or others be routers or end point.
The coordinator should send by default data to the second XBee and vice versa. So set the registers properly.


After that connect the XBee to the RX and TX GPIO pins.

Please use an external 3.3V because the XBee power is near the limit of the Raspberrry Pi . Check the picture of one of my previous link. I add a simple Le33 regulator with capacitor to prevent oscillation.

Hook the second XBee to another computer or to the PI using the USB . it should be recognize as /dev/ttyUSB0 or /dev/ttyACMA0. do a ls -l /dev/tty* to check.

now start two minicom console.

sudo minicom -D /dev/ttyAMA0 -b 9600
and
sudo minicom -D /dev/ttyUSB0 -b 9600

Normally if you set xctu correctly it should echo on the next console. This is true only if you set the XBee in AT console not on API.

bend94
Posts: 7
Joined: Wed Dec 30, 2015 9:30 pm

Re: raspberry interface xbee S2

Sat Jan 02, 2016 8:22 pm

Hi,
I am so happy, i am in progress !!!! :D

I used Xctu and set my xbee to "AT COORDINATOR"

First i used my pi usb port and "minicom -b 9600 -o -D /dev/ttyUSB0" i am able to use this command
+++OK
ATMY ... etc (so working by this way)

However with an external power supply 3V3 and a connection between the XBee pin and to the RX and TX GPIO pins of my PI.
when i use "minicom -b 9600 -o -D /dev/ttyAMA0"
I received strange caracters like this all the time :

��(|¢ªú  ªý¨ý  @Àð��@þ�@ èê ú(� �ê� ý�¨þ´ ì�ê¨

i wonder if there is not another process already using this device /dev/ttyAMA0 ??? please help

All the commands like +++ and AT... are only available in at mode ?

my project is to connect a relay to a Xbee end device.
My raspberry pi will be connected to a Xbee in coordinator mode to be able to activate the remote relay.
in this way do i have to use API and AT Mode ??

thanks
benoit

danjperron
Posts: 3508
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: raspberry interface xbee S2

Sun Jan 03, 2016 7:16 pm

did you put the ground on common between the RPi and the external power?

bend94
Posts: 7
Joined: Wed Dec 30, 2015 9:30 pm

Re: raspberry interface xbee S2

Sun Jan 03, 2016 7:41 pm

hello,

great !!!! thanks it is now working with /dev/ttyAMA0 i was not aware of the common ground

All the commands like +++ and AT... are only available in at mode ?

my project is to connect a relay to a Xbee end device.
My raspberry pi will be connected to a Xbee in coordinator mode to be able to activate the remote relay.
in this way do i have to use API and AT Mode ??

thanks

danjperron
Posts: 3508
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: raspberry interface xbee S2

Sun Jan 03, 2016 7:52 pm

In reality the XBee by itself could do it.

When you setup XBee with XCTU, could set one input from the coordinator to be mirror on one output to another XBee.


This way you don't need serial communication on the XBee. Just connect a GPIO to one of the I/O , in input mode, of the XBee and the protocol will automatically mirror the I/O value to the specific XBee.

http://www.instructables.com/id/Remote- ... e-Passing/

danjperron
Posts: 3508
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: raspberry interface xbee S2

Sun Jan 03, 2016 8:04 pm

Also maybe you could check my multi-IO post with Xbee.

I don't use the AT mode, just the serial communication

Check the mp4. I do have a relay module attach to one of the unit.

viewtopic.php?p=619189#p619189

ghp
Posts: 1518
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: raspberry interface xbee S2

Sun Jan 03, 2016 9:25 pm

There are some projects explained at http://examples.digi.com/category/lights-motors-more/
You can use 'bare' xbee module to switch things.

Regards,
Gerhard

edit: when switching relays, it is generally needed to use a transistor. See http://www.susa.net/wordpress/2012/06/r ... sing-gpio/ for how to do this.

Return to “Interfacing (DSI, CSI, I2C, etc.)”