IoT-Internet of Things : Hands On Spark Core

And there I was, so much excited about my new Spark module!
Alas!! It didn’t go good.  For a warm welcome, there were these problems to bang my head with.  The module I received looked just alright because the shipping was not good, I got its packaging open, and it didn’t work too.  Wohoaa!!! totally my case.
I expected it to be having ZERO or almost NO learning curve i.e. NOT ‘learning a lot and then doing a little’ rather ‘Doing a Lot and learning by doing’.

Unboxed it, I ordered it with the antenna(flex).  So, as it was said, I followed the command with their “Getting Started”spark_module

Step 1 and Step 2 are just powering up and installing an IOS/Android application so lets move forward.

Step 3 a.k.a. the pain in ASS.
And here is how the picture changes from this point onwards.

STEP 3:
Make sure your phone is connected to the WiFi you want to use (it’ll show up in the SSID blank on the app), then enter your password and click CONNECT!

This may take a little while- but don’t worry. It should go through the following colors:

  • Blinking blue: Listening for Wi-Fi credentials
  • Solid blue: Getting Wi-Fi info from app
  • Blinking green: Connecting to the Wi-Fi network
  • Blinking cyan: Connecting to the Spark Cloud
  • Blinking magenta: Updating to the newest firmware
  • Breathing cyan: Connected!

My spark module did a few steps i.e the LED indeed changed uptil blinking cyan/magenta or so.  Well I am bad at colors but one thing I was sure of that I was not getting the “Breathing” pattern of led in that CYAN color which one can spot from the animation given at the above link.

Summarizing the whole kaput i.e. my almost day, there are actually two immediate possible ways of configuring the Spark module to work.

1. Self configuration of Spark Module via SMART CONFIG i.e. all goes automatically.

  • IF your android/IOS application works for your device.  I have seen people whining over internet and forums that the application doesn’t work on their particular device but works rest of their devices.
  •   IF your spark core module is working! PERIOD.
    (I got exhausted making it work) If both the above things don’t go south, then you are so going to enjoy the spark.

2. Manual Configuration – because there are so much more chances that automatic configuration is not going to work because of the instability of the device.  There are many causes it might not work in automatic configuration.

http://docs.spark.io/connect/##connecting-your-core-connect-over-usb
Manual configuration is obviously a bit harder for newbies.  In case of other OS, I dare not comment but in case of Linux it was all smooth.  Installing a few packages, removing a few, configuring the right settings and BAMM! it works.

How SPARK Module works (superficially)?

1. Spark Module is having CC3000 wifi chip with the controller alongside.  So all we need to do is to correctly configure the wifi chip rest is all handled automatically.

2. The mobile application is connected to a WIFI network(it IS mandatory) and in the same WIFI network, we wish to connect our SPARK core too.

3. On opening the mobile app, it automatically loads the current wifi and we need to supply the password and then click connect except for the cases of having AES encrypted passwords, in that case, we have to supply that passphrase too.

4. On clicking Connect, the app kinda broadcasts the wifi SSID and the password in some encrypted form, so its more or less secure somehow(I am not exactly sure how secure it is) and the SparkCore having device name – sparkdevices2013 accepts the SSID and password from the encrypted data and connects to internet, and in exchange the mobile application gets the IP of Spark Core and thus proceeds for further communication with the device.

If your device is working, then you will get to name the CORE, and will get the TINKER screen, i.e. an application in your mobile device to access GPIO of SPARK module and it will look like this

spark_app_1

You can now control the digital and Analog pins of the SPARK module from the mobile app.  Mobile app is really not powerful yet as whole of the things are tried to tie up with the Web based IDE that looks and builds like Arduino environment.

In case you don’t face hardware or firmware problems, you are good to create a spark via your apps on WEB IDE building interface.

To me, WEB IDE really seems a little slow and pushing or uploading the apps part has got a big room for improvement.
Otherwise, it all works with sincere latency(well, one can’t really say of Internet. When, How and where one packet travels…ughh the old painful story of a data packet travel).

PROBLEMS & General Troubleshooting:

The Spark module is currently having many a problems while configuring WIFI. Automatic configuration seems to be having many a issues with different android hardwares/softwares, I contacted a few who said so on Google Reviews of Spark App.
Manual configuration is not easy, rather it is tricky because the same module is playing role in multiple modes.
Listening Mode –  After start holding the MODE button for 3 seconds till blue lights lits up and blink.
DFU mode –  Programming mode for reflashing the binaries
Factory Reset – Resetting the core module.

Many a people on forums say that Doing Factory reset a few times make their module working, I really don’t buy their point.

Reflashing the binaries through DFU mode worked for some.

In my case the problem was of “bad keys”, much like this guy’s video
https://www.youtube.com/watch?v=Tp63HkpFe1Y&feature=youtu.be

Every device has keys and this is some kind of keys sync error, red led blinking at a fast rate and spark module tries to restart, connects to wifi correctly as per the colour code given on the “getting started” page but then it goes to {red/yellow} color scheme again.
This suggests bad keys.

Solution is to reconfigure your keys:  Follow the link if you get the same error

http://support.spark.io/hc/en-us/articles/203038434-How-do-I-backup-restore-change-my-Core-s-Key-

https://github.com/spark/spark-cli#spark-keys-doctor

 

Next consecutive posts will be followed with real tinkering and more SPARK 😉