Orangepi0 Posted November 17, 2017 Posted November 17, 2017 (edited) Hello everyone, I'm having some trouble with i2c between orangepi zero and ina219. Here is i2cdetect -y 0 respons: " 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: 40 -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --" I'm using https://github.com/chrisb2/pi_ina219 and also installed https://github.com/adafruit/Adafruit_Python_GPIO and both of them installed without any problem, but when I run: "from ina219 import INA219, DeviceRangeError from time import sleep SHUNT_OHMS = 0.1 MAX_EXPECTED_AMPS = 2.0 ina = INA219(SHUNT_OHMS, MAX_EXPECTED_AMPS, address=0x40) ina.configure(ina.RANGE_16V) def read_ina219(): try: print('Bus Voltage: {0:0.2f}V'.format(ina.voltage())) print('Bus Current: {0:0.2f}mA'.format(ina.current())) print('Power: {0:0.2f}mW'.format(ina.power())) print('Shunt Voltage: {0:0.2f}mV\n'.format(ina.shunt_voltage())) except DeviceRangeError as e: # Current out of device range with specified shunt resister print(e) while 1: read_ina219() sleep(1)" I get: "Traceback (most recent call last): File "zero.py", line 7, in <module> ina.configure(ina.RANGE_16V) File "/root/pi_ina219/ina219.py", line 164, in configure self._max_expected_amps) File "/root/pi_ina219/ina219.py", line 282, in _calibrate self._calibration_register(calibration) File "/root/pi_ina219/ina219.py", line 328, in _calibration_register self.__write_register(self.__REG_CALIBRATION, register_value) File "/root/pi_ina219/ina219.py", line 360, in __write_register self._i2c.writeList(register, register_bytes) File "build/bdist.linux-armv7l/egg/Adafruit_GPIO/I2C.py", line 128, in writeList File "build/bdist.linux-armv7l/egg/Adafruit_PureIO/smbus.py", line 274, in write_i2c_block_data IOError: [Errno 70] Communication error on send" So does anyone know what to do to fix this error. Thanks Edited November 17, 2017 by Orangepi0
Recommended Posts