element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
In the Air Design Challenge
  • Challenges & Projects
  • Design Challenges
  • In the Air Design Challenge
  • More
  • Cancel
In the Air Design Challenge
Blog [AirCare] InTheAir - Week 6: Accessing Fuel Tank's Data
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: fvan
  • Date Created: 5 Dec 2014 12:26 PM Date Created
  • Views 1561 views
  • Likes 3 likes
  • Comments 8 comments
  • eclipse_iot
  • mqtt
  • openhab
  • beaglebone_black
  • internet_of_things
  • in_the_air
  • texas_instruments
  • iot_sensor_nodes
  • cc3200
  • launchpad
Related
Recommended

[AirCare] InTheAir - Week 6: Accessing Fuel Tank's Data

fvan
fvan
5 Dec 2014

Previous posts for this project:

  • [AirCare] InTheAir - Project Description
  • [AirCare] InTheAir - Week 1: Getting a Launchpad to Blink
  • [AirCare] InTheAir - Week 2: Preparing the Beaglebone Black
  • [AirCare] InTheAir - Week 3: Fuel Tank Testing
  • [AirCare] InTheAir - Week 4: Using the CC3200
  • [AirCare] InTheAir - Week 5: openHAB and MQTT

 

  • Introduction
  • Energia & CC3200 on Mac
  • Trial & error
  • Recovering the battery
  • Pinout diagrams
  • Glitches in the readings
  • Sketch

 

Introduction

 

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").

image

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 peteroakes 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.

image

 

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.

imageimage

 

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:

image

(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:

imageimage

 

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

 

Sketch

 

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.

 

#include <WiFi.h>
#include <PubSubClient.h>

// 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
#endif

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

WiFiClient wclient;
byte ip[]     = { 172, 16, 0, 100 };
PubSubClient client("iot.eclipse.org", 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() {
  Wire.begin();
  myFuelTank.begin();
}

void loop() {
  publishData();
  delay(300000);
}

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

  char content[10];

  if (client.connect("CC3200-Room-1")) {
      myFuelTank.get();
      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);

      client.disconnect();
  }
  delay(500);

  WiFi.disconnect();
}

 

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

image

  • Sign in to reply

Top Comments

  • shabaz
    shabaz over 10 years ago +2
    Hi Frederick, Excellent post!! Thank you for sharing the sketch. This is fantastic, it builds on Peter's Robert Peter Oakes excellent documentation for the Fuel Tank board, and allows anyone to remotely…
  • fvan
    fvan over 10 years ago in reply to shabaz +2
    Hi shabaz, thanks! I do hope this post will be useful and I like how challenges help people build on top of eachother's work. The hardest part is usually finding the pieces of information scattered around…
  • DAB
    DAB over 10 years ago +1
    Very good post. I hope to get back to my CC3200 and booster pack, so I plan to use this information. Thanks DAB
Parents
  • ipv1
    ipv1 over 10 years ago

    Nice post. The solution you are using involves connecting multiple pins of the launchpad itself.

    Referring diagram at: http://energia.nu/wordpress/wp-content/uploads/2014/09/fueltankbppinmap.jpg

     

    You could have connected the pins from J2(14&15) to J1(9& 10) which would have yielded the same result. I took a different path and simply 'cut' the traces to the J2 and soldered them to J1 instead. That way I free up two pins from the CC3200. The fuel booster works as is with the MSP430F5529 USB Lunchpad which has two I2C peripherals.

     

    Additionally, If you need SPI in your design then the shorted pins will cause a conflict.

    I will post on the cut and hack once I test out the code which I wrote in CCS. image

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • ipv1
    ipv1 over 10 years ago

    Nice post. The solution you are using involves connecting multiple pins of the launchpad itself.

    Referring diagram at: http://energia.nu/wordpress/wp-content/uploads/2014/09/fueltankbppinmap.jpg

     

    You could have connected the pins from J2(14&15) to J1(9& 10) which would have yielded the same result. I took a different path and simply 'cut' the traces to the J2 and soldered them to J1 instead. That way I free up two pins from the CC3200. The fuel booster works as is with the MSP430F5529 USB Lunchpad which has two I2C peripherals.

     

    Additionally, If you need SPI in your design then the shorted pins will cause a conflict.

    I will post on the cut and hack once I test out the code which I wrote in CCS. image

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
  • fvan
    fvan over 10 years ago in reply to ipv1

    Hi Inderpreet!

     

    Thanks for the feedback. I suppose this is indeed one solution out of multiple (and perhaps not the best), but I'm learning image.

     

    I do wonder why such "tricks" are necessary to get a BoosterPack to work with a different LaunchPad.

    Looking at Arduino and Shields, and don't remember having to do similar things to get a Shield to work with different Arduino models.

     

    Looking forward to your post to see the alternative in action image.

     

    Frederick

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube