sparkfun / BMP180_Breakout

Breakout board for the Bosch BMP180 barometric pressure sensor
Other
69 stars 101 forks source link

how to add 2 bmp180 sensors to one arduino board? #2

Closed mkahali closed 10 years ago

mkahali commented 10 years ago

Hi,

I need to add 2 BMP180 pressure sensor to one arduino board. sensors will place in different pressure conditions. Would you please tell me which changes should be done in the program to read data from both simultaneously? in case of hardware, to which pins the second one should be connected? I connected 1 sensor and read the measurement.

mgrusin commented 10 years ago

That's a little tough for a couple of reasons. 1) The BMP180 has a single, unchangeable address, so if you put two on the same I2C bus they will conflict with each other. 2) Unlike it's predecessor, the BMP180 does not have a reset pin, which prevents you from keeping one in reset while you're talking to another one on the same bus.

One way you may be able to work around this is to use a software I2C library to create a second I2C bus on a free pair of pins. You could then put one BMP180 on the original hardware bus, and the second BMP180 on the new software bus. Here is one such library, there may be more: http://playground.arduino.cc/Main/SoftwareI2CLibrary. Sparkfun's SFE_BMP180 library will likely need to be modified to use a software library, as it was written to use the Wire (hardware) library, in which case you'll need to create and load two SFE_BMP180 libraries, one to work with the original hardware bus, and one to work with the new software bus.

You may also be able to solve this problem in hardware, by taking the single hardware I2C bus, and running it through some circuitry that switches it between your two BMP180 devices. You could try something like the 4067 analog mux (https://www.sparkfun.com/products/9056). It's like a rotary switch that routes one signal to one of 16 possible outputs. You would need two of these, one for SCL and one for SDA. The control signals would go to both of them so both lines are switched in parallel. One BMP180 would then go to C0, the other would go to C1 (and you could have 14 more if you wanted). In your code you just need to control the switch before reading the BMP180s.

I hope this helps, good luck!

mkahali commented 10 years ago

Dear Mike Grusin,

Thanks a lot for all these explanation. It looks really helpful. Thank you for the time that you spent to explain all.

Just a small part is still unclear for me; “in which case you'll need to create and load two SFE_BMP180 libraries, one to work with the original hardware bus, and one to work with the new software bus.”

This means I need to put SFE_BMP18 library, 2 times in the main folder of library. But, when the name is similar they will replace each other. Or I need to change the name, and call them separately in the software?!

The second issue is, I can open and read the SoftI2CMaster.h file in Github, but I cannot download it. Is it the same as “i2cmaster.zip” in http://homepage.hispeed.ch/peterfleury/avr-software.html ?

Look forward to hearing from you soon.

Best Regards,

Maryam Kahali

From: Mike Grusin [mailto:notifications@github.com] Sent: Montag, 5. Mai 2014 20:07 To: sparkfun/BMP180_Breakout Cc: mkahali Subject: Re: [BMP180_Breakout] how to add 2 bmp180 sensors to one arduino board? (#2)

That's a little tough for a couple of reasons. 1) The BMP180 has a single, unchangeable address, so if you put two on the same I2C bus they will conflict with each other. 2) Unlike it's predecessor, the BMP180 does not have a reset pin, which prevents you from keeping one in reset while you're talking to another one on the same bus.

One way you may be able to work around this is to use a software I2C library to create a second I2C bus on a free pair of pins. You could then put one BMP180 on the original hardware bus, and the second BMP180 on the new software bus. Here is one such library, there may be more: http://playground.arduino.cc/Main/SoftwareI2CLibrary. Sparkfun's SFE_BMP180 library will likely need to be modified to use a software library, as it was written to use the Wire (hardware) library, in which case you'll need to create and load two SFE_BMP180 libraries, one to work with the original hardware bus, and one to work with the new software bus.

You may also be able to solve this problem in hardware, by taking the single hardware I2C bus, and running it through some circuitry that switches it between your two BMP180 devices. You could try something like the 4067 analog mux (https://www.sparkfun.com/products/9056). It's like a rotary switch that routes one signal to one of 16 possible outputs. You would need two of these, one for SCL and one for SDA. The control signals would go to both of them so both lines are switched in parallel. One BMP180 would then go to C0, the other would go to C1 (and you could have 14 more if you wanted). In your code you just need to control the switch before reading the BMP180s.

I hope this helps, good luck!

— Reply to this email directly or view it on GitHub https://github.com/sparkfun/BMP180_Breakout/issues/2#issuecomment-42218070 . https://github.com/notifications/beacon/7486269__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxNDkzMjQ1MCwiZGF0YSI6eyJpZCI6MzE0Mjc0NTZ9fQ==--3671314e0941cdc2c44cd85c2523a298da7b4237.gif

mahfuz195 commented 10 years ago

i have used a MUX(74HC4052) to solve the problem. you can find the code and schematic here. https://github.com/mahfuz195/Pressure_sensor_BMP180

ToniCorinne commented 10 years ago

Closing this issue out unless any other assistance is needed.

WinniePough commented 9 years ago

It would seem to me that an un-powered I2C module could not answer when being addressed. It would also seem logical that an un-powered I2C module would not keep any other module from functioning. So the easy solution is aught to be to alternately power the two modules and separate the response as separate variables in the software. Simply select two output pins as voltage out for the 3.3 Volt excitation to the two modules alternating between 3.3 V and ground as outputs.

mahfuz195 commented 9 years ago

from my knowledge ,what i understand is that  it depends on your implementation and your system setup.Some sensors have some initial startup time before communicating in I2C and if you use tun off/on Vdd method then volatile registers value will be lost(e.g. for bmp180 accuracy level register value.)for BMP180 if you use MUX , then this algorithm you can you1. Start bmp180 sensor#1 measuring pressure data.2. Switch MUX and bmp180 sensor#2 measuring pressure data.3. Swithc MUX and read pressure from bmp180 sensor#1.4. Switch MUX and read pressure from bmp180 sensor#2with this algorithm we can get both pressure data which is measured in almost same time-stamp.  Kind Regards,Md. Mhafuzul Islam

 On Monday, September 28, 2015 1:52 AM, WinniePough <notifications@github.com> wrote:

It would seem to me that an un-powered I2C module could not answer when being addressed. It would also seem logical that an un-powered I2C module would not keep any other module from functioning. So the easy solution is aught to be to alternately power the two modules and separate the response as separate variables in the software. — Reply to this email directly or view it on GitHub.