Skip to content

1‐Wire Temperature Sensors with FanPico

Timo Kokkonen edited this page Aug 30, 2024 · 12 revisions

1-Wire Temperature Sensor Support

Starting from firmware version v1.7.0, FanPico supports some common 1-Wire Temperature Sensors (up to 8 sensors is supported simultaneously).

1-Wire Temperature sensors can be configured as "sources" to virtual sensors (VSENSORS)

Supported 1-Wire Sensors

Currently supported sensor models:

Device Type Notes
DS18S20 Temperature sensor (9bit)
DS1822 Temperature sensor (9-12bit)
DS18B20 / MAX31820 Temperature sensor (9-12bit)
DS1825 / MAX3826 Temperature sensor (9-12bit)
DS28EA00 Temperature sensor (9-12bit)

Connecting 1-Wire Sensors to FanPico

FanPico boards that have dedicated "1-Wire" connector or "LCD (SPI)" connector support 1-Wire sensors.

Early boards don't dedicated connector (or built-in pull-up resistor) but can be used with appropriate cable/adapter.

Connecting 1-Wire Sensors to FanPico-0401D

This board has dedicated "1-Wire" connector for easily connecting sensors.

NOTE! Jumper (JP12) next to 1-Wire connector is used to enable built-in 4.7K pull-up resistor. This jumper should normally be installed (unless there is need to use external pull-up resistor).

fanpico-0401d-1wire

Connecting 1-Wire Sensors to FanPico-0804D

This board does not have dedicated 1-Wire connector, but 1-Wire sensors can be connected via pins on the "LCD (SPI)" connector.

Connecting 1-Wire Sensors to "LCD (SPI)" connector

Pin Label 1-Wire Notes
DC DQ (Data)
Vcc Vdd
GND GND
RST or BL (Pull-Up) 1-Wire needs pull-up (4.7k) resistor between DQ and Vdd these pins can be used to 3.3V for the pull-up resistor.

lcd_spi_connector-small

1-Wire sensor connected via "LCD (SPI)" connector using adapter cable: fanpico-0804D-1wire_1

Adapter cable (with built-in 4.7K resistor) for connecting 1-Wire sensors: 1wire-adapter

Configuring 1-Wire Temperature Sensors

To use 1-Wire temperature sensors, support for 1-Wire must be enabled: SYS:ONEWIRE ON

Enabling 1-Wire Support

Enable 1-Wire Support on FanPico-0401D

To use 1-Wire, support must be enabled:

SYS:ONEWIRE ON
CONF:SAVE
*RST

Enable 1-Wire Support on FanPico-0804D

To use 1-Wire, SPI and Serial must be disabled in the configuration:

SYS:SERIAL OFF
SYS:SPI OFF
SYS:ONEWIRE ON
CONF:SAVE
*RST

Identifying Connected 1-Wire Sensors

After 1-Wire support has been enabled and unit rebooted, detected 1-Wire sensors can be viewed usign command SYS:ONEWIRE:SENSORS?

For example:

SYS:ONEWIRE:SENSORS?
1,280dd46900000016,24.1

Configuring 1-Wire Sensor as Virtual Sensor (source)

After 1-Wire sensor is connected and successfully found using SYS:ONEWIRE:SCAN? command, it can be configured as temperature source for one of the eight virtual sensors (VSENSOR1 ... VSENSOR8).

For example, configure sensor on address 280dd46900000016 as VSENSOR2:

CONF:VSENSOR1:SOURCE onewire,280dd46900000016
CONF:SAVE
*RST

Check Virtual Sensor Sources

Command SYS:VSENSORS:SOURCES? can be used to list (source) configuration for all virtual sensors.

SYS:VSENSORS:SOURCES?
vsensor1,i2c,0x48,TMP117
vsensor2,onewire,280dd46900000016
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 1-Wire 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...

[23:14:54.455] Disconnected
[23:14:55.457] 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.971136][0] System starting...
[     0.971370][0] Uptime before soft reset: 1467s
[     0.971576][0] RTC clock time: 2024-08-29 23:14:55
[     0.971675][0] Initializing I2C Bus..
[     0.971807][0] I2C Bus initialized at 1000 kHz
[     0.974914][0] I2C Device TMP117 (at 0x48): mapped to vsensor1
[     0.975341][0] Initializing OLED Display...
[     1.026020][0] I2C OLED Display: SH1107 (at 3c)
[     1.057364][0] Initializing WiFi...
[     1.057581][0] WiFi country code: 005355 (US)
...
[     1.873551][0] Initializing 1-Wire Bus...
[     1.875872][0] Scanning 1-Wire bus...
[     1.879131][0] All devices in 1-Wire bus have power.
[     1.894435][0] 1-Wire device count change detected: 0 --> 1
[     1.894712][0] 1-Wire Device1: 280dd46900000016
[     1.894838][0] System initialization complete.
...