i2c pyb or machine for sgp30 adafruit sensor?

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
Posts: 4
Joined: Fri Jun 18, 2021 2:03 am

Re: i2c pyb or machine for sgp30 adafruit sensor?

Post by boadeletrius » Sun Jun 20, 2021 7:42 am

In case anyone else wants to use this sensor. This post was very useful for getting the SGP30 working with the current Micropython version on an esp8266. A quick summary:

Use the driver from here: https://github.com/alexmrqt/micropython-sgp30
modify line 54 from

Code: Select all

_SGP30_FEATURESET        = const(0x0020)
to this:

Code: Select all

_SGP30_FEATURESET        = const(0x0022)

Code: Select all

import machine
import adafruit_sgp30
i2c = machine.I2C(scl=machine.Pin(5), sda=machine.Pin(4), freq=100000)
i2c.init(scl=machine.Pin(5), sda=machine.Pin(4))
sgp30 = adafruit_sgp30.Adafruit_SGP30(i2c)
co2eq, tvoc = sgp30.iaq_measure()
print("CO2eq = %d ppm \t TVOC = %d ppb" % (co2eq, tvoc))

Post Reply