The library we use is "libxbee3."
The Original repository of "libxbee3" is https://github.com/attie/libxbee3
This repository is for the use of Zigbee module(xbee S2C) on Respberry pi.
The following is the manual of XBEE S2C:
https://www.digi.com/resources/documentation/digidocs/pdfs/90002002.pdf
The OS on the Respberry Pi is RASPBIAN STRETCH LITE 2017-11-29 version.
The official website of Raspberry Pi is https://www.raspberrypi.org
The download link of RASPBIAN STRETCH LITE(2017-11-29 version) is
http://vx2-downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-12-01/2017-11-29-raspbian-stretch-lite.zip
sudo apt-get install -y wiringpi git vim
If you are building libxbee, then there are a number of options avaliable to you.
Initially you should run the following command:
$ make configure
This will retrieve a default config.mk
that is suitable for your Respberry Pi.
In our project you need to
un-comment OPTIONS+= XBEE_LOG_LEVEL=100
comment OPTIONS+= XBEE_LOG_RX_DEFAULT_OFF
comment OPTIONS+= XBEE_LOG_TX_DEFAULT_OFF
un-comment OPTIONS+= XBEE_NO_RTSCTS
You should review this file and then run the following command:
$ make all
After the build process has completed, you should find suitable files in ./lib.
E.g: for a Unix-like OS you can expect to find .so and .a files
for Windows you can expect to find a .dll file
It is highly recommended that you don't modify any of the build system.
To install libxbee simply type (you will require root permissions):
$ sudo make install
Compile your applications, including xbee.h in the relevant source files.
Ensure you link with libxbee (e.g: using gcc -lxbee
)
If you are compiling the object file directly into your executable instead
of making use of the library,
you must include the following link flags:
-lpthread -lrt
Config now can be upload by program, but still something need to set up before start using Zigbee.
It is essential for Connection and Configure through Serial Port.
In this project, we use ZIGBEE TH Reg
as our main Function. The following config is for it.
- Open XCTU (Download Link: https://www.digi.com/products/xbee-rf-solutions/xctu-software/xctu)
- Add the radio you decide to setup
- click the radio you decide to setup
- Depends on different identity/role of the zigbee(Coornidator/Endpoint), there are different parameters setting. For Coornidator (Gateway),
- JV (Channel Verification) =
Disable[0]
- CE (Coordinator Enable) =
Enable[1]
- DH (Destination Address High) =
0
- DL (Destination Address Low) =
0xFFFF
- AP (API Output Mode) =
API enabled[1]
- D6 (DIO7 Configuration) =
Disable[0]
- D7 (DIO7 Configuration) =
Disable[0]
- JV (Channel Verification) =
- For EndPoint (LBeacon),
- JV (Channel Verification) =
Enable[1]
- CE (Coordinator Enable) =
Disable[0]
- DH (Destination Address High) =
0
- DL (Destination Address Low) =
0
- AP (API Output Mode) =
API enabled[1]
- D6 (DIO7 Configuration) =
Disable[0]
- D7 (DIO7 Configuration) =
Disable[0]
- JV (Channel Verification) =
- Edit /boot/cmdline.txt , delete any parameter involve erial port "ttyAMA0" or "serial0".
- Disabale the on-board Bluetooth for Raspberry Pi Zero W
- Edit /boot/config.txt , add enable_uart=1 and dtoverlay=pi3-disable-bt
Manual For XCTU: https://www.digi.com/resources/documentation/digidocs/PDFs/90001458-13.pdf
For the serial setting for Raspberry pi, follow the instructions in the blog of: http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/io-pins-raspbian/uart-pins