Pages: 1 [2]   Go Down
Author Topic: How can I add 2 pressure sensors BMP180 to Arduino Uno?  (Read 1145 times)
0 Members and 1 Guest are viewing this topic.
Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 620
Posts: 33992
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Effing brilliant!  (Someone please remix it so the vocals are more distinct!)
OK done a remix and replaced the file above with the new one.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

about the pull up resistors, I tried with and witout. the point is there is not any new defined I2C. So does not matter if I put that resistors or not. Or it does matter and I do not know!

That I2CMaster is not read in the program, because when I wite # include <wire.h> this Wire s in orange color. but when I write #include <i2cMaster.h>, it is still black. because it does not considered as a header.

Question: If this command of #include <i2cMaster.h> really defined a new couple of I2C pins, and I did not use resistors, what may  happened?
Question: is 4.7 kohm is enough for pull up resistors? how should I put it?

Thanks for time to answer!
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 620
Posts: 33992
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
the point is there is not any new defined I2C. So does not matter if I put that resistors or not. Or it does matter and I do not know!
Not sure I understand those words. You always need one set of pull up resistors on each I2C bus.

Quote
it is still black. because it does not considered as a header.
No it is still black because someone did not put in the line in the keywords.txt file that makes it change colour, that is all.

Quote
Question: If this command of #include <i2cMaster.h> really defined a new couple of I2C pins, and I did not use resistors, what may  happened?
Then it would not work.

Quote
Question: is 4.7 kohm is enough for pull up resistors? how should I put it?
Yes, wire them from signal to +5V.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
You always need one set of pull up resistors on each I2C bus.
I dont think always! at lease for pins A4 and A5, as you can see here:
https://learn.sparkfun.com/tutorials/bmp180-barometric-pressure-sensor-hookup-/all

what does
Quote
put in the line in the keywords.txt file
mean?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 302
Posts: 26248
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I dont think always!
I do.
If you look at the schematic for the breakout board, you'll see that it has pullups fitted.
If you put more than one device on this I2C bus, and it has pullups fitted, you'll need to disable one set.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Faraday Member
**
Karma: 62
Posts: 3011
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You don't need to have two copies of the library code.

You need to instantiate two instances of the device interface class.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

And I am going to connect 2 BMP180 that are already mountes on the break out board. So I do not need to add 2 Pull Up resistors again. Right?
once more I repeat what I want to do. I am going to connect 2 BMP180 presure sensors, mounted on the breadout boards. they both have the same predefined address. because I need to read the data from them with the low frequenca (once per second) I have tp define new I2C pins, to connect them together to Arduino.
thus, I need to copy I2C library in the main library. -I found at lease 4 different types of libraries. one has just header file, one .cpp format,.... I do not even know which one is good to use-
By the way, I tried all, with and without pull up resistors. no one worked.   smiley-confuse
any Idea!!??

Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 302
Posts: 26248
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's a shame it's a 3.3.V device.
If the required read frequency is low, and the power requirements of the sensor less than about 30mA, you could have put them both breakout boards on the same bus, and powered them individually from a separate I/O pin.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 620
Posts: 33992
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I dont think always! at lease for pins A4 and A5, as you can see here:
YES YOU DO!! as you can see here:-
http://www.dsscircuits.com/index.php/articles/47-effects-of-varying-i2c-pull-up-resistors

Quote
what does
Quote
put in the line in the keywords.txt file
mean?
In every library there is a file called keywords.txt - that file defines what words change colour.

Quote
I need to copy I2C library in the main library.
No you don't.
For the last time I tell you -: You use one board on the I2C hardware lines of A4 & A5
You use the other board on two digital lines that you designate as data and clock in a "software I2C" library.
Then as the BMP180 library uses the hardware I2C bus you have to hack a copy of the BMP180 library ( call it something else ) to use the "software I2C" library.

It is becoming increasingly clear that you are not able to do this project with your current state of knowledge and your unwillingness / inability to follow advice.
Logged

Offline Offline
Faraday Member
**
Karma: 62
Posts: 3011
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In principle,  you don't need two copies of the device library.  You create two instances of the same object.

You may need to fix any problems this causes with the class library if it is not written properly.  I found the library for this device is not very good,  so I fixed it.

The other problem is,  you tried communicating with the two devices,  and it didn;t work out.    You need to solve one problem at a time.   Try connecting just one device,  and make sure it works.    Then try just connecting the other device,  and make sure it works.   Then you know for sure,   each of your devices is good and not busted.

 Then try connecting just one device to the emulated I2c,   and see if that works.   And then the other one.   Then you will know if the emulated I2C scheme actually works.

Only after you have done all those things,  should you try using both devices.

Your alternative plan is to use a different device,  such as the MS5611,   then you don't have the I2c address problem.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello there smiley. Same problem here.
I also need to hook up two BMP180-sensors to a Uno.
First I tried the SoftI2cMaster library. But I couldn't get I to work. So after a lot of frustration I wrote my own I2C library specially for BMP180. It can properly also be used for some other sensors too.
It supports an infinite number of I2C-connections (as long as you have enough pins on your board).

I have attached an example .ino which reads two BMP180-sensors. It can be easily modified to more sensors.
I have also attached the library.h and .cpp which should be put in your library folder.

There is almost no comments in the code since I am a lazy bastard, wrote it for my self and only puts it up here as a kind gesture.

BTW: If the sensor is located on a breakoutboard, it has pull-up-resistors built in.

Hope it helps dude. smiley-cool

* BMP180_Dual_Pressuresensors_AH.ino (5.04 KB - downloaded 15 times.)
* MyWireLib.cpp (5.54 KB - downloaded 11 times.)
* MyWireLib.h (0.72 KB - downloaded 9 times.)
Logged

Pages: 1 [2]   Go Up
Jump to: