DS18B20 : Capteur de température 1 Wire avec Pico et Pyboard
Bonjour à tous,
Le tuto DS18B20 (Capteur de température 1 Wire) à été mis à jour sur notre dépôt GitHub pour inclure le câblage et test pour les plateformes PyBoard et Pico sous MicroPython
![]() |
| DS18B20 sur Pico Source: esp8266-upy |
![]() |
| DS18B20 sur Pyboard Source: esp8266-upy |
Et le code de test qui reste assez simple
from machine import Pin
from onewire import OneWire
from ds18x20 import DS18X20
from time import sleep_ms
# PyBoard
bus = OneWire( Pin("Y3") )
# ESP8266
# bus = OneWire( Pin(2) )
# Pico
# bus = OneWire( Pin(2) )
ds = DS18X20( bus )
# Scan all the DS12B20 on the bus (for each of the ROM address).
# Each of the device do have a specific address
roms = ds.scan()
for rom in roms:
print( rom )
# Request temps from sensors
ds.convert_temp()
# Waits for 750ms (required)
sleep_ms( 750 )
# Display the temp for each device
for rom in roms:
temp_celsius = ds.read_temp(rom)
print( "Temp: %s Celcius" % temp_celsius )
Ressource
- Tutoriel DS18B20 sur esp8266-upy (Github MCHobby)
Liste d'achat
- Shop: DS18B20 @ MCHobby
- Shop: DS18B20 WaterProof @ MCHobby
- Raspberry-Pi Pico @ MCHobby
- Raspberrt-Pi Pico Wireless @ MCHobby


Écrire un commentaire