Jump to content
  • 0

BME280 on Armbian 5.85 on Orange Pi PC Plus


darethehair
 Share

Question

Armbianmonitor:

Hello Folks!

 

Already successfully running an RTL-SDR device (for Flight Tracking) and U-Blox NEO-6M GPS (for GPS/NTP) on my Orange Pi PC Plus, and now wanted to try a BME280 weather chip, but ran into problems talking to it.  The 'i2cdetect' seems to be working fine:

darren@frodo10:~$ sudo i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- 76 --               

However, after many Googles with both C and Python code, I can't seem to successfully talk to this device :(

 

In my last attempt (using bme280_sample.py and modifying the reference to 0x76, installing 'smbus2', etc.):

darren@frodo10:~/Downloads$ sudo python bme280_sample.py
Traceback (most recent call last):
  File "bme280_sample.py", line 138, in <module>
    setup()
  File "bme280_sample.py", line 133, in setup
    writeReg(0xF2,ctrl_hum_reg)
  File "bme280_sample.py", line 19, in writeReg
    bus.write_byte_data(i2c_address,reg_address,data)
  File "/usr/local/lib/python2.7/dist-packages/smbus2/smbus2.py", line 391, in write_byte_data
    ioctl(self.fd, I2C_SMBUS, msg)
IOError: [Errno 6] No such device or address

Does the 'ic2detect' output mean that I have everything wired up properly?  Am I close to success?

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

Order Armbian Linux merch!

  • 0
7 hours ago, martinayotte said:

Did you tried modifying "bus_number = 1" to "bus_number = 0"  ?

You can also try using this python library instead of "smbus2" : https://github.com/duxingkei33/orangepi_PC_gpio_pyH3

Hello!

 

Thanks for your suggestions.  Changing the 'bus_number' had no effect.  I implemented the python library you suggested, but I have not found app code specifically to test the BME280.  All of the code I have tested so far results in some sort of failure.  The latest one (from blackmagicboxes) results in the following:

darren@frodo10:~/Downloads/bmp280_p$ ./bme280_p
Failed to open the bus.

With successful 'i2cdetect', can I be confident my device is working and wired correctly i.e. that my problems are just a 'software' issue?

Link to comment
Share on other sites

  • 0
12 hours ago, darethehair said:

With successful 'i2cdetect', can I be confident my device is working and wired correctly i.e. that my problems are just a 'software' issue?

I think so ...

 

12 hours ago, darethehair said:

I implemented the python library you suggested

You need to take your existing script and translate all the smbus calls to the new library.

Link to comment
Share on other sites

  • 0

Update: Success!

 

Some articles that I read, including the one here, suggest using PA19/PA18 instead of PA12/PA11, so I swapped my wires around.  I also followed the suggestion to wire SDO to GND as that article mentions.  After doing this, and rebooting, the code I was trying started to work.  Why?  I have no idea, but I am happy.  Next (small) hurdle -- deal with the expected distorted values being encountered while the BME280 sensor is in the same coffee can as the Orange Pi :)

 

Thanks Martinayotte!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...