CC3000 Home Automation Application for MSP430FR5739

From Texas Instruments Wiki
Jump to: navigation, search


Return to CC3000 Main page

Introduction

This wiki describes the first time installation and use of CC3000 module on MSP430 FRAM board with Home Automation application. This demo shows how CC3000 module can be used to secure the house and control appliances using an android application. This Application uses the TCP connection and wait on the port 3333 for the connection. The first five LED's (1,2,3,4 and 5) are used to indicate the state and the activity on the CC3000 + MSP430 kit, the sixth LED is used as light. The MSP430 thermistor and the remaining two LED's are used to simulate the temperature control, LED 7 as Heater on and LED 8 as A/C on. Three axis accelerometer on MSP430FRAM board is used to secure the house from intrusion.
Home Automation intro.png

Prerequisites

Hardware

  1. 1x LSR SimpleLink Wi-fi CC3000 FRAM Evaluation Kit, orderable from the TI eStore, which is comprised of the following individually orderable components:
    1. 1x CC3000EM, orderable from the TI eStore
    2. 1x MSP430FRAM (MSP-EXP430FR5739), orderable from the TI eStore
  2. 1x Wi-fi Access Point (will be using TP-Link WR740N)
  3. 1x android tablet/smart phone

Software

  1. Download the Patch Programmer installer for MSP430Fr5739 board. 
  2. Download the Sample Applications and Demo for MSP430Fr5739 board. 
  3. Either Code Composer Studio or IAR is needed in order to view and compile the patch programmer sources. Alternatively the binary can be used to burn directly to the board(Included in Patch Programmer download).
    1. CCSv5.2
    2. IAR Embedded Workbench v5.52
  4. Download the CC3000 Home Automation Android Application in the Android device.
    1. The Android SDK is needed in order to modify the Android application. Alternatively the APK can be download in the Android device directly.

Assumptions & Knowledge Base

The user should have knowledge of or be familiar with:

  1. Performing out of box experiment at least once: Wi-Fi MSP430 FRAM Getting Started Guide



Environment Setup

The user has the option of either one of these two IDEs (Integrated Development Environment), in order to run the Home Automation application demo.
Please use the one that you are familiar with.


Loading the Home Automation Application Using CCSv5

Working with CCS will require opening the provided workspace, and compiling and burning it to the board following these instructions:

In order to open a workspace and compile the application by yourself, please follow these steps:

1. Open Code Composer Studio v5.

2. Set the workspace to \..\Home Automation App CCS

3. Select Project->Import Existing Eclipse Project.

4. Select Browse and open the Home Automation App CCS Folder.

5. You should see the CC3000 Automation App, CC3000 Host Driver, and CC3000 SPI projects appear. Select Select All and then click Finish. Your workspace should be automatically created.

NOTE: Before building, open "CC3000 Spi" project properties by right clicking on the project in the workspace and increase the optimization level to 2 as shown in the image.

HA CCS.png

Repeat the same process for "CC3000 Host Driver" and "CC3000 Automation App" project.

NOTE: This Project is build using "CCS v5.2". To work with "CCS v5.3", replace the "Home Automation App CCS -> CC3000 Automation App -> lnk_msp430fr5739.cmd" file with "Basic WiFi Application CCS -> BasicWiFi Application -> lnk_msp430fr5739.cmd" of MSP430FR5739.

Both mentioned issues will be fixed in the next release of CC3000.

6. Build your workspace as follows:

1. In the Workspace window, click CC3000 Host Driver and press the hammer icon in order to build the Host Driver library.
2. In the Workspace window, click CC3000 Spi and press the hammer icon in order to build the SPI library.
3. In the Workspace window, click CC3000 Automation App and then press the hammer icon in order to build the email application.
4. To download and debug the CC3000 Automation application, click the 'Debug' button.


Loading the Home Automation Application Using IAR

Working with IAR will require opening the provided workspace; then compiling and burning the code the board.

In order to open a workspace and compile the application by yourself, please follow these steps:

  1. Open IAR Embedded Workbench
  2. From the menu: Open, then select Workspace
  3. Browse to CC3000 Home Automation Application IAR folder.
  4. Select CC3000 Home Automation IAR IDE workspace. Click on Open
  5. Your workspace should be automatically created. You will see the Home Automation Application workspace, opened with the following sub-projects
  • CC3000 Automation App
  • CC3000 Host Driver
  • CC3000_Spi
  1. Build your workspace: In the Workspace window, build the sub projects in order to generate theirs respective libraries.

You build, by selecting each sub project, then right click your mouse, and select Make. Do the build in this order

  • C3000 Host Driver project,
  • CC3000_Spi
  • CC3000 Automation App

Finally, you can build the CC3000 Automation App

  1. To download and debug the CC3000 Automation App, click the 'Download and Debug' button.



Step-by-Step Demo Procedure

This Section guides the user on how to run the out of box demo of Home Automation application on CC3000 + MSP430FRAM kit and use the android application.

Step 1. Preparing the hardware

Connect the CC3000 EM board to the MSP430 FRAM board as shown below so that the antenna is facing inwards. Apply power to the FRAM board by connecting its USB to your computer. Windows may install the various USB drivers.


CC3000 MSP430FRAM Setup.png


Step 2. Setting up the Access Point

Connect the Power Adapter to the Access Point and turn it on using the Power Button. Verify that the Power LED is on and the Wireless LED is blinking.
CC3000 TPLink AP Setup.png

Note: The Japanese Kits include Buffalo AirStation Nfiniti Access Points. If using this kit, please use the following File:Buffalo AP settings Guide.pdf

Step 3. Updating the Service Pack

Service Pack v1.11 includes Smart Config and Service Discovery functionality. This Service Pack replaces previous versions and does not support older versioned demos.
Please ensure the correct firmware is installed by using the Patch Programmer to load the EEPROM on the CC3000.

Step 4. Programming the FRAM board

Open command prompt and navigate to the location of the source code. Go inside "tools/MSP430Flasher_1.1.3" and run "download_cc3000_fram_Home_Automation.bat" file in Command prompt. If the Application is successfully installed LED 1 will start glowing on the kit.

Step 5. Connecting CC3000 to Access Point

You can connect your CC3000 device to Access point using Smart Configuration mechanism. A smart phone Android/iPhone is required for this process.

  1. Press the S1 button on the FRAM board. If the board was already associated to another Access Point, it will disconnect and All LEDs will turn off. In all cases, LED 1 will turn on and LED 8 will start blinking, indicating that the Smart Configuration process has started.
    CC3000 MSP430FRAM FirstTime Start.png


  2. Now, connect your smart phone to the Access Point. The smart configuration process will succeed only if your Smart phone is connected to the same AP you are trying to configure CC3000 to connect to.

  3. Open your Smart phone Smart Config Application. Make sure the SSID in the application is equal to the AP SSID to which you are trying to connect, if not, enter it manually. Also, make sure the AES encryption flag is unmarked. Device name for this application is "CC3000". For a more detailed description on how to perform this step, refer to the CC3000 Smart Configuration Guide.
    IOS configuration.PNG


  4. When the Smart Config is done successfully and CC3000 is connected to the AP LEDs 1,2,3 and 4 will start glowing.

Exclamation-icon.jpg Home Automation Application does not support AES encryption enabled smart config mode due to the memory constrains of MSP430FRAM board


Step 6. Connecting Android Application to CC3000

Open the "CC3xxx Home Automation" Android Application. Wait few seconds for CC3000 Device to be Added in the available device list in Android application. When a new device is detected a popup will appear. Open the device list and Select the CC3000 device to connect to it.
Home Automation Connect to device.png

After Android Application is connected to CC3000, LED 5 will start glowing on MSP430 FRAM board.

Step 7. Using Application

As soon as the android application is connected to the device, data exchange will start. Packet from device will have three axis accelerometer and thermistor (temperature sensor) reading.
This demo supports three functionality,

1. Window Security: Using the 3 axis accelerometer on MSP430FRAM board you can simulate the Window security feature. Tilt/shake the CC3000 + MSP430FRAM kit in any direction. Window dialog box will popup in the android application displaying warning signal and LED 6 on the board will start blinking. To stop press done button on the Window dialog box.
Home AUtomation Window.png

2. Light Control: You can control the brightness of LED 6 using the android application. Open the light dialog box and use the slider bar to control the brightness of LED. Rightmost position represent the full brightness while lightmost position will turn the LED off.
Home Automation Light Control.png

3. Temperature Control: Temperature dialog box in the android application is used to check the current room temperature and set the desired temperature. The temperature is controlled by turning AC/Heater on. LED 7 on MSP430FRAM board will turn on at Heater On signal and LED 8 will turn on case of A/C on signal. A/C or Heater on signal will be send in case desired temperature and current temperature difference is greater than 2.
Home Automation Temperature Control.png

Note: Desired temperature value should be greater than zero.

Packet Structure

The data communication between device and Android application uses packet of 8 bytes. The following packet structure is used by application.

From Device to Android Application:

Byte:    0         1         2                  3                 4                 5               6         7
Field:   NU        NU        Accelerometer-x    Accelerometer-y   Accelerometer-z   Temperature     NU        NU

From Android Application to Device:

Byte:    0               1               2               3                          4                 5                6        7
Field:   RGB-R(0-255)    RGB-G(0-255)    RGB-B(0-255)    Living Room Light(0-255)   Fan Switch(0/1)   Fan Light(0/1)   NU       AC/Heater status(0/1/2)


However the bytes 0,1,2,4 and 5 of Android to Device packet are not used by the CC3000 Home Automation demo application.

Site Map