V
10  
Tags
Attachments
Dobrica Pavlinušić's random unstructured stuff
Orange Pi Plus 2
iio.conf

orangepiplus2_info.jpg

http://www.orangepi.org/orangepiplus2/

https://www.armbian.com/orange-pi-plus-2/

SoC H3 @ 1.2GHz[1]
DRAM 2GiB DDR3 @ ?MHz (H5TC4G83AFR-PBA)
NAND 16GB EMMC Flash (in 2016 KLMAG2GEND-B031 but now slower KLMAG2WEPD-B031)
Power DC 5V @ 2A (4.0mm/1.7mm barrel plug - centre positive)
Features
Video HDMI (HDCP, CEC), CVBS
Audio 3.5 mm Jack, HDMI, Microphone
Network 10/100/1000Mbps Ethernet (Realtek RTL8211E), WiFi 802.11 b/g/n (Realtek RTL8189ETV)
Storage �SD (max 64GB), SATA 2.0 (via GL830 USB-to-SATA bridge, +5V power on JST XH 2.5mm connector)
USB 4 USB 2.0 Host (via FE1.1s hub), 1 USB 2.0 OTG

bme280 i2c temperature/humidity/pressure

/home/dpavlin/linux-gpio-pinout/overlay-load.sh /boot/dtb-`uname -r`/overlay/*h3*i2c0*

root@opip:/home/dpavlin/linux-gpio-pinout# i2cdetect -y 2
     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 --

Check i2c address in datasheet

Connecting SDO to GND results in slave
address 1110110 (0x76); connection it to V DDIO results in slave address 1110111 (0x77)

root@opip:/home/dpavlin/linux-gpio-pinout# zgrep BMP280 /proc/config.gz
CONFIG_BMP280=m
CONFIG_BMP280_I2C=m
CONFIG_BMP280_SPI=m

root@opip:/home/dpavlin/linux-gpio-pinout# echo bmp280 0x76 > /sys/bus/i2c/devices/i2c-2/new_device
root@opip:/home/dpavlin/linux-gpio-pinout# [Sat Jan  2 11:43:58 2021] i2c i2c-2: new_device: Instantiated device bmp280 at 0x76
[Sat Jan  2 11:43:58 2021] bmp280 2-0076: supply vddd not found, using dummy regulator
[Sat Jan  2 11:43:58 2021] bmp280 2-0076: supply vdda not found, using dummy regulator
[Sat Jan  2 11:43:58 2021] bmp280 2-0076: bad chip id: expected 58 got 60
[Sat Jan  2 11:43:58 2021] bmp280: probe of 2-0076 failed with error -22


So it's not BMP280, but BME280.

Using https://www.raspberrypi-spy.co.uk/2016/07/using-bme280-i2c-temperature-pressure-sensor-in-python/
I downloaded and modified for python3 bme280.py

root@opip:/home/dpavlin# ./bme280.py
Chip ID : 96
Version : 0
Temperature : 24.65 C
Pressure : 998.4304559219445 hPa
Humidity : 41.458674890198445 %e

So let's try with correct sensor name

root@opip:/sys/bus/i2c/devices/i2c-2# echo bme280 0x76 > /sys/bus/i2c/devices/i2c-2/new_device
[Sat Jan  2 12:32:01 2021] bmp280 2-0076: supply vddd not found, using dummy regulator
[Sat Jan  2 12:32:01 2021] bmp280 2-0076: supply vdda not found, using dummy regulator
[Sat Jan  2 12:32:01 2021] i2c i2c-2: new_device: Instantiated device bme280 at 0x76

root@opip:~# apt install libiio-utils

root@opip:~# iio_info
Library version: 0.16 (git tag: v0.16)
Compiled with backends: local xml ip usb serial
IIO context created with local backend.
Backend version: 0.16 (git tag: v0.16)
Backend description string: Linux opip 5.10.0-rc7-sunxi #20.11.3 SMP Fri Dec 11 21:18:30 CET 2020 armv7l
IIO context has 1 attributes:
	local,kernel: 5.10.0-rc7-sunxi
IIO context has 1 devices:
	iio:device0: bme280
		3 channels found:
			humidityrelative:  (input)
			2 channel-specific attributes found:
				attr  0: input value: 40775
				attr  1: oversampling_ratio value: 16
			pressure:  (input)
			2 channel-specific attributes found:
				attr  0: input value: 99.809761718
				attr  1: oversampling_ratio value: 16
			temp:  (input)
			2 channel-specific attributes found:
				attr  0: input value: 25350
				attr  1: oversampling_ratio value: 2

collect using telegraf

root@opip:/etc/telegraf/telegraf.d# ../telegraf --config iio.conf --test
2021-01-02T12:39:39Z I! Starting Telegraf
> iio,host=opip,name=bme280 humidityrelative=39.934,pressure=99.801214843,temperature=25.66 1609591179000000000

 

Upload Files

Click "Browse" to find the file you want to upload. When you click "Upload file" your file will be uploaded and added to the list of attachments for this page.

Maximum file size: 50MB

 
 
 
File Name Author Date Uploaded Size

Save Page As

Enter a meaningful and distinctive title for your page.

Page Title:

Tip: You'll be able to find this page later by using the title you choose.

Page Already Exists

There is already a page named XXX. Would you like to:

Save with a different name:

Save the page with the name "XXX"

Append your text to the bottom of the existing page named: "XXX"

Upload Files

Click "Browse" to find the file you want to upload. When you click "Add file" this file will be added to the list of attachments for this page, and uploaded when you save the page.

 
 
 
Add Tags

Enter a tag and click "Add tag". The tag will be saved when you save the page.

Tag: 

Suggestions: