Drogheda/03-Architecture-Hardware/watchdog-protoboard-bringup.md

124 lines
7.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
tags: [project-drogheda, hardware, watchdog, prototype, breadboard, bom, bring-up]
project: Project Drogheda
author: Helgen CTO
date: 2026-06-22
status: Active — shop list for the Blackpill bring-up
---
# Watchdog Bring‑up — Protoboard Shopping List (print me)
> Goal: breadboard the v2.2 watchdog on your **existing Blackpill**, prove the
> state machine + sensing + load switch + fans + temp loop, **before** any PCB.
> All parts are **through‑hole / breadboard‑friendly** and stocked at a normal MX
> electronics shop (Steren / AG Electrónica / local). Quantities include spares.
> Pin map: [[03-Architecture-Hardware/watchdog-pcb-v3-design#2|design §2]] ·
> firmware: `blackpillrtkcode_v2.ino` (v2.2).
## 0. Already have — do NOT buy
STM32F411 Blackpill · USB‑C/micro cable · 18650 + PowerBoost · Mean Well SD‑15B‑05
(or a bench PSU) · multimeter · the F9P + 4G master (only needed later, not for the
bring‑up). A **heat source** (hair dryer / lighter / hot water cup) to trigger the
thermal/fan test — household, no need to buy.
---
## 1. Core — bring up the "brains" (buy this even if the shop is sparse)
| # | Item | Qty | Value / part | ~MXN | For |
|---|---|---|---|---|---|
| 1 | Breadboard 830‑pt | 2 | half/full | 120 | build surface (2 = room for fans/sensors) |
| 2 | Jumper wires M‑M | 1 pk | 65 pcs | 60 | board wiring |
| 3 | Jumper wires M‑F | 1 pk | 40 pcs | 50 | to Blackpill / modules |
| 4 | Resistor assortment box | 1 | ¼ W (incl. 330Ω,1k,4.7k,10k,100k,220Ω) | 120 | dividers, gates, pull‑ups |
| 5 | LED (any) | 5 | 3/5 mm | 10 | status LED on PB0 |
| 6 | Ceramic cap 100 nF | 10 | 0.1 µF (104) | 20 | ADC filters + decoupling |
| 7 | Electrolytic 100 µF / ≥16 V | 4 | — | 20 | rail bulk / modem‑burst reservoir |
| 8 | **2N3904** (NPN, TO‑92) | 3 | load‑switch driver | 15 | PA1 → P‑FET gate |
| 9 | **IRF9540 / IRF9540N** (P‑MOSFET, TO‑220) | 2 | high‑side 5 V switch | 40 | switched 5 V to "stack" |
| 10 | **10 kΩ trim pot** | 2 | breadboard trimmer | 30 | sweep VBAT / ignition to test thresholds |
| 11 | Tactile button or slide switch | 2 | — | 20 | simulate ignition on/off |
| 12 | Male header strip | 1 | 1×40, 2.54 mm | 15 | solder onto any module that needs pins |
**Core subtotal ≈ 520 MXN.** With this you can flash v2.2, watch the `$PHLG`/TLM log,
and validate the **load switch + the three sense dividers + LED** — the whole watchdog
logic — without the thermal parts.
---
## 2. Thermal add‑ons — fans + temperature (the v3 new stuff)
| # | Item | Qty | Value / part | ~MXN | For / note |
|---|---|---|---|---|---|
| 13 | 5 V fan, 40–60 mm, **3‑wire** | 1 | 3‑wire = has tach | 60 | one extraction fan; 3‑wire so PB10 reads RPM. Grab a 2nd as a spare if cheap |
| 14 | **IRLZ44N** (logic‑level N‑MOSFET, TO‑220) | 2 | fan low‑side PWM | 30 | 1 + spare; **must be logic‑level**; see substitute below |
| 15 | Schottky **1N5819** | 3 | fan flyback | 10 | one across the fan (1N4007 ok if out) |
| 16 | I²C temp+RH breakout | 1 | **SHT31 / SHT40** ideal | 120 | matches firmware (0x44). RH catches condensation |
| 17 | Analog temp **LM35** (TO‑92) | 2 | sure‑thing fallback | 25 | every shop has it; heat it → watch fans ramp |
| 18 | **DS18B20** waterproof probe | 1 | 1‑wire | 45 | great as the battery/modem hot‑spot probe |
| 19 | LM2596 buck module (adj.) | 1 | 24/12 → 5 V | 35 | dedicated **fan 5 V** rail (caveat §0a) if no 2nd bench PSU |
**Thermal subtotal ≈ 260 MXN** (one fan + driver + one temp option). Grab #13–15 for the fan, and **one** temperature option
(#16 ideal, else #17/#18).
---
## 3. Substitutions (shop stock varies — these all work)
| If they're out of… | Buy instead | Catch |
|---|---|---|
| IRLZ44N (logic‑level FET) | **2N2222A** (TO‑92) or **TIP120** (Darlington) | BJT: add 1 kΩ base resistor; fine for a <0.5 A fan. **Plain IRF540/IRFZ44 won't fully turn on from 3.3 V — avoid.** |
| SHT31/SHT40 I²C breakout | **BME280/BMP280** (I²C, common) | address 0x76/0x77 → small firmware change |
| Any I²C sensor | **LM35** (analog) or **DS18B20** (1‑wire) | not I²C → firmware reads ADC / 1‑wire instead (I'll patch it) |
| IRF9540 P‑MOSFET | keep your original, or **2N2222 high‑side** is awkward — ask for any P‑channel ≥30 V | gate fully pulled to GND by the 2N3904, so a standard P‑FET is OK here |
| 1N5819 Schottky | **1N4007** | slightly slower; fine at fan PWM |
---
## 4. Bring‑up order (so the list maps to actions)
1. **Just USB** — flash v2.2, open serial @115200. Confirm `BOOT/COLS/TLM` lines **and a
`$PHLG,...*CS` every 30 s**. (No external parts — this proves the firmware.)
2. **LED on PB0** via 330 Ω → watch the blink codes change with state.
3. **Load switch** — 2N3904 + IRF9540 + 1 kΩ (base) + 10 kΩ (gate pull‑up) from a 5 V rail;
put an LED+330 Ω on the switched output. Toggle: confirm **OFF at reset**, ON when PA1
drives. (This is the heart of recovery.)
4. **Sense dividers** — two 10 kΩ each (÷2) into **PA0** (battery via 18650) and **PA4**
(5 V rail); a 10 kΩ pot into **PA5** (ignition). Sweep them and watch `veh`/`ign` flip in
the TLM with hysteresis/debounce.
5. **Fan** — PA6 → gate (220 Ω) of IRLZ44N → fan(−); flyback diode across the fan;
100 kΩ gate→GND. Watch it spin/ramp; tach wire → 10 kΩ pull‑up to 3V3 → PB10 →
RPM in the log; **unplug the fan → `FAN_FAULT`**.
6. **Temperature** — I²C breakout on PB6/PB7 (+4.7 kΩ pull‑ups), or LM35 on an ADC pin.
Heat it → fans ramp per the 45→70 °C curve; at 75 °C the existing thermal derate kicks in.
---
## 5. Wiring cheat‑sheet (Blackpill side)
```
PA0 ← BAT ÷2 (10k/10k) from 18650+ PA6 → 220Ω → IRLZ44N gate; fan(−); 1N5819 ∥ fan
PA4 ← 5V ÷2 (10k/10k) from 5V rail PB10 ← fan tach, 10k pull-up → 3V3 (1k series)
PA5 ← IGN ÷2 (10k/10k) from pot/switch PB6/PB7 → I²C SCL/SDA (+4.7k each → 3V3)
PA1 → 1k → 2N3904 base; collector → IRF9540 PB0 → 330Ω → LED → GND
gate; 10k gate→5V; drain → switched (PA7/PB12 left free — 2nd fan if ever needed)
5V → stack (use an LED load to test)
GND/5V/3V3 rails common; fan 5V from a SEPARATE 5V (LM2596 or 2nd PSU) — not the stack rail.
```
---
## 6. Note on the temp sensor + firmware
The v2.2 firmware reads **I²C SHT40 (0x44) + TMP102 (0x48)**. Whatever you bring back:
- **SHT31/SHT40** → works as‑is (SHT40) or a 1‑line address tweak (SHT31).
- **BME280** → change address + read call.
- **LM35 / DS18B20** → analog / 1‑wire; tell me which and I'll patch `buildPHLG()` +
the fan‑curve input to read it. For *tomorrow's* bring‑up the fan loop can also be
driven off the **MCU‑internal** temp (already in firmware) — heat the whole board and
the derate still triggers, so you can prove the fan path even before the sensor arrives.
## Related
- [[03-Architecture-Hardware/watchdog-pcb-v3-bom|v3 BOM (production + bench, xlsx)]] ·
[[03-Architecture-Hardware/watchdog-pcb-v3-design|v3 design (pin map, sub‑circuits)]] ·
`04-Source-Code/firmware/blackpillrtkcode_v2/blackpillrtkcode_v2.ino`