hot-tub/hardware-setup.md
... ...
@@ -1,479 +0,0 @@
1
-# Hardware Setup Plan
2
-
3
-This document describes a practical DIY hardware implementation for automating the stock-tank hot tub. It assumes the existing propane camping water heater remains manually set for gas and burner behavior, while the automation controls water circulation, filtration, temperature sensing, and optional safety sensors.
4
-
5
-The design goal is to keep the system beginner-friendly: use plug-in AC switching, screw terminals, waterproof connectors, and replaceable sensors instead of soldered permanent wiring.
6
-
7
-> Safety note: this project combines water, outdoor electricity, propane, and hot water. Use GFCI protection for all AC power. Do not place non-outdoor-rated AC gear where it can get wet. Do not automate propane gas valves unless you are using certified gas-control hardware and know the applicable code. When in doubt, have an electrician review the AC side.
8
-
9
-## System Overview
10
-
11
-The Raspberry Pi reads temperature and safety sensors, then turns two AC loads on and off:
12
-
13
-- Heat circulation pump: moves tub water through the propane heater.
14
-- Filter pump: runs the 1000 gph filtration pump on demand or on a schedule.
15
-
16
-The propane heater is still manually prepared before use:
17
-
18
-1. Open the propane bottle.
19
-2. Set the heater's gas and water controls to known safe positions.
20
-3. Let the automation switch the circulation pump to start or stop heating.
21
-
22
-When the heat pump runs, water flow causes the propane heater to ignite using its normal built-in flow switch.
23
-
24
-```text
25
- Wi-Fi
26
- |
27
- +-------------+
28
- | Raspberry Pi |
29
- +-------------+
30
- | | |
31
- temp probe| | |GPIO / USB control
32
- | | |
33
- +-----+ | +------------------+
34
- | | |
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
53
-```
54
-
55
-## Recommended Shopping List
56
-
57
-### Core Control Hardware
58
-
59
-Buy:
60
-
61
-- 1 Raspberry Pi Zero 2 W, Raspberry Pi 3, or Raspberry Pi 4.
62
-- 1 official Raspberry Pi power supply.
63
-- 1 high-endurance microSD card, 32 GB or larger.
64
-- 1 waterproof plastic enclosure, NEMA 4X / IP65 or better, roughly 12 in x 10 in x 6 in or larger.
65
-- 1 small DIN rail or mounting plate for the inside of the enclosure.
66
-- 1 set of cable glands or waterproof bulkhead connectors for every cable entering the box.
67
-- 1 Raspberry Pi screw-terminal breakout or screw-terminal HAT.
68
-- 1 pack of Wago lever nuts or small screw terminal blocks.
69
-- 1 pack of adhesive cable tie mounts and UV-resistant zip ties.
70
-- 1 outdoor-rated extension cord sized for the total pump load.
71
-- 1 outdoor GFCI outlet, portable inline GFCI adapter, or GFCI-protected circuit.
72
-
73
-The Raspberry Pi should live inside the waterproof enclosure. Mount it on standoffs or a DIN-rail adapter so it is not loose inside the box.
74
-
75
-### AC Pump Switching
76
-
77
-For a beginner-friendly build, avoid bare relay boards that expose mains voltage. Use enclosed AC switching modules.
78
-
79
-Buy one of these approaches:
80
-
81
-#### Preferred: Enclosed IoT Relay Modules
82
-
83
-- 2 enclosed AC relay outlet modules, such as Digital Loggers IoT Relay or an equivalent enclosed relay module with a low-voltage control input.
84
-- 2 short outdoor-rated extension cords, if needed, to route pump plugs cleanly.
85
-
86
-Use one relay module for the heat circulation pump and one for the filter pump. The Pi only sends a low-voltage control signal; the relay module handles AC switching inside an enclosed product.
87
-
88
-#### Acceptable Alternative: Outdoor Smart Plugs
89
-
90
-- 2 outdoor-rated smart plugs with local API support.
91
-
92
-This is easier electrically, but depends more on Wi-Fi and vendor behavior. Prefer smart plugs that can be controlled locally on your LAN instead of only through a cloud service.
93
-
94
-Avoid:
95
-
96
-- Loose relay boards switching 120 VAC inside a plastic box.
97
-- Indoor smart plugs sitting outdoors.
98
-- Non-GFCI AC power.
99
-- Running pump current through breadboards, jumper wires, or small PCB traces.
100
-
101
-### Temperature Sensors
102
-
103
-Buy:
104
-
105
-- 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.
107
-- 4 waterproof 3-pin connectors, such as M8/M12 aviation connectors, or 3-pin waterproof pigtail connectors.
108
-
109
-Use four tub temperature probes and calculate the tub temperature from their average:
110
-
111
-- Hot-return side probe: measures the side where heated water enters.
112
-- Opposite-side probe: measures the side farthest from the hot return.
113
-- Near-end probe: measures one end of the tank.
114
-- Far-end probe: measures the other end of the tank.
115
-
116
-A 4-point average is a better fit for this tub than a single probe because the heater return can create temporary hot spots. The controller can also watch the spread between probes. For example, if one probe reads 10 degrees hotter than the others, the software can ignore that probe temporarily or keep circulating water until the readings converge.
117
-
118
-The DS18B20 probes use three wires:
119
-
120
-```text
121
-DS18B20 wire Raspberry Pi connection
122
-------------------------------------------------
123
-Red / VCC 3.3V
124
-Black / GND Ground
125
-Yellow / Data GPIO4, with 4.7k pull-up to 3.3V
126
-```
127
-
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.
129
-
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.
131
-
132
-### Water Level / Dry-Run Protection
133
-
134
-Buy:
135
-
136
-- 1 vertical float switch or horizontal side-mount float switch rated for water exposure.
137
-- 1 waterproof 2-pin connector.
138
-- 1 short piece of PVC pipe or plastic guard to protect the float from swimmers and sloshing water.
139
-
140
-The water-level sensor should tell the Pi whether the tub has enough water to safely run the heating pump. A float switch is more beginner-friendly than ultrasonic sensing because steam, splashing, and outdoor light can confuse distance sensors.
141
-
142
-Recommended mounting:
143
-
144
-- Place the float switch near the side wall of the tank.
145
-- Set it slightly above the minimum safe intake level for the heat circulation pump.
146
-- Protect it with a small slotted PVC guard so it cannot be bumped easily.
147
-
148
-### Optional Flow Sensor
149
-
150
-Buy:
151
-
152
-- 1 inline water flow switch or flow meter sized for the heater loop tubing.
153
-- Matching hose adapters, clamps, and thread seal tape.
154
-
155
-A flow sensor is optional but useful. It lets the controller confirm that water is actually moving when the heat pump is on. This can catch a clogged line, failed pump, blocked intake, or closed valve.
156
-
157
-For a beginner build, a simple flow switch is easier than a pulse-counting flow meter. Wire it like a basic open/closed sensor.
158
-
159
-### Optional Outside Temperature Sensor
160
-
161
-Buy:
162
-
163
-- 1 waterproof DS18B20 probe for outside air temperature, or 1 weatherproof outdoor temperature module.
164
-
165
-This can support future anti-freeze logic. Mount it under the control box or under a small shield so it reads outdoor air, not direct sun or heat radiating from the tub.
166
-
167
-### Plumbing Hardware
168
-
169
-Buy as needed to match the pump and heater hose sizes:
170
-
171
-- Reinforced hose rated for hot water.
172
-- Stainless hose clamps.
173
-- Barbed hose adapters.
174
-- Thread seal tape.
175
-- Ball valves for isolating the pump and heater.
176
-- Unions or quick-disconnect hose fittings for service.
177
-- Intake strainer for the heat circulation pump.
178
-- Optional check valve to discourage reverse flow.
179
-
180
-The exact fittings depend on the current pump, heater, and tank connections. Bring one existing hose/fitting to the hardware store if you are unsure of sizes.
181
-
182
-## Physical Layout
183
-
184
-Mount the control box close enough for sensor cables and pump cords, but not where bathers will splash it.
185
-
186
-Good locations:
187
-
188
-- On a post next to the tub.
189
-- On a nearby wall.
190
-- On a small stand beside the tub.
191
-
192
-Avoid:
193
-
194
-- Attaching the control box where it can be submerged.
195
-- Mounting it directly above heater exhaust.
196
-- Placing it where people step over cords.
197
-- Letting cable glands point upward where rain can sit on them.
198
-
199
-Recommended enclosure layout:
200
-
201
-```text
202
-+--------------------------------------------------+
203
-| Waterproof Control Box |
204
-| |
205
-| +------------------+ +-----------------+ |
206
-| | Raspberry Pi | | Terminal Blocks | |
207
-| | on standoffs | | Sensors / GPIO | |
208
-| +------------------+ +-----------------+ |
209
-| |
210
-| Low-voltage side AC relay side |
211
-| +----------------+ +-----------+ |
212
-| | Sensor glands | | Relay 1 | |
213
-| | M8/M12 plugs | | Relay 2 | |
214
-| +----------------+ +-----------+ |
215
-| |
216
-| Bottom cable entries: sensors, control wires, AC |
217
-+--------------------------------------------------+
218
-```
219
-
220
-Keep low-voltage sensor wiring separated from AC pump cords inside the enclosure. If the relay modules are too large or not rated to sit inside the enclosure, mount them in their own weather-protected location and run only their low-voltage control wires back to the Pi box.
221
-
222
-## Plumbing Layout
223
-
224
-The heat loop should pull water from the tub, push it through the pump, then through the propane heater, and return hot water to the tub.
225
-
226
-```text
227
-Stock Tank
228
- |
229
- | intake with strainer
230
- v
231
-+------------------+
232
-| Heat Circ Pump | controlled by Pi relay
233
-+--------+---------+
234
- |
235
- v
236
-+------------------+
237
-| Propane Heater | gas remains manually opened/set
238
-+--------+---------+
239
- |
240
- | hot return line
241
- v
242
-Stock Tank
243
-```
244
-
245
-Recommended details:
246
-
247
-- Put a strainer before the heat pump intake.
248
-- Add a ball valve on each side of the pump/heater loop so you can service parts without draining the tub.
249
-- Use unions or quick disconnects near the pump and heater.
250
-- Keep hoses short and smooth to reduce flow restriction.
251
-- Keep heater exhaust fully outdoors and unobstructed.
252
-
253
-## Sensor Attachment
254
-
255
-### Tub Temperature Probes
256
-
257
-The temperature probes should read circulating tub water, not air, tank wall temperature, or only the hot heater return stream.
258
-
259
-Recommended placement:
260
-
261
-- Put four probes around the tank so the controller can average the readings.
262
-- Keep all probe tips at roughly the same depth, about halfway down the water column.
263
-- Put one probe near the heater return side, but not directly in the blast of hot return water.
264
-- Put one probe on the opposite side of the tank.
265
-- Put one probe near each long end of the tank.
266
-- Use adhesive cable clips, stainless clips, or a small bracket to keep the probe tips submerged.
267
-- Route the probe cables up and out of the tub so bathers cannot snag them.
268
-
269
-Do not let the probe tip rest directly against the aluminum tank wall. It should be surrounded by water.
270
-
271
-Top-down placement for a 6 ft x 2 ft stock tank:
272
-
273
-```text
274
-Top view
275
-
276
- +--------------------------------------------------+
277
- | Probe 3 Probe 4 |
278
- | |
279
- | |
280
- | hot return ---> circulating water |
281
- | |
282
- | Probe 1 Probe 2 |
283
- +--------------------------------------------------+
284
-
285
-Probe 1: near heater return side, offset from direct hot flow
286
-Probe 2: opposite side from heater return
287
-Probe 3: one long end of the tank
288
-Probe 4: other long end of the tank
289
-```
290
-
291
-During heating, display both the average temperature and the temperature spread. The average is useful for control. The spread tells the user whether the tank is evenly mixed yet.
292
-
293
-### Low-Water Float Switch
294
-
295
-Mount the float switch near the pump intake height. The controller should refuse to run the heat pump if this switch indicates low water.
296
-
297
-```text
298
-Side view of tub wall
299
-
300
- Normal water line -------------------------
301
-
302
- [ temp probe ]
303
-
304
- Minimum safe line -----[ float switch ]----
305
-
306
- [ pump intake / strainer ]
307
-```
308
-
309
-## Electrical Connections
310
-
311
-### Low-Voltage Sensor Wiring
312
-
313
-Bring each sensor into the enclosure through a waterproof connector or cable gland. Inside the box, land the wires on screw terminals.
314
-
315
-Suggested Pi GPIO assignments:
316
-
317
-```text
318
-Function Pi Pin / GPIO
319
-------------------------------------------------
320
-DS18B20 data bus GPIO4
321
-Low-water float switch GPIO17
322
-Optional flow switch GPIO27
323
-Heat relay control GPIO22
324
-Filter relay control GPIO23
325
-Ground Any Pi GND pin
326
-3.3V sensor power Pi 3.3V pin
327
-```
328
-
329
-The DS18B20 data line needs a 4.7 kOhm pull-up resistor between data and 3.3V. Some breakout boards include this resistor.
330
-
331
-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
-
333
-### AC Power Path
334
-
335
-The AC power path should be simple and GFCI-protected:
336
-
337
-```text
338
-House / outdoor outlet
339
- |
340
- v
341
-GFCI protection
342
- |
343
- v
344
-Outdoor-rated extension cord
345
- |
346
- v
347
-Weather-protected relay outlets
348
- |
349
- +--> Heat circulation pump
350
- |
351
- +--> Filter pump
352
-```
353
-
354
-Important rules:
355
-
356
-- The Raspberry Pi does not power the pumps.
357
-- Pump AC power only passes through enclosed relay outlets or outdoor smart plugs.
358
-- All pump plugs should have drip loops.
359
-- Keep every plug connection off the ground.
360
-- Do not exceed the amp rating of the relay module, smart plug, extension cord, or outlet.
361
-
362
-## Assembly Steps
363
-
364
-1. Build the plumbing loop without automation first.
365
- Confirm that the pump reliably moves water through the heater and back to the tub.
366
-
367
-2. Mount the waterproof control box.
368
- Choose a stable location near the tub but away from splash zones and heater exhaust.
369
-
370
-3. Install cable glands or bulkhead connectors.
371
- Put sensor connectors on one side or the bottom of the enclosure. Put AC/control cable entries separately.
372
-
373
-4. Mount the Raspberry Pi and terminal blocks.
374
- Use standoffs, DIN rail adapters, or a mounting plate. Do not let electronics float loose in the box.
375
-
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.
378
-
379
-6. Connect the low-water float switch.
380
- Wire it to a GPIO input and ground through a waterproof connector.
381
-
382
-7. Connect relay control inputs.
383
- 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
-
385
-8. Plug pumps into the relay-controlled outlets.
386
- Label one outlet "HEAT PUMP" and the other "FILTER PUMP".
387
-
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.
390
-
391
-10. Test with water before using heat.
392
- Run the heat circulation pump with propane closed first. Confirm water flow and no leaks.
393
-
394
-11. Test heating under supervision.
395
- Open propane, start heating, and watch the first full heat-up cycle in person. Confirm the controller stops heating near the target temperature.
396
-
397
-## Recommended Labels
398
-
399
-Label everything before closing the box:
400
-
401
-- HEAT PUMP OUTLET
402
-- FILTER PUMP OUTLET
403
-- TUB TEMP 1
404
-- TUB TEMP 2
405
-- TUB TEMP 3
406
-- TUB TEMP 4
407
-- LOW WATER SWITCH
408
-- OUTSIDE TEMP, if installed
409
-- PI POWER
410
-- GFCI REQUIRED
411
-
412
-Labels matter because this system will be used outdoors, serviced later, and possibly unplugged between uses.
413
-
414
-## Minimum Safety Behavior the Hardware Should Support
415
-
416
-The hardware should make it possible for the software to enforce these rules:
417
-
418
-- 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.
420
-- Do not run heat above a hard maximum temperature.
421
-- Do not run heat indefinitely if temperature is not rising.
422
-- Optionally stop heat if the flow switch says water is not moving.
423
-- Keep filter control independent from heat control.
424
-
425
-Hardware alone will not enforce all of this, but the sensors and relay layout make those software checks possible.
426
-
427
-## Suggested Build Phases
428
-
429
-### Phase 1: Basic Remote Control
430
-
431
-Install:
432
-
433
-- Raspberry Pi.
434
-- Two enclosed AC relay outlets or two outdoor smart plugs.
435
-- Heat pump control.
436
-- Filter pump control.
437
-
438
-Result: remote on/off for heating circulation and filtration.
439
-
440
-### Phase 2: Temperature Automation
441
-
442
-Add:
443
-
444
-- Four waterproof DS18B20 tub temperature probes.
445
-- Web interface target temperature setting.
446
-- Software hysteresis, such as heating until the 4-point average reaches target temperature and restarting when the average drops 3 degrees.
447
-
448
-Result: the system can maintain a target temperature range.
449
-
450
-### Phase 3: Safety Sensors
451
-
452
-Add:
453
-
454
-- Low-water float switch.
455
-- Optional flow switch.
456
-- Optional outside temperature sensor.
457
-
458
-Result: the system can refuse unsafe heating and support future freeze-protection behavior.
459
-
460
-## Final Recommended Parts Summary
461
-
462
-For the first complete version, buy:
463
-
464
-- Raspberry Pi Zero 2 W, Pi 3, or Pi 4.
465
-- Official Pi power supply.
466
-- 32 GB or larger high-endurance microSD card.
467
-- IP65 / NEMA 4X waterproof enclosure.
468
-- Pi screw-terminal breakout or HAT.
469
-- Waterproof cable glands or M8/M12 connectors.
470
-- 2 enclosed AC relay outlet modules, or 2 outdoor smart plugs with local control.
471
-- 4 waterproof DS18B20 tub temperature probes.
472
-- 1 waterproof float switch.
473
-- Optional inline flow switch.
474
-- Optional outside temperature probe.
475
-- Wago connectors or screw terminal blocks.
476
-- Outdoor-rated extension cord and GFCI protection.
477
-- Hot-water-rated hose, hose clamps, valves, unions, and strainers as needed.
478
-
479
-This gives the system enough hardware to measure a 4-point average water temperature, control heating circulation, control filtration, and detect the most important unsafe condition: low water.
hot-tub/overview.md
... ...
@@ -1,40 +0,0 @@
1
-# Hot Tub Automation
2
-
3
-Given a "Cowboy Hot Tub", the idea is to replace the heavily manual control system with a highly automated one that can be managed remotely.
4
-
5
-## Current Setup
6
-
7
-- 6' x 2' x 2' Aluminum Stock Tank
8
-- Propane powered camping water heater (manual controls for gas and water flow)
9
-- 2.64 gpm pump - to cycle water from the stock tank through the water heater
10
-- Floating thermometers that transmit temparature wirelessly to a receiver in the house
11
-- Remote on/off switch for pump electric plug
12
-- 1000 gph water filter / pump - Must be plugged / unplugged manually to operate
13
-
14
-Given the above setup, when the tub is to be used, the user must:
15
-- ensure the propane gas bottle is open
16
-- turn on the pump
17
-- watch the temperature rise
18
-- once the tub is at the desired temperature, turn off the pump
19
-
20
-## Target Setup
21
-
22
-- temp sensors in the tub report temp to computer of some kind
23
-- filter and heat pump connected to computer somehow
24
-- computer connected to web via Wifi
25
-- computer exposes web interface and API allowing user or app to:
26
- - see temperature
27
- - turn on / off heat
28
- - turn on / off filter
29
- - set target temp, allow computer to maintain temp within 3 degree range
30
- - possibly even report on water level (requires additional sensors)
31
- - possibly anti-freeze pumping depending on external temp?
32
-
33
-## Implementation Notes
34
-
35
-### Hardware Setup
36
-
37
-- Computer likely raspberry pi
38
-- pi lives in a waterproof computer box which may be attachable to the tub
39
-- system powered by plugging in an extension cord to exposed electrical connector
40
-- all sensors and accessories controlled by the computer should be pluggable / unpluggable (not soldered or fixed attachment)
... ...
\ No newline at end of file
projects/hot-tub/hardware-setup.md
... ...
@@ -0,0 +1,479 @@
1
+# Hardware Setup Plan
2
+
3
+This document describes a practical DIY hardware implementation for automating the stock-tank hot tub. It assumes the existing propane camping water heater remains manually set for gas and burner behavior, while the automation controls water circulation, filtration, temperature sensing, and optional safety sensors.
4
+
5
+The design goal is to keep the system beginner-friendly: use plug-in AC switching, screw terminals, waterproof connectors, and replaceable sensors instead of soldered permanent wiring.
6
+
7
+> Safety note: this project combines water, outdoor electricity, propane, and hot water. Use GFCI protection for all AC power. Do not place non-outdoor-rated AC gear where it can get wet. Do not automate propane gas valves unless you are using certified gas-control hardware and know the applicable code. When in doubt, have an electrician review the AC side.
8
+
9
+## System Overview
10
+
11
+The Raspberry Pi reads temperature and safety sensors, then turns two AC loads on and off:
12
+
13
+- Heat circulation pump: moves tub water through the propane heater.
14
+- Filter pump: runs the 1000 gph filtration pump on demand or on a schedule.
15
+
16
+The propane heater is still manually prepared before use:
17
+
18
+1. Open the propane bottle.
19
+2. Set the heater's gas and water controls to known safe positions.
20
+3. Let the automation switch the circulation pump to start or stop heating.
21
+
22
+When the heat pump runs, water flow causes the propane heater to ignite using its normal built-in flow switch.
23
+
24
+```text
25
+ Wi-Fi
26
+ |
27
+ +-------------+
28
+ | Raspberry Pi |
29
+ +-------------+
30
+ | | |
31
+ temp probe| | |GPIO / USB control
32
+ | | |
33
+ +-----+ | +------------------+
34
+ | | |
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
53
+```
54
+
55
+## Recommended Shopping List
56
+
57
+### Core Control Hardware
58
+
59
+Buy:
60
+
61
+- 1 Raspberry Pi Zero 2 W, Raspberry Pi 3, or Raspberry Pi 4.
62
+- 1 official Raspberry Pi power supply.
63
+- 1 high-endurance microSD card, 32 GB or larger.
64
+- 1 waterproof plastic enclosure, NEMA 4X / IP65 or better, roughly 12 in x 10 in x 6 in or larger.
65
+- 1 small DIN rail or mounting plate for the inside of the enclosure.
66
+- 1 set of cable glands or waterproof bulkhead connectors for every cable entering the box.
67
+- 1 Raspberry Pi screw-terminal breakout or screw-terminal HAT.
68
+- 1 pack of Wago lever nuts or small screw terminal blocks.
69
+- 1 pack of adhesive cable tie mounts and UV-resistant zip ties.
70
+- 1 outdoor-rated extension cord sized for the total pump load.
71
+- 1 outdoor GFCI outlet, portable inline GFCI adapter, or GFCI-protected circuit.
72
+
73
+The Raspberry Pi should live inside the waterproof enclosure. Mount it on standoffs or a DIN-rail adapter so it is not loose inside the box.
74
+
75
+### AC Pump Switching
76
+
77
+For a beginner-friendly build, avoid bare relay boards that expose mains voltage. Use enclosed AC switching modules.
78
+
79
+Buy one of these approaches:
80
+
81
+#### Preferred: Enclosed IoT Relay Modules
82
+
83
+- 2 enclosed AC relay outlet modules, such as Digital Loggers IoT Relay or an equivalent enclosed relay module with a low-voltage control input.
84
+- 2 short outdoor-rated extension cords, if needed, to route pump plugs cleanly.
85
+
86
+Use one relay module for the heat circulation pump and one for the filter pump. The Pi only sends a low-voltage control signal; the relay module handles AC switching inside an enclosed product.
87
+
88
+#### Acceptable Alternative: Outdoor Smart Plugs
89
+
90
+- 2 outdoor-rated smart plugs with local API support.
91
+
92
+This is easier electrically, but depends more on Wi-Fi and vendor behavior. Prefer smart plugs that can be controlled locally on your LAN instead of only through a cloud service.
93
+
94
+Avoid:
95
+
96
+- Loose relay boards switching 120 VAC inside a plastic box.
97
+- Indoor smart plugs sitting outdoors.
98
+- Non-GFCI AC power.
99
+- Running pump current through breadboards, jumper wires, or small PCB traces.
100
+
101
+### Temperature Sensors
102
+
103
+Buy:
104
+
105
+- 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.
107
+- 4 waterproof 3-pin connectors, such as M8/M12 aviation connectors, or 3-pin waterproof pigtail connectors.
108
+
109
+Use four tub temperature probes and calculate the tub temperature from their average:
110
+
111
+- Hot-return side probe: measures the side where heated water enters.
112
+- Opposite-side probe: measures the side farthest from the hot return.
113
+- Near-end probe: measures one end of the tank.
114
+- Far-end probe: measures the other end of the tank.
115
+
116
+A 4-point average is a better fit for this tub than a single probe because the heater return can create temporary hot spots. The controller can also watch the spread between probes. For example, if one probe reads 10 degrees hotter than the others, the software can ignore that probe temporarily or keep circulating water until the readings converge.
117
+
118
+The DS18B20 probes use three wires:
119
+
120
+```text
121
+DS18B20 wire Raspberry Pi connection
122
+------------------------------------------------
123
+Red / VCC 3.3V
124
+Black / GND Ground
125
+Yellow / Data GPIO4, with 4.7k pull-up to 3.3V
126
+```
127
+
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.
129
+
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.
131
+
132
+### Water Level / Dry-Run Protection
133
+
134
+Buy:
135
+
136
+- 1 vertical float switch or horizontal side-mount float switch rated for water exposure.
137
+- 1 waterproof 2-pin connector.
138
+- 1 short piece of PVC pipe or plastic guard to protect the float from swimmers and sloshing water.
139
+
140
+The water-level sensor should tell the Pi whether the tub has enough water to safely run the heating pump. A float switch is more beginner-friendly than ultrasonic sensing because steam, splashing, and outdoor light can confuse distance sensors.
141
+
142
+Recommended mounting:
143
+
144
+- Place the float switch near the side wall of the tank.
145
+- Set it slightly above the minimum safe intake level for the heat circulation pump.
146
+- Protect it with a small slotted PVC guard so it cannot be bumped easily.
147
+
148
+### Optional Flow Sensor
149
+
150
+Buy:
151
+
152
+- 1 inline water flow switch or flow meter sized for the heater loop tubing.
153
+- Matching hose adapters, clamps, and thread seal tape.
154
+
155
+A flow sensor is optional but useful. It lets the controller confirm that water is actually moving when the heat pump is on. This can catch a clogged line, failed pump, blocked intake, or closed valve.
156
+
157
+For a beginner build, a simple flow switch is easier than a pulse-counting flow meter. Wire it like a basic open/closed sensor.
158
+
159
+### Optional Outside Temperature Sensor
160
+
161
+Buy:
162
+
163
+- 1 waterproof DS18B20 probe for outside air temperature, or 1 weatherproof outdoor temperature module.
164
+
165
+This can support future anti-freeze logic. Mount it under the control box or under a small shield so it reads outdoor air, not direct sun or heat radiating from the tub.
166
+
167
+### Plumbing Hardware
168
+
169
+Buy as needed to match the pump and heater hose sizes:
170
+
171
+- Reinforced hose rated for hot water.
172
+- Stainless hose clamps.
173
+- Barbed hose adapters.
174
+- Thread seal tape.
175
+- Ball valves for isolating the pump and heater.
176
+- Unions or quick-disconnect hose fittings for service.
177
+- Intake strainer for the heat circulation pump.
178
+- Optional check valve to discourage reverse flow.
179
+
180
+The exact fittings depend on the current pump, heater, and tank connections. Bring one existing hose/fitting to the hardware store if you are unsure of sizes.
181
+
182
+## Physical Layout
183
+
184
+Mount the control box close enough for sensor cables and pump cords, but not where bathers will splash it.
185
+
186
+Good locations:
187
+
188
+- On a post next to the tub.
189
+- On a nearby wall.
190
+- On a small stand beside the tub.
191
+
192
+Avoid:
193
+
194
+- Attaching the control box where it can be submerged.
195
+- Mounting it directly above heater exhaust.
196
+- Placing it where people step over cords.
197
+- Letting cable glands point upward where rain can sit on them.
198
+
199
+Recommended enclosure layout:
200
+
201
+```text
202
++--------------------------------------------------+
203
+| Waterproof Control Box |
204
+| |
205
+| +------------------+ +-----------------+ |
206
+| | Raspberry Pi | | Terminal Blocks | |
207
+| | on standoffs | | Sensors / GPIO | |
208
+| +------------------+ +-----------------+ |
209
+| |
210
+| Low-voltage side AC relay side |
211
+| +----------------+ +-----------+ |
212
+| | Sensor glands | | Relay 1 | |
213
+| | M8/M12 plugs | | Relay 2 | |
214
+| +----------------+ +-----------+ |
215
+| |
216
+| Bottom cable entries: sensors, control wires, AC |
217
++--------------------------------------------------+
218
+```
219
+
220
+Keep low-voltage sensor wiring separated from AC pump cords inside the enclosure. If the relay modules are too large or not rated to sit inside the enclosure, mount them in their own weather-protected location and run only their low-voltage control wires back to the Pi box.
221
+
222
+## Plumbing Layout
223
+
224
+The heat loop should pull water from the tub, push it through the pump, then through the propane heater, and return hot water to the tub.
225
+
226
+```text
227
+Stock Tank
228
+ |
229
+ | intake with strainer
230
+ v
231
++------------------+
232
+| Heat Circ Pump | controlled by Pi relay
233
++--------+---------+
234
+ |
235
+ v
236
++------------------+
237
+| Propane Heater | gas remains manually opened/set
238
++--------+---------+
239
+ |
240
+ | hot return line
241
+ v
242
+Stock Tank
243
+```
244
+
245
+Recommended details:
246
+
247
+- Put a strainer before the heat pump intake.
248
+- Add a ball valve on each side of the pump/heater loop so you can service parts without draining the tub.
249
+- Use unions or quick disconnects near the pump and heater.
250
+- Keep hoses short and smooth to reduce flow restriction.
251
+- Keep heater exhaust fully outdoors and unobstructed.
252
+
253
+## Sensor Attachment
254
+
255
+### Tub Temperature Probes
256
+
257
+The temperature probes should read circulating tub water, not air, tank wall temperature, or only the hot heater return stream.
258
+
259
+Recommended placement:
260
+
261
+- Put four probes around the tank so the controller can average the readings.
262
+- Keep all probe tips at roughly the same depth, about halfway down the water column.
263
+- Put one probe near the heater return side, but not directly in the blast of hot return water.
264
+- Put one probe on the opposite side of the tank.
265
+- Put one probe near each long end of the tank.
266
+- Use adhesive cable clips, stainless clips, or a small bracket to keep the probe tips submerged.
267
+- Route the probe cables up and out of the tub so bathers cannot snag them.
268
+
269
+Do not let the probe tip rest directly against the aluminum tank wall. It should be surrounded by water.
270
+
271
+Top-down placement for a 6 ft x 2 ft stock tank:
272
+
273
+```text
274
+Top view
275
+
276
+ +--------------------------------------------------+
277
+ | Probe 3 Probe 4 |
278
+ | |
279
+ | |
280
+ | hot return ---> circulating water |
281
+ | |
282
+ | Probe 1 Probe 2 |
283
+ +--------------------------------------------------+
284
+
285
+Probe 1: near heater return side, offset from direct hot flow
286
+Probe 2: opposite side from heater return
287
+Probe 3: one long end of the tank
288
+Probe 4: other long end of the tank
289
+```
290
+
291
+During heating, display both the average temperature and the temperature spread. The average is useful for control. The spread tells the user whether the tank is evenly mixed yet.
292
+
293
+### Low-Water Float Switch
294
+
295
+Mount the float switch near the pump intake height. The controller should refuse to run the heat pump if this switch indicates low water.
296
+
297
+```text
298
+Side view of tub wall
299
+
300
+ Normal water line -------------------------
301
+
302
+ [ temp probe ]
303
+
304
+ Minimum safe line -----[ float switch ]----
305
+
306
+ [ pump intake / strainer ]
307
+```
308
+
309
+## Electrical Connections
310
+
311
+### Low-Voltage Sensor Wiring
312
+
313
+Bring each sensor into the enclosure through a waterproof connector or cable gland. Inside the box, land the wires on screw terminals.
314
+
315
+Suggested Pi GPIO assignments:
316
+
317
+```text
318
+Function Pi Pin / GPIO
319
+------------------------------------------------
320
+DS18B20 data bus GPIO4
321
+Low-water float switch GPIO17
322
+Optional flow switch GPIO27
323
+Heat relay control GPIO22
324
+Filter relay control GPIO23
325
+Ground Any Pi GND pin
326
+3.3V sensor power Pi 3.3V pin
327
+```
328
+
329
+The DS18B20 data line needs a 4.7 kOhm pull-up resistor between data and 3.3V. Some breakout boards include this resistor.
330
+
331
+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
+
333
+### AC Power Path
334
+
335
+The AC power path should be simple and GFCI-protected:
336
+
337
+```text
338
+House / outdoor outlet
339
+ |
340
+ v
341
+GFCI protection
342
+ |
343
+ v
344
+Outdoor-rated extension cord
345
+ |
346
+ v
347
+Weather-protected relay outlets
348
+ |
349
+ +--> Heat circulation pump
350
+ |
351
+ +--> Filter pump
352
+```
353
+
354
+Important rules:
355
+
356
+- The Raspberry Pi does not power the pumps.
357
+- Pump AC power only passes through enclosed relay outlets or outdoor smart plugs.
358
+- All pump plugs should have drip loops.
359
+- Keep every plug connection off the ground.
360
+- Do not exceed the amp rating of the relay module, smart plug, extension cord, or outlet.
361
+
362
+## Assembly Steps
363
+
364
+1. Build the plumbing loop without automation first.
365
+ Confirm that the pump reliably moves water through the heater and back to the tub.
366
+
367
+2. Mount the waterproof control box.
368
+ Choose a stable location near the tub but away from splash zones and heater exhaust.
369
+
370
+3. Install cable glands or bulkhead connectors.
371
+ Put sensor connectors on one side or the bottom of the enclosure. Put AC/control cable entries separately.
372
+
373
+4. Mount the Raspberry Pi and terminal blocks.
374
+ Use standoffs, DIN rail adapters, or a mounting plate. Do not let electronics float loose in the box.
375
+
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.
378
+
379
+6. Connect the low-water float switch.
380
+ Wire it to a GPIO input and ground through a waterproof connector.
381
+
382
+7. Connect relay control inputs.
383
+ 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
+
385
+8. Plug pumps into the relay-controlled outlets.
386
+ Label one outlet "HEAT PUMP" and the other "FILTER PUMP".
387
+
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.
390
+
391
+10. Test with water before using heat.
392
+ Run the heat circulation pump with propane closed first. Confirm water flow and no leaks.
393
+
394
+11. Test heating under supervision.
395
+ Open propane, start heating, and watch the first full heat-up cycle in person. Confirm the controller stops heating near the target temperature.
396
+
397
+## Recommended Labels
398
+
399
+Label everything before closing the box:
400
+
401
+- HEAT PUMP OUTLET
402
+- FILTER PUMP OUTLET
403
+- TUB TEMP 1
404
+- TUB TEMP 2
405
+- TUB TEMP 3
406
+- TUB TEMP 4
407
+- LOW WATER SWITCH
408
+- OUTSIDE TEMP, if installed
409
+- PI POWER
410
+- GFCI REQUIRED
411
+
412
+Labels matter because this system will be used outdoors, serviced later, and possibly unplugged between uses.
413
+
414
+## Minimum Safety Behavior the Hardware Should Support
415
+
416
+The hardware should make it possible for the software to enforce these rules:
417
+
418
+- 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.
420
+- Do not run heat above a hard maximum temperature.
421
+- Do not run heat indefinitely if temperature is not rising.
422
+- Optionally stop heat if the flow switch says water is not moving.
423
+- Keep filter control independent from heat control.
424
+
425
+Hardware alone will not enforce all of this, but the sensors and relay layout make those software checks possible.
426
+
427
+## Suggested Build Phases
428
+
429
+### Phase 1: Basic Remote Control
430
+
431
+Install:
432
+
433
+- Raspberry Pi.
434
+- Two enclosed AC relay outlets or two outdoor smart plugs.
435
+- Heat pump control.
436
+- Filter pump control.
437
+
438
+Result: remote on/off for heating circulation and filtration.
439
+
440
+### Phase 2: Temperature Automation
441
+
442
+Add:
443
+
444
+- Four waterproof DS18B20 tub temperature probes.
445
+- Web interface target temperature setting.
446
+- Software hysteresis, such as heating until the 4-point average reaches target temperature and restarting when the average drops 3 degrees.
447
+
448
+Result: the system can maintain a target temperature range.
449
+
450
+### Phase 3: Safety Sensors
451
+
452
+Add:
453
+
454
+- Low-water float switch.
455
+- Optional flow switch.
456
+- Optional outside temperature sensor.
457
+
458
+Result: the system can refuse unsafe heating and support future freeze-protection behavior.
459
+
460
+## Final Recommended Parts Summary
461
+
462
+For the first complete version, buy:
463
+
464
+- Raspberry Pi Zero 2 W, Pi 3, or Pi 4.
465
+- Official Pi power supply.
466
+- 32 GB or larger high-endurance microSD card.
467
+- IP65 / NEMA 4X waterproof enclosure.
468
+- Pi screw-terminal breakout or HAT.
469
+- Waterproof cable glands or M8/M12 connectors.
470
+- 2 enclosed AC relay outlet modules, or 2 outdoor smart plugs with local control.
471
+- 4 waterproof DS18B20 tub temperature probes.
472
+- 1 waterproof float switch.
473
+- Optional inline flow switch.
474
+- Optional outside temperature probe.
475
+- Wago connectors or screw terminal blocks.
476
+- Outdoor-rated extension cord and GFCI protection.
477
+- Hot-water-rated hose, hose clamps, valves, unions, and strainers as needed.
478
+
479
+This gives the system enough hardware to measure a 4-point average water temperature, control heating circulation, control filtration, and detect the most important unsafe condition: low water.
projects/hot-tub/overview.md
... ...
@@ -0,0 +1,40 @@
1
+# Hot Tub Automation
2
+
3
+Given a "Cowboy Hot Tub", the idea is to replace the heavily manual control system with a highly automated one that can be managed remotely.
4
+
5
+## Current Setup
6
+
7
+- 6' x 2' x 2' Aluminum Stock Tank
8
+- Propane powered camping water heater (manual controls for gas and water flow)
9
+- 2.64 gpm pump - to cycle water from the stock tank through the water heater
10
+- Floating thermometers that transmit temparature wirelessly to a receiver in the house
11
+- Remote on/off switch for pump electric plug
12
+- 1000 gph water filter / pump - Must be plugged / unplugged manually to operate
13
+
14
+Given the above setup, when the tub is to be used, the user must:
15
+- ensure the propane gas bottle is open
16
+- turn on the pump
17
+- watch the temperature rise
18
+- once the tub is at the desired temperature, turn off the pump
19
+
20
+## Target Setup
21
+
22
+- temp sensors in the tub report temp to computer of some kind
23
+- filter and heat pump connected to computer somehow
24
+- computer connected to web via Wifi
25
+- computer exposes web interface and API allowing user or app to:
26
+ - see temperature
27
+ - turn on / off heat
28
+ - turn on / off filter
29
+ - set target temp, allow computer to maintain temp within 3 degree range
30
+ - possibly even report on water level (requires additional sensors)
31
+ - possibly anti-freeze pumping depending on external temp?
32
+
33
+## Implementation Notes
34
+
35
+### Hardware Setup
36
+
37
+- Computer likely raspberry pi
38
+- pi lives in a waterproof computer box which may be attachable to the tub
39
+- system powered by plugging in an extension cord to exposed electrical connector
40
+- all sensors and accessories controlled by the computer should be pluggable / unpluggable (not soldered or fixed attachment)
... ...
\ No newline at end of file