SmartConfig

Author Gravatar Image RICK LESNIAK
SmartConfig is the special functionality in the CC3000 that allows setting the SSID and password settings without having to type or re-program the module. Any iOS/Android device can be used to set the configuration - solving the annoying deployment problem of how to set the connection details for a new device.

SmartConfigCreate and SmartConfigReconnect

These two SmartConfig sketches should be used together to demonstrate how the SmartConfig app can be used on your smartphone to pass connection details to your CC3000.

SmartConfigCreate

This sketch will initialise the CC3000, erasing any previous connection details stored on the device. It will then enter SmartConfig mode with a 60 second timeout where it waits for configuration data to arrive from the SmartPhone.

If a connection was successfully established, the connection details will be stored in the non-volatile memory of the CC3000, and the module will be configured to automatically reconnect to this network on startup (meaning you don't need to run the SmartConfig app unless your AP details change or you erase the stored connection details on the module).

There's no need to edit the sketch to add your SSID and password - the SmartConfig app does that for you!

SmartConfigReconnect

This sketch shows how to use the CC3000 in 'reconnect' mode, and avoid erasing all stored connection profiles, which is unfortunately necessary with other sketches where manual config data is provided.
  • Initializates the CC3000 with a special SmartConfig flag so it doesn't erase the profile data
  • Access Point connection (based on saved AP details)
  • DHCP address assignment
  • Disconnect
SmartConfig is still in beta testing! It might not work on all networks!

Using the SmartConfigCreate Sketch

Step One: Install the SmartConfig App

Before you can use SmartConfig to provide your AP connection details, you need to install the SmartConfig app:

Step Two: Configure the SmartConfig App on your Phone

Once you've installed the SmartConfig app, you need to connect to the AP that the CC3000 will be using (HOMENETWORK in the images below), and then load the app.

You should see a screen similar to the following, with the AP's SSID, Gateway IP Address and Device Name fields already populated:
This tutorial will use an iPad to provide the SmartConfig details, but the process is basically the same on Android.
Add the password for your Access Point, but don't click the START button yet!
Don't change the Key or DeviceName fields!

Step Three: Open and Run 'SmartConfigCreate'

  • In the File > Examples > Adafruit_CC3000 menu select the SmartConfigCreate sketch.
  • Run the sketch and open the Serial Monitor via Tools > Serial Monitor.
  • You should see something similar to the following text:
Copy Code
Hello, CC3000!

RX Buffer : 131 bytes
TX Buffer : 131 bytes
Free RAM: 595

Initialising the CC3000 ...
Firmware V. : 1.24
MAC Address : 0x08 0x00 0x28 0x01 0xA8 0x1F
Waiting for a SmartConfig connection (~60s) ...

Step Four: Start the SmartConfig app on your Phone

Before the Android sketch times out, click to 'Start' button in your TI app, and watch the serial monitor window of your sketch. After about 30 seconds you should see something similar to the following:
Copy Code
Got smart config data
Saved connection details and connected to AP!
Request DHCP

IP Addr: 192.168.0.103
Netmask: 255.255.255.0
Gateway: 192.168.0.1
DHCPsrv: 192.168.0.1
DNSserv: 192.168.0.1

To use these connection details be sure to use
'.begin(false, true)' with your Adafruit_CC3000
code instead of the default '.begin()' values!

Closing the connection

Step Five: Stop the SmartConfig App on the Phone

If everything worked out and you successfully connected to your AP, the connection details were also stored in non-volatile memory on the CC3000 module. You can now use the SmartConfigReconnect sketch to test the connection details, specifically paying attention to the extra flags in the Adafruit_CC3000.begin() function compared to other sketches..

Did the sketch timeout before connecting?

  • Be sure to click 'Stat' in the SmartPhone app as soon as the 'Waiting for SmartConfig connection (~60s) ...' message pops up. The SmartConfig device will timeout after 60 seconds, so you may need to run the sketch again and be a bit quicker with your fingers.
  • Make sure that the iPad or SmartPhone is connected to the same AP that you want the CC3000 to connect to!
  • Check your password in case there is a typo

Using the SmartConfigReconnect Sketch

The SmartConfigReconnect sketch shows how to use (and retain) the connection details that were written to the device in the example above.

The key to using and maintaining the connection details is to pass an optional flag to the Adafruit_CC3000 classes .begin() function to tell the driver NOT to delete existing connections, and to stay in auto connect mode:
Copy Code
  /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
  /* !!! Note the additional arguments in .begin that tell the   !!! */
  /* !!! app NOT to deleted previously stored connection details !!! */
  /* !!! and reconnected using the connection details in memory! !!! */
  /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */  
  if (!cc3000.begin(false, true))
  {
    Serial.println(F("Unable to re-connect!? Did you run the SmartConfigCreate"));
    Serial.println(F("sketch to store your connection details?"));
    while(1);
  }
The first flag should always be false, and is used to indicate that we are going to perform a firmware update. The second flag should always be true when using SmartConfig data, and puts the CC3000 in an auto-reconnect mode and maintains existing connection details in non-volatile memory.

If you were able to successfully connect using the SmartConfigCreate sketch, SmartConfigReconnect should give you something similar to the following output:
Copy Code
Hello, CC3000!

Trying to reconnect using SmartConfig values ...
Reconnected!

Requesting DHCP

IP Addr: 192.168.0.103
Netmask: 255.255.255.0
Gateway: 192.168.0.1
DHCPsrv: 192.168.0.1
DNSserv: 192.168.0.1

Closing the connection
Any time you don't provide the extra flags to the .begin method, all connection details will be erased and auto-reconnect mode will be disabled! Unfortunately, this is necessary when providing manual connection details, so be careful using non SmartConfig* sketches if you don't want to lose your connection details.
Last updated on 2014-04-24 at 03.50.39 PM Published on 2013-09-16 at 05.57.40 PM