Odd behavior with clue and SCD30
by mspearfungi on Wed Dec 08, 2021 12:36 pm
Introduction
===========
I can't find any description of an error that happens on power on but disappears on reset. Here is an example and there is probably a simple explanation I'm missing.
The Problem
===========
When programing the Clue, as it is plugged into my PC with USB, the code works perfectly every time. When on battery power the code does not run and and error message is displayed on the Clue (included below). But here is the weird part: If the Reset button on the Clue is pressed the code works perfectly.
Circuit description
================
Very simple. The Clue is the center of the device. In use it is powered by an Adafruit Power Boost 500 C with a 2000 mAh lithium battery.
The SCD30 is Stemma connected to the Clue. There is a power switch between the power board and the Clue.
Egregious Code
===============
# Almost Working Version of Mushroom Farmer's friend environmental sensor
import adafruit_scd30
import time
import board
import digitalio
import busio
from adafruit_clue import clue
# Create object for CO2
scd = adafruit_scd30.SCD30(board.I2C())
# check scd30
print(scd.CO2)
clue_display = clue.simple_text_display(text_scale=4, colors=(clue.WHITE,))
# Set up non variant titles
clue_display[1].color = clue.GREEN
clue_display[2].color = clue.RED
clue_display[3].color = clue.BLUE
print("Check point B")
while True:
clue_display[1].text = "CO2 %d ppm" % scd.CO2
ftemp = (scd.temperature * 1.8) +32
clue_display[2].text = "Temp %0.0f F" % ftemp
clue_display[3].text = "RH %0.0f %%" % scd.relative_humidity
clue_display.show()
time.sleep(2)
Error Message when code fails
===========================
Board ID:clue_nrf52840_express
code.py output:
Check point A
Traceback (most recent call last):
File “code.py”, line 8, in <module>
File “adafruit_clue.py”, line 930, in <module>
File “adafruit_clue.py”, line 221, in __init__
File “adafruit_lsm6ds/__init__py”, line 194, in __init__.py
ValueError: No I2C device a address: 6a
Code done running.
Alternate Approach
==================
Note that looking in the Forums shows a comment about starting up the "temperamental" SCD30. When I try that I get another error amounting to P19 already in use.