Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By reaper7
#19763 @scargill - following formula return "RELATIVE PRESSURE"
Code: Select allreturn (int32_t)(pow(((float)MYALTITUDE/44330)+1,5.255F)*pressure);

where MYALTITUDE is 93.0meters in Your case and pressure is a real pressure measurement by BMP.

At this moment for me (153.0m) real pressure => 1010hPa and calculated relative pressure => 1028hPa
User avatar
By canedje
#33168
torntrousers wrote:WIth the Sparkfun BMP180 Arduino library code running on an ESP-12 with BMP180 i get a temp of 20c and pressure of 1030mb which seems about right. There are some debug printouts in the library i could uncomment if that would help show how it works out those values but i don't know how close this Arduino code compares to yours?


I'd tried to run the above metioned library and example.
I still do recieve compiler errors. (The e_pow command is not working)

    c:/users/e.w/appdata/roaming/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libm.a(lib_a-e_pow.o):(.literal+0x104): undefined reference to `__ieee754_sqrt'
    c:/users/e.w/appdata/roaming/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib\libm.a(lib_a-e_pow.o): In function `__ieee754_pow':
    d:\ivan\projects\arduinoesp\toolchain\dl\esp-newlib\build\xtensa-lx106-elf\newlib\libm\math/../../../../../newlib/libm/math/e_pow.c:164: undefined reference to `__ieee754_sqrt'
    collect2.exe: error: ld returned 1 exit status
    makefile:79: recipe for target 'BMP180TEST.elf' failed
    make: *** [BMP180TEST.elf] Error 1

What am I doing wrong? Is there a workaround for the e_pow command?
User avatar
By Olyflyer
#33437 I have successfully used the Adafruit_BMP085 library in the Arduino IDE with an ESP8266-01, but you have to modify the Adafruit_BMP085.cpp file to disable the Pressure calculation function as this uses a 'pwr' maths function which does not appear to be implemented yet in the ESP library. If you use the standard Adafruit_BMP085 library then you will get a compile failure related to the 'pwr' function.

After the library has been sorted, include both Wire.h and the Adafruit_BMP085.h libraries in your sketch, define SDA_pin & SCL_pin as the chosen GPIO pins on your ESP (I used GPIO0 for I2C_SCL and GPIO2 for I2C_SDA on an ESP8266-01 module) and then call Wire.begin(SDA_pin, SCL_pin) in the sketch setup section BEFORE calling Adafruit_BMP085.begin(). The Wire call will then cause the Adafruit library to use the defined I2C pins.
Do the above to a standard Adafruit example sketch & it should work ok.
Just connect the BMP180 to 3.3v, and the two chosen I2C pins.

Note that you cannot use the Pressure reading parts of any examples due to the above mentioned maths library issue.