-
Notifications
You must be signed in to change notification settings - Fork 971
Add BMP280 I2C example #127
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
Add BMP280 I2C example #127
Conversation
kilograham
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall I like this a lot even though i did make a bunch of comments
|
Perhaps it's worth changing your wiring diagram to use a half-size breadboard (as you've only got a very limited number of wires), like the other examples in Appendix A of https://datasheets.raspberrypi.org/pico/raspberry-pi-pico-python-sdk.pdf ? EDIT: Ah, oops, I was looking at the wrong PDF! 🤣 A bunch of the examples in https://datasheets.raspberrypi.org/pico/raspberry-pi-pico-c-sdk.pdf do use full-size breadboards, whereas it looks like they could get away with using half-size breadboards 😉 Also @aallan I've just noticed that (most of) the wiring-diagrams in the Python SDK PDF have the Pico's USB port facing to the right, whereas (most of) the wiring-diagrams in the C/C++ SDK PDF have the Pico's USB port facing to the left 😉 |
I've done so anyway and I think it looks quite nice! |
|
I know this is intended to be a standalone example, but I wonder if there's any value in trying to keep the "I2C BMP280" and "SPI BME280" examples vaguely similar-ish? Just as one example, the SPI BME280 example does: printf("Humidity = %.2f%%\n", humidity / 1024.0);
printf("Pressure = %dPa\n", pressure);
printf("Temp. = %.2fC\n", temperature / 100.0);whereas the I2C BMP280 example does: float converted_temp = bmp280_convert_temp(&temp, ¶ms) * 0.01f;
float converted_pressure = bmp280_convert_pressure(&pressure, &temp, ¶ms) * 0.001f;
printf("Temperature: %.2f °C Pressure: %.3f kPa\n", converted_temp,
converted_pressure); |
|
On an additional side-note @aallan , I also just noticed that the Raspberry Pi Pico PCB images in Appendix A of https://datasheets.raspberrypi.org/pico/raspberry-pi-pico-c-sdk.pdf look less detailed than their counterparts in Appendix A of https://datasheets.raspberrypi.org/pico/raspberry-pi-pico-python-sdk.pdf ? |
|
Yes. They need replacing with the new Fritzing part. Most of them were done pre-launch. |
|
I've only realized now after some head scratching on another board, that the SDK's |
I know very little about I2C, but does the same thing affect #143 ? (please leave an appropriate comment on that PR if it does) |
Done! |
|
I added a comment about Actually, while it makes sense for the files listed in |
Ah, yeah I didn't see that, thanks for bringing it up again. I agree, and perhaps we should indicate this in a little comment too? |
|
Where are we on this, are we ready to pass it to @kilograham for a final review? @lurch opinions? |
|
There is an outstanding change request flagged, but I believe it has been fixed but I cannot see a way of flagging it has been fixed. Otherwise, this LGTM. |
I think we'd just have to "re-request review" from @kilograham. There seems to be no way to get rid of the flag otherwise. |
This PR adds a new example for the BMP280 temperature and pressure sensor via I2C. It takes care of reading sensor values and also the necessary conversion for the values to make sense. I'm not sure how much "cleaning up" is needed, for now all code is in one file for simplicity but a few definitions want to be in their own header file. Fritzing diagram and file included, accompanying documentation too.