0

circuitpython and esp8266 i2c errors
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

circuitpython and esp8266 i2c errors

by jfranklyn on Wed Apr 07, 2021 3:32 pm

Hello,
I'm using and ESP8266 and trying to interface with an INA260 both from adafruit. I'm using this version of circuitpython:
Adafruit CircuitPython 3.1.2 on 2019-01-07; ESP module with ESP8266

I'm trying to use the ina260simpletest.py example. If this is the wrong code to use please point me to the right code. These are the files that I have imported into the ESP8266:
>>> os.listdir('.')
['boot.py', 'umqttsimple.py', 'main.py', 'adafruit_ina260.py', 'i2c_device.py']

This is what the board module contains:
>>> dir(board)
['ADC', 'GPIO16', 'GPIO14', 'SCK', 'GPIO12', 'MISO', 'GPIO13', 'MOSI', 'GPIO15', 'GPIO2', 'GPIO0', 'GPIO4', 'SDA', 'RX', 'TX', 'GPIO5', 'SCL']
>>>

When I type in the ina260 sample code, I get this error:
>>> import board
>>> import adafruit_ina260
>>> i2c = board.I2C()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'I2C'

I've seen that this problem might be fixed and there is an updated board.py. I've imported that file, but I don't see any updated in the board module. board.I2C is still missing.

What do I need to do to get this fixed?

I choose the ESP8266 because I need wifi connections to use MQTT to connect to other ESP8266's and an RPI Zero W MQTT broker. Should I be using a different feather board?
Thanks

jfranklyn
 
Posts: 26
Joined: Fri Mar 13, 2020 6:50 pm

Re: circuitpython and esp8266 i2c errors

by tannewt on Wed Apr 07, 2021 6:06 pm

The ESP8266 is no longer supported in CircuitPython and I think the board.I2C() thing was added after that. We recommend the ESP32-S2 for newer CircuitPython Wifi connected devices. Adafruit doesn't have a feather yet but UnexpectedMaker has made one (and Adafruit carries it.)

tannewt
 
Posts: 2349
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.