What we will do in this Arduino IOT experiment

We know a lot about of about Inter Of Things or in short IOT in this technology era. In fact, this is one of the top topics in technology discussion as well one of multimillion dollar tech industries for tech entrepreneur and business investor. But we will not discuss that here. Rather we will go into some real hardcore experiment to understand from its core. We will demonstrate this internet of things in or IOT using Arduino, CC3000 while configuring the WiFi using the SmartConfig feature of CC3000 to publish some sensor data to a cloud database. To do that We will publish a photo-sensor values to the Sparkfun ‘Phant’ database. We will use a Sparkfun Wifi CC3000 breakout board and Arduino to gather the sensor values and then publish or stream those values to that Cloud or at least to that internet Database.

Sparkfun Texus instrument CC3000 Breakout Board

CC3000 Breakout Board

We are using:

1. Texas instrument CC3000 wifi-processor for communication

2. Arduino to collect sensor data

3. https://data.sparkfun.com or ‘Phant’ to store/publish/stream the values into ‘Phant’ database

4. A photo-resistive sensor for sensor values and a 10kΩ resistor

Connecting CC3000, Photo sensor, and Arduino

First, we need to connect the breakout board as shown below:

IOT sensor data publish to phant

connecting Arduino CC3000 and photo sensor circuit diagram

(CC3000 Breakout Board → Arduino)

  • GND → GND
  • VCC → 5V
  • MOSI → 11
  • MISO → 12
  • CS → 10
  • INT → 2
  • SCK → 13
  • EN → 7
  • The output of a photocell (voltage divided with a 10kΩ resistor) connects to A0.

CC3000 Arduino Library Installation

Now we need to download the Arduino library for Sparkfun CC3000 breakout board. There is another library for cc3000 by Adafruit cc3000 breakout board.

But as we are using Sparkfun breakout board we will use the Sparkfun library. We need to download the zip file and install or extract it to the Arduino Library Folder. I have a complete post on this but in short just,

  1. navigate to Sketch > Include Library.
  2. At the top of the drop-down list, select the option to “Add .ZIP Library” and locate the zip file that we downloaded from the GitHub repository.

Sending Wifi network credentials(SSID and password) to our Wifi cc3000 processor

We can hard code the wifi SSID and password into the code we will upload in Arduino to communicate using cc3000. But from a product point of view, the users has no access to microcontroller code for a specific product. Also, when we change the network environment how we will change the WiFi credentials. Will we change every time in the code every time we change the network? ‘SmartConfig’ and ‘FastConfig’ feature comes in handy in this kind of situation. In fact, smart config is actually generalized feature these days for any advanced WiFi processor.


Smart Config Application is used in order to configure a CC3000 device to connect to a specific network. In general nowadays for any IOT processor “Smart Config” means sending WIFI credentials from a smartphone.


When the SmartConfig procedure is run, the CC3000 creates a connection profile in non-volatile memory (note that all previous connection profiles are deleted). The connection profile can be recalled later (even if the CC3000 and Arduino lose power!) to perform the FastConnect procedure, which allows the CC3000 to connect to the last access point stored in memory. We can see that this feature is also available in other IOT processor in one way or other.

This example requires two different Arduino programs but illustrates the steps necessary to use TI’s SmartConfig procedure. We can create a program that combines SmartConfig and FastConnect to allow users the option of selecting which method to connect to a network.

Combining SmartConfig and FastConnect for TI CC3000 IOT processor in Arduino

In the code, I combine two of them. First It will check the WiFi credentials in volatile memory. If it finds it will try to use to connect the WiFi network. That is the part of the Fast Connect. If it fails it will wait for Smart Config to get the credentials sent from the user phone.  For the code visit here:


Now in the section let’s see how we can use the Smart Config App.

SmartConfig Application for the Andriod and iOS developer

We can find the source code for Andriod and iOS here. We need to have a TI account to download the source code.

For Android

For Android, we need to download the .exe file and just install it. It will extract all the android source files into a folder. You can install it to your Andriod Phone in two ways. I will first explain the better way. (better way in my sense because we will know the source code exactly what we are installing and if needs we may even change the code or the UI according to our needs.)

Now just in case you may have another platform like Linux or MAC, I put the code in my GitHub repository so that you can avoid the installing the .exe file.

Procedure 1:

1.1 Once you download the code from the repository, open eclipse and connect the USB to the computer.

1.2 If your target phone or the device(tab) is installed properly, running the code will ask you to select your target device.

Eclipse: asking to select the Android device

Eclipse: asking to select the Android device

1.3 Select the device and press OK.

Eclipse running

Eclipse: Running well 🙂

Note: If you face the issue like “unable resolve target android-17”, you can right click on your project -> properties -> Android -> Select the Target android version you want to compile and Apply. And you should be good to go.

Procedure 2:

2.1. In the bin folder, you will find the SmartConfigCCX.apk file.

2.2. Run the self-extracting .exe and accept the defaults. The program will unzip a series of folders to C:\TI\CC3000AndroidApp.

Using a USB cable, plug your phone into your computer.

2.3 Navigate to the directory of the SmartConfigCCX.apk (for example C:\TI\CC3000AndroidApp\SmartConfigCC3X\bin) and copy SmartConfigCCX.apk to the Internal Storage of your Android device

2.4. On your phone or tablet, go to Settings → Security, and check “Unknown sources” to allow the installation of the .apk file.

2.5. Install a file browser, such as OI File Manager in your Android device.

2.6. Find the ‘SmartConfigCC3X.apk’ file. For me it is in the /storage/emulated/[SD card]. Click on the SmartConfigCC3X.apk.


Android – browse to the SmartConfig app


2.7. it will ask you if you want to install it or not. Click “Install.”

2.8. Once the app has installed, click “Done.”

For iPhone

For ‘iphone’ we can also follow 2 procedure. The one about any IOT product or experiment excite me that it really involves several technological aspect and skill set to build a final. Like from embedded programming to Android and iOS programming.

Procedure 1:

1.1. We can download the source code for iPhone from here.

1.2. After downloading open the code with Xcode and select your phone.

iphone SmartConfig

iOS source code for Smart Config App

3. You may need to do a little optimize or tweak something with your code. Some optimization and correction will be done automatically by Xcode if necessary. In my case, I was getting an error something like “fembed-bitcode is not supported on versions of iOS prior to 6.0”. To solve that I searched for “bitcode” in the project>Build Settings (To get that window simply select the project name at the top of the Folder structure on the left and then select ‘Build Settings’) and change “Enable Bitcode” option to No.

Select 'enable bitcode' as No

Select ‘enable bitcode’ as No

1.3. Click the run button if everything is OK, Xcode will build and run the application. You will see the CC3x App appears on your iPhone. Open CC3x and put the wifi SSID and password. If the Arduino is on, you will see the wifi is successfully configured.

Procedure 2:

Another easy procedure is to download the free app from the iTunes store: TI WiFi SmartConfig

Publish the data in Phant database

    1. Visit: https://data.sparkfun.com/
    2. Then we will create a free data stream.Each Phant data stream has one public and one private key. The “public key” is visible to everyone who visits the data stream because it’s part of the URL. So, the stream looks like: https://data.sparkfun.com/streams/[The_Public_Key]. For my photo sensor data stream, it is: https://data.sparkfun.com/streams/yA6dXAGooNcw1Rdwld6j
    3. POST the data:The “private key” is required to post any data to the stream. This key isn’t publicly visible, and it should only be known by you or anyone else allowed to post to your stream.The last parameter we should when we POST is field names. Each stream contains one or more field names – the “labels” for your data values. As I am publishing only the value of photosensor here, I have only one field which is photosensor and I declare the variable in my Arduino code like: const String fieldNames[NUM_FIELDS] = {"photosensor"};
      String fieldData[NUM_FIELDS];
      I declare fieldNames as a string and it has one value which are the field names of our stream “photosensor”.  And the field names and sensor values are Coded in an array so that if needed can be put more fields values.
    4. Later in the loop the code is like:

client.print("GET /input/");
for (int i=0; i<NUM_FIELDS; i++)
client.println(" HTTP/1.1");
client.print("Host: ");
client.println("Connection: close");

The reason is simple. For every data point POST in the stream the format of the request is:

GET /input/publicKey?private_key=privateKey&photosensor=sensorValues&time=5201 HTTP/1.1\n
Host: data.sparkfun.com\n
Connection: close\n

And that exactly what we print for every sensor read in every loop if you look closely in the above code.

5. Finally in the Phant if you go to the URL https://data.sparkfun.com/streams/[The_Public_Key] (For my stream which is https://data.sparkfun.com/streams/yA6dXAGooNcw1Rdwld6j)

It looks like:

Phant realtime database for IOT

Phant Stream for IOT

One thing, I did not put my private key in the GitHub code. So, Do not forget to change the KEY for your own stream. And last but not least, let me know your comments and let me if you had any issue with the code. 😀