In The Air – Week 6

Last week, I set up openHAB to visualise data on my FuelTank’s battery state. But how did I access this data from the CC3200? Let’s find out …

Energia & CC3200 on Mac

But first … another problem was solved!

At long last, the CC3200 is working with Energia on my Mac, thanks to pmohan for pointing me to the solution. The issue was caused by the latest version of OSX (Yosemite) not allowing to run unsigned drivers (“kext”).

Screen Shot 2014-11-19 at 20.50.30

Using a manual fix which disables the signature checking in OSX, the driver can be loaded and the CC3200 detected in Energia! Woop!

Trial & error

During my research, I came across some posts and reviews by Peter Oakes in which he created an Energia sketch to retrieve some statistics from the Fuel Tank BoosterPack via I2C.

I hooked up the Fuel Tank Boosterpack to the CC3200, loaded the sketch in Energia and monitored the serial output. Nothing spectacular happened.

Screen Shot 2014-11-23 at 18.34.01

All values were “0”. This meant that either the sketch would somehow not be compatible with the CC3200 or that the I2C slave was unreachable.
Searching a bit more, I came across a library (it’s at the bottom of that page – or here) doing the same thing, and the result was unfortunately the same. (What was I expecting ??)

Recovering the battery

At some point, I connected the Fuel Tank to the CC3200 and had it run on the battery without charger.
Unfortunately, the battery discharged a bit faster than expected, while I was away at work.

The result ? By the time I got home, the battery would no longer charge via the Fuel Tank when connected to a power source.

Looking through the Fuel Tank’s documentation, there is a trick to “kickstart” the charging of the battery in case it was discharged too much.
The procedure is described in paragraph 6 of the user guide and helped me recover the battery, after which it was charging with the Fuel Tank again.

Pinout diagrams

In order to troubleshoot the problem, I searched pinouts of both the CC3200 and the Fuel Tank BoosterPack. I found both on the Energia website.

cc3200lppinmap fueltankbppinmap

What I noticed based on these diagrams, is that the Fuel Tank BoosterPack seems to have multiple I2C pins!
Using jumper wires, I tested the different I2C pins of the BoosterPack with the CC3200, until I found a working set.

After that, I connected the BoosterPack to the CC3200 and used the jumper wires on the CC3200 directly. Like so:

Screen Shot 2014-12-05 at 12.56.17

(Fritzing part for the CC3200 was found here: New CC3200 Launchpad Fritzing Part)

I removed the jumpers connecting the onboard sensors to the I2C bus and connected jumpers to the I2C pins attached to the underlying BoosterPack.
Because I removed the jumpers of the onboard sensor, I had to ensure the “pull-up” jumper on the BoosterPack was in place. You can verify the pull-ups are ok if the green and orange LEDs of the CC3200 are on.

With this little manipulation, I was finally having proper readings on the Fuel Tank’s data with both Peter’s code and the library:

Screen Shot 2014-11-23 at 22.33.50 Screen Shot 2014-11-23 at 22.42.08

Glitches in the readings

I did notice some glitches in the values read when doing the following:
connecting/disconnecting a charging source
having the CC3200 connected via USB to PC (for Serial output) at the same time


This is my current sketch. It’s still very basic and rough, but it does the trick for now.
It will need to be improved to go into deep sleep after sending the values, until the next set of values is to be sent.


// Core library for code-sense
#if defined(WIRING) // Wiring specific
#include "Wiring.h"
#elif defined(MAPLE_IDE) // Maple specific
#include "WProgram.h"
#elif defined(MPIDE) // chipKIT specific
#include "WProgram.h"
#elif defined(DIGISPARK) // Digispark specific
#include "Arduino.h"
#elif defined(ENERGIA) // LaunchPad MSP430, Stellaris and Tiva, Experimeter Board FR5739 specific
#include "Energia.h"
#elif defined(CORE_TEENSY) // Teensy specific
#include "WProgram.h"
#elif defined(ARDUINO) && (ARDUINO >= 100) // Arduino 1.0 and 1.5 specific
#include "Arduino.h"
#elif defined(ARDUINO) && (ARDUINO < 100) // Arduino 23 specific
#include "WProgram.h"
#else // error
#error Platform not defined

// Include application, user and local libraries
#include "Wire.h"
#include "FuelTankLibrary.h"

WiFiClient wclient;
byte ip[]     = { 172, 16, 0, 100 };
PubSubClient client("", 1883, callback, wclient);
FuelTank myFuelTank;

#define       WIFI_SSID         "wifi57"
#define       WIFI_PWD          "**********"

void callback(char* inTopic, byte* payload, unsigned int length) {
// Handle callback here

void setup() {

void loop() {

void publishData() {
  WiFi.begin(WIFI_SSID, WIFI_PWD);
  while(WiFi.localIP() == INADDR_NONE) {
  // Give some time to settle

  char content[10];

  if (client.connect("CC3200-Room-1")) {
      sprintf(content, "%d", myFuelTank.voltage_mV());
      client.publish("cc3200-fvan\/voltage", content);

      sprintf(content, "%d", myFuelTank.timeToEmpty_mn());
      client.publish("cc3200-fvan\/tte", content);

      sprintf(content, "%d", myFuelTank.stateOfCharge_Percent());
      client.publish("cc3200-fvan\/soc", content);



The result of the data being received, as seen from openHAB:

Screen Shot 2014-11-27 at 14.57.12

© Frederick Vandenbosch, 2014-2021. Unauthorised use and/or duplication of this material without express and written permission from this blog’s author and owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Frederick Vandenbosch with appropriate and specific direction to the original content.