martinberlin / H-spi-adapters

PCB design for SPI adapters (HATs)
https://www.tindie.com/stores/fasani
Other
22 stars 2 forks source link

Small review #9

Open shadowpho opened 1 year ago

shadowpho commented 1 year ago

I had a day off and I love ESP32 stuff so i reviewed! Feel free to take anything useful to you and ignore the rest 👍 (regarding the 1.54-watch-pcb)

Small review for schematic:

Brief layout review:

martinberlin commented 1 year ago

Great review @shadowpho I will try to correct some of this things. Just to add some context I think we are speaking about the watch PCB.

Some notes from the top of my head: C16 is there only because max. output power of the MCP1700-33 is 250 mA. Which is enough for most things, but if the epaper update that is about 30 mA is combined with a 250 mA spike from WiFi or BLE then it resets when this additional power puff is not there. That is the only reason of being there, probably a much smaller one could be enough with a different LDO. Will explore this what you say about the EN pin, but IMHO, it should be always on even when the ESP32 is in deep-sleep mode. Right? Or what is your idea to reduce power more?

For me what is missing is an extra P-Mosfet like Q4 should be added using a free GPIO (2 for example) to enable the 3V3 power line of the epaper. Because they have deepsleep mode but they also consume like 0.2 mA or so which eats your battery slowly. My current demo-watch with DS3231 lasts only about 48 Hrs updating each 2 minutes the epaper on a 100 mA LiOn battery and it is a very small 200x200 monochrome display.

About built-in USB: I had a very different start than you. Started with first S2 models and I found it difficult to use, at that time you had to press RST + BOOT buttons. It was hard to debug using Serial output... I really want to have proper UART. Do not have to press any buttons at all and I want that enters serial mode automatically using: idf.py flash monitor But if you confirm me that everything works exactly as with an UART chip then I will have a try. Maybe in last 2 years things changed a lot and I am being too old school :P

But overall I agree there is still a lot of room to improve this PCB. About the smaller resistances I agree of course everything could be smaller using 0402. But only until till discovering that you need to change a pull-up or whatever, and I dont have 0402 at hand and it is also awful to solder. I stick to 0604 in first revisions because is very often you need to correct something and at least this I can solder manually. Also many parts are bigger than they should because they are Standard basic parts. Otherwise you end up using external parts that sum up to make your PCB much more expensive. If it was for a client that is paying and needs quality plus a very small PCB it will make sense, but when you are doing a hobby project and financing it from your own pocket you need to have some constraints.

shadowpho commented 1 year ago

Great review @shadowpho I will try to correct some of this things. Just to add some context I think we are speaking about the watch PCB.

Yep! Watch PCB.

Some notes from the top of my head: C16 is there only because max. output power of the MCP1700-33 is 250 mA. Which is enough for most things, but if the epaper update that is about 30 mA is combined with a 250 mA spike from WiFi or BLE then it resets when this additional power puff is not there. That is the only reason of being there, probably a much smaller one could be enough with a different LDO. Will explore this what you say about the EN pin, but IMHO, it should be always on even when the ESP32 is in deep-sleep mode. Right? Or what is your idea to reduce power more?

That's scary! ESP32-C3-mini mentions max power at 350 mA. The fact that 100 uF fixes it is very worriesome for sure! (100 uF is not very much power, meaning it's going to be very marginal... a slightly longer current spike or different silicon will break for sure, especially across temp/humidity). There are better parts but I used TPRT9013-33 (500 mA LDO, 8 cents on jlcpb, has enable pin. Slightly higher quiescent, but not noticeably unless you are doing deep sleep).

For me what is missing is an extra P-Mosfet like Q4 should be added using a free GPIO (2 for example) to enable the 3V3 power line of the epaper. Because they have deepsleep mode but they also consume like 0.2 mA or so which eats your battery slowly. My current demo-watch with DS3231 lasts only about 48 Hrs updating each 2 minutes the epaper on a 100 mA LiOn battery and it is a very small 200x200 monochrome display.

I had issues with deepsleep on ESP32-S2. It was very tricky to achieve and very difficult to debug. (I turned off i2c clock, shut down wifi... oh it doesn't wake up. Looks like I have to leave some wifi clocks on... but then it instantly wakes up? grrrrr). It seems that everyone just uses light sleep and calls it good enough.

Instead I found it easier to turn off ESP32 + circuitry altogether and use an external chip to turn power back on (like with your RTC -- interrupt pin used as wakeup). You program the RTC to wake ESP32 up in ~2 minutes, and then turn off enable (you can use a flip-flop for example or even just RC with diode). This way you don't need a second P-FET either, as all of 3v3 goes off. The epaper\esp32\any leakages.... all power is gone :).

The downside is that you have more limited ways to wake up, but in this example is not needed -- The ESP32 can set a certain wake-up time and wake up then (plus maybe add a button to wakeup if desired?)

About built-in USB: I had a very different start than you. Started with first S2 models and I found it difficult to use, at that time you had to press RST + BOOT buttons. It was hard to debug using Serial output... I really want to have proper UART. Do not have to press any buttons at all and I want that enters serial mode automatically using: idf.py flash monitor But if you confirm me that everything works exactly as with an UART chip then I will have a try. Maybe in last 2 years things changed a lot and I am being too old school :P

No, that sounds about right, I had similar issues with S2, especially earlier software which was pretty crappy. However it seems newer versions are better, for example here is what espressif says about debugging: "The quickest and most convenient way to start with JTAG debugging is through a USB cable connected to the D+/D- USB pins of ESP32-C3. No need for an external JTAG adapter and extra wiring / cable to connect JTAG to ESP32-C3."

Now I didn't use this chip so I would not recommend switching just based on my word, but if you add an option to test it out you will know how good/not good it is (plus will be able to switch to it for production, as that will save the IC cost if you want to make >100).

But overall I agree there is still a lot of room to improve this PCB. About the smaller resistances I agree of course everything could be smaller using 0402. But only until till discovering that you need to change a pull-up or whatever, and I dont have 0402 at hand and it is also awful to solder. I stick to 0604 in first revisions because is very often you need to correct something and at least this I can solder manually. Also many parts are bigger than they should because they are Standard basic parts. Otherwise you end up using external parts that sum up to make your PCB much more expensive. If it was for a client that is paying and needs quality plus a very small PCB it will make sense, but when you are doing a hobby project and financing it from your own pocket you need to have some constraints.

0402 is not that bad to solder. My hands are pretty shaky, but 0402 is decent (albeit not fast). With that said I perfectly understand not wanting to use the smaller parts if one prefers faster\easier soldering :-).

By the way, lcsc has dirt-cheap caps\resistors. I ordered 3 books of 0402\0603 parts for total of $50. It's a lot of common and tuning values (100 types of 10-100 parts). I do some wireless tuning with VNA so I needed a lot of values, but I found a lot of use out of them otherwise as well. Plus I got to indulge and bought random large caps\supercaps\antennas as well :smirk:

martinberlin commented 1 year ago

LDO I‘m going to switch LDO to the one you recommended. The MCP1700 is leaking from 3V3 VOUT to VIN when you power the PCB directly via the 3.3V pin. This draws 4mA in deepsleep since starts feeding the UART chip which was not in anyway intended. Thanks for recommending me TPRT9013-33. The others I will slowly update in next revision. By the way: Could not find the TPRT9013-33GB footprint anywhere so far.

shadowpho commented 1 year ago

Note that all LDOs are going to leak VOUT to VIN! They all control a FET internally which means there's a backwards diode due to structure of the FET.

I am a bit confused on design above -- because if VBUS is not plugged in then there will be no 3v3, so this will not operate on battery at all.

As for UART chip -- it's likely the MCU was backdriving the chip into TX pin (as UART by default is active low, meaning in IDLE the line has 3.3v on it). If you turn off UART and set TX to low you would see it go away?

image

martinberlin commented 1 year ago

I am a bit confused on design above -- because if VBUS is not plugged in then there will be no 3v3, so this will not operate on battery at all.

Yes. That’s how it was intended since it’s a wall switch. So it’s either powered by VUSB and has UARt just for programming/Serial output. Or by 3V3 directly. would like to send you a kit just for fun so you try it out. At least you can play with the PCB you’ve helped me to improve so much. Thanks a lot for the recommendations.

updated schematics: https://github.com/martinberlin/bistable-smart-switch/tree/master/Hardware/C3-27-epaper-touch/schematics

About:

As for UART chip -- it's likely the MCU was backdriving the chip into TX pin (as UART by default is active low, meaning in IDLE the line has 3.3v on it). If you turn off UART and set TX to low you would see it go away?

I'm not sure if I can turn off UART in ESP32. I will check it out, you mean setting directly that GPIO to low... interesting idea. Thanks a lot!

shadowpho commented 1 year ago

Yes. That’s how it was intended since it’s a wall switch. So it’s either powered by VUSB and has UARt just for programming/Serial output. Or by 3V3 directly. would like to send you a kit just for fun so you try it out. At least you can play with the PCB you’ve helped me to improve so much. Thanks a lot for the recommendations.

Ahhh I see interesting.. so the battery is only there for RTC then. No problem! Happy to see more hobbyists hardware! I'll ping you on twitter 👍

I'm not sure if I can turn off UART in ESP32. I will check it out, you mean setting directly that GPIO to low... interesting idea. Thanks a lot!

image

Looks like it can -- change UART0 to GPIO20/21. However I don't think there's enough information to tell if it's plugged in (ESP32-C3-Mini does not have VBUS. If desired you can add a resistor divider from VBUS (divide by 2) to a GPIO and that can tell to reconfigure. )