Designing an ESP32 based device - in need of feedback

olupolup
Posts: 4
Joined: Thu Dec 15, 2022 8:50 pm

Designing an ESP32 based device - in need of feedback

Postby olupolup » Thu Sep 14, 2023 9:00 pm

Hello,

I am trying to design my first device based on an esp32 s3 wroom (but might move to an S2 for pricing).

This is a simple device, battery operated, with 5 buttons, reset and boot, a rotary encoder, an 2.4 tft screen, a 27mm speaker and jack output, an SD card. Basically an mp3 player.

I use a simple max98357a as DAC+amp. It will drive both headphones and speaker. And I am managing gain digitally as well as by changing a gpio connected to the GAIN pin, to adapt to both situation.

I use a main controller for the power to all peripherals, so that I can shut everything before sending the esp to deep sleep (mp3 player power off).

I plan on coding the esp through the built-in usb-to-serial. I also wish to use the device as mass storage with the tinyUSB project.

I have been picking around some public schematic for inspirations and asking a few communities, but I think I can find here some educated feedbacks on the schematics. I am starting my journey on electronics, and knowing what I had wrong is my best way to learn.

The schematics are attached as PDF.

A million thanks in advance for anyone finding a bit of time to review this.
Attachments
Untitled.pdf
(642.39 KiB) Downloaded 410 times

ESP_Sprite
Posts: 9583
Joined: Thu Nov 26, 2015 4:08 am

Re: Designing an ESP32 based device - in need of feedback

Postby ESP_Sprite » Fri Sep 15, 2023 2:49 am

Looks good. I'd also add some ESD on your audio jack, given the fact that possibly a charged human will plug something ungrounded (i.e. a headphone set) in there.

I'm not sure about D3; if this is a normal diode, it'll take 0.7V off your 3.3V and that'll eat into your headroom and makes the chip work very close to the minimum voltage it needs. I'd make sure this is some kind of Schottky, or maybe you want to change it to a choke if the intention is to get a 'clean' power supply.

There's one bit of critical information I'm missing to see if you're using the ESP32 in-spec: what color is your charging indicator LED?

olupolup
Posts: 4
Joined: Thu Dec 15, 2022 8:50 pm

Re: Designing an ESP32 based device - in need of feedback

Postby olupolup » Fri Sep 15, 2023 6:41 am

Thanks a lot for your time! Indeed you are not the first one to question this diode and i dont know why it's there. Do you reckon I could get rid of it ? It seems so looking at the schematics. Otherwise I'll move to a shottky.

The led is red I believe, it's lighted when the battery is charging. What is the impact of the color ?

Thanks again.

ESP_Sprite
Posts: 9583
Joined: Thu Nov 26, 2015 4:08 am

Re: Designing an ESP32 based device - in need of feedback

Postby ESP_Sprite » Sat Sep 16, 2023 12:16 am

On the diode: Yes, I'd remove it. No clue what it would be good for as specced either. You could replace it with some filtering (a coil or something) that combined with the bulk caps filter out the 300KHz switching frequency of the class-D amp in there; any coil of, say, 1uH or higher would do a good job there. Or you could simply leave it off entirely; the datasheet for that chip does not mention the need for any filtering except for the bulk caps you already have.

Wrt the LED: That's what I feared - a red LED here is out of spec, with a blue LED it would be fine, but your circuit would perhaps not work then.

And yes, that sounds ridiculous, but it's actually factual. Assuming USB can be up to 5.5V, your voltage on BAT_CHARGING_STAT can be 5.5V minus the Vf of the LED. Red LEDs have a Vf of down to 1.6V, meaning the voltage on that node can be up to 3.9V, which is more than the 3.6V that is allowed on a GPIO pin. Blue LEDs can have a Vf up to 3.7V, meaning your 'high' voltage would be too low for the ESP32 to detect it as 'high.

You can solve this in multiple ways. Either you make sure you select a specific model of LED where the Vf is such that you know it always works. Alternatively you protect the GPIO by putting a 3.3V zener between it and Gnd. The third option is to just YOLO it: in theory you're operating hte GPIO out of spec, but it's current-limited by the 2.2K resistor and it's only a few tenths of volt out of spec and only when Vusb is very high, so if this is an one-off, it's probably fine.

olupolup
Posts: 4
Joined: Thu Dec 15, 2022 8:50 pm

Re: Designing an ESP32 based device - in need of feedback

Postby olupolup » Fri Sep 22, 2023 3:03 pm

Hello,

Thanks a million for your explanations, I waited a bit to post again here mainly due to the high moderation times. I have been making some tweaks to the board:

- removed d3
- removed the rotary and went for switches instead
- added some capacitors for the esp32 s3 - I just saw that on a feather board, does that make sense ?
- Changed the resistor around the battery level to a 1M - it's been recommended to me as drawing less current while achieving the same result. Would you agree ?

And some other tweaks.

The new schematics are attached - If you still have a minute to take a quick look, I’d be thankful for some feedback to any big mistakes.

I am not sure actually what was the color of the LED in the original design. Moving to a blue one would make good sense for the user experience, what should I be careful about when choosing this path ?

I am preparing to move to production, and have been designing PCB and tracks (attaching an image of this). On this, one question comes to mind - should I use bigger tracks for the current paths or is that more or less fine to use the default track size for everything ?

Also on capacitors - the one used for stabilizing current, is there a physical placement required, or can they be pretty much anywhere on the PCB ? (this might come as a very stupid question, but I am being candid).

Finally, some parts recommendation:

- Does anyone have a battery/speaker connector to recommend that would have a slimmer profile than this pretty big jst PH2 that I am using ?
- The cheaper the best - as I’ll be connecting to the wifi, playing mp3s and diplaying static images (bitmap or jpeg) on the tft screen, i wouldn’t describe this project as resource intensive. Should I consider an S2 or even a C3 for the mcu, rather than the s3?

Thanks again for the support I found here, this is really empowering me on this first experience!
Attachments
Untitled-pcb.png
Untitled-pcb.png (491.88 KiB) Viewed 2891 times
Untitled.pdf
Schematics
(630.69 KiB) Downloaded 363 times

Who is online

Users browsing this forum: No registered users and 55 guests