logo elektroda
logo elektroda
X
logo elektroda

[Solved] How to connect and configure BMP085 with ESP-01 via I2C?

mgrems 816 3
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 17669157
    mgrems
    Level 11  
    I am having a problem "servicing" a BMP085 sensor. The sensor communicates via I2C. The Arduino uses the analogue pins for this (e.g. A4 and A5) and everything works.
    I need to pack the chip into a small box and send pressure values via wi-fi, so I am reliant on using the ESP-01 chip.

    The ESP-01 has two pins GPIO0 and GPIO2, which in theory, when pulled up with 3k3 resistors to Vcc, act as I2C communication. I connect SDA to GPIO0 and SCL to GPIO2. I get a message on the serial port monitor that it can't see the sensor.

    Have any of you worked through this? I've tested the BMP085 sensor on the Arduino and it works, the ESP-01 works because I've blinked the LEDs from both outputs, I've got the basics down but can't cope with this.

    Please give me suggestions - Maciej

    Code: C / C++
    Log in, to see the code
    .

    How to connect and configure BMP085 with ESP-01 via I2C?



    I used https://www.instructables.com/id/How-to-use-the-ESP8266-01-pins/ and nothing
    Do you have a problem with Arduino? Ask question. Visit our forum Arduino.
  • ADVERTISEMENT
  • Helpful post
    #2 17669297
    Slawek K.
    Level 35  
    You are missing the definition of Wire.begin together with the pins on which the I2C transmission is to take place. For UNO this is in the core by default, here you have to add it at the beginning in the setup:
    Code: C / C++
    Log in, to see the code
    .

    Greetings
  • ADVERTISEMENT
  • Helpful post
    #3 17669505
    khoam
    Level 42  
    rs6000 wrote:
    You are missing the definition of Wire.begin including the pins on which the I2C transmission is to take place.
    .
    The Wire.begin() call is sewn into Adafruit_BMP085::begin(), without the pin numbers:
    Code: C / C++
    Log in, to see the code
    .

    Use the following sequence, before calling Adafruit_BMP085::begin():
    Code: C / C++
    Log in, to see the code
    .
  • #4 17670698
    mgrems
    Level 11  
    WORKS, super thanks. I tried the Wire.begin() function, but didn't know you had to provide arguments. So simple, and so effective.

    I'm inserting the working code if anyone needs it in the future:

    Code: C / C++
    Log in, to see the code
    .

    and the result of the operation:
    How to connect and configure BMP085 with ESP-01 via I2C? .
ADVERTISEMENT