AFTR
Automatic Faucet Temperature Robot
Preface: While this is still a project I'm proud of, I've since learned much more about PCB design and modern design practices, exemplified in my QuadProtoBoard Project.
AFTR is a project of my own ideation for which I engineered a 115 component 4 layer custom PCB using professional grade E-CAD software.
800+ lines of code written in C allow the board to perform its purpose of controlling an apparatus attached to a generic bathroom sink and allowing the user to set a desired water temperature. The robot will then adjust the faucet handles through use of a thermistor and a PID based feedback loop to adjust the water to the desired temperature and continuously adjust after that to maintain the temperature or adjust to a new setting.
As can be seen more closely in the schematics below, the board is compatible with drawing power from line voltages of either 9V or 12V. The board is configured to have the option of being simultaneously hooked up to a 9V battery and line power, but the power circuit was designed such that it will only draw power from the battery when the line power is disconnected, prolonging battery life. It can also draw power through the USB-C port for programming and testing, though this won't be enough amperage to actually run the motors under load.
The 57mm by 48mm board is controlled by an STM32G431 MCU which manages the multiple onboard peripherals including a USB-C port, a thermistor, two 6V servo motors, an encoder, an OLED user display, four pushbuttons, a cooling fan, an SWD communication port, and boot circuitry, all of which utilize standardized connectors of 2.00mm, 2.54mm, or similar. The design makes very efficient use of this MCU utilizing 31/32 available pins.
Below is an outline of the 3D designed and printed casing, schematic outline, and PCB layout. Once the finished fabrication arrives from the factory I'll post some pictures here.
For this project I used Fusion 360 to design the apparatus, including motor mounts and custom stepper motor attachments to attach to the mechanics underneath a common bathroom sink faucet handle. The sliding mechanism allows continuous adjustment for any common width of faucet handles, with a built in stop that prevents the slide from disconnecting. All these pieces are designed to be 3D printed with common materials such as PLA or PETG
A closer view of the sliding mechanism.
The schematics were designed for an emphasis in readability and clarity, so that other engineers reading my work can easily understand the design's flow and structure.
This is a snip of the top layer routing and component layout of the board. The middle two layers are ground and 3.3V solid layers, and the bottom layer is a second signal layer.
The power inputs are in the bottom right of this picture at J101 and J102, along with J302 from the left side of the board that runs a trace along layer 4. The power flows through the input filtering including a fuse for each input except the USB input, a TVS diode, reverse current protection, an external on/off switch, and an RLC filter circuit.
Care was taken to isolate the high power peripherals as much as possible from the communications peripherals. This is evident with motors M201 and M202 on the top right of the board, in contrast to the USB port J302 and encoder input U202 on the left and bottom areas respectively.
In blue here are the traces of the second signal layer located on the back side of the PCB. A 3D render of the same traces can be seen in the next picture.
Care was taken here to ensure appropriate spacing between traces, and minimal trace length of critical signals to maximize signal integrity.
The decoupling capacitors are arranged as closely as possible to the voltage input pins of the MCU in accordance with the manufacturer's specifications. Following common layout best practices, throughout the board the lower capacitance decoupling capacitors are arranged more closely to the pins to allow the smaller capacitors to respond quickly to changes in current demand, filtering out the higher frequency noise as well as reducing parasitic inductance.
The back side of the board, showing the layer 4 signal traces.
I enjoyed making this project and look forward to making my next board. If you have roles available, I'm actively looking for positions in circuit design for this summer. Please contact me at clayclemmer@gmail.com to get in touch with me.