9c659718aac687d278eec58d9fffa9fbc70186be
projects/hot-tub/hardware-setup.md
| ... | ... | @@ -8,7 +8,7 @@ The design goal is to keep the system beginner-friendly: use plug-in AC switchin |
| 8 | 8 | |
| 9 | 9 | ## System Overview |
| 10 | 10 | |
| 11 | -The Raspberry Pi reads temperature and safety sensors, then turns two AC loads on and off: |
|
| 11 | +The Raspberry Pi receives temperature data from a small sensor hub, reads safety sensors, then turns two AC loads on and off: |
|
| 12 | 12 | |
| 13 | 13 | - Heat circulation pump: moves tub water through the propane heater. |
| 14 | 14 | - Filter pump: runs the 1000 gph filtration pump on demand or on a schedule. |
| ... | ... | @@ -27,29 +27,29 @@ When the heat pump runs, water flow causes the propane heater to ignite using it |
| 27 | 27 | +-------------+ |
| 28 | 28 | | Raspberry Pi | |
| 29 | 29 | +-------------+ |
| 30 | - | | | |
|
| 31 | - temp probe| | |GPIO / USB control |
|
| 32 | - | | | |
|
| 33 | - +-----+ | +------------------+ |
|
| 34 | - | | | |
|
| 30 | + | | | |
|
| 31 | + USB / UART| | |GPIO / USB control |
|
| 32 | + | | | |
|
| 33 | + +-----+ | +------------------+ |
|
| 34 | + | | | |
|
| 35 | 35 | +-----------+ +-----------+ +-----------+ |
| 36 | - | Tub Temp | | Low Water | | AC Switch | |
|
| 37 | - | Sensor | | Sensor | | Modules | |
|
| 38 | - +-----------+ +-----------+ +-----+-----+ |
|
| 39 | - | |
|
| 40 | - +-----------------+-----------------+ |
|
| 41 | - | | |
|
| 42 | - +---------------+ +---------------+ |
|
| 43 | - | Heat Circ Pump| | Filter Pump | |
|
| 44 | - +-------+-------+ +---------------+ |
|
| 45 | - | |
|
| 46 | - v |
|
| 47 | - +---------------+ |
|
| 48 | - | Propane Heater| |
|
| 49 | - +-------+-------+ |
|
| 50 | - | |
|
| 51 | - v |
|
| 52 | - Back to Tub |
|
| 36 | + | Temp | | Low Water | | AC Switch | |
|
| 37 | + | Sensor Hub| | Sensor | | Modules | |
|
| 38 | + +-----+-----+ +-----------+ +-----+-----+ |
|
| 39 | + | | |
|
| 40 | + +-----------+ +--------------+--------------+ |
|
| 41 | + | 4 Tub | | | |
|
| 42 | + | Probes | +---------------+ +---------------+ |
|
| 43 | + +-----------+ | Heat Circ Pump| | Filter Pump | |
|
| 44 | + +-------+-------+ +---------------+ |
|
| 45 | + | |
|
| 46 | + v |
|
| 47 | + +---------------+ |
|
| 48 | + | Propane Heater| |
|
| 49 | + +-------+-------+ |
|
| 50 | + | |
|
| 51 | + v |
|
| 52 | + Back to Tub |
|
| 53 | 53 | ``` |
| 54 | 54 | |
| 55 | 55 | ## Recommended Shopping List |
| ... | ... | @@ -98,12 +98,59 @@ Avoid: |
| 98 | 98 | - Non-GFCI AC power. |
| 99 | 99 | - Running pump current through breadboards, jumper wires, or small PCB traces. |
| 100 | 100 | |
| 101 | -### Temperature Sensors |
|
| 101 | +### Temperature Sensor Hub |
|
| 102 | + |
|
| 103 | +Buy: |
|
| 104 | + |
|
| 105 | +- 1 Raspberry Pi Pico, Pico W, Arduino Nano / Uno, Adafruit QT Py RP2040, or similar small microcontroller. |
|
| 106 | +- 1 USB cable from the sensor hub to the Raspberry Pi, or a 3-wire UART connection if the hub will be mounted separately. |
|
| 107 | +- 1 small screw-terminal breakout board or terminal strip for the sensor hub. |
|
| 108 | +- Optional: 1 small IP65 junction box if the sensor hub will sit near the tub instead of inside the main control enclosure. |
|
| 109 | + |
|
| 110 | +The recommended approach is to connect all tub temperature probes to this small sensor hub instead of connecting the probes directly to the Raspberry Pi. A Raspberry Pi Pico is a good fit because it is inexpensive, easy to power from the Pi over USB, and can run simple firmware that reads the DS18B20 bus, averages the readings, detects missing probes, and sends one compact data package to the Pi. |
|
| 111 | + |
|
| 112 | +The main Raspberry Pi remains the system controller. It runs the web interface, target-temperature logic, pump control, logging, and alerts. The sensor hub only owns temperature measurement. |
|
| 113 | + |
|
| 114 | +```text |
|
| 115 | +4 DS18B20 tub probes |
|
| 116 | + | |
|
| 117 | + v |
|
| 118 | ++----------------------+ |
|
| 119 | +| Temperature Sensor | |
|
| 120 | +| Hub, such as Pico | |
|
| 121 | ++----------+-----------+ |
|
| 122 | + | |
|
| 123 | + | USB serial, or UART |
|
| 124 | + v |
|
| 125 | ++----------------------+ |
|
| 126 | +| Raspberry Pi | |
|
| 127 | +| main controller | |
|
| 128 | ++----------------------+ |
|
| 129 | +``` |
|
| 130 | + |
|
| 131 | +The sensor hub should report data in a simple JSON or JSON-like line format, one message per reading interval. For example: |
|
| 132 | + |
|
| 133 | +```json |
|
| 134 | +{ |
|
| 135 | + "average_f": 102.4, |
|
| 136 | + "sensors": [ |
|
| 137 | + { "id": "probe_1", "temp_f": 102.8, "status": "ok" }, |
|
| 138 | + { "id": "probe_2", "temp_f": 102.1, "status": "ok" }, |
|
| 139 | + { "id": "probe_3", "temp_f": null, "status": "missing" }, |
|
| 140 | + { "id": "probe_4", "temp_f": 102.3, "status": "ok" } |
|
| 141 | + ], |
|
| 142 | + "failed_sensors": ["probe_3"] |
|
| 143 | +} |
|
| 144 | +``` |
|
| 145 | + |
|
| 146 | +The average should only include sensors with `status: "ok"`. If too many sensors are missing, or if the working sensors disagree by an extreme amount, the Raspberry Pi should treat the temperature package as unsafe and refuse to heat. |
|
| 147 | + |
|
| 148 | +### Temperature Probes |
|
| 102 | 149 | |
| 103 | 150 | Buy: |
| 104 | 151 | |
| 105 | 152 | - 4 waterproof DS18B20 temperature probes with stainless tips and 6 ft to 10 ft cables. |
| 106 | -- 1 4.7 kOhm resistor, if your Pi screw-terminal board does not include a DS18B20 pull-up resistor. |
|
| 153 | +- 1 4.7 kOhm resistor, if your sensor hub breakout does not include a DS18B20 pull-up resistor. |
|
| 107 | 154 | - 4 waterproof 3-pin connectors, such as M8/M12 aviation connectors, or 3-pin waterproof pigtail connectors. |
| 108 | 155 | |
| 109 | 156 | Use four tub temperature probes and calculate the tub temperature from their average: |
| ... | ... | @@ -118,16 +165,16 @@ A 4-point average is a better fit for this tub than a single probe because the h |
| 118 | 165 | The DS18B20 probes use three wires: |
| 119 | 166 | |
| 120 | 167 | ```text |
| 121 | -DS18B20 wire Raspberry Pi connection |
|
| 168 | +DS18B20 wire Sensor hub connection |
|
| 122 | 169 | ------------------------------------------------ |
| 123 | 170 | Red / VCC 3.3V |
| 124 | 171 | Black / GND Ground |
| 125 | -Yellow / Data GPIO4, with 4.7k pull-up to 3.3V |
|
| 172 | +Yellow / Data One digital input, with 4.7k pull-up to 3.3V |
|
| 126 | 173 | ``` |
| 127 | 174 | |
| 128 | -Many DS18B20 probes use red, black, and yellow wires, but verify the datasheet for the exact probes you buy. DS18B20 probes can share the same 3-wire bus, so all four probes can connect to the same 3.3V, ground, and GPIO4 data terminals. Each probe has a unique digital address that the software can label during setup. |
|
| 175 | +Many DS18B20 probes use red, black, and yellow wires, but verify the datasheet for the exact probes you buy. DS18B20 probes can share the same 3-wire bus, so all four probes can connect to the same 3.3V, ground, and sensor-hub data terminals. Each probe has a unique digital address that the sensor-hub firmware can label during setup. |
|
| 129 | 176 | |
| 130 | -For reliability, run the four probe cables back to a small terminal block in the control box instead of splicing them permanently. This makes it easier to replace a bad probe later. |
|
| 177 | +For reliability, run the four probe cables back to a small terminal block near the sensor hub instead of splicing them permanently. This makes it easier to replace a bad probe later. |
|
| 131 | 178 | |
| 132 | 179 | ### Water Level / Dry-Run Protection |
| 133 | 180 | |
| ... | ... | @@ -203,8 +250,8 @@ Recommended enclosure layout: |
| 203 | 250 | | Waterproof Control Box | |
| 204 | 251 | | | |
| 205 | 252 | | +------------------+ +-----------------+ | |
| 206 | -| | Raspberry Pi | | Terminal Blocks | | |
|
| 207 | -| | on standoffs | | Sensors / GPIO | | |
|
| 253 | +| | Raspberry Pi | USB | Temp Sensor Hub | | |
|
| 254 | +| | on standoffs +------>| plus terminals | | |
|
| 208 | 255 | | +------------------+ +-----------------+ | |
| 209 | 256 | | | |
| 210 | 257 | | Low-voltage side AC relay side | |
| ... | ... | @@ -317,7 +364,7 @@ Suggested Pi GPIO assignments: |
| 317 | 364 | ```text |
| 318 | 365 | Function Pi Pin / GPIO |
| 319 | 366 | ------------------------------------------------ |
| 320 | -DS18B20 data bus GPIO4 |
|
| 367 | +Temperature sensor hub USB serial, or UART GPIO pins |
|
| 321 | 368 | Low-water float switch GPIO17 |
| 322 | 369 | Optional flow switch GPIO27 |
| 323 | 370 | Heat relay control GPIO22 |
| ... | ... | @@ -326,7 +373,19 @@ Ground Any Pi GND pin |
| 326 | 373 | 3.3V sensor power Pi 3.3V pin |
| 327 | 374 | ``` |
| 328 | 375 | |
| 329 | -The DS18B20 data line needs a 4.7 kOhm pull-up resistor between data and 3.3V. Some breakout boards include this resistor. |
|
| 376 | +Suggested sensor hub wiring: |
|
| 377 | + |
|
| 378 | +```text |
|
| 379 | +Function Sensor hub connection |
|
| 380 | +------------------------------------------------ |
|
| 381 | +DS18B20 data bus Any firmware-supported digital input |
|
| 382 | +DS18B20 pull-up 4.7 kOhm from data to 3.3V |
|
| 383 | +DS18B20 power 3.3V |
|
| 384 | +DS18B20 ground Ground |
|
| 385 | +Pi communication USB serial, or UART TX/RX plus shared ground |
|
| 386 | +``` |
|
| 387 | + |
|
| 388 | +Use USB serial if the sensor hub sits inside the same enclosure as the Pi. It is simple, powers the hub, and appears to the Pi as a serial device. Use UART only if you have a reason to avoid USB, and keep the Pi and hub grounds tied together. |
|
| 330 | 389 | |
| 331 | 390 | For switches such as float and flow sensors, wire one side to GPIO and the other to ground, then configure the Pi input with an internal pull-up resistor in software. |
| 332 | 391 | |
| ... | ... | @@ -370,28 +429,31 @@ Important rules: |
| 370 | 429 | 3. Install cable glands or bulkhead connectors. |
| 371 | 430 | Put sensor connectors on one side or the bottom of the enclosure. Put AC/control cable entries separately. |
| 372 | 431 | |
| 373 | -4. Mount the Raspberry Pi and terminal blocks. |
|
| 432 | +4. Mount the Raspberry Pi, temperature sensor hub, and terminal blocks. |
|
| 374 | 433 | Use standoffs, DIN rail adapters, or a mounting plate. Do not let electronics float loose in the box. |
| 375 | 434 | |
| 376 | -5. Connect the DS18B20 temperature probes. |
|
| 377 | - Wire VCC to 3.3V, ground to ground, and data to GPIO4 with a 4.7 kOhm pull-up resistor. |
|
| 435 | +5. Connect the DS18B20 temperature probes to the sensor hub. |
|
| 436 | + Wire VCC to 3.3V, ground to ground, and data to the hub's DS18B20 data input with a 4.7 kOhm pull-up resistor. |
|
| 437 | + |
|
| 438 | +6. Connect the sensor hub to the Raspberry Pi. |
|
| 439 | + Use USB serial if the hub is in the same enclosure. Confirm the Pi receives JSON-style readings with average temperature, individual readings, and failed-sensor status. |
|
| 378 | 440 | |
| 379 | -6. Connect the low-water float switch. |
|
| 441 | +7. Connect the low-water float switch. |
|
| 380 | 442 | Wire it to a GPIO input and ground through a waterproof connector. |
| 381 | 443 | |
| 382 | -7. Connect relay control inputs. |
|
| 444 | +8. Connect relay control inputs. |
|
| 383 | 445 | Wire the Pi GPIO relay outputs to the low-voltage control inputs of the enclosed relay modules. Follow the relay module's manual for polarity and trigger voltage. |
| 384 | 446 | |
| 385 | -8. Plug pumps into the relay-controlled outlets. |
|
| 447 | +9. Plug pumps into the relay-controlled outlets. |
|
| 386 | 448 | Label one outlet "HEAT PUMP" and the other "FILTER PUMP". |
| 387 | 449 | |
| 388 | -9. Test each part manually. |
|
| 389 | - Confirm the software can read all four temperature probes, see the float switch change state, turn the heat pump outlet on/off, and turn the filter outlet on/off. |
|
| 450 | +10. Test each part manually. |
|
| 451 | + Confirm the sensor hub can read all four temperature probes, the Pi can receive the temperature package, the Pi can see the float switch change state, and the Pi can turn the heat pump and filter outlets on/off. |
|
| 390 | 452 | |
| 391 | -10. Test with water before using heat. |
|
| 453 | +11. Test with water before using heat. |
|
| 392 | 454 | Run the heat circulation pump with propane closed first. Confirm water flow and no leaks. |
| 393 | 455 | |
| 394 | -11. Test heating under supervision. |
|
| 456 | +12. Test heating under supervision. |
|
| 395 | 457 | Open propane, start heating, and watch the first full heat-up cycle in person. Confirm the controller stops heating near the target temperature. |
| 396 | 458 | |
| 397 | 459 | ## Recommended Labels |
| ... | ... | @@ -404,6 +466,8 @@ Label everything before closing the box: |
| 404 | 466 | - TUB TEMP 2 |
| 405 | 467 | - TUB TEMP 3 |
| 406 | 468 | - TUB TEMP 4 |
| 469 | +- TEMP SENSOR HUB |
|
| 470 | +- PI USB TEMP LINK |
|
| 407 | 471 | - LOW WATER SWITCH |
| 408 | 472 | - OUTSIDE TEMP, if installed |
| 409 | 473 | - PI POWER |
| ... | ... | @@ -416,7 +480,8 @@ Labels matter because this system will be used outdoors, serviced later, and pos |
| 416 | 480 | The hardware should make it possible for the software to enforce these rules: |
| 417 | 481 | |
| 418 | 482 | - Do not run heat if the low-water switch says water is too low. |
| 419 | -- Do not run heat if the four temperature probes disagree by an extreme amount. |
|
| 483 | +- Do not run heat if the temperature sensor hub reports missing probes beyond the allowed limit. |
|
| 484 | +- Do not run heat if the working temperature probes disagree by an extreme amount. |
|
| 420 | 485 | - Do not run heat above a hard maximum temperature. |
| 421 | 486 | - Do not run heat indefinitely if temperature is not rising. |
| 422 | 487 | - Optionally stop heat if the flow switch says water is not moving. |
| ... | ... | @@ -442,6 +507,8 @@ Result: remote on/off for heating circulation and filtration. |
| 442 | 507 | Add: |
| 443 | 508 | |
| 444 | 509 | - Four waterproof DS18B20 tub temperature probes. |
| 510 | +- Temperature sensor hub. |
|
| 511 | +- Sensor-hub firmware that reports average temperature, individual probe readings, and failed probes to the Pi. |
|
| 445 | 512 | - Web interface target temperature setting. |
| 446 | 513 | - Software hysteresis, such as heating until the 4-point average reaches target temperature and restarting when the average drops 3 degrees. |
| 447 | 514 | |
| ... | ... | @@ -462,6 +529,10 @@ Result: the system can refuse unsafe heating and support future freeze-protectio |
| 462 | 529 | For the first complete version, buy: |
| 463 | 530 | |
| 464 | 531 | - Raspberry Pi Zero 2 W, Pi 3, or Pi 4. |
| 532 | +- Raspberry Pi Pico, Arduino Nano / Uno, or similar microcontroller for the temperature sensor hub. |
|
| 533 | +- USB cable for the sensor hub, or UART wiring if mounted separately. |
|
| 534 | +- Small screw-terminal breakout board or terminal strip for the sensor hub. |
|
| 535 | +- Optional small IP65 junction box for the sensor hub if it will sit near the tub. |
|
| 465 | 536 | - Official Pi power supply. |
| 466 | 537 | - 32 GB or larger high-endurance microSD card. |
| 467 | 538 | - IP65 / NEMA 4X waterproof enclosure. |
| ... | ... | @@ -469,6 +540,8 @@ For the first complete version, buy: |
| 469 | 540 | - Waterproof cable glands or M8/M12 connectors. |
| 470 | 541 | - 2 enclosed AC relay outlet modules, or 2 outdoor smart plugs with local control. |
| 471 | 542 | - 4 waterproof DS18B20 tub temperature probes. |
| 543 | +- 1 4.7 kOhm resistor for the DS18B20 pull-up, unless included on the sensor hub breakout. |
|
| 544 | +- 4 waterproof 3-pin connectors for the temperature probes. |
|
| 472 | 545 | - 1 waterproof float switch. |
| 473 | 546 | - Optional inline flow switch. |
| 474 | 547 | - Optional outside temperature probe. |