Jump to content
chicken

[Energia Library] Bosch BMP085 Template Library

Recommended Posts

I finished up my first Energia project, a template library for the Bosch BMP085 temperature and pressure sensor. It uses I2C and supports temperature in Celsius and pressure in Pascal.
 
https://github.com/astuder/BMP085-template-library-Energia
 
I connected the GY-80 breakout commonly found on eBay, but it should also work with most other BMP085 breakouts, like the ones from Adafruit or Sparkfun.
 
Note that I had to patch Energia to make 1-byte read work on MSP430G2553 with Rev1.5 LaunchPad. I also had to remove the LED2 jumper, probably due to too weak I2C pull-up.
 
Update:
 
Tested on LaunchPad 1.5 with MSP430G2553, StellarPad Rev A and Arduino R3.
 
Energia requires patches 226 and 235 in twi.c for I2C to work properly on MSP430G2553
https://github.com/energia/Energia/pull/226/files
https://github.com/energia/Energia/pull/235/files
 
Updates:
- Tested with Energia 0101E0010 with MSP430G2553 and F5529, no more I2C patches needed.
- Tested with BMP180 and Software I2C http://forum.43oh.com/topic/3777-energia-library-bosch-bmp085-template-library/?p=44410

- Fixed I2C for Energia 0101E0016 by removing ugly hacks from the past from the library code. Tested only with MSP430G2553

Share this post


Link to post
Share on other sites

here as summoned :)

 

I got the new LaunchPad this week and installed Energia 0010 a while ago, but hadn't time yet to test this library.

 

As my I2C fixes to Energia 0009 were accepted into the main branch, in theory the library and example should work as provided without any patching.

 

Please let me know if you run into issues - or even better, if it worked.

Share this post


Link to post
Share on other sites

I've ordered the sensor so when it arrives I will test and report. Also ordered the AM2302 temp/humidity sensor so we'll see how that goes, too. 

Share this post


Link to post
Share on other sites

Tested with Energia 0101E0010 and the new F5529 LaunchPad. It works as expected if SDA/SCL are connected to pins P3.0 / P3.1, i.e. the same pins as with the G2553.

 

The source of confusion is likely the F5529 quick start guide which shows I2C on pins P4.1 / P4.2, while Energia sticks to the backward compatible pin layout.

Share this post


Link to post
Share on other sites

Got the sensor, and with chicken's help got his demo example running. 

 

The only gotcha I encountered was that, according to the quick start guide, the F5529 LaunchPad defaults the I2C Clock and Data lines to pins 4.2 and 4.1, respectively. Who knows why? When I moved them to 3.1 and 3.0, it worked. (On this version of the LaunchPad, these latter pins are by default the SPI signals MISO and MOSI.) 

 

I also wired up an input pin to the optional EOC (end of conversion) signal from the sensor, and presumably that's working too to speed things up a bit. 

Share this post


Link to post
Share on other sites

@@abecedarian From a quick glance at the source, Energia does only check whether USCI is present and then uses UCB0, which is wired to the same pins for G2553 and F5529. 4.2/4.1 would be UCB1.

 

IMO, this makes sense as it maintains backward compatibility with the MSP430 LaunchPad. Too bad the quick start guide does not reflect this.

 

Unlike for Stellaris/Tiva, the MSP430 implementation of Wire does not yet allow to set an alternative I2C module.

 

PS: On the Tiva LaunchPad, the pins in question are actually connected with 0-ohm resistors (R9/R10), which caused its own set of confusion :)

Share this post


Link to post
Share on other sites

Would be nice to be able to access other peripherals with similar functionality though. ;-)

As in, it would be nice to be able to mix I2C and SPI devices together, easily.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×