libelium
  • rss
  • flickr
  • twitter
  • facebook
  • youtube

Documentation: X-TICK Tutorial

Contents:

Introduction

Ingredients:

Difficulty: Medium -medium

Preparation Time: 1 hour

x-tick
 

Steps Index

Steps Index:

  1. Description.
  2. Charging the lithium battery.
  3. Connecting the X-TICK to the PC.
  4. Receiving data.
  5. Setting the XBee parameters.
  6. Using X-TICK in a XBee network.
  7. Sending data.
  8. Power save - sleep mode.
  9. An X-TICK example: Indoor locating system.
  10. Video-Tutorial.

Step 1: Description:

XBee programmable USB stick (X-TICK) is a small device battery powered totally programmable.

It has 4 position joystick and 1 led you can program as you want. Just plug it into your computer and you'll charge its lithium battery (300 mAh), program it as you want and you can integrate it into your XBee sensor network, you can control events, check if the pen is inside a building, open / close doors / windows...

Connected to the computer it also can be used as a gateway to collect data from the XBee sensor network.

The main features are:

  • USB connection
  • 4 positions joystick
  • ON / OFF switch
  • XBee series 1 module (802.15.4)
  • 1 Led programmable
  • 1 Led status indicator
  • Lithium battery 3.7 V – 300 mAh
  • Lanyard
  • Low power consumption in powersave mode
x-tick

The XBee communicator features are:

  • IEE 802.15.4 standard protocol
  • Long range data integrity
    • Indoor/Urban: up to 30m
    • Outdoor line of sight: up to 100m
    • Transmit power: 1mW (0 dBm)
    • Receiver sensitivity: -92 dBm
  • Low power
    • TX current 45 mA
    • Rx current 50 mA
    • Power-down current < 10 µA

Step 2: Charging the lithium battery:

Charging X-TICK is very easy, there are two possibilities for charging: USB standard port in a computer (cable included) or mini USB wall adapter power supply (not included).

The full charge in the battery will take around 3-4 hours.

Step 3: Connecting the X-TICK to the PC:

Installing drivers
Drivers can be downloaded here: http://www.ftdichip.com/Drivers/VCP.htm.

Communicating with XBee
Just connecting X-TICK to the computer we can open a serial port terminal and connect to the stick.
Serial port settings: 19200 baudrate, 8 bits, no parity, 1 stop bit.

Checking the connection:

Type +++ (No CR after +++)
X-TICK answer OK  

Once we get the OK answer from XBee we can go to the next step and get data from the network.

Step 4: Receiving data:

With X-TICK connected to the USB port we can get the data from the XBee, all data XBee receives from another XBee modules in the network are sent to the USB port.

The data we receive from the sticks in the network are shown in the picture.

x-tick

The data packets sent by a X-TICK are:

x-tick

In our example

7e 00 0a 83 00 01 4a 00 01 00 0f 00 0e 13

Where

Byte Value  
1 7e Start delimiter
2-3 00 0a Length
4 83 API identifier byte
5-6 00 01 Sender address
7 4a RSSI value
8 00 Option byte
9 01 Samples number
10-11 00 0f Inputs activated
12-13 00 0e Value of the inputs
14 13 Checksum

The interesting bytes for us are:

Byte Value  
5-6 00 01 Sender address
  00 MSB
  01 LSB
12-13 00 0e Value of the inputs
  00 MSB
  0e LSB
  0e (hex) = 1110 (bin)  
  bit 3 1 Input 3 HIGH (no active)
  bit 2 1 Input 2 HIGH (no active)
  bit 1 1 Input 1 HIGH (no active)
  bit 0 0 Input 0 LOW (active)

Note that we use the active low system for the joystick direction activated.

The values for byte 12 - 13 for the directions are:

00 0b (0000 1011) UP
00 0e (0000 1110) RIGHT
00 0d (0000 1101) DOWN
00 07 (0000 0111) LEFT
x-tick

We also can receive data from another XBee devices.

For example, Waspmote, SquidBee, etc.

Step 5: Setting the XBee parameters:

You can configure the XBee parameters, once your X-TICK is connected to a PC, AT commands can be sent to the X-TICK.

To get the module into configuration mode, you need to send it three plus signs: '+++' and there needs to be at least one second before and after during which you send no other character to the module. Note that this includes newlines or carriage return characters. You need to make sure your terminal software is configured to send characters as you type them, without waiting for you to press enter. Otherwise, it will send the plus signs immediately followed by a newline (i.e. you won't get the needed one second delay after the '+++'). If you successfully enter configuration mode, the module will send back the two characters 'OK', followed by a carriage return.

Send command Expected response
+++ OK<CR>

Once in configuration mode, you can send AT commands to the module. Command strings have the form ATxx (where xx is the name of a setting). To read the current value of the setting, send the command string followed by a carriage return. To write a new value to the setting, send the command string, immediately followed by the new setting (with no spaces or newlines in-between), followed by a carriage return. For example, to read the network ID of the module (which determines which other Xbee modules it will communicate with), use the ATID command:

Send command Expected response
ATID<CR> 3332<CR>

To change the network ID of the module:

Send command Expected response
ATID5555 OK<CR>

Now, check that the setting has taken effect:

Send command Expected response
ATID<CR> 5555<CR>

Unless you tell the module to write the changes to non-volatile (long-term) memory, they will only be in effect until the module loses power. To save the changes permanently (until you explicitly modify them again), use the ATWR command:

Send command Expected response
ATWR<CR> OK<CR>

You can see all the AT commands in the XBee manual.

Step 6: Using X-TICK in a XBee network:

X-TICK can be used in a XBee network (Waspmote network, SquidBee network...), maybe some of the XBee parameters need to be configured (ID, DH, DL, MY...).

Step 7: Sending data:

The data X-TICK is sending matches with the state of the joystick. The commands need for this configuration are:

Command Value
D0 3
D1 3
D2 3
D3 3
IC F

(Minimum firmware version required 1.xA0)

D0, D1, D2 and D3 are parameters for setting ports 0,1,2 and 3 as input.

Step 8: Power save - sleep mode:

The basic idea for saving power in these devices is to keep XBee in sleep mode as long time as we can. As we want to send data only when the joystick is activated, we'll keep XBee in sleep mode and when the joystick is activated, XBee is waked up and send the data witch says witch direction was activated.

X-TICK is ready to wake up XBee when the joystick is activated, just SM (sleep mode) command must be set to 1 (Pin hibernate).

Step 9: An X-TICK example: Indoor locating system:

For this application we could use a X-TICK as a mobile device sending packets in time intervals.

The main idea is to integrate X-TICK into a SquidBee network in the building (see figure 11), these Squidbees will get the messages from X-TICK and also will get the RSSI (received signal strength indicator) of the signal, with this value SquidBee is able to estimate the distance (meters) to the mobile device. If we have a system in the computer with the coordinates of all Squidbees in the network we can estimate the position of our X-TICK.

x-tick

The set up for X-TICK is very simple:

  • Sleep mode - cyclic sleep.
  • Destination address FFFF (broadcast).
  • The same ID than the SquidBees network.

The commands need for this configuration are:

Command Value  
SM 5 (cyclic sleep)
ST c8 (200 ms)
SP 1f 4 (5 s)
DL f f f f (broadcast address)

X-TICK will be 5 seconds sleeping, after 5 seconds it wakes up, send a packet and after 200 ms goes back to sleep.

A parameter than maybe is interesting for this application is PL (power level) because it lets to change the emission power.

Step 10: Video-Tutorial:

Here's an explanatory video, which shows the whole process developed in this tutorial:

 

 

Links and Documentation

Links and Documentation: