Connected Devices

Week 2: Internet Connectivity

connecteddevicesConnected Devices [pdf]

This week, we’re going to learn how to connect to wifi networks and online data using an Arduino-compatible board, the WildFire from WickedDevice. The board includes a TI CC3000 module which can connect to wifi networks.

WildFire3-eWickedDevice WildFire board



These instructions explain how to install the files you need to work with the WildFire board and Adafruit CC3000 library from the Arduino software. They assume that you already have Arduino installed, version 1.6 (or later).

  1. Install the FTDI drivers.
  2. Locate your Arduino sketchbook folder. This should be the Arduino directory in your documents folder (e.g. “My Documents” on Windows or “Documents” on Mac). You can also find (or change) the sketchbook’s location in the preferences dialog of Arduino.
  3. Create a “hardware” folder. Inside the sketchbook folder, create a folder named “hardware” (all lowercase). (There should already be a folder called “libraries” in the sketchbook folder. If there isn’t, create one.)
  4. Move the WildFire files into the hardware folder. Unzip the WildFire zip you downloaded (if you haven’t already). There should be a folder called “WildFire-Arduino-Core-master” inside it, and a folder called “WickedDevice” inside of that. Move the “WickedDevice” folder into the “hardware” folder you created into your Arduino sketchbook. You should end up with “Documents > Arduino > hardware > WickedDevice”, which should contain a folder called “avr” (along with some other files).
  5. Move the CC3000 library files into the libraries folder. Unzip the Adafruit CC3000 library zip file you downloaded if you haven’t already. It should contain a folder called “Adafruit_CC3000_Library-master”. Move that folder into the “libraries” folder in your sketchbook.
  6. Restart the Arduino software.
  7. Check that everything installed correctly. Inside the “Tools > Board” menu you should see entries for the WildFire. Inside the “Sketch > Import Library” menu, you should see “Adafruit_CC3000_Library-master”.

Connecting to the Internet w/ the WildFire

To test the WildFire and its ability to connect to the internet, we’ll run the WebClient example. This connects to the Adafruit web site and downloads a short web page.

  1. Open the WebClient example in Arduino. You can it in “File > Examples > Adafruit_CC3000_Library-master”.
  2. Change the pin numbers for the CC3000. These specify how the CC3000 module is connected to the microcontroller (the ATmega1284) on the WildFire board. The IRQ line is connected to pin 22; VBAT to pin 23; and CS to pin 21. Your code should look like:
    #define ADAFRUIT_CC3000_IRQ   22
    #define ADAFRUIT_CC3000_VBAT  23
    #define ADAFRUIT_CC3000_CS    21
  3. Change the wifi network information. Set WLAN_SSID to the name of your network, WLAN_PASS to the password for your network (if there is one), and WLAN_SECURITY to the type of security your network uses (WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2). For example, at MIT, we’d set WLAN_SSID to “MIT GUEST” and WLAN_SECURITY to WLAN_SEC_UNSEC. (The value of WLAN_PASS doesn’t matter, since there’s no password for the MIT Guest network.). This would look like:
    #define WLAN_SSID       "MIT GUEST"
    #define WLAN_PASS       "myPassword"
  4. Select the board and port. Select “WildFire v3″ from the Tools > Board menu and the appropriate serial port from the Tools > Port menu. The serial port should be something like “/dev/tty.usbserial-XXXXX” on Mac and is likely to be the highest numbered COM port on Windows. One way to figure out the right serial port is to see which menu item appears when you plug the WildFire into your computer and disappears when you disconnect it.
  5. Upload the WebClient sketch to your Arduino.
  6. Open the serial monitor. Be sure to set the baud rate to 115200.
  7. Check for a successful internet connection. You should see output like that shown below.

WebClient output

Web Services for Connected Devices

The Wildfire board (or any Arduino + CC3000 combination) can, theoretically, connect directly to arbitrary websites and services. In practice, though, many web sites are designed to be accessed by a web browser or software running on computers or smartphones with lots of processing power. As a result, it might not be possible to do the processing needed to communicate with those sites from a simple device like an Arduino board.

There are a number of online web services specially designed to facilitate access to web information from simple embedded processors (like the ATmega chips on an Arduino):

Using Temboo to Access Web Services

We’re going to use Temboo to access a variety of web services from the WildFire board.

Instructions for setting up Temboo for IoT mode + Arduino + Adafruit CC3000. Changing pin numbers. Creating sketch and extra sketch tab for TembooAccount.h header file. (Fixing syntax error in Temboo sketch.)

Example sketches (download zip file): weather (+ parsing temperature to, say, LED color), sending an email using gmail, something with input from the internet that changes quickly.

Formatting XML

Try: this XML formatter.

Leave a Reply