Project

General

Profile

PortsBMP085 and using A4 and A5 for I2C

Added by GaryP about 5 years ago

I am currently struggling to get a BMP085 sending data using the Jeelib/payload method.

At the moment I am using the Adafruit library for BMP readings but cannot find an example of using this and Jeelib.

To check if there is some sort of conflict I was going to try and use one of many Jeelib / PortsBMP examples out there but seem to have a pins problem. I am looking to use the the standard Uno A4 - SDA and A5 - SCL pins for the I2C but cannot find the mapping option in PortsBMP for this.

Can anyone help (or let me know if they have any working code for Jeelib sending Adafruit BMP derived data).

Any help much appreciated.

Thanks
Gary


Replies (6)

RE: PortsBMP085 and using A4 and A5 for I2C - Added by jcw about 5 years ago

This seems to be badly documented: if you use a port number of “0” (zero), the JeeLib PortI2C class will use the hardware pins (A4+A5).

RE: PortsBMP085 and using A4 and A5 for I2C - Added by GaryP about 5 years ago

Great - that is working a treat with your PortsBMP example

I am looking at an example that Nathan Chantrell has been using with his TinyTx which seems to have some different syntax:

#include  // Part of JeeLib
PortI2C i2c (2);         // BMP085 SDA to D8 and SCL to D7
BMP085 psensor (i2c, 3); // ultra high resolution

versus from your sample:

#include 
PortI2C two (0); // Uses standard Uno A4 and A5
BMP085 psensor (two, 3); // ultra high resolution

Is this from an older version of the library? Do I just use “PortI2C i2c (0); ”?
Many thanks
Gary

RE: PortsBMP085 and using A4 and A5 for I2C - Added by JohnO about 5 years ago

The TinyTX is based on the ATTiny84 processor versus the ATMega328 of the Uno.

RE: PortsBMP085 and using A4 and A5 for I2C - Added by GaryP about 5 years ago

John

I appreciate that Nathan was using the port redirect because he was not on a 328 - I am trying to reverse that to get to the stock Uno/328 position.

His code has some very useful #if/#endif code to deal with the ATTiny/328 position but this is not one of those sections. Link to Nathan’s code.

Should I go with:

PortI2C two (0);
BMP085 psensor (two, 3);

or

PortI2C zero (0);
BMP085 psensor (zero, 3);

I thought the first version was working last night but might need to check I am getting some sensible readings - I was happy just to be getting anything at that stage!

Many thanks

Gary

RE: PortsBMP085 and using A4 and A5 for I2C - Added by JohnO about 5 years ago

I’m sorry that I jumped the gun Gary.

RE: PortsBMP085 and using A4 and A5 for I2C - Added by GaryP about 5 years ago

No worries, it made me double-check I had understood JCW’s comment correctly and now I am not that sure.

This seems to be working in Nathan’s sketch to get me data into the payload variables:

PortI2C zero (0); 
BMP085 psensor (zero, 3);

but now I cannot get it to transmit - back to the drawing board!

    (1-6/6)