Skip to content

bmp085 module returns incorrect values (bmp180 sensor) #1471

@CosmicMac

Description

@CosmicMac

Expected behavior

Right values returned by bmp180 lua module:

Lua module temperature: 25.2
Lua module pressure: 1009.9

Actual behavior

Wrong values returned by bmp085 native module:

Native module temperature: 143.9
Native module pressure: 1344.5

Test code

local SDA_PIN = 4 -- BMP180 SDA pin on GPIO2
local SCL_PIN = 3 -- BMP180 SCL pin on GPIO0
local OSS = 3 -- BMP180 oversampling setting (0: ultra low power, 1: standard, 2: high resolution, 3: ultra high resolution)


-- Test with bmp180 lua module (https://github.com/javieryanez/nodemcu-modules/tree/master/bmp180)
local bmp180 = require("bmp180")
bmp180.init(SDA_PIN, SCL_PIN)
bmp180.read(OSS)
local t1 = string.format("%.1f", bmp180.getTemperature() / 10)
local p1 = string.format("%.1f", bmp180.getPressure() / 100)
bmp180 = nil
package.loaded["bmp180"] = nil

print("Lua module temperature:", t1)
print("Lua module pressure:", p1)


-- Test with bmp085 native module

bmp085.init(SDA_PIN, SCL_PIN)
local t2 = string.format("%.1f", bmp085.temperature() / 10)
local p2 = string.format("%.1f", bmp085.pressure(OSS) / 100)

print("Native module temperature:", t2)
print("Native module pressure:", p2)

NodeMCU version

NodeMCU custom build by frightanic.com
branch: master
commit: 95e85c7
SSL: false
modules: adc,bmp085,cjson,dht,file,gpio,i2c,net,node,tmr,uart,wifi
build built on: 2016-08-23 18:24
powered by Lua 5.1.4 on SDK 1.5.4.1(39cb9a32)

Hardware

ESP8266 board based on ESP-12f

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions