MXC01

From Wiki for Dragino Project
Jump to: navigation, search

Introduction

xBee /Bluetooth Bee Converter

xBee /Bluetooth Bee converter is a PCB adapter to conver the xBee / Bluetooth Bee UART interface to MS14 UART interface.

With xBee / Bluetooth Bee converter, user can connect their Zigbee network or Bluetooth Network into IP network.

xBee /Bluetooth Bee Converter



Use with Xbee Module (IoT Firmware)

Introduction

MXC01 and Digi XBee

User can plug in the Digi XBee to the MXC01 Bee Converter and configure / communicate with the XBee with MS14.

Configure XBee

User can program the Xbee by the MS14 via minicom.Make sure the ms14 has IoT firmware install and running in Disable Linux Console mode (GUI --> Sensor --> PowerUART).

First, Install minicom by running below command in MS14:

root@dragino2-5fd209:~# opkg update
Downloading http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/attitude_adjustment.
root@dragino2-5fd209:~# opkg install minicom
Installing minicom (2.3-1) to root...
Downloading http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/minicom_2.3-1_ar71xx.ipk.
Configuring minicom.

Then we can use minicom to configure the XBee. in SSH access, run minicom and configure minicom as:

  • Serial Device: /dev/ttyATH0
  • Bps/Par/Bits  : 9600 8N1
  • Hardware Flow Control : No
  • Software Flow Control : No
  • Add linefeed : ON
  • local Echo on/off : ON

In minicom, type +++ to enter XBee configure mode( don't press ENTER after type +++ ). Then the xbee module return OK and you can type the commands as decribed in XBee Commands. Below is a screen shot to show how to set the XBee ID. NOTE: XBee will exit configure mode if there is no input for several seconds.

Use minicom to configure XBee module



Point to Point test with other xBee Module use minicom

This test is a point to point test to show the communication between two xBee module:

  • One module is placed into the MXC01 and MS14, another module is connected to
  • In x-CTU. Configure both xBee module destination addree to point to the other module.
  • In MS14 -- GUI --> Sensor --> PowerUART . set the UART operation mode to Disable Linux Console
  • In MS14, open minicom and type strings, the strings will auto send to another xBee and show in the x-CTU pannel. type strings in x-CTU, the info will also sent to the MS14 and shown in minicom.
Point to Point xBee test



UART Routing Web Interface

The xBee is compilance with PowerUART --> UART Routing UI, any data received from the UART will be filtered and save in the pre-configure position which can be used for other programs. More info please refer the PowerUART --> UART Routing UI.


Echo test with xBee

This code is the echo test demo to test the xBee module. Test Method:

  • One module is placed into the MXC01 and MS14, another module is connected to
  • In x-CTU. Configure both xBee module destination addree to point to the other module.
  • In MS14 -- GUI --> Sensor --> PowerUART . set the UART operation mode to Disable Linux Console
  • Run the above echo test script. type a string the x-CTU and it will receive a return immediately.
Echo test with xBee



Use with Bluetooth Bee (IoT Firmware)

Introduction

MXC01 and a Bluetooth Bee

User can plug in the Bluetooth Bee HC-05/HC-06 to the MXC01 and configure / communicate with the Bluetooth Bee with MS14

Configure Bluetooth Bee

User can program the Bluetooth Bee in the MS14 Linux Console by minicom. Make sure the ms14 has IoT firmware install and running in Disable Linux Console mode (GUI --> Sensor --> PowerUART).

First, Install minicom by running below command in MS14:

root@dragino2-5fd209:~# opkg update
Downloading http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/attitude_adjustment.
root@dragino2-5fd209:~# opkg install minicom
Installing minicom (2.3-1) to root...
Downloading http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/minicom_2.3-1_ar71xx.ipk.
Configuring minicom.

Then we can use minicom to configure the BlueTooth Bee. in SSH access, run minicom and configure minicom as:

  • Serial Device: /dev/ttyATH0
  • Bps/Par/Bits  : 9600 8N1
  • Hardware Flow Control : No
  • Software Flow Control : No
  • local Echo on/off : ON

The AT Command Set of Bluetooth Bee HC-05 and HC-06 can be found from this link AT Command set

Below are the configure example from minicom. It sets the bluetooth name to Dragino and Password to 8888.

NOTICE: The bluetooth module require short interval (1s) between characters. So better use copy/paste method to send commands instead of typing manually.

Use Minicom to Configure Bluetooth Bee



Echo test with Bluetooth Bee

This code is the echo test demo to test the Bluetooth Bee module. Test Method:

  • Run the script in MS14
  • Use mobile phone to connect the bluetooth module via BlueTerm
  • Type a string in BlueTerm, and BlueTerm will get feedback from the bluetooth module.
Echo test with Bluetooth Bee



UART Routing Web Interface

The Bluetooth Bee is compilance with PowerUART --> UART Routing UI, any data received from the UART will be filtered and save in the pre-configure position which can be used for other programs. More info please refer the PowerUART --> UART Routing UI.

Receive/Send Strings from/to Bee converter

--Lua script to show how to get strings from the xBee converter and send it back. 
--Put this code in ms14 and rename it to test.lua and run <span CLASS=bluetext>lua test.lua</span>. 
--It will monitor any strings from the bee converter and send back the same string. 
local baudrate = '9600'    -- Set Baud Rate, change for the exact module
local nixio = require 'nixio'
 
os.execute('stty -F /dev/ttyATH0 ' .. baudrate .. ' clocal cread cs8 -cstopb -parenb') -- Set baud rate
 
function DataToUART(message)
	local	serialout=nixio.open("/dev/ttyATH0","w")      --open uart interface
	serialout:write(message)
	serialout:close()
end
 
while 1 do                          --loop to get data and process
serialin=io.open("/dev/ttyATH0","r")   --open serial port and prepare to read data from Arduino
	while line==nil do        -- read data from serial. 
         	line=serialin:read() 
         	serialin:flush()
	end
	print(line)    --print the data
	DataToUART('We received ' .. line)   --send string to uart tx
	--------------------------------------
	--put your code here to process data--
	--------------------------------------
 
	serialin:close()
	line=nil    --clear the line data
end

Schematic/PCB

Source

xBee / Bluetooth Bee Schematic