Embedded system for respiratory monitoring - project review - Page 1
Forum section: electronics / general

author: Kp91
author_rank: Newbie
timestamp: February 18, 2025, 06:34:57 pm
content: Hello everyone,This is not my first PCB design, but I’ve always worked in a hobbyist capacity, so I would really appreciate any suggestions or feedback regarding potential mistakes that could affect the functionality of my circuit.The final device will be an embedded system for respiratory monitoring. In the previous version, I used an ESP8266 microcontroller, but now I’ve decided to migrate to the ESP32, which integrates Bluetooth connectivity and has a dual-core processor.Connected to it is an analog pressure sensor (MP3V5004GP), powered by 3V, with an input range from 0.6V to 2.9V. I used a voltage divider with resistors of 180kOhm and 100kOhm to bring the voltage down to 1V for the microcontroller.There’s also a battery gauge with an I2C interface and 10kOhm pull-up resistors.For battery management, I based the circuit on the ESP32-WROOM-32 development board, FEATHER model. This setup includes a 3.3V voltage regulator (AP2112K-33TRG1), which receives voltage either from the battery (LiPo 3.7V, 820mAh) or from the USB Type-C port via a protection diode. The selection between the two voltages depends on the presence of the power supply, managed by a P-channel enhancement mode MOSFET (DMP2045U).Battery charging is handled by the MCP73831T-2ACIOT component.I believe I’ve designed this part correctly, based on the components' datasheets. However, I have doubts about the maximum current ranges that the components can handle. Also, I’ve added a latched push button between the input line and the voltage regulator, but in my previous version of the design it seemed to cause issues. Specifically, it appeared that a small amount of current could flow in the circuit even when the switch was open. How can I prevent this from happening?Finally, four LEDs (which will be used as indicators in the final enclosure) and a buzzer are connected to the GPIOs of the microcontroller.I’ve designed the 4-layer PCB using OrCad. You can find attached photos of the design, the Gerber viewer, and the 3D model.Thank you in advance to anyone who will be willing to help. I truly believe in the value of this community, without it many beginner designers would be lost.

author: thm_w
author_rank: Super Contributor
timestamp: February 18, 2025, 09:48:56 pm
content: U4 is the latching push button you are talking about? Try to use "PBx" or "SWx" for buttons instead of Ux.You will have some leakage through D1 but not much.MCP73831T says it has some 2uA leakage from VBatt, not much.Try to have Vcc rails pointing up, not pointing down.C21 and C22 are not needed.U14 should be a transistor symbol not a box, and should be "Qx". No idea if its wired correctly, I assume it is.

author: eugene
author_rank: Frequent Contributor
timestamp: February 19, 2025, 07:44:53 pm
content: Why the 180k/100k voltage divider at the ADC pin? The large resistance will cause the ADC to take longer to settle, and reducing the signal by 1/3 will only make the SNR worse. The ADC in the ESP32 can handle 3.3V. Why not feed the pressure sensor directly without the voltage divider?

author: tggzzz
author_rank: Super Contributor
timestamp: February 19, 2025, 08:09:25 pm
content: This appears to be some form of medical life support project.For the project as a whole, cf just the schematic and layout, you will need to define not only how itworks(easy) but how itfails(more difficult).Such failures should encompass at least individual sensor failures, PSU failures (especially if connected to a living being), algorithm failures, software failures, immersion in fluids, EMI/EMC, and more.

author: nctnico
author_rank: Super Contributor
timestamp: February 19, 2025, 10:15:39 pm
content: I don't quite see the advantage of using the MAX17048. I'd monitor the battery voltage using the ADC and just set an alarm for a voltage level.Another problem I see is the ADC reference in respect to the pressure sensor. The internal reference in the ESP32 is pretty bad. If the pressure sensor output is a ratio of the supply voltage, I'd leave the reference chip out and measure both sensor output and the supply voltage using the ADC. That way you can cancel whatever the error is on the supply voltage. If the sensor has an absolute output, then you'll need to bring the reference voltage to the ESP32 as well and measure it.What I'm missing in the PCB are power and ground planes. A solid ground plane will make it massively easier to pass CE compliance testing.

author: thm_w
author_rank: Super Contributor
timestamp: February 20, 2025, 12:27:36 am
content: Quote from: nctnico on February 19, 2025, 10:15:39 pmThey are on the internal two layers.

author: Kp91
author_rank: Newbie
timestamp: February 20, 2025, 11:20:01 am
content: Quote from: thm_w on February 18, 2025, 09:48:56 pmThanks, you're right I should use SWx for all switches and Qx for MOSFETs. I must have been confused while creating the schematics.What do you mean by "Vcc rails pointing up, not pointing down"? I can't see where I did that.

author: Kp91
author_rank: Newbie
timestamp: February 20, 2025, 11:23:49 am
content: Quote from: eugene on February 19, 2025, 07:44:53 pmThe reason is that, in the previous version, I was using an ESP8266 microcontroller with 1V ADC. I assumed the input range was the same when I migrated to ESP32, I was clearly wrong. Thanks

author: Kp91
author_rank: Newbie
timestamp: February 20, 2025, 11:32:59 am
content: Quote from: tggzzz on February 19, 2025, 08:09:25 pmThe project aims to develop a non-invasive breathing monitoring device, which is currently in the prototype phase. If it ever progresses to production, I will need to address rigorous validation processes and risk assessments. However, at this stage, the focus is primarily on testing the device's functionalities, including power management, connectivity, and data acquisition. Thank you for your suggestions!

author: tggzzz
author_rank: Super Contributor
timestamp: February 20, 2025, 11:41:38 am
content: Quote from: Kp91 on February 20, 2025, 11:32:59 amGood luckBe aware that this is a class of devices that could indirectly kill someoneeven if it is functioning as designed. All that it needs is for the specification to be inadequate, or for someone to take or avoid an action based on your device's readings. Thus be careful with the details of the Ts & CsWhen, many decades ago, I built something vaguely similar for a client, the contract's cover letter drew attention to a clause in the contract "This is not suitable for life support applications". The client accepted the contract, since they knew their name would be on any device and their reputation was on the line.

author: Kp91
author_rank: Newbie
timestamp: February 20, 2025, 01:33:26 pm
content: Quote from: nctnico on February 19, 2025, 10:15:39 pmI'm using the MAX17048 battery gauge because it provides more accurate information on battery voltage and charge percentage, rather than just a simple analog voltage. However, you're right, I didn't account for the supply voltage reference in the pressure sensor's output. That seems like a much more valid solution, thanks!The power and ground planes are on the internal layers. You can see the vias to power (blue) and ground (purple) on the PCB.

author: nctnico
author_rank: Super Contributor
timestamp: February 20, 2025, 11:07:28 pm
content: I still don't think the MAX17048 brings anything to the table you can't do with just measuring the voltage and -maybe- do a temperature compensation for the tempco of the Li-ion cell. The datasheet shows errors in the +/- 5% range. That is not accurate by any metric and likely things will get worse when the device is subjected to a wilder variety of charge cycles and temperature changes. Estimating SOC is one of the hardest things to do for a battery but using two voltage thresholds to determine nearly empty and nearly full will always work.