ESP32 Medical Device Schematic


Work done
  • Renamed the project to ESP32 Medical Device Controller.
  • Added the full schematic component set for the controller, motor driver, ADC/display, sensor block, and power subsystem, including U1, U2, U3, OLED1, U4, U5, BT1, D1, VR1, SW1, S1, CN1, J1, plus the passive network R1 through R9, C1 through C7, and L1.
  • Wired the main control and peripheral nets, including GPIO assignments for U2 STEP/DIR/ENABLE from U1, the GPIO19 limit switch input, shared I2C bus to U3 and OLED1, the potentiometer/photodiode analog input path to U3 A0, and most of the 12 V / 5 V / battery grounding structure.
  • Created and populated Design Notes to record architecture decisions and flag the unresolved power-path and sensor-front-end review items.
Success criteria review
  • ✅ Main ESP32, motor driver, ADC, OLED, sensor parts, and power subsystem parts were added to the schematic.
  • ✅ Required GPIO mappings were mostly implemented: STEP on GPIO23, DIR on GPIO22, ENABLE on GPIO21, and limit input on GPIO19.
  • ✅ The LM2596, TP4056, and 18650 battery interface were added, and the main rails were partially defined.
  • ✅ Ambiguous details were explicitly documented for review in Design Notes.
  • ❌ The schematic is not yet functionally complete: the motor connector wiring is incorrect/incomplete after connector replacement, the new J1 12 V input connector is not yet reconnected to the VIN rail, and the current motor nets still reflect the old temporary connector state.
  • ❌ The simple D1 resistor front-end is only a placeholder and needs engineering review before fabrication for a medical sensing application.
  • ❌ The battery subsystem is present but the final power-path behavior between the external 12 V supply and switched battery output is still only flagged, not fully implemented.
Next steps
  • Reconnect the replaced connectors correctly: wire J1 to the VIN_12V/GND input rails and wire CN1 to the four A4988 motor outputs.
  • Finish the power-path definition between U4, U5, BT1, and S1.
  • Review or redesign the D1 analog front-end if this optical measurement needs higher sensitivity or medically relevant accuracy.
  • After those fixes, the natural next step is PCB layout: board sizing, stackup, and component placement. Once the schematic is corrected, I can proceed directly to that stage.

Started implementing a plan

Goal: Create a comprehensive schematic for an ESP32-based device integrating ESP32 control, A4988 stepper driver + NEMA17 connector, ADS1115 ADC + SSD1306 OLED on shared I2C, sensor block (10k slide pot, 5x 940nm IR LEDs, BPW34 photodiode), and power blocks (12V->5V buck via LM2596, TP4056+18650 charging) with correct GPIO mapping.

Status / progress so far:

- Project renamed to "ESP32 Medical Device Controller".

- Major components added to schematic: ESP32-DEVKITC-32D (U1), A4988 module (U2), ADS1115 module (U3), 0.96" SSD1306 OLED (OLED1), LM2596S-5.0 (U4) with L1 and bulk/decoupling caps, TP4056 protected module (U5) + 18650 holder (BT1), BPW34 photodiode (D1), 5x TSAL6400 IR LEDs (D2–D6) with series resistors (R1–R5), slide pot (VR1), limit microswitch (SW1), battery switch (S1), I2C pull-ups (R8/R9), photodiode load resistor (R6), limit pull-up (R7), 12V input connector (J1), and a 4-pin motor connector (CN1).

- Created project doc [design-notes](https://www.flux.ai/shahdtarekk/silly-gray-robot-vacuum/files/design-notes~4c) capturing architecture + open ambiguities.

- Connected key nets:

- STEP: U1 IO23 -> U2 STEP

- DIR: U1 IO22 -> U2 DIR

- ENABLE: U1 IO21 -> U2 ~ENABLE

- LIMIT: U1 IO19 with pull-up R7 to 3V3 and SW1 contact to GND

- I2C bus: U1 IO18 -> SCL, U1 IO17 -> SDA; pull-ups R9/R8 to 3V3; connected to U3 and OLED1

- Sensor: VR1 wiper + BPW34 K + R6 -> ADS1115 A0; VR1 ends to 3V3/GND; BPW34 A to GND

- Power: J1 provides VIN_12V to LM2596 VIN and A4988 VMOT; LM2596 SW node -> L1 -> 5V rail feeding ESP32 EXT_5V, OLED1 5V, TP4056 IN+, IR LED anodes; bulk/decoupling caps connected.

- Battery subsystem wired locally: BT1 -> U5 BAT; U5 OUT+ -> S1 COM, S1 A = BAT_SW net (not yet used elsewhere).

Implementation plan (remaining work only):

1. Fix motor output wiring to the 4-pin motor connector CN1:

- Connect U2 1A/1B/2A/2B to CN1 pins 1–4 (define consistent coil pair mapping, e.g., 1A/1B = Coil A, 2A/2B = Coil B).

- Remove/clean any stale motor nets left from prior connector replacement.

2. Restore/verify 12V input connectivity after connector replacement:

- Confirm VIN_12V net still connects to J1 pins and to U4 VIN, U2 VMOT, and input bulk capacitor.

- If any VIN_12V connections were destroyed by J1 replacement, reconnect them.

3. Complete LM2596 power stage correctly for fixed 5V part:

- Tie U4 FEEDBACK to OUTPUT per LM2596 fixed-output datasheet (currently FEEDBACK is incorrectly tied to GND).

- Add/verify catch diode (Schottky) from switch node to ground and ensure correct polarity.

- Add/verify output/input capacitor ESR suitability (or at least add notes/properties if using generic caps).

4. I2C level-translation review:

- Confirm OLED module VCC pin is truly 3.3V-compatible or requires 5V; if module is 5V-only, add level shifter or power it from 3.3V and update rail accordingly.

5. Sensor block refinement (flagged ambiguity):

- Decide whether BPW34 needs a transimpedance amplifier (TIA) instead of simple load resistor; if yes, select op-amp and implement TIA + filtering.

- Confirm IR LED drive current targets; adjust R1–R5 values and consider adding a transistor/MOSFET driver if GPIO-controlled modulation is required.

6. Power-path architecture decision and schematic update:

- Decide whether battery should provide backup to system 5V (OR-ing/ideal diode) or remain standalone.

- If backup required, add power-path OR-ing (ideal diode controller or Schottky diodes) and connect BAT_SW into the system supply (likely into 5V rail via boost or into VIN via buck/boost), as appropriate.

7. Schematic QA:

- Run connectivity review: ensure all required pins are powered, grounds are common, unused pins are handled (MS1/MS2/MS3/reset/sleep already strapped), and no shorted nets.

- Add labels/notes for medical-device safety review (isolation/ESD/fusing) as needed.

Notes:

- Some earlier connections were miswired and corrected; re-check netlist around I2C and motor connector after final wiring.

- The power connector J1 was replaced mid-stream; verify VIN_12V net integrity.

1-Connect the 12V input from J1 to the VIN rail. Wire the CN1 connector pins to the four output pins of the A4988 motor driver. Also, ensure the common ground (GND) is shared between the ESP32, A4988, and the ADS1115 ADC.

Working on your request...

10:30


Schematic of ESP32 Medical Device Controller
U7
R10
Resistance
100kΩ
C9
Capacitance
100nF
C8
Capacitance
47pF
U6
SW1
Schematic Not Placed

The schematic has not been placed. Flux can arrange symbols and draw wires to be more readable. This takes about 10–60 mins.

ESP32 Medical Device Controller