Jump to content

Recommended Posts

Posted

Hi,

 

 

First, i'am french, excuse my bad english...

 

I have a problem with my orangepi zero using a bme280 weather sensor with i2c.  (I have 2 sensors)

After long search and try, i've found the way to make this sensor working with the orange pi zero, by reading the datasheet where it's indicated that you must put CSB to Vdd to select i2c interface.

!!!  - I never wired this pin to my rapsberry pi and it always work , never see in any tuto too!!!

 

Th problem is that I don't read good values, it seem that the values are always the same, based on calibration . I try to figure out what happen but i'm not so friendly with i2c protocol.

 Here are the results of my tests from my rapsberry, the 2 sensors works fine.

 


pi@raspberrypi:~/i2cBME280 $./bme280-1.py
temp : 22.00  ℃
pressure : 1033.26 hPa
hum :  52.78 %

pi@raspberrypi:~/i2cBME280 $ i2cdump -y 1 0x76
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
80: 94 50 89 42 7c 2e f0 06 36 70 c2 68 32 00 62 8f    ?P?B|.??6p?h2.b?
90: 2f d6 d0 0b ec 19 47 00 f9 ff ac 26 0a d8 bd 10    /?????G.?.?&????
a0: 00 4b 08 00 00 00 00 00 00 00 00 00 33 00 00 c0    .K?.........3..?
b0: 00 54 00 00 00 00 60 02 00 01 ff ff 1f 71 03 00    .T....`?.?..?q?.
c0: 00 00 27 ff 00 00 00 00 01 00 00 00 00 00 00 00    ..'.....?.......
d0: 60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    `...............
e0: 00 76 01 00 12 03 00 1e 4e 41 ff ff ff ff ff ff    .v?.??.?NA......
f0: ff 00 01 00 27 a0 00 51 47 00 81 8b 00 6a d8 80    ..?.'?.QG.??.j??
pi@raspberrypi:~/i2cBME280 $ i2cdump -y 1 0x77
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
80: 91 70 89 3f 60 2e f0 06 2f 6f 7f 67 32 00 3a 8f    ?p??`.??/o?g2.:?
90: 50 d6 d0 0b e6 1d 00 00 f9 ff ac 26 0a d8 bd 10    P?????..?.?&????
a0: 00 4b b2 00 00 00 00 00 00 00 00 00 33 00 00 c0    .K?.........3..?
b0: 00 54 00 00 00 00 60 02 00 01 ff ff 1f 71 03 00    .T....`?.?..?q?.
c0: 00 00 27 ff 00 00 00 00 01 00 00 00 00 00 00 00    ..'.....?.......
d0: 60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    `...............
e0: 00 72 01 00 12 0c 00 1e 43 41 ff ff ff ff ff ff    .r?.??.?CA......
f0: ff 00 01 00 27 a0 00 4d 76 00 80 dc 00 6e 25 80    ..?.'?.Mv.??.n%?

 

And then from my orangepi zero :

 


cedricici@orangepizero:~/bme280$ ./bme280.py
temp : 20.68  ℃
pressure :  705.81 hPa
hum :  80.81 %
cedricici@orangepizero:~/bme280$ ./bme280-1.py
temp : 21.76  ℃
pressure :  680.09 hPa
hum :  76.92 %


cedricici@orangepizero:~/bme280$ i2cdump -y 0 0x76
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
80: 94 50 89 42 7c 2e f0 06 36 70 c2 68 32 00 62 8f    ?P?B|.??6p?h2.b?
90: 2f d6 d0 0b ec 19 47 00 f9 ff ac 26 0a d8 bd 10    /?????G.?.?&????
a0: 00 4b 08 00 00 00 00 00 00 00 00 00 33 00 00 c0    .K?.........3..?
b0: 00 54 00 00 00 00 60 02 00 01 ff ff 1f 60 03 00    .T....`?.?..?`?.
c0: 00 00 00 ff 00 00 00 00 00 00 00 00 00 00 00 00    ................
d0: 60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    `...............
e0: 00 76 01 00 12 03 00 1e 4e 41 ff ff ff ff ff ff    .v?.??.?NA......
f0: ff 00 00 00 00 00 00 80 00 00 80 00 00 80 00 80    .......?..?..?.?
cedricici@orangepizero:~/bme280$ i2cdump -y 0 0x77
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
80: 91 70 89 3f 60 2e f0 06 2f 6f 7f 67 32 00 3a 8f    ?p??`.??/o?g2.:?
90: 50 d6 d0 0b e6 1d 00 00 f9 ff ac 26 0a d8 bd 10    P?????..?.?&????
a0: 00 4b b2 00 00 00 00 00 00 00 00 00 33 00 00 c0    .K?.........3..?
b0: 00 54 00 00 00 00 60 02 00 01 ff ff 1f 60 03 00    .T....`?.?..?`?.
c0: 00 00 00 ff 00 00 00 00 00 00 00 00 00 00 00 00    ................
d0: 60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    `...............
e0: 00 72 01 00 12 0c 00 1e 43 41 ff ff ff ff ff ff    .r?.??.?CA......
f0: ff 00 00 00 00 00 00 80 00 00 80 00 00 80 00 80    .......?..?..?.?

 

It's clear that reading values are not set correctly ( 0xF7 to 0xFE) .

The config registers (0xF2 0xF4 0xF5 are null too , but the bme280.py write this registers without any error?

 

I use the same wiring on the two board (orange & raspberry) .

 

Has someone see something like this before?

 

Thank you.

 

Posted

I use that sensor on all of my boards (Orange Pi Zero, RPIs, NanoPis) and it gives consistent results. I'm not sure why you're seeing an issue, but it would be helpful to see your code. I've written C code to directly read the calibrated values from the sensor. You can try it as another test:

 

https://github.com/bitbank2/bme280

 

Posted
6 hours ago, Larry Bank said:

I use that sensor on all of my boards (Orange Pi Zero, RPIs, NanoPis) and it gives consistent results. I'm not sure why you're seeing an issue, but it would be helpful to see your code. I've written C code to directly read the calibrated values from the sensor. You can try it as another test:

 

https://github.com/bitbank2/bme280

 

 

+1 never had a single problem with this sensor when used inside my house. On you other post I've also proposed another python library.

Posted
12 hours ago, Larry Bank said:

I use that sensor on all of my boards (Orange Pi Zero, RPIs, NanoPis) and it gives consistent results. I'm not sure why you're seeing an issue, but it would be helpful to see your code. I've written C code to directly read the calibrated values from the sensor. You can try it as another test:

 

https://github.com/bitbank2/bme280

 

Many thanks for yours rapid answers !

 

I try your code and the 2 sensors run perfectly...  with my python code too now !!!!

 

This is the code i try  : (not mine)

https://github.com/SWITCHSCIENCE/BME280/blob/master/Python27/bme280_sample.py

The difference with yours is that it don't write to register before reading. Is that a prerequisite?

 

Again,  this python code works now and it always works on my pi.

Is there an initialization file or something that is write to the OS for i2c devices?

 

Ia'm now ready to close my WeatherStation box ;-)

 

Cédric

 

 

 

 

 

 

Posted
6 minutes ago, Cedricici said:

Many thanks for yours rapid answers !

 

I try your code and the 2 sensors run perfectly...  with my python code too now !!!!

 

This is the code i try  : (not mine)

https://github.com/SWITCHSCIENCE/BME280/blob/master/Python27/bme280_sample.py

The difference with yours is that it don't write to register before reading. Is that a prerequisite?

 

Again,  this python code works now and it always works on my pi.

Is there an initialization file or something that is write to the OS for i2c devices?

 

Ia'm now ready to close my WeatherStation box ;-)

 

Cédric

 

 

 

 

 

 

I2C devices normally have a "register" structure where you write the register number before reading its value. I also initialize the sampling/power mode of the device. It's hard to make heads or tails of the python code because I can't see the variable types. Some of the BME280 registers are signed values and some are unsigned. It's easy to mess things up if you're not careful with the handling of signed/unsigned values and overflowing 32-bits.

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines