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

BME280 sensors support. #311

Merged
merged 5 commits into from
Jan 26, 2021
Merged

BME280 sensors support. #311

merged 5 commits into from
Jan 26, 2021

Conversation

dukess
Copy link
Contributor

@dukess dukess commented Jan 25, 2021

Reduce number of DHT22 sensors to 20.
Fixed wrong unit for abs humidity.
BME sensors programs use numbers 20200-20299.
Using I2C bus.
Pins: SDA/SCL on Mega and SDA1/SCL1 on Due.
First sensor must have 0x76 address.
Pullup resistor(s) must be used on Due.

Compiled but NOT TESTED.

Reduce number of DHT22 sensors to 20.
BME sensors programs use numbers 20200-20299.
Using I2C bus.
Pins: SDA/SCL on Mega and SDA1/SCL1 on Due.
First sensor must have 0x76 address.
Pullup resistor(s) must be used on Due.
@1coderookie
Copy link
Contributor

1coderookie commented Jan 25, 2021

Cool, thanks, will test it asap.
Up to me you could change the max amount of BME280 to 2 (20200-20299 are 100!), cuz afaik BME280 always come with 0x76-address and can only be changed to 0x77 if one changes something at the sensor hardware / pcb itself by cutting a contact and soldering another contact. So iirc it's not even possible to connect more than 2 of them to the I2C anyway (and I guess most people will stick with one anyway).

@fredlcore
Copy link
Owner

Thanks! But why the reduction to 20 DHT sensors (not that anyone will need these many anyways, but just out of curiousity)?

@dukess
Copy link
Contributor Author

dukess commented Jan 25, 2021

Up to me you could change the max amount of BME280 to 2 (20200-20299 are 100!), cuz afaik BME280 always come with 0x76

For every sensor using 6 programs: ID, temp, humidity, Abs humidity, pressure, altitude. Other programs can be used for new sensors types in future.

But why the reduction to 20 DHT sensors (not that anyone will need these many anyways, but just out of curiousity)?

Reason is only one: for a more logical layout in the category. I could add the programs at the end, from 20900 to 20950, but then the sensors would go after the contents of the arrays

@fredlcore
Copy link
Owner

Ok, thanks!

@1coderookie
Copy link
Contributor

Up to me you could change the max amount of BME280 to 2 (20200-20299 are 100!), cuz afaik BME280 always come with 0x76

For every sensor using 6 programs: ID, temp, humidity, Abs humidity, pressure, altitude. Other programs can be used for new sensors types in future.

Ah yes, sure - sorry, didn't think of that right now ;)

@fredlcore
Copy link
Owner

Due to another merge, there are now conflicts, could you check please?

@1coderookie
Copy link
Contributor

1coderookie commented Jan 26, 2021

Pullup resistor(s) must be used on Due.

Compiled but NOT TESTED.

Just tried - isn't it merged yet?
@dukess: What do you mean by "Pullup resistor(s) must be used on Due"? Ususally there's no need to add any pullups, you just have to connect the four pins..? Where/how should one add a pullup? EDIT: The 'regular' breakout boards of the BME280 already have pullups integrated - I'll test it w/o external ones first. But anyway, please let me know what you mean/how you meant it.. ;)

@fredlcore fredlcore merged commit 958e8d6 into fredlcore:master Jan 26, 2021
@fredlcore
Copy link
Owner

Merged just now

@dukess
Copy link
Contributor Author

dukess commented Jan 26, 2021

@1coderookie I have read on various websites that the second I2C bus requires external resistors. It is possible that this is erroneous information, but I can't check it, so I thought it would be better to write a warning.

@1coderookie
Copy link
Contributor

1coderookie commented Jan 26, 2021

Ah ok, got it. You're right that in general (not only at the second I2C afaik) external pullups are needed!
But: At the 'usual' (cheap China) breakout boards there are already external pullups added, also a levelshifter etc., but you're right - sometimes it could be neccessary to add them if they aren't already existent on the board (there seem to be different boards available). Will make that note also in the manual, thanks, didn't think of that before ;)
I'll let you know here if everything works as expected, thanks for implementing btw ;)

@1coderookie
Copy link
Contributor

@dukess: Now there's the definement for BME280 in config.h which a) has to be activated and b) where one has to choose if one or two sensors are connected. Wouldn't it be good to also have that field within the webconfig like for DHT etc (but not for the pins of course, just for the amount of connected BMEs)? Maybe even something like 0 = deactivated, 1 = 1sensor, 2 = 2sensors?

@1coderookie
Copy link
Contributor

So, did a new test. Adjusted config.h, serial monitor says

15:38:43.464 -> Init BME280 sensor(s)...
15:38:43.464 -> Sensor with address 76 found

but no values presented within /K49 (doesn't appear, maybe you didn't add?) or /20200-20299 (just empty page).. :(

@1coderookie
Copy link
Contributor

There is an error(?)-message while compiling, but it doesn't seem to bother so far cuz flashing is possible. But maybe that could be a reason..?

In file included from /tmp/arduino_build_363932/sketch/src/BlueDot_BME280/BlueDot_BME280.h:9:0,
                 from /tmp/arduino_build_363932/sketch/src/BlueDot_BME280/BlueDot_BME280.cpp:10:
/home/db/.arduino15/packages/arduino/hardware/sam/1.6.12/libraries/Wire/src/Wire.h: In member function 'uint8_t BlueDot_BME280::readByte(byte)':
/home/db/.arduino15/packages/arduino/hardware/sam/1.6.12/libraries/Wire/src/Wire.h:50:10: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
  uint8_t requestFrom(int, int);
          ^
/home/db/.arduino15/packages/arduino/hardware/sam/1.6.12/libraries/Wire/src/Wire.h:47:10: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
  uint8_t requestFrom(uint8_t, uint8_t);
          ^

@fredlcore
Copy link
Owner

If it compiles fine, it's just a warning, and if it comes from a library (such as Wire.h) and not from BSB_lan_., then it has usually nothing to do with the BSB-LAN problem.

@dukess
Copy link
Contributor Author

dukess commented Jan 26, 2021

@1coderookie Thank you for testing!
I found a mistake: I mixed up < and >. Fixed. #313

Now there's the definement for BME280 in config.h which a) has to be activated and b) where one has to choose if one or two sensors are connected. Wouldn't it be good to also have that field within the webconfig like for DHT etc (but not for the pins of course, just for the amount of connected BMEs)? Maybe even something like 0 = deactivated, 1 = 1sensor, 2 = 2sensors?

It is harder: every sensor require a object and their quantity hard-coded at building. Of course, we can redo this code to be able to dynamically change the sensors quantity, but it will take up more space in memory. Can we postpone this until the next release? I would like to make another release with Mega support.

@1coderookie
Copy link
Contributor

Sweet!
Bildschirmfoto von 2021-01-27 06-06-45

About webconfig: No problem, so let's leave it in config.h - most users won't change the amount of sensors anyway.. ;)

@dukess
Copy link
Contributor Author

dukess commented Jan 27, 2021

Thank you for testing!

@1coderookie
Copy link
Contributor

Thank you for implementing! :)
Didn't test it with two BMEs though, but I guess that also works fine.. ;)

@1coderookie
Copy link
Contributor

New chapter in the manual: https://1coderookie.github.io/BSB-LPB-LAN_EN/chap12.html#1233-notes-on-bme280-sensors

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

Successfully merging this pull request may close these issues.

None yet

3 participants