Motor controller with Esp32, schematic review - Page 1
Forum section: electronics / projects

author: lemm
author_rank: Contributor
timestamp: October 04, 2025, 03:43:47 pm
content: Hi everyone,I've completed the schematic for a battery-powered ESP32 smart motor controller and would be grateful for a final review before I commit to PCB layout. The goal is a robust and reliable design.Key Features:MCU: ESP32-C3-MINI-1-N4Power: 3S Li-ion (12.6V) with a TPL5110 timer for ultra-low standby power.Motor Driver: DRV8871 driving an N20 motor with encoder.Sensing: INA219 for current measurement.Programming: On-board USB-C via CP2102N.I'm open to any and all feedback on the entire schematic. I'm especially interested in any potential "gotchas" with the power management circuit or tips for preventing motor noise issues.The full schematic is attached as a screenshot. Thanks for your time and expertise! 😊

author: Benta
author_rank: Super Contributor
timestamp: October 04, 2025, 08:46:30 pm
content: First, I like your approach drawing a real schematic, but it has some quirks.Second, it seems you've made a special symbol for your ESP32 to fit your schematic (I may be wrong here, I'm not an expert on ESP32). But if it's the case: Don't do that!An ESP32 has a lot of pins, live with it. Use a standard symbol that can be reused and has relation to the real world.Third, I highly recommend learning how to use hierachical sheets in KiCAD. The whole power supply section, wakeup and protection block could be dropped into a subsheet with just battery input and 3.3 and 12 V outputs.Fourth, the wakeup circuit doesn't have an output. So what does it do?Last, I'd place U3 next to U2 to show the current sensing and motor drive belong together, and emphasize the power flow to the motor.

author: lemm
author_rank: Contributor
timestamp: October 05, 2025, 07:46:06 am
content: Thank you very much for your feedback, it really means a lotI'm more concerned that my circuit diagram won't work from a technical point of view, as it's my first printed circuit board.

author: tooki
author_rank: Super Contributor
timestamp: October 05, 2025, 07:37:32 pm
content: Quote from: lemm on October 04, 2025, 03:43:47 pmDoesn’t that go without saying??Anyhow, a few concerns:1. The programming circuit should be copied from Espressif’s devkit design if you want automatic programming to work. Otherwise you will need to sequence the EN and BOOT buttons manually, at the correct time, every single time you want to program it. Look at the schematic for the devkit:https://dl.espressif.com/dl/schematics/SCH_ESP32-C3-DEVKITM-1_V1_20200915A.pdfIn fact, basing an ESP32 board design off of the corresponding devkit design is always a good starting point.Make your life easier by using the 28-pin version of the CP2102N so that your design can match theirs 1:1, and then copy their design 1:1, including bypass caps on VBUS, input protection diodes on VBUS and D+/D-, and above all, the entire Q1/Q2 circuit that handles programming. I have no idea where you got the idea to use capacitors in series with DTR/RTS to EN/GPIO9, respectively. Use the recommended circuit instead.Make sure you lay out the CP2102N section of the PCB cleanly, with carefully-routed USB and with a solid, clean ground. I have seen a CP2102N design fail to work (would not enumerate on USB), based solely on poor PCB layout, with D+/D- snaking all over the place and a poor ground. The identical schematic, laid out properly, worked.2. In the Standby/Wake-Up section, you’ve got the input voltage coming in the right side, and then moving to the left. That’s wrong. Fundamentally, signal flow should always be from left to right.I don’t think this design will work anyway: the output of the system timer chip (DRV) is intended to drive the gate of a P-channel MOSFET, so it goeslowto turn on the system. Your main 3.3V regulator’s EN input isactive-high, meaning that you need to pull it high to turn on your 3.3V rail.3. In the 3.3V supply, your regulator IC is deprecated (“NOT RECOMMENDED FOR NEW DESIGNS”). Use something newer. And then slavishly copy the PCB layout from the manufacturer’s datasheet, reference design, evaluation board, etc. Poor layout can cause DC-DC converters to behave poorly or fail altogether, and I strongly suspect you don’t yet have enough understanding of PCB layout to actually design your own switching converter layout.4. In the main schematic block (MCU, etc) you don’t have it grouped by key signal flows. For example, in the INA219 (whose part number is cut off, additionally) you used a net label for the critical connection (motor power) so that “support” connections (IC supply, I2C, etc) can be tied directly to the MCU. That’s the exact opposite of how you should do that. It is MUCH more important to make clear how the INA219 measures motor current than to avoid using ports for power and I2C!I do not agree with Benta’s recommendation to avoid making custom schematic symbols. It’s not always advantageous, but it can be, and I’ve never heard anyone recommend avoiding it before. But I have seen many people recommend it, for the sake of circuit clarity. HOWEVER, you must do it correctly. The blob of overlapping text on the MCU’s ground pin and “NC” pin suggests to me that you’re trying to simplify connections to multiple pins. I would not recommend this: if, for whatever reason, KiCad decides not to connect toallof the overlapping pins on the symbol, you have no way to identify it, never mind fix it, and the PCB may not work if the GND connection is missing to a pin that really needs it. You see the connection dot, but really can’t verify if all pins are connected or not!If you really want to reduce symbol pin count (which I don’t consider a strong goal in itself), then the correct way to do it is to define one pin on the symbol, and then reuse the same pin number for ALL the GND pads in the PCB footprint. (This is commonly seen in, for example, coaxial connectors that have a bunch of pins to mount the connector body.) An alternative is to divide the component into parts, and use one part for power pins, and the other for all the rest.5. If you’ve got enough free MCU pins, add a JTAG debugging connector. Step-by-step hardware debugging can be a huge help. Espressif’s official debugger only costs 11 francs even from good distributors like Digikey and Mouser.

author: tooki
author_rank: Super Contributor
timestamp: October 05, 2025, 07:45:29 pm
content: Quote from: Benta on October 04, 2025, 08:46:30 pmThat’s the opposite advice from what I’ve seen. Why would you not want to modify it to make circuit function clearer?You can reuse custom symbols just as easily as premade ones — or use them as starting points for further customization in later designs.And “relation to the real world”? Do you mean making the schematic symbol match the physical pinout? That’s arguably the most reviled approach to schematic symbol design!Quote from: Benta on October 04, 2025, 08:46:30 pmIt took me a while to find it, but it is intended to drive the EN input of the main, switchable 3.3V buck converter. However, as I describe in #2 in my prior reply, it won’t work.

author: Benta
author_rank: Super Contributor
timestamp: October 05, 2025, 09:20:17 pm
content: Quote from: tooki on October 05, 2025, 07:45:29 pmDunno where you get your advice from, but try dialling down your aggressions. Do you have some beef with me?Of course you can reuse custom symbols, that was not my point. But it's very questionable if you can reuse the customisation that was "right" for the last schematic. I seriously doubt it, In the end you have a "customised" part for every schematic. If you like that, fine.I've never advocated "footprint symbols" in my life, and accusing me of that is an insult. Grouping signals is my way to go, no matter what the footprint looks like. You're welcome to read my earlier posts on this.But making an amputated symbol where perhaps pins that need pullups or other stuff are ignored is bad practice. That's the point.It's better to show all signals and how they're terminated (or not) than presenting partial information. That's my opinion.

author: tooki
author_rank: Super Contributor
timestamp: October 06, 2025, 07:51:41 pm
content: Quote from: Benta on October 05, 2025, 09:20:17 pmHuh? I don’t have any beef with you and none of the above was intended or written with any aggression. The questions are intended as such, not as sarcasm or rhetorical questions.(You’re German, right? Germans are famous for being direct, and it’s not meant with any ill will. Same here.)If it came across as aggressive, I apologize. It wasn’t meant that way at all.Quote from: Benta on October 05, 2025, 09:20:17 pmI wasn’t accusing. I was asking, hence why I wrote the question (not statement) “Do you mean making the schematic symbol match the physical pinout?”However, I don’t really understand what youdomean. I don’t know what you mean by an “amputated symbol”, nor what you originally meant by “relation to the real world”, since the schematic itself is an abstraction.

author: Benta
author_rank: Super Contributor
timestamp: October 06, 2025, 09:00:42 pm
content: Quote from: tooki on October 06, 2025, 07:51:41 pmFirst, good the clear the air, no hard feelings (on both sides, I hope).No, IMO the schematic is not an abstraction, but a precise representation of the circuit in symbolic form. There should be a 1:1 relation between schematic and PCB, making it possible to do fault finding, debugging and analysis in the "real world" using the schematic as a reference. And that includes all pins on all parts in the schematic (that's where the "amputated" part comes in). NC can be left out, but not DNC.The abstraction is called a "block diagram" or "functional diagram" and is a different thing. BTW, I'm looking for good SW to do that part, but haven't found any.

author: tooki
author_rank: Super Contributor
timestamp: October 09, 2025, 07:13:15 am
content: Quote from: Benta on October 06, 2025, 09:00:42 pmNo worries!Quote from: Benta on October 06, 2025, 09:00:42 pmWell, the reason I think the schematic is an abstraction is that while it tells youwhatis connected, it doesn’t tell youhowit’s connected. That’s what a PCB layout, wiring diagram, and/or wiring list do. The schematic is a very close abstraction, but an abstraction nonetheless, while a block diagram is a much higher level abstraction.(As for software to make the latter, I’ve been using draw.io, but I find it kinda clumsy and tedious.)