Sensor2Server Quick Start

The Anaren Sensor2Server development kit is a powerful new kit that allows you to build sensor to server applications quickly and easily. This guide will walk you through the steps to help you get up and running.

= What's Included = You should have in your kit:
 * An A2530E24A-GE1 Zigbee-to-Ethernet Gateway, including:
 * Gateway Power Supply
 * Standard USB A plug to Mini-B USB cable for connecting the Gateway to a terminal emulator or USB for power
 * Ethernet cable for connecting the Gateway to the local router or switch
 * Development Boards, each includes:
 * TI MSP-EXP430G2 LaunchPad development kit
 * Anaren A2530E24A-LPZ ZigBee BoosterPack kit
 * Standard-A to Mini-B USB cable for connecting the LaunchPad to a terminal emulator or USB for power

= You will Need = To get up and running easily you will need:
 * Computer with at least two available USB ports and a connection to the Internet
 * FTDI USB drivers for Gateway Select and download the version for your operating system.
 * MSP430 LaunchPad drivers if you don't have IAR Embedded Workbench installed already. Note: for code development you will need to install this eventually.
 * Terminal Emulator like TeraTerm.
 * Connection to the Internet for the Gateway

= A Little Definition of Terms = In this document, we use the following terms to describe what is a flow of data starting at your sensor, and ending on the Tesla Coil web portal page. So it will be helpful to describe the path and the elements that this data flows through. We will start at the Sensor itself.


 * 1) On the Anaren A2530E24A-LPZ ZigBee BoosterPack board, there are two sensors -- a TI TMP006 Infrared Temperature Sensor and an AMS TCS3414 Color Sensor.
 * 2) The Temperature and Color sensors send their information via I2C to the application running on the MSP430G2553 microcontroller on the TI MSP-EXP430G2 LaunchPad board.
 * 3) The MSP-430 microcontroller then sends the sensor data over a SPI connection to the A2530E24AZ1 AIR ZigBee / 802.15.4 module on the ZigBee BoosterPack board.
 * 4) The AIR ZigBee module then sends the sensor data over the air (wirelessly) in an Info Message to the AIR ZigBee module inside the A2530E24A-GE1 Zigbee-to-Ethernet Gateway.
 * 5) The Gateway's AIR ZigBee module then sends the data via SPI to the microcontroller inside the Gateway.
 * 6) The Gateway microcontroller then sends the data to its 10/100BaseT wired Ethernet interface using UDP/IP protocol.
 * 7) The data then passes over the Ethernet to the Ethernet Router / Firewall that connects to the internet.
 * 8) The data then travels through the "cloud" to the Tesla COIL Demo Server.
 * 9) The Server sends an acknowledgement message that travels back in the reverse direction to the Gateway.
 * 10) The Server then logs the data into a database, and presents that data on the web portal.
 * 11) You the user can then use a web browser to browse the web portal page and see your data.

= Configuring the Server = Once you have verified that you have everything then you can get started. You will now need to configure the server for your Gateway. It's easy and free. We've partnered with Tesla Controls to provide their sensor development environment, COIL, at no cost to you. This will allow you to view sensor data over the internet.

Create New Account on Server
Create a new user account on the Server. To proceed you will need to know the following information:
 * First & Last Name
 * Valid Email Address
 * Password - must be at least 8 characters
 * Name for your site - it could be anything, but also must be at least characters. This could be "Headquarters" or "West Wing" etc. We use it for differentiating between multiple locations in large systems.
 * Which Time Zone the site is located in.

To create the account, do the following:
 * Open a web browser (Safari, Firefox, Chrome, or if you must, Internet Explorer) to COIL by Tesla Controls
 * Click on the "Create New Account" link.
 * Enter the requested information. This will create a user account and set up a site for you.

Add the Gateway to your Site
The server is receiving messages from thousands of Gateways and doesn't know which Gateway is yours. You will need to tell the server which Gateway you are using. You can add multiple Gateways if you want using the same procedure.
 * Go to the Gateways Page by clicking the link at the top that says Gateways
 * Click the "Add Gateway" link
 * Enter the MAC Address of the Gateway (no dashes). This is printed on the bottom of the Gateway next to the bar code and starts with 00-1B-C5-0A. Be sure to enter the full MAC address, e.g. 001BC50A517F or similar. You are required to enter it twice to be sure that it was entered correctly.
 * You can optionally add a note about this Gateway, e.g. "mounted under the sink" or similar. This can be changed later on.

= Install Drivers and Software = Install the drivers so that you can communicate with the Gateway and the development boards.
 * 1) Download the FTDI USB driver from the link above and run the installer. FTDI supports just about every operating system used by mankind, and installation is easy.
 * 2) If you don't already have IAR-MSP430 or Code Composer Studio installed, then you'll need to install the MSP430 LaunchPad driver. Refer to the MSP-EXP430G2 LaunchPad Experimenter Board User's Guide for more information. Better yet, install IAR Embedded Workbench for MSP430 so you can edit the examples.
 * 3) Install TeraTerm from the link above, or other Terminal Emulator.

= Install Gateway = Now that we have the drivers installed we can actually do something. These instructions may seem overly basic but it's important not to leave anything out.
 * 1) Plug one end of the Ethernet Cable into the Gateway's RJ-45 jack and plug the other end into your internet connection.
 * 2) Plug the Mini-USB cable into your computer and then into the Gateway
 * 3) The power LED (blue) on the front of the Gateway should now be illuminated. If it is not then check the USB connection.
 * 4) Open TeraTerm and connect to the Gateway.
 * 5) Go to File: New connection
 * 6) Select 'Serial' radio button
 * 7) Select the COM port connected to the Gateway. This will be different on each machine but will be identified as 'USB Serial Port' in the selector
 * 8) Click Ok
 * 9) Select Setup Serial Port and set to 115200 baud, 8 bit, No parity, 1 stop bit, No flow control
 * 10) Click Ok
 * 11) If you don't see anything, don't worry. The Gateway doesn't normally output anything to the terminal unless you want it to. Press ? and you should see a menu of commands. If this doesn't work then try closing the serial connection and re-opening it. If it still is not working then try disconnecting the USB cable and reconnecting it. The FTDI interface used is very robust, it shouldn't take much work to get it talking.

= Check Gateway is on the Internet = Since this is our first time, we will be methodical about verifying that the Gateway is connecting to the Internet properly.

Ethernet Link
The RJ-45 jack on the Gateway has two LEDs: Verify that the Amber LED is illuminated. This means that the Ethernet cable is plugged in. You may see the green LED blinking from time to time too.
 * Amber (right side) indicates Link and is illuminated when the Gateway is powered and connected to an Ethernet hub or switch.
 * Green (left side) indicates Activity and is illuminated when Ethernet traffic is sent or received.

View IP Address Settings
By default the Gateway will obtain an IP address using DHCP but may also be configured to use a static IP Address. If you need to configure it to use Static IP Address, see Configuring Gateway Addressing.

To view the Gateway's IP Address settings, press 'E' at the command line prompt. You should see that the Gateway has an IP Address and that it's not 0.0.0.0 or 169.254.x.x. If desired then you can Restart the Gateway.

Ping the Server
Now press 'D' to ping the server (in the cloud). This uses a ping to check whether the Gateway can see the Server. You should see that the ping has a reply. If it does not then there is a problem with your internet connection. Also try pinging the same server from a computer that is on the same network. ping demo.teslacontrols.com
 * In Windows, this is accomplished by opening a command prompt and then typing
 * In Mac OS or *nix based Operating Systems, this is accomplished by opening a command line prompt and typing the above text.

Send Info Message to Server
With the assurance that our Gateway is on the internet and functioning correctly we can now attempt to communicate with the server. Now press 'I' to send an Info message to the server. The Gateway sends this automatically but this is a handy tool to generate a message at our request.

No Connection to Server Message
When an Info Message (containing sensor data) is sent from the Gateway to the Server, the Server responds to the Gateway with an ACK message to close the loop. The ACK message is sent from the Server via UDP through your Firewall to UDP port 42000 on the Gateway. So in order for the Gateway to receive the ACK message, your firewall will likely need to be configured to forward UDP port 42000 messages to the Gateway.

In a sensors-only setup (i.e. all the real message flow is from the Gateway to the Server), it is not mandatory that the Gateway receives the ACK messages. So if your firewall blocks these messages, and you do not wish to add a "Port Forwarding" rule to the firewall, then you will simply see an occasional "No Connection to Server" message on your Gateway console port.

The upload of messages from the Gateway to the Server is still operational -- as long as you can successfully ping the Server.

To add a port forwarding rule to your firewall for UDP 42000, you may need to Change Firewall Settings.

Test Connection to Server
To ensure that we added our Gateway correctly, go back to TeraTerm connected to the Gateway and press 'I' to send an info message to the Gateway. On the server, click on the Gateways link at the top and you should see your Gateway listed along with information about it, including 'From IP Address' and 'Last Heard' or similar. If no information is shown then try pressing 'I' again to send more info messages. Also refresh the web page to be sure that you're getting the most recent data.

View Gateway Information
After you have verified that you can receive a message from the Gateway, on the Gateways page in COIL click on the 'edit' link in the table. This will display the contents of the most recent Info Message received from the Gateway. The Gateway sends out status messages periodically or when instructed to by the user either via command line interface or button.

= Further Development = Now that you have the basics down, you may want to see the Command Line Interface for more information about customizing the performance of the Gateway.