GPS speedometer and clock
A bike or car speedometer that needs no wheel sensor: satellites do the measuring.
Shop by category
Shop all componentsMicroPython includes network, socket, onewire and ds18x20, so a Pico W can read a DS18B20 and act as a tiny web server with no extra libraries. The program opens a socket on port 80, reads the probe for each request and returns an HTML page that refreshes itself. A simple socket server handles one visitor at a time, which is fine for a personal thermometer.
Tick anything you already have and the total updates.
Waterproof DS18B20 probe
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB power adapter.
main.pyimport network, socket, time, onewire, ds18x20
from machine import Pin
SSID = "YOUR_WIFI"
PASSWORD = "YOUR_PASSWORD"
ds = ds18x20.DS18X20(onewire.OneWire(Pin(15)))
roms = ds.scan()
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(SSID, PASSWORD)
while not wlan.isconnected():
time.sleep(0.5)
print("Open http://%s" % wlan.ifconfig()[0])
s = socket.socket()
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(("0.0.0.0", 80))
s.listen(2)
while True:
conn, addr = s.accept()
conn.recv(1024)
ds.convert_temp()
time.sleep_ms(800)
t = ds.read_temp(roms[0])
html = ("<meta name='viewport' content='width=device-width'><meta http-equiv='refresh' content='5'>"
"<h1>Temperature</h1><h2>%.1f °C</h2>" % t)
conn.send("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nConnection: close\r\n\r\n" + html)
conn.close()
No probe was found. Check the pull-up resistor and wiring.
Each request waits for a temperature conversion (about 0.8 s).
The phone must be on the same Wi-Fi.
Yes, one at a time. For many visitors use a more capable server.
Use the Pico OLED thermometer project instead.
Store readings in a list and draw them with a small script in the page.
5 parts: Raspberry Pi Pico W Microcontroller Board, DS18B20 Waterproof Temperature Probe – 1m Cable, Stainless Steel, Resistor Assortment Kit (30 Values), Solderless Breadboard and Dupont Jumper Wires (40 pcs). On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 1.5 hours. The build on this page has 6 steps.
No. This page has the complete, tested code (main.py).
About ₹829 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Connecting a Pico W to Wi-Fi; Writing a simple socket web server; Reading a DS18B20.
Ideas that reuse this build: Pico DS18B20 thermometer OLED. They are listed under Take it further on this page.
A bike or car speedometer that needs no wheel sensor: satellites do the measuring.
Records where you went every five seconds, ready to open on a map.
Two boards, two radios: press the button at the gate and it rings indoors.
Check temperature, humidity and pressure from any phone on your Wi-Fi.
Learning project. Check every circuit and the datasheet of each part before you power it up.