Skip to content

Raspberry Tool for managing I2C modules. EEPROM (24c01-1024), PWM LED/Motor driver (PCA9632), I/O driver (PCA9557), Temp/Humid sensor (HDC1080, HTU21D), Fan controller with a PWM (EMC2301), Pressure sensor(MS5637), Display (SSD1306), Current Voltage Power measurement (INA226, INA260), PMU (AXP209), i2cdetect

License

Notifications You must be signed in to change notification settings

mamin27/ecomet_i2c_raspberry_tools

Repository files navigation

ecomet_i2c_raspberry_tools

Last modification: 24.09.2024 Contributor: Marian Minar

Dont forget to add /python_test_script/display/images/star.png if you were satisfy with the software!

Twitter: News and statuses

NEW! SourceForge.net:

  • Oscilloscope-like application eCScope for Raspberry PI 3+ (32bit Raspbian) based on INA260 chips and built with the Ecomet-i2c-sensors Python library.

Download eCScope

Project eCScope was created to show progress in development. Insert the #eCScope keyword into the issue section.

PyPi module: ecomet-i2c-sensor

Current release: 0.1.8

New features

  • AXP209 driver added (X-Powers)
  • TSL25911 driver added (Osram-AMS)
  • add i2c_interface parameter as switch for libraries Adafruit_PureIO or smbus2
  • Add Allwiner CPU A10 driver, olimex OLinuXino A10 update load_config_yaml
pip install ecomet-i2c-sensors

Test release: 0.1.9.post3

  • AS3935 driver added (Sciosens)
  • SGP40 driver added (Sensirion)
  • MCP3221 driver added (Microchip)
  • MCP3221 added feature for convert measured number to range or 360 degree, or cardinal points
  • Fixes in PCA9632, prepared for multiple chips at I2C bus
  • HDC1080 driver mainly code rewritten, different methon calls
pip3 install -i https://test.pypi.org/simple/ecomet-i2c-sensors

Wiki Hardware prototypes boards: link

Scope: The Driver for I2C Chip maintenance from Raspberry PI 1B+ and above and AllWinner CPU. This code tools contains python & free pascal code focused to I2C communication of raspberry pi with IOT modules.

  • tested at Raspberry PI 1B+, 3B+, 4B+, 4CM
  • tested at AllWinner CPU H616, mangopi MCore-H616, Orange PI Zero2

Current CHIP maintained:

List of modules:

  • AS3935 -> !NEW! Franklin Lightning Sensor
  • AXP209 -> PMU (Power Management Unit) Sensor
  • EEPROM module -> EEPROM read/write 24cXXX chips
  • EMC2301 module -> Fan controller with a PWM fan driver
  • HDC1080 module -> High Accuracy Digital Humidity Sensor with Temperature Sensor
  • HTU21D module -> Digital Relative Humidity sensor with Temperature output, calculation of Dew Point
  • INA226,INA260 module -> Precision Digital Current and Power Monitor With Low-Drift, Precision Integrated Shunt
  • ISL2802x module -> will be added python module description
  • MCP3221 module -> !NEW! Low-Power 12-Bit A/D Converter
  • MS5637 module -> Ultra-compact micro altimeter. Integrated digital pressure sensor (24 bit ΔΣ ADC), Operating range: 300 to 1200 mbar, -40 to +85 °C
  • PCA9557 module -> Remote8-Bit I2C and SMBusLow-PowerI/O ExpanderWith Reset andConfigurationRegisters
  • PCA9632 module -> 4-bit Fm+ I2C-bus low power LED driver (could be used for motor control)
  • SGP40 module -> Indoor Air Quality Sensor for VOC Measurements
  • SN-GCJA5 -> Laser Type PM Sensor
  • SSD1306 module -> SSD1306 is a single-chip CMOS OLED/PLED driver with controller for organic / polymer light emitting diode dot-matrix graphic display system.
  • TSL25911 -> Ambient Light Sensor

Software for Chips:

Chip Python 3 driver FPC GUI Hardware Board Contributor Notes Planned work Requestor Interests
!NEW! AS3935 yes check no
AXP209 yes check no A10 Olimex Only partially implemented pdf, check
EEPROM 24cXXX yes no I01,I02,I03,I04 currently tested at 24c01,24c04,24c08,24c16,24c32,24c64
EMC2301 yes yes I02 add EMC2302-05 chips in design
HDC1080 yes yes I03,I04 !NEW! python lib not compatible with previous version, see test script
HTU21D yes no I03,I04
INA226, INA260 yes yes I01
ISL2802x in progress no
MCP3221 yes check no
MS5637 yes no I04
PCA9557 yes no I01
PCA9632 yes yes I04
SN-GCJA5 yes check no
SGP40 yes check no
SSD1306 yes no I01
TSL25911 yes check no

Setting of config file for ecomet-i2c-sensors python library:

Library is looking in directory ~/.comet for file config.yaml that contains i2c parameters for custom linux distribution and I2C EEPROM memory setting. Here is a example of config file content:

comet@orangepizero2:~/.comet $ cat config.yaml
--- # The I2C config file

i2c:
    smb: i2c-3 # set bus i2c-1
    smb_detect: 0..3 # list of monitored smb bus by i2cdetect
    eeprom:
      ic: '24c01'
      slaveaddr: 0x50
      writestrobe: 26 # hold pin low to write to eeprom
    sensor:
      ms5637:
        pressure:
          { min: 600, max: 1300 }
      sn_gcja5:
        PM1_0:
          { min: 0, max: 1200 }
        PM2_5:
          { min: 0, max: 1200 }
        PM10:
          { min: 0, max: 1200 }
parameter sub-parameter description example value
smb: name of active i2c in /dev i2c-1
smb_detect: list of monitored i2c neworks used by command i2c_ecomet_detect 0..1
eeprom: eeprom section
ic: 24x00 series of eeprom chip name '24c01'
slaveaddr: address of eeprom chip in hex 0x50
writestrobe: GPIO pin number used as CS (chip select) signal for eeprom IC 26
sensor: part for setting particular sensors
ms5637: preasure min max { min: 600, max: 1300 }
sn_gcja5: air quality min max

Note: Currently only one eeprom chip could be added.

Alternative command for I2C chip detection:

Here is alternative command to i2cdetect for detection of active I2C chips at I2C bus: i2c_ecomet_detect.py

pi@raspberrypi:~/ecomet_i2c_raspberry_tools/bin $ python3 i2c_ecomet_detect.py
3.9.9 (main, Jan 16 2022, 22:51:22)
[GCC 11.2.0]
ecomet.Board_Platform: INFO     Start logging ...
ecomet.Board_Platform: INFO     Board platform: RASPBERRY_PI 4B:1.4
ecomet.Board_Platform: INFO     Number of I2C buses at the board: 2
ecomet_i2c_sensors.platform.i2c_platform: INFO     >>> Testing at bus: 0
ecomet_i2c_sensors.platform.i2c_platform: INFO     No Chip connected
ecomet_i2c_sensors.platform.i2c_platform: INFO     >>> Testing at bus: 1
ecomet_i2c_sensors.platform.i2c_platform: INFO     Default bus number: 1
ecomet_i2c_sensors.platform.i2c_platform: INFO     Identified Slaves Chips: 0xc:0x1a:0x2f:0x40:0x50:0x51:0x52:0x53:0x54:0x55:0x56:0x57:0x62:0x70:0x76

Requestor Interests: If you would like to reqest some new feature or add some new Chip at the development list let me know by adding issue or by email.

About

Raspberry Tool for managing I2C modules. EEPROM (24c01-1024), PWM LED/Motor driver (PCA9632), I/O driver (PCA9557), Temp/Humid sensor (HDC1080, HTU21D), Fan controller with a PWM (EMC2301), Pressure sensor(MS5637), Display (SSD1306), Current Voltage Power measurement (INA226, INA260), PMU (AXP209), i2cdetect

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published