Introduction & Background Bits
This blog post is part of a Project titled “IoT Lamp” and also serves as a tutorial for the CC3200 and Energia beginner.
I wanted to have a wireless connection to the light so that I may be able to control the color, brightness etc like in the case of phillips hues. I however wanted something that I could modify to have four channels so that I may use my own make and color of LEDs. This ofcourse later will be used for a hydroponic garden I have already setup BUT right now the point is to have a wireless connection. I had an assortment of options from 433MHz AM modules, to a cc2500 with MSP430 or Si4455s or LPRS eRICs or even my fav CC110L. I even bought a Cypress PSoC BLE kit to experiment with because writing firmware can be a tad bit boring at time. At this point I decided to try out Energia with the CC3200 and I had tried it before but I have had… issues.
My past experiences involved messing with service packs and there were a lot of problems with the REV3.2 board and the newer service pack. Long story short- it did not work out then and now I have a new project and so Energia was given a go.
Skip this section if you have already used energia. So what is Energia? Energia is TI’s delayed answer to Arduino- Simple! AVRs rule the DIY world because they are easy to use and that is due to the enormous community and the arduino IDE. Its based on processing IDE and is written in Java. The compiler is GCC and it can be ported to most OSs and for the most part, you don’t need to ‘install’ anything. Just copy the whole folder and bam! You are ready for the show. No messy configurations etc. You select the boards from a list and there is a library of demo code which comes with the thing, ready to go.
The downside? Its more or less based on prewritten C code like if you want to set a pin HIGH, then you call
which in turn passes your arguments to somewhere else and then the compiler is supposed to convert it into assembly blah blah blah. You get the point. In short, if you are an absolute control freak(like me who has memorized ASM for 8080, 8086, 8051 and AVR to the instruction cycle- I teach this stuff to undergrads!) you will never be truly happy. That is one of the reasons why I usually go Assembly or C that I know how to write and which I can predict most of the time. Energia comes in when you are either a beginner or a non-engineer or a lazy engineer 🙂 … like me in this instance. There is library for getting wifi up and running and that was my interest here. I did write a C application for a few CC3200 projects sometime back but I am not going to talk about that here. Maybe later.
Setting up the launchpad
Sounds interesting but its actually just a sequence of steps that you have to follow… EXACTLY OR YOU WILL DESTROY TIME AND SPACE!!!!
Just kidding. The CC3200 is a pretty tough cookie. Here is what you do.
If you have just taken out the LP out of the box, you should check the version of the board and the silicon. There are labels in the board that identify it like in my case REV 3.2 which tells me that its not the latest board and the latest software or firmware updates may not work for me. See the images below from http://www.ti.com/lit/ug/swru372b/swru372b.pdf
Next we need to checkout the part or silicon number. In my case it is the XCC3200HZ which is preproduction version as per
https://e2e.ti.com/support/wireless_connectivity/simplelink_wifi_cc31xx_cc32xx/f/968/t/399389 and there are 80Kbs used for internal purposes. The service pack release notes at http://processors.wiki.ti.com/index.php/CC32xx_Release_Notes also tell us that the device is indeed supported. Cool! Lets move on.
For our exercise we want to use the Energia platform and in my case i had already use my launchpad for previous applications. Hence I downloaded and installed the standalone version of uniflash from http://www.ti.com/tool/uniflash and when your run it,
There is an option to ‘Format’ which is what we need to do. Connect a jumper as shown in the image below and then the launchpad to the USB port. Type in the correct port number and when it asks for the size, simply enter 1MB.
At this point, my launchpad is pretty much good to go. Note that if you are trying to update the firmware, the instructions can be found http://energia.nu/cc3200guide/
Doing the Energia
The CC3200 is an internet on a chip device so instead of the conventional Blinking LED, I setup the MQTT Demo. Start Energia and then… Follow the screeshots…
The Hello WiFi example is pretty straightforward and all you need to do is supply the Wifi Access Point Name, password and MQTT Topic. Done. To program the board, again connect the jumper as before and then reset the launchpad. Next use the Energia’s Upload button and it should tell you that the board was successfully programmed. Take out the jumper and reset the board and when you do, it will connect to the access point and start sending messages via MQTT. Use your favorite MQTT Client to subscribe to the topic you mentioned and you should see the CC3200 talk!
I hope this helps you and if does add a comment and share.