Recovered and reconciled the PCB layout. The last independently verified state was 1 GND airwire, 4 overlapping-copper errors, and 0 dangling traces; the executor then completed a focused cleanup pass.
Remaining
ACUs were exhausted before I could retrieve the cleanup report or run an independent final DRC.
Final airwire/DRC counts and mechanical constraints therefore remain unconfirmed.
No schematic changes or manufacturing exports were made.
Received notification from "PCB Layout Completion" that it finished — picking the work back up.
I can’t retrieve and reconcile the completed executor report because ACUs are currently unavailable.
Current last-verified PCB state:
1 GND airwire
4 copper-overlap errors
0 dangling traces
The executor subsequently completed a cleanup pass, but final DRC/airwire counts and the mechanical constraints remain unconfirmed. No additional project changes were made in this session.
Status: Review
Battery-powered electronics for a timed bag-lock mechanism using a bidirectional N20-class brushed DC gearmotor. Scope includes power, MCU, timer display, two-button UI, motor drive, battery measurement, endstop input, protection, debug, schematic, and a compact 2-layer PCB. Mechanical lock, enclosure, and 3D design are excluded.
Intended Use
A prototype/production-intent controller mounted in a compact bag-lock assembly. It closes the mechanism for a selected interval, then opens automatically. Reliability, battery safety, fault observability, and guaranteed reopening take priority over minimum cost.
What the Device Should Do
Operate from two series AAA cells.
Select 30 min, 1 h, 2 h, or 4 h lock intervals.
Pulse the motor for approximately 1–2 s in opposite directions to close and open.
Keep the motor fully off/coasting between pulses; never hold with continuous current.
Refuse closing when battery voltage is too low to reliably reopen later.
Open when the timer expires, when the primary button is pressed while locked, or after a ~6 s override hold.
Gate display power so the UI can fully sleep.
Optionally confirm opening using an external cam/endstop switch with firmware timeout/retries.
Main Features
PY32F002A-family MCU, TSSOP-20 preferred.
4-digit common-anode LED timer display with TM1637 driver.
Two tactile buttons.
Bidirectional low-voltage H-bridge motor drive.
Switched battery ADC divider.
Side-exit motor and endstop connectors.
SWD-style debug header.
Safe reset defaults and low sleep current.
System Architecture
Diagram
Hardware Subsystems
Power
Two AAA cells in series, nominally ~3.0 V, connected through two PCB wire pads.
No regulator in the baseline design; MCU and motor driver operate directly from the battery rail.
Local MCU decoupling: 100 nF plus 10 µF.
Local motor-driver decoupling: 100 nF plus 10 µF.
Gated display rail local decoupling: 100 nF.
MCU and Debug
PUYA PY32F002AF15P6TU or compatible PY32F002A TSSOP-20.
TI DRV8837/DRV8837C-class bidirectional H-bridge preferred.
VM/VCC from battery, OUT1/OUT2 to motor, IN1/IN2 from MCU.
100 kΩ pull-down on both motor inputs for reset-safe OFF/coast behavior.
Sleep/enable arrangement must guarantee no accidental motor drive during reset and near-zero idle motor current.
Driver and battery source must tolerate short N20 startup/stall-current pulses; final motor stall current remains a required confirmation.
Display and UI
TM1637 SOP-20 driving a 0.56-inch four-digit common-anode LED display.
AO3401-class P-channel MOSFET high-side power gate; 100 kΩ gate pull-up makes display default OFF.
Two 6×6 mm SMD tactile switches.
Exact display pinout must be verified against the selected part before PCB routing.
Battery Measurement
100 kΩ / 100 kΩ divider into an MCU ADC input.
AO3400-class N-MOSFET switches the divider return; 100 kΩ gate pull-down keeps measurement disabled by default.
Firmware measures battery before CLOSE and applies a conservative reopen reserve threshold.
External Connections
Motor: JST-SH 1.0 mm 2-pin right-angle SMD or equivalent.
Endstop: JST-SH 1.0 mm 2-pin right-angle SMD or equivalent.
Battery: two wire pads.
Debug: 1×4, 2.54 mm header.
Interfaces and Connections
Table
Interface
Signals
Battery
BAT+, GND
Motor
MOTOR_A, MOTOR_B
Endstop
ENDSTOP, GND
Display
SEG1–SEG8, DIG1–DIG4 between TM1637 and display; CLK/DIO to MCU
Debug
BAT, GND, SWDIO, SWCLK
Buttons
SW_A and SW_B active-low to MCU
Power and Runtime Expectations
Low-power sleep is the dominant idle mode: display rail off, battery divider off, motor disabled/coasting.
Display operates only briefly after user interaction.
Motor operates only for ~1–2 s close/open pulses.
Runtime depends strongly on MCU sleep current, display duty cycle, motor stall/start current, pulse duration, and battery chemistry.
Power Tree and Power Budget
Table
Load
Sleep
Active typical
Peak/transient
MCU
Datasheet low-power mode
Few mA class
Datasheet maximum TBD
TM1637 + LED display
0 when gated
Display-dependent
Segment current dependent
H-bridge logic
Sleep/off current
Logic current
Motor current
N20 motor
0
Motor-dependent
Stall/start current TBD
Battery divider
0 when gated
~15 µA at 3.0 V
Same
The motor dominates peak current. The final driver, connectors, copper, and source impedance must be validated against the selected motor’s measured or specified stall current at fresh-cell voltage. AAA alkaline voltage sag is a central feasibility risk; NiMH starts near 2.4–2.8 V and is acceptable only if MCU, display, and driver UVLO/headroom remain valid.
Robotics-ready closed-loop brushed DC motor controller with bidirectional 2 A H-bridge drive, quadrature encoder feedback, current sensing, protection, MCU control, debug access, and status indicators.
Properties
Properties describe core aspects of the project.
Pricing & Availability
Distributor
Qty 1
Arrow
$0.84–$1.85
Digi-Key
$0.00
HQonline
$0.64–$0.73
LCSC
$0.93–$1.09
Mouser
$1.66
TME
$1.58
Verical
$0.60–$6.43
Controls
Welcome 👋
Flux helps you build PCBs faster with an AI teammate!
Create your account to collaborate, stay updated, fork your own version, and get instant answers from our AI agent.