-
-
Notifications
You must be signed in to change notification settings - Fork 11
I2C Temperature Sensors with FanPico
Starting from firmware version v1.7.0, FanPico supports some common I2C Environmental Sensors (up to 8 sensors is supported simultaneously).
I2C (temperature) sensors can be configured as "sources" to virtual sensors (VSENSORS)
Currently supported sensor types/models:
Manufacturer | Sensor Model/Type | Description | Temperature Accuracy | Humidity Accuracy | Pressure Accuracy | Notes |
---|---|---|---|---|---|---|
Analog Devices | ADT7410 | 16bit Temperature sensor | 0.5C | N/A | N/A | Adafruit Stemma QT module tested. |
ASAIR | AHT1x (AHT10, AHT11, ...) | Temperature and Humidity sensor | N/A | Generic "no name" ATH10 module tested. | ||
ASAIR | AHT2x (AHT20, AHT21, ...) | Temperature and Humidity sensor | 0.5C | 3% | N/A | Generic "no name" AHT21 module tested. |
AMS | AS621x series (AS6212, AS6214, AS6218) | Temperature sensor | AS6212 (0.2C), AS6214 (0.4C), AS6218 (0.8C) | N/A | N/A | Sparkfun AS6212 QWIIC module tested. |
Bosch | BMP180 | Digital Pressure Sensor | 0.5C | N/A | 0.12hPa | Generic "no name" module tested. |
Bosch | BMP280 | Digital Pressure Sensor | 0.5C | N/A | 0.12hPa | Generic "no name" module tested. |
Infineon | DPS310 | Barometric Pressure Sensor | 0.5C | N/A | 0.06hPa | Adafruit Stemma QT module tested. |
Microchip | MCP9808 | Digital Temperature Sensor | 0.25C | N/A | N/A | Adafruit module tested. |
NXP | PCT2075 | Digital Temperature Sensor | 1C | N/A | N/A | Generic "no name" module tested. |
STMicroelectronics | STTS22H | Temperature Sensor | 0.5C | N/A | N/A | Sparkfun QWIIC module tested. |
Texas Instruments | TMP102 | Digital Temperature Sensor | 2C | N/A | N/A | Sparkfun QWIIC module tested. |
Texas Instruments | TMP117 | Digital Temperature Sensor | 0.1C | N/A | N/A | Adafruit Stemma QT module tested. |
FanPico boards that have I2C connectors can be used with I2C Temperature sensors. (early board "0804" does not have I2C pins available, but later boards support I2C sensors).
This board has dedicated "QWIIC" connector for easily connecting sensors from SparkFun (QWIIC) or Adafruit (Stemma QT).
This board does not include QWIIC connector, but there is alternate pinout connector for I2C OLED module that can be used for the purpose:
I2C Temperature sensors can be configured as "source" for any of the eight virtual sensors (VSENSORS).
I2C Bus must be enabled for sensors to work. FanPico-0401D has I2C bus always enabled, but FanPico-0804D I2C bus shares pins with SPI connector, so I2C is not available if SPI bus is enabled (LCD display in use, etc).
To make sure I2C is active (needed on FanPico-0804D only):
SYS:SPI OFF
CONF:SAVE
*RST
After sensors have been connected, scan I2C bus to make sure sensor is seen by FanPico.
NOTE, if there is multiple sensors on same address these sensors will not work, all devices connected to I2C bus must be using unique addresses.
Scan bus after connecting a TMP117 sensor:
SYS:I2C:SCAN?
Scanning I2C Bus... 0x3c, 0x48
Device(s) found: 2
0x3c is OLED module, so TMP117 must be the second device found: 0x48
After I2C sensor is connected and successfully found using SYS:I2C:SCAN?
command, it can be configured
as temperature source for one of the eight virtual sensors (VSENSOR1 ... VSENSOR8).
For example, configure TMP117 sensor on address 0x48 as VSENSOR1:
CONF:VSENSOR1:SOURCE i2c,0x48,tmp117
CONF:SAVE
*RST
Command SYS:VSENSORS:SOURCES?
can be used to list (source) configuration for all virtual sensors.
SYS:VSENSORS:SOURCES?
vsensor1,i2c,0x48,TMP117
vsensor2,manual,0.00,30
vsensor3,manual,0.00,30
vsensor4,manual,0.00,30
vsensor5,manual,0.00,30
vsensor6,manual,0.00,30
vsensor7,manual,0.00,30
vsensor8,manual,0.00,30
If logging level is set to INFO (or higher) then when FanPico boots it will log I2C sensor initialization status during boot:
SYS:LOG INFO
CONF:SAVE
[ 477.066428][0] Saving configuration...
[ 477.162675][0] File "fanpico.cfg" successfully created: 7401 bytes
*RST
[ 481.514438][0] Initiating reboot...
[22:02:16.721] Disconnected
[22:02:17.724] Connected
FanPico-0804D v1.7.0 (Aug 23 2024; Release; SDK v1.5.1; pico_w)
Hardware Model: FANPICO-0804D
Board: pico_w
MCU: RP2040-B2 @ 125MHz
Serial Number: e6614103e1234567
Found persistent memory block
[ 0.986720][0] System starting...
[ 0.990123][0] Uptime before soft reset: 481s
[ 0.994566][0] RTC clock time: 2024-08-28 22:02:17
[ 0.999383][0] Initializing I2C Bus..
[ 1.003155][0] I2C Bus initialized at 1000 kHz
[ 1.010508][0] I2C Device TMP117 (at 0x48): mapped to vsensor1
[ 1.013934][0] Initializing OLED Display...
[ 1.068544][0] I2C OLED Display: SH1107 (at 3c)
[ 1.101574][0] Initializing WiFi...
[ 1.102487][0] WiFi country code: 005355 (US)
...
[ 5.981634][1] vsensor1: Temperature change 0.0C --> 24.8C
...