Author Topic: Embedded system for respiratory monitoring - project review  (Read 3492 times)

0 Members and 1 Guest are viewing this topic.

Offline Kp91Topic starter

  • Newbie
  • Posts: 7
  • Country: gb
Embedded system for respiratory monitoring - project review
« on: February 18, 2025, 06:34:57 pm »
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.
 

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 8155
  • Country: ca
  • Non-expert
Re: Embedded system for respiratory monitoring - project review
« Reply #1 on: February 18, 2025, 09:48:56 pm »
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.

Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 
The following users thanked this post: Kp91

Offline eugene

  • Frequent Contributor
  • **
  • Posts: 538
  • Country: us
Re: Embedded system for respiratory monitoring - project review
« Reply #2 on: February 19, 2025, 07:44:53 pm »
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?
90% of quoted statistics are fictional
 
The following users thanked this post: Kp91

Offline tggzzz

  • Super Contributor
  • ***
  • Posts: 22381
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Embedded system for respiratory monitoring - project review
« Reply #3 on: February 19, 2025, 08:09:25 pm »
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 it works (easy) but how it fails (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.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 
The following users thanked this post: Kp91

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 28869
  • Country: nl
    • NCT Developments
Re: Embedded system for respiratory monitoring - project review
« Reply #4 on: February 19, 2025, 10:15:39 pm »
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.
« Last Edit: February 19, 2025, 10:22:00 pm by nctnico »
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 
The following users thanked this post: Kp91

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 8155
  • Country: ca
  • Non-expert
Re: Embedded system for respiratory monitoring - project review
« Reply #5 on: February 20, 2025, 12:27:36 am »
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.

They are on the internal two layers.
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 
The following users thanked this post: Kp91

Offline Kp91Topic starter

  • Newbie
  • Posts: 7
  • Country: gb
Re: Embedded system for respiratory monitoring - project review
« Reply #6 on: February 20, 2025, 11:20:01 am »
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.

Thanks, 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.
 

Offline Kp91Topic starter

  • Newbie
  • Posts: 7
  • Country: gb
Re: Embedded system for respiratory monitoring - project review
« Reply #7 on: February 20, 2025, 11:23:49 am »
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?

The 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 :)
 

Offline Kp91Topic starter

  • Newbie
  • Posts: 7
  • Country: gb
Re: Embedded system for respiratory monitoring - project review
« Reply #8 on: February 20, 2025, 11:32:59 am »
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 it works (easy) but how it fails (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.

The 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! :)
 

Offline tggzzz

  • Super Contributor
  • ***
  • Posts: 22381
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Embedded system for respiratory monitoring - project review
« Reply #9 on: February 20, 2025, 11:41:38 am »
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 it works (easy) but how it fails (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.

The 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! :)

Good luck :)

Be aware that this is a class of devices that could indirectly kill someone even 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 & Cs :)

When, 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.
« Last Edit: February 20, 2025, 03:19:02 pm by tggzzz »
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline Kp91Topic starter

  • Newbie
  • Posts: 7
  • Country: gb
Re: Embedded system for respiratory monitoring - project review
« Reply #10 on: February 20, 2025, 01:33:26 pm »
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.

I'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.

 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 28869
  • Country: nl
    • NCT Developments
Re: Embedded system for respiratory monitoring - project review
« Reply #11 on: February 20, 2025, 11:07:28 pm »
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.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf