I've been designing an ESP32-based board recently and I got to thinking. What's the
minimum you can get away with and still have a working module?
The ESP32-S3 Wroom module is particularly interesting. It only needs a few components
to make a complete, fully functioning dev board.
What's nice about the S3 modules is that you don't need to have a USB UART bridge
chip. You can connect it directly to the USB data lines. But just how minimal can we make
things and still have something that works?
Well, let's have a look at the recommended schematic and see what we can chop out and
what is definitely required.
So obviously something we definitely can't do without is a ground connection. There are
annoyingly two ground pins, we could probably just connect one, but we'll do both for now.
We're also going to need 3.3 volts. Unfortunately for this, we will need an external component,
a Low Dropout Regulator. We get 5 volts out from the USB connection and if we use
that directly, it will fry our ESP32.
For this initial test, I'm going to use this handy module that has an AMS117 3.3V regulator
along with the required capacitors. If we wanted to go even more minimal, we could try
just dropping the voltage over a few diodes to get it down to a safe level. Three diodes
in series would get us down to around 3.2 volts, which would be acceptable to an ESP32.
If it was a low power device, we could probably get away with a Zener diode or even a resistor
divider. But the ESP32 can spike up to a lot of power, especially when you're using
Wi-Fi or Bluetooth.
Given that we've got some capacitors on the regulator board and we're going to play
fast and loose with this proof of concept, we can just cross out these decoupling capacitors
from the schematic.
For the enable pin, we can just connect it directly to 3.3 volts, so we can ignore this
little RC circuit. The recommended values are 10K and 1uF, and it's intended to stop
the ESP32 from running until the supply voltage has stabilized. Since we're connecting it
directly to 3.3 volts, we can also do away with this push button. We can drop this crystal
and capacitors. This is only required if we want to use an external oscillator for keeping
accurate time during deep sleep. The last thing we need are the data lines for USB.
On the schematic, there are a couple of zero-ohm resistors, so we can just ignore those. There's
also a couple of capacitors. These are completely optional. They can help with very noisy signals,
but they aren't required, so we'll just get rid of them as well.
IO19 goes to the D-minus pin, and IO20 goes to the D-plus pin.
Now if you're using a brand new fresh module straight out of the factory, you may need
to connect the IO0 pin to ground to manually put the ESP32 into download mode. My experience
is that you only need to do this the first time you program the module. However, your
mileage may vary. It does seem to be quite fussy, and the internet is full of people
complaining that they can't program their modules. We can cross out this connection
from the exposed pad to ground. This is completely optional. It can help with heat dissipation
from the module, but it's not required. Check the datasheet for details.
And finally, we can cross out the UART connector. We'll get our serial output over the USB
and we're not going to use JTAG debugging, so that can go as well.
Well it seems like we've crossed out quite a lot of components. What does our circuit
actually look like? Well we've got the ESP32-S3 module, we can't really do without that.
And we've got our USB connection, with 5V, D-minus, D-plus and ground.
We need to take the 5V through a regulator to give us our 3.3V connection. We'll hook
the EN pin directly to that. And we'll hook up the ground connections.
D-minus connects directly to IO19 and D-plus connects directly to IO20.
I'm also going to add a resistor and an LED to GPIO2. There's no point doing anything
if we can't run a blink sketch.
Let's get some wires soldered onto a module. I've got a couple of modules that are connected
to some prototype boards that I can salvage. I just need to heat up the PCB using my mini
hot plate and we can pluck them off. The nice thing about this being pre-soldered is that
all the pins are now nicely plated, so connecting wires to them should be easy.
But of course soldering the ground wires is always slightly annoying. There's a lot
of copper connected to the pins and I really should have bumped up the temperature of my
soldering iron, but it goes on eventually. The 3.3V pin and the enable pin are both very
easy. And so are the two data pins, IO19 and IO20.
And finally, we hook a wire up to IO2 for our LED.
So that's the soldering all done. I've hooked everything up to a USB breakout board. Let's
see if it actually works.
Well, initially this is quite promising. We've got a light on our voltage regulator, so we've
got 5V coming from the USB port and it should be creating 3.3V, so our ESP32 should be getting
power. And if we look on our computer, we can see that we've got a USB device showing
up. So far, so good.
I've got a very simple sketch here. Let's see if it uploads. I'm using PlatformIO
as I found the Arduino IDE to be quite unreliable, especially when uploads fail. It seems to
lock up the USB device and it even crashed my computer a couple of times.
We'll hit the upload button. Our code compiles.
And it's a miracle. The code is being uploaded to the module.
And it's flashing the LED.
If we open up the serial monitor, we can see our messages coming through as well. I did
need to add these funny pre-processor definitions to get output to come out from the serial
port. If you know what they mean, then let me know in the comments.
Now at this point, most sensible people would call it a day. We've proved a point. We've
shown you don't need many components. It's very cool.
Or maybe they'd think, I could make a really nice small PCB for a dev board. I could get
it manufactured by the channel sponsor PCBWay. They'd do a really great job and give me a
fantastic board. But not me. I got to thinking, there's a surprising
amount of space on the back of the module. We could probably fit the USB socket and the
voltage regulator on it. The circuit is not very complicated. How hard can it be?
I've covered up the EPad with Kapton tape so we don't short anything out. We need
our voltage regulator and our USB connector. We'll add in the voltage regulator decoupling
capacitor between the output and ground, and another one between 5 volts and ground.
So that's where we want our components, and in theory we have a very simple circuit.
We've got ground coming from the USB socket. We can just connect to one of the ground pins
on the module, and we need to connect it to one side of the input capacitor. And we need
to connect it to the ground pin of the voltage regulator. We need 5 volts from the USB socket
to the input of the regulator, and we need to connect the regulator output to the 3.3
volt pin and the enable pin. Finally, we just need to connect the two data
lines D-pin 19 and D-pin 20. It should be pretty straightforward.
So I've superglued the two main components, the voltage regulator and the USB socket in
place. In the hopes of making my life slightly easier, I'm using a micro USB socket which
has slightly more accessible pins than a USB-C socket. We can tack the capacitors in place
with some solder. It's not the nicest job, but they are connected and they are not going
anywhere. This seems to be going surprisingly well.
My initial plan was to try and make most of the connections using stripped solid core
wire. My thinking was this could easily be bent into shape and would be quite neat. Obviously,
the best laid plans of mice and men, this did not work very well. The wire is far too
springy, and it's quite hard to get it to bend into the right shape. So I tried just
using straight bits of wire. This did work slightly better, and I was able to get the
initial ground connection done. For the next connection, I switched over to more flexible
cable. This was a lot easier to work with, and we are able to connect up the output from
the regulator to the 3.3 volt pin and the enable pin. It's just not particularly tidy.
We need the 5 volt supply from the USB socket. I managed to get this soldered on, but it's
getting increasingly hard to get into the USB connector pins and the superglue is not working
very well on this component. The last thing we need is the ground connection
for the voltage regulator. At this point, I thought I'd better test things and see
if we can actually get 3.3 volts, and it actually worked. The last two connections broke me.
Getting the D minus and D plus pin soldered proved to be a step too far. I just could
not get into the USB pins to solder them effectively, and I kept desoldering the other wires. The
USB socket was also not very secure. There's no way it would survive being plugged into
multiple times. So I decided to swallow some pride, and I glued a USB breakout board in
its place. This was a lot easier to solder the wires onto, and it's still pretty compact,
and it should let me plug it in out multiple times.
For the piece de resistance, I added an LED to one of the more accessible pins. It's
not pretty, the wires could be made much shorter, but it works, I'm pretty pleased. We can
run our little blink sketch, and after modifying the pin number, it works really well. Now,
would I do this again? Probably not, but it was fun to try and see what was possible.
Now go and watch this much more sensible video about Raspberry Pi's and wireless power.