Git Product home page Git Product logo

butler-xbee-gateway's Introduction

BUTLER-XBEE-GATEWAY

About

  • It is a gateway between XBee® ZigBee and TCP network for BUTLER smart house framework.
  • Gateway extracts data from XBee® ZigBee frames and sends to the TCP Server.
  • Gateway maintains separate TCP connection for each XBee® ZigBee device.

In default configuration/example:

Purpose

Usually microcontrollers like Arduino doesn't have network stack. If you use a MQTT library to communicate with broker you still need network stack. The only way to communicate with world is a Serial. Serial is simple and really popular. A lot of RF modules do work via Serial interface. Unfortunately on other side you get Serial as well in case of XBee® ZigBee. MQTT broker doesn't support Serial connection directly and we need to pack data from Serial to TCP:
      Arduino --> Serial --> RF <---z---> RF --> Serial --> xbee-gateway --> TCP --> MQTT Broker

Usage

  • Connect XBee® ZigBee Coordinator to PC where the application is installed.
  • Launch the application.
  • Do not forget to power ON all nodes with XBee® ZigBee wireless interfaces.

XBee® ZigBee Network Configuration

  • Install XCTU.
  • Use XCTU for installing the firmware to the XBee® devices.
  • XBee® ZigBee network must have only one Coordinator.
  • XBee® ZigBee Coordinator must be connected to the PC were you plan to run the application.
  • All other devices in the network must be XBee® ZigBee End Device or XBee® ZigBee Router.

XBee® ZigBee Coordinator

  • Coordinator must have the firmware with ZigBee Coordinator API functional set.
  • Use XCTU to set AP (API mode) option to 0x2 (escapes).
  • Use XCTU to set BD (Baud Rate) to 57600.

XBee® ZigBee End Device and XBee® ZigBee Router

  • Devices must have the firmware with ZigBee End Device or ZigBee Router functional set.
  • Use XCTU to set PAN ID. It must be equal with Coordinator.
  • Use XCTU to set DH and DL to 0x0 (send data to Coordinator).

Prepare build environment

Cmake

Install Cmake with version 2.8 or later.

C++

Install the compiler with C++11 support.

Boost

Install Boost libraries with version 1.45 or later.

Building

UNIX like OS

  • Create a build directory for out of source compilation:
mkdir <build directory>
  • Go to the build directory:
cd <build directory>
  • Use Cmake to prepare the build:
cmake <path to sources>
  • Use make to start the build process:
make
  • The resulting binary file is located in <build directory>/bin/

UNIX like OS + Eclipse

  • Create a build directory for out of source compilation:
mkdir <build directory>
  • Go to the build directory:
cd <build directory>
  • Use cmake to prepare the build:
cmake -G"Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug <path to sources>
  • Import the project from the build directory (File -> Import -> General -> Existing Projects into Workspace)
  • Use Project -> Build Project to start the build process

Raspberry Pi (cross compilation using Docker)

docker pull monstrenyatko/docker-rpi-cross-compiler
  • Create a build directory for out of source compilation:
mkdir <build directory>
  • Go to the build directory:
cd <build directory>
  • Use script to build deb package:
<path to sources>/build/docker_raspberrypi/build.sh <path to sources>
  • The resulting deb file is located in <build directory>

Configuration

Configuration file is done in JSON format.

Example:
{
	"logger":{
		"level":"INFO"
	},
	"serial":{
		"name":"/dev/usbserial",
		"baud": 57600
	},
	"tcp":{
		"address":"test.mosquitto.org",
		"port": 1883
	}
}

Logger

Application logger settings.

Block name

logger

Parameters:
level (String)

Set verbose level.

Value Description
"ERROR" Prints only errors
"WARN" ERROR level + warnings
"INFO" WARN level + processing information
"DEBUG" INFO level + debug information
"TRACE" DEBUG level + messages content
file (String)

Path to logfile like "/var/log/my.log".

Serial

Serial port settings.

Block name

serial

Parameters:
name (String)

Path to serial port device like "/dev/usbserial".

baud (Number)

Serial port baud rate like 57600.

TCP

TCP connection settings.

Block name

tcp

Parameters:
address (String)

Server address like "test.mosquitto.org"

port (Number)

Server port like 1883

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.