- https://www.microchip.com/en-us/product/MCP2221
- https://elinux.org/Interfacing_with_I2C_Devices
- https://www.kernel.org/doc/Documentation/i2c/dev-interface
- https://github.com/nonNoise/PyMCP2221A
Source:
- https://gist.github.com/mamemomonga/fdb7a2330b0a3c5d2ba50528c5946ef4
- https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/SoftwareLibraries/Firmware/MCP2200_MCP2221_CDC_Linux_Readme.txt
wget http://ww1.microchip.com/downloads/en/DeviceDoc/mcp2221_0_1.tar.gz
tar zxvf mcp2221_0_1.tar.gz
cd mcp2221_0_1
sudo make modules
sudo make install
sudo ./driver_load.sh
apt install i2c-tools
sudo i2cdetect -l
i2c-3 i2c i2c-mcp2221 at bus 001 device 006 I2C adapter
sudo i2cdetect -y 3
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
python3 -m venv venv
source venv/bin/activate
pip3 install bpython
Source: https://learn.adafruit.com/circuitpython-libraries-on-any-computer-with-mcp2221/linux
pip3 install hidapi
pip3 install adafruit-blinka
export BLINKA_MCP2221=1
import board
dir(board)
Source:
- https://github.com/sparkfun/Qwiic_BME280_CCS811_Combo
- https://learn.adafruit.com/adafruit-bme280-humidity-barometric-pressure-temperature-sensor-breakout/python-circuitpython-test
sudo i2cdetect -l
i2c-3 i2c AMDGPU DM i2c hw bus 0 I2C adapter
i2c-10 i2c i2c-mcp2221 at bus 001 device 014 I2C adapter
i2c-1 i2c Synopsys DesignWare I2C adapter I2C adapter
i2c-8 i2c AMDGPU DM aux hw bus 2 I2C adapter
i2c-6 i2c AMDGPU DM i2c hw bus 3 I2C adapter
i2c-4 i2c AMDGPU DM i2c hw bus 1 I2C adapter
i2c-2 i2c Synopsys DesignWare I2C adapter I2C adapter
i2c-0 i2c Synopsys DesignWare I2C adapter I2C adapter
i2c-9 i2c AMDGPU DM aux hw bus 3 I2C adapter
i2c-7 i2c AMDGPU DM aux hw bus 0 I2C adapter
i2c-5 i2c AMDGPU DM i2c hw bus 2 I2C adapter
sudo i2cdetect -y 10
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- 5b -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- 77
pip3 install adafruit-circuitpython-bme280
export BLINKA_MCP2221=1
import board
from adafruit_bme280 import basic as adafruit_bme280
i2c = board.I2C() # uses board.SCL and board.SDA
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
print("\nTemperature: %0.1f C" % bme280.temperature)
print("Humidity: %0.1f %%" % bme280.humidity)
print("Pressure: %0.1f hPa" % bme280.pressure)
pip3 install adafruit-circuitpython-ccs811
export BLINKA_MCP2221=1
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
import time
import board
import adafruit_ccs811
i2c = board.I2C() # uses board.SCL and board.SDA
ccs811 = adafruit_ccs811.CCS811(i2c, address=0x5B)
# Wait for the sensor to be ready
while not ccs811.data_ready:
pass
while True:
print("CO2: {} PPM, TVOC: {} PPB".format(ccs811.eco2, ccs811.tvoc))
time.sleep(0.5)
Grove - I2C ADC is a 12-bit precision ADC module based on ADC121C021.
- https://wiki.seeedstudio.com/Grove-I2C_ADC/
- https://github.com/ControlEverythingCommunity/ADC121C021
- http://blog.rareschool.com/search/label/ADC
I2C adress is 0x50.
i2cdetect -y 10
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
# set mode
i2cset -y 10 0x50 0x02 0x20
watch -n1 i2cget -y 10 0x50 0
Use bpython as lightweight Python interpreter: