Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Humidity is disabled in the BME280 I2C driver because of a missing write operation #424

Closed
ssorc opened this issue May 29, 2017 · 5 comments
Labels

Comments

@ssorc
Copy link
Contributor

ssorc commented May 29, 2017

Calling the Humidity() function on the BME280Driver I2C driver results in the error: "Humidity disabled".

This is because the initHumidity() function is incomplete; it writes out the humidity data acquisition options, but doesn't then write to the "ctrl_meas" register, as per Section 5.4.3 of the BME280 data sheet:

The “ctrl_hum” register sets the humidity data acquisition options of the device. Changes to
this register only become effective after a write operation to “ctrl_meas”.

I have a patch so can generate a pull request if someone else can confirm that this is the case! I have tested this on a Raspberry Pi Model B using the Sparkfun BME280 Atmospheric Sensor Breakout with gobot 1.5.0 and golang 1.7.5.

@deadprogram
Copy link
Member

Hi @ssorc thanks for the report. I will setup to test this issue shortly and get back to you.

@deadprogram
Copy link
Member

Hi @ssorc yes, I can confirm that error is being returned.

Interestingly, restarting the program causes the readings to come thru correctly on subsequent runs.

In any case, your PR to address this would be appreciated. Thank you!

@ssorc
Copy link
Contributor Author

ssorc commented May 30, 2017

The restart may work because the call to d.initialization() in Start() is writing to the ctrl_meas register (see the bmp280RegisterControl register in the BPM280 driver's initialization() function) and this may be enough to finally enable the humidity sensor.

I will send through a PR: it's only a couple of lines.

ssorc added a commit to ssorc/gobot that referenced this issue May 31, 2017
… by enforcing the write to the 'ctrl_meas' register, as per Section 5.4.3 of the BME280 data sheet

Signed-off-by: Graeme Cross <graeme@ceriumdesigns.com>
@ssorc
Copy link
Contributor Author

ssorc commented May 31, 2017

I've submitted the PR.

deadprogram added a commit that referenced this issue Jun 5, 2017
Issue #424: Enables humidity readings in the BME280 driver by enforci…
deadprogram pushed a commit that referenced this issue Jun 15, 2017
…ng the write to the 'ctrl_meas' register, as per Section 5.4.3 of the BME280 data sheet

Signed-off-by: Graeme Cross <graeme@ceriumdesigns.com>
@deadprogram
Copy link
Member

Version 1.6.0 is now out, and includes this fix. Now closing, thanks again @ssorc for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants