Part of my home weather station project involves using various sensors. One of the ones I purchased for use was a GY-BMME/PM280 sensor. It’s a Chinese knock off that I bought several years ago when I first contemplated this idea. It lacks a humidity sensor that you would find on the genuine BME280 sensor (BMP280 does the same, but it doesn’t have a humidity sensor). The BME280 is the recommended one people use, but thought I’d document it here.
As I had some problems along the way, and also used it as a learning opportunity for me and anyone else who is struggling.
Some tips I think you might find useful
- Make sure you have the I2C identifier installed in Arduino IDE. You can have up to 127 devices installed on the I2C channel, each with their own 0x address. You need this information to correctly identify the channel to use
- If you’re new to Arduino IDE (like me), make use of the verify code function, it helps you pinpoint the errors so that you actually learn, and also gives you an idea where to troubleshoot your sensor information
- If you’re using I2C, make sure you specify the device address you’re using (this is below in my code in the section noted as following) status = bmp.begin(0x77); – if you’re I2C address is 0x76, amend it to this.
- Make sure you close the serial-monitor if you have it open when doing an upload. I tend to find it caused an “Access Denied” message when uploading because it was in use.
- Be careful with the Chinese knock offs. Mine first showed up against 0X76, and I went through everything on my IDE but it wouldn’t work (came back as device 0x0). All the wiring was correct, I just thought it was a duff device. In the end I read that this chip is 3.3v so thought I’d toasted it. My device does seem buggy though, so if you get nothing working, maybe try pulling SDO low and seeing if it works using 0x77 as the address. EDIT – I found the best way to fix this was by wiring it up as I2C, but also wiring the SDO pin to VCC. So I could force the device to use the 0x77 address, otherwise it’s meant to default to 0X76.
Pressure and Altitude the same thing aren’t they?
Yes, but no. Their readings are taken from the same pressure sensor. However pressure and altitude readings different depending on sea height. This is why there are two readings.
What code am I using?
Here is the code that I’m using in my Arduino for this GY-BMME/PM280 sensor
Thank you and free link share
I found the following sites/articles useful when I was troubleshooting my own code
- Essensys.com – I used this because I had to work out how to convert the pressure (in Pascals to mbar) – basically divide by 100, because the standard readings you get from the sensor are in Pascals. Also read up on the difference between altitude and pressure
- Calcmaps.com – I used this to find my altitude in Metres. You can convert to feet if needed (something like altitude * 3.3), there’s an exact number but I can’t be bothered to look it up (3ft f3 inchest in 1 metre) (A quick site was 3.28084), so should be close. My altitude registers as 150m on the sensor I’m using, and this shows 115m. I attribute this to the current pressure levels and the accurace of the sensor. It won’t really change anyway because it’s for a static weather station, but always good to know anyway.
- I also used Elevation Maps for same thing. It also helped me work out what the average air pressure is meant to be for the altitude calculation (I got this from Arduino though – 1013.25 iirc as it displays code tips against each command)
- Thecodeteacher.com – This was a quick one, the Arduino IDE serial monitor was displaying everything on the same line, I had to quickly look up how to input as a new line item (like a carriage return). Basically “print” = same line, “println” = carriage return.
- Instructables.com – I found this code when reading up, and found it easy to use. It was simplistic and kept in a basic format. I needed something simple to read to understand how it was constructed.
- Protosupplies.com – I used this initially when I was writing my code until I found the instructables article. It was a bit too indepth for what I needed. However, it was useful for the help I needed, and also the reference points for altitude.
- Microcontrollerslab.com – Reading up on the sensor, when I discovered about it’s operating voltage. I actually created a voltage divider after reading this article, and seemed to get it working. Wasn’t sure if it was me or just dumb luck. I need to look further into it, as the device seems to fluctuate between 0x76, and 0x77 addresses (guessing because I’m not using SPI)
- Simple-circuit.com – More further reading to debug my issues with the sensor. Basically helped me understood the pins. The devices should default to 0x76 or 0x77 but the one I have seems to shift, so I forced it after reading this article. Wired up as I2C, then if SDO pin is wired to VCC, the address becomes 0X77, and if wired to GND it becomes 0X76. I wired to VCC to force it which makes it easier.