How to use XBEE and Cytron XBEE Shield on Arduino Yún?

Bluetooth, XBee, RF......

How to use XBEE and Cytron XBEE Shield on Arduino Yún?

Postby John_Tan86 » Sat Nov 08, 2014 9:50 am

Hi

I would like to use the Yún to received data or comment from WIFI internet then transfer and receive data from local XBEE.

The hardware setup is like this:

2 x XBEE S2
2 x Cytron XBEE Shield
1 Arduino UNO
1 Arduino Yún

A XBEE and XBEE shield install on top of the Arduino Yún, and it act like a HUB, to communicate with the use via wifi internet.
A XBEE and XBEE shield install on top of the Arduino UNO, and it act as a local end-device, to receive and transmit data to hub.

I can found my XBEE on UNO one in the XCTU software.
The problem I face here is, I cannot use the Arduino Yún with Cytron Shield.

Can anyone teach me how to configure it? :?:

and one more question is:
when i found my XBEE in the XCTU, but i cannot change the MY address.
In the XCTU, the MY parameter is only for "read only". :?:
John_Tan86
Freshie
 
Posts: 4
Joined: Sat Nov 08, 2014 9:26 am

Re: How to use XBEE and Cytron XBEE Shield on Arduino Yún?

Postby ober » Sat Nov 08, 2014 5:43 pm

Well, there are some differences in term of architecture and interface between UNO and YUN.

1st you need to understand UART, the basic serial communication used on UNO and XBee. Of course YUN is using UART too, but in different way.

When you use XCTU, the computer is communicating with XBee using Arduino UNO's on board USB to UART chip, and you move the mini jumpers (both) to "USB" on the XBee shield, right? What happen is:

XCTU on computer -------- USB to UART chip on Arduino UNO ---------- XBee on XBee shield with the jumpers at USB.

So that's works fine!

Now, what happen on YUN? YUN does not come with USB to UART chip for program loading and also UART communication with computer. Instead the YUN uses the interface on Arduino Leonardo that utilize the USB peripheral of Atmega32u4 to load program, it does not offer direct UART communication to computer. Yes, you can still use XBee shield on Arduino Leonardo, but not with XCTU to detect and configure the XBee (on XBee shield). Look at the hardware connection:
Computer 's USB -------------------------- USB of ATmega32u4.

The computer communication stop at Atmega32u4, so how can Leonardo communicate with the XBee in that case? Leonardo is able to communicate with XBee because the TX and RX (UART's pins) of Leonardo are still available. Not to forgot, the objective is for Leonardo to communicate with XBee not the computer. Computer communication with XBee is needed only when you want to configure the XBee. At the end, you want the Leonardo or UNO to communicate with XBee. Of course, in this case you need to develop sketch for Leonardo to communicate with XBee. If you need to use computer with XBee only, I would recommend the SKXBee instead.

There is a way to overcome this, you can utilize CDC (Communication Device Class) sketch, load into the Leonardo and it become a USB to UART chip. The hardware become:
Computer USB (see as COM port) --- USB of ATmega32u4 (with CDC)'s UART --- XBee on Xbee shield (D0 and D1 for TX and RX)
But I never tried this before :)

Now, let's discuss about YUN. On YUN, ATmega32u4 is used too. So you cannot get the XCTU to communicate with XBee on XBee shield, that is explained earlier, by default. Even if the mini jumpers are moved to D0 and D1 for RX and TX on XBee shield plus you load the CDC sketch into Arduino YUN, you will still get a fail result. The reason? Because on YUN, the D0 and D1 is connected to AR9331 chip (LININO). You cannot use the hardware pin on YUN for external device or shield, it will crash with the communication with AR9331. So how can Arduino YUN communicate with XBee or any other device that uses UART? Use the software serial.

Quated from Arduino YUN official page:
A SoftwareSerial library allows for serial communication on any of the Yún's digital pins. Pins 0 and 1 should be avoided as they are used by the Bridge library.

So how can we use it? Move the mini jumpers on XBee shield to other pins except USB, D0 and D1. Develop your sketch using softwareserial instead of hardware serial(Serial.begin etc).

When you want to configure the Xbee using XCTU, use Arduino UNO instead of Arduino YUN.

Yes, you might be confused! My advise, hands-on, try it and from the mistakes and exploration, you should be getting near to the concept and solution.
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Re: How to use XBEE and Cytron XBEE Shield on Arduino Yún?

Postby John_Tan86 » Tue Dec 16, 2014 11:12 pm

Hi Ober

I found that's other issue on the Yun, It cannot read IR library which is download from https://github.com/shirriff/Arduino-IRremote.
John_Tan86
Freshie
 
Posts: 4
Joined: Sat Nov 08, 2014 9:26 am

Re: How to use XBEE and Cytron XBEE Shield on Arduino Yún?

Postby yonghui » Thu Dec 18, 2014 8:14 pm

Not all library is compatible every arduino board. But u can modify it for your board.
thanks&regards,
yh
yonghui
Moderator
 
Posts: 732
Joined: Mon Sep 28, 2009 3:27 pm


Return to Wireless Device

Who is online

Users browsing this forum: No registered users and 9 guests

cron