I am having an issue with connecting to the onboard LC709203 .
(Esp32-S3 Link
https://circuitpython.org/board/adafrui ... 3_nopsram/)
From the link above, LiPoly battery monitor - LC709203 chip actively monitors your battery for voltage and state of charge / percentage reporting over I2C. I can't seem to get the I2C to find the module, running the scan i2c addresses show that there is something at 0xb however, I2C says it is empty. Scan code says there is something at 0xb.
Using:
adafruit-circuitpython-bundle-7.x-mpy-20220524.zip
adafruit-circuitpython-adafruit_feather_esp32s3_nopsram-en_US-7.3.0.uf2
I don't know if I am doing something completely wrong OR I found a hardware or software bug . Code and Output follows below.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Code from esp32-s2 that I am attempting to use on the esp32-s3 feather
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
# SPDX-License-Identifier: Unlicense
"""
CircuitPython Simple Example for BME280 and LC709203 Sensors
"""
import time
import board
#from adafruit_bme280 import basic as adafruit_bme280
from adafruit_lc709203f import LC709203F, PackSize
from adafruit_bme280 import basic as adafruit_bme280
from adafruit_lc709203f import LC709203F, PackSize
# Create sensor objects, using the board's default I2C bus.
i2c = board.I2C()
# bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
battery_monitor = LC709203F(board.I2C())
battery_monitor.pack_size = PackSize.MAH400
'''
# change this to match your location's pressure (hPa) at sea level
#bme280.sea_level_pressure = 1013.25
'''
while True:
'''
print("\nTemperature: {:.1f} C".format(bme280.temperature))
print("Humidity: {:.1f} %".format(bme280.relative_humidity))
print("Pressure: {:.1f} hPa".format(bme280.pressure))
print("Altitude: {:.2f} meters".format(bme280.altitude))
'''
print("Battery Percent: {:.2f} %".format(battery_monitor.cell_percent))
print("Battery Voltage: {:.2f} V".format(battery_monitor.cell_voltage))
time.sleep(2)
OUTPUT FROM ABOVE
*********************************************************************************
Error shown in repl, The same problem occurs for the bme280 at a different address
code.py output:
Traceback (most recent call last):
File "code.py", line 18, in <module>
File "adafruit_lc709203f.py", line 117, in __init__
ValueError: No I2C device at address: 0xb
Code done running.
Press any key to enter the REPL. Use CTRL-D to reload.
*********************************************************************************
Code to scan the i2c addresses in use
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""CircuitPython I2C Device Address Scan"""
# If you run this and it seems to hang, try manually unlocking
# your I2C bus from the REPL with
# >>> import board
# >>> board.I2C().unlock()
import time
import board
# To use default I2C bus (most boards)
i2c = board.I2C()
# To create I2C bus on specific pins
# import busio
# i2c = busio.I2C(board.SCL1, board.SDA1) # QT Py RP2040 STEMMA connector
# i2c = busio.I2C(board.GP1, board.GP0) # Pi Pico RP2040
while not i2c.try_lock():
pass
try:
while True:
print(
"I2C addresses found:",
[hex(device_address) for device_address in i2c.scan()],
)
time.sleep(2)
finally: # unlock the i2c bus when ctrl-c'ing out of the loop
i2c.unlock()
OUTPUT FROM ABOVE
******************************************************
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
I2C addresses found: ['0xb']
I2C addresses found: ['0xb']
I2C addresses found: ['0xb']
Traceback (most recent call last):
File "code.py", line 31, in <module>
KeyboardInterrupt:
******************************************************
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks for your assistance.
Steve Schaefer