Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login
MakAir: Covid-19 ventilator with a Raspberry Pi (blog.senx.io) similar stories update story
95.0 points by mtmail | karma 10094 | avg karma 1.54 2021-01-07 12:34:32+00:00 | hide | past | favorite | 65 comments



view as:


You can also find the project on GitHub: https://github.com/makers-for-life/makair

=> HN effect, the server is sloooow. Sorry.

Pierre, the author of this article.


Great work. I am a big fan of Raspberry pi. For hospital environment does raspberry pi have the reliability, stability and durability for health use case for real life environments?

it will be so budget friendly, i am sure many hospitals in the world can use it...


My initial reaction was to say that there is no way the RPi would be reliable enough for clinical purposes. However, from the schematics, it looks like the RPi is only used for displaying the airflow curves and not used to control the ventilating. A microcontroller is used for that critical function.

If this is the case, then this would make the reliability much better and there is a chance it could be useful to many places. If the SD card on the Pi dies (which, if they are logging the data to SD and not RAM, is a likely event), then they can have spare SDs available as part of the standard operating procedure. It's not ideal, but so long as the main microcontroller is functioning, the display could be considered non-critical. Although, ICU staff might disagree...


It's why there is a second board to handle critical tasks: https://news.ycombinator.com/item?id=25671318

If I could ask -- I saw a LoRA circuit mentioned in the schematics... what is that used for?

Good question! The plan was to use it for the central alarm room in temporary hospitals where no network exists.

We planned to develop a small gateway to gather all the devices alarms, linked to bed number. It was not developed, but hardware has the feature.

The LoRa fairness will allow very few data to come up, but high level alarms vital could be transmitted several times in a second if needed.

We know we cannot use it to transfer waveforms of course.


Short answer is no, I don't trust Rpi for vital tasks.

Long answer : In this project, Raspberry is used to display curves and set some parameters. The core (ventilator algorithm) is implemented on the STM32F411, there is just a serial link in-between.

The STM32 also monitor the Raspberry... If there is no heartbeat on the serial link, the STM32 shuts down the power supply of the raspberry, and ventilation goes on.

The fact is that it never happens yet during our tests (4 months uptime now for some devices). The ArchLinux is restricted to the bare minimum, and the Rust app do not overheat the CPU. Is it by chance, or not ? Before any MTBF conclusion, you need thousands of units running during months...

On another project of medical datalogger, I also put a little arduino as hardware watchdog. If no heartbeat of the main application, it just resets the Rpi.

I also use industrial SD card, which are far more reliable and provide SMART informations. See another article on this subject: https://blog.senx.io/a-10-year-warranty-thanks-to-iot/


This is good systems design. I've made a system with a similar design (RPI for display and UI, one STM32 for hardware control, another as watchdog) for an industrial marking system, and it's run almost daily for 3 years without any issues.

The great thing about the Pi in this case is that it's non-critical, and if it ever does die, you spend $35 and put in a new SD card.


As soon as ANSM (french equivalent of US FDA) hears "linux", "wifi", "connected", they see a scary green monster...

And to be honnest, I understand their point. How can you certify Linux ? So much code behind... It is not a car multimedia center, it is a ventilator, a class III vital device.

In this project, what was really impressive is the gap between the bare minimum (a 4 lines lcd screen + a few buttons + a pressure sensor, and you can make people breath), and the doctors expectations (curves, flow meters, statistics, O2 sensors...).

This is the same for lots of activity: experts cannot work with basic tools anymore. Only High level experts still can.

Conclusion: do not work with high level experts to build your specifications. Also listen to normal experts and doctors that needs more UX assistance.


Thank you for this valuable insight.

Do you think relying on something like a hospital-provided tablet would have worked? Was this considered?

I mean, having that many screens may be a bit redundant, if you can have a single high-quality one. That said, I understand it introduces some complexity due to wireless protocols, paring with the right ventilator, etc.


You're welcome.

In our initial requirement list, it was designed to be used in temporary hospitals (any public hall for example).

Screen convergence is not for now in hospitals. Behind one sensor, there is one company that sells its monitor with the sensor. Some old well known sensors now converge to one monitor (philips, edwards life science...), but there is a still one screen for every other functions.

Gathering data (when the constructor made it available) is a mess... look at HL7 specs! To build a medical datalogger, you sometimes must interface to an analog output (it is part of my job).

By the way, most monitors runs windows CE behind. Which is also a problem now: https://www.integrasources.com/blog/windows-ce-end-of-life-m...


I assume when you refer to 'serial link' you mean that you are using Rpi UART interface to communicate with the STM32.

I can see the convenience of using UART but as a very cautionary advice, hospital environments are electrically quite harsh in terms of EM noise. A serial line even a short one can absolutely suffer from interference.

You already made it relatively fail-safe with the heartbeat/watchdog but please consider upgrading your design to use comms with a differential signal, anything like CAN or even RS-485 in that Rpi/STM32 link would be a significant improvement.


I'll be very happy for my industrial projects if BCM2711 come with CAN or RS485 built-in, but for the moment, there is nothing planned by Raspberry...

A low speed 115200 baud link does the job, with applicative CRC on both side to be sure there is no corruption.

My method to test communication robustness: I inject pulses through a capacitor directly on the UART lines. I did it on this project, no problem. The four bytes CRC32 prevents random EM noise errors.

STM32 telemetry code is here:

https://github.com/makers-for-life/makair-firmware/blob/mast...

Pierre, author of the article.


If your embedded stack supports USB you could use CDC ACM for possibly more robust comms (checksummed by USB, no need for RTS/CTS).

Also there are CAN hats for rPi (SPI) or USB<->CAN bridges (using slcan protocol and Linux driver).


I think the problem OP is referring to is that if you were proposing this design for a approved medical device for use in say US & EU, you might have trouble passing e.g. 60601 because of the communication channel. I haven't looked over the design in detail but EMI etc. can be quite tricky to manage in this sort of device.

You're right. We will see. EMC tests are part of our program.

Are you working with a test house? They can really help pin down issues quickly.

Sounds like a fun project!


Yes we are :) The first days were fun. Then the french government pushed the project. Challenging, crazy, but exhausting. 25 days without coming back home! Then the lockdown did the job, and the project was not so urgent, so the ANSM (french equivalent of US FDA) was not so in a hurry. And now it seems to take ages for us between two administrative steps, but it is still fast for ANSM. Development of a ventilator take normally a few years!

Good stuff! Device projects typically take a while. Industry average for a device like this is something like 3-5 years start to finish, so you are right it's pretty quick (although other ventilator efforts have been similarly fast - it's almost like there was extraordinary motivation).

I've seen 18 months before, but that was primarily software. I think the FDA clock on evaluation is 120 days now, that's after all the i's are dotted and t's crossed. EU MDD/MDR is similar, iirc.

Congrats on getting something together quickly!


Why use the Rpi at all (Nothing against them, I have a few)? If the Pi is just writing graphics to a screen, why not handle that directly with the STM32? Running an RTOS, it should be able to manage a low priority GUI task along with the real-time ventilator tasks.

there’s no guarantee in linux when or if your code will execute. it works well for consumer apps but you can’t use linux eg to pilot an airplane or for life support

It's why there is a second board to handle critical tasks: https://news.ycombinator.com/item?id=25671318

I thought everyone decided we didn't need a vast number of ventilators like we thought we would? There was a huge panic for a week last March and a lot of random companies were going to be making them, then it just seemed to go away.

Does anyone know if we managed to ramp up normal production or there was some other reason it stopped being an issue? Or maybe the issue didn't go away just the media coverage and they're still trying to use ad-hoc ventilators?


GM contracted with one or more actual medical device companies to produce ventilators under the DPA. So yes we needed ventilators, but we produced a ton of them to fulfill that need.

To be even-handed, both Ford and GM produced ventilators.

I've heard directly from doctors that the entire ventilator thing was a huge mistake and ended up causing more death. Treatment is now more focused on statins. The covid shell is basically in your blood clotting everything up - it's a huge ass fat cell that is killing people. Take aspirin.

Also help your immune system before and after you get covid by taking Vitamin D, E, K, A, C and Magnesium (helps with D intake issues).


I'd love some articles that back this up - I've seen low Vitamin D be mentioned as a comorbidity, but I don't think generic advice on vitamins and taking aspirin is that useful without any sort of evidence.


While on the whole you are completely correct, it's worth remembering that the risks associated with taking recommend doses of vitamins are negligible.

The only plausible confounding factor is people behaving less responsibility in the belief that they are somehow safe. On a personal level, try not to do that.


This is great advice. If you have a chance to get the vaccine, that's the best option. But keep wearing masks, and try to not get the virus in any ways you can. Vitamins are basically boosting your immune system, and as a bonus there are studies that back up that it actually helps in some cases 77% better outcomes (potentially more). That doesn't mean you can't die from covid even if you're taking these vitamins (as well as with the vaccine).

Yeah, vitamins I understand, but Aspirin has negative effects with constant long term use. I'm just not comfortable with those recommendations without any effort to support.


As far as I understood doctors, in march there was no guidelines for the disease. It was considered as a respiratory disease.

Later on, it was requalified as a vascular disease, scientists looked at cytokines / interleukin (I AM A ELECTRONIC ENGINEER, please correct me doctors).

Now, there is some systematic treatments earlier (https://jamanetwork.com/journals/jama/fullarticle/2770275), so yes, far fewer patients needs an invasive ventilator.

And that is great.


The ventilators were a death sentence. Many of the people who died early on, died not due to COVID, but due to their lungs getting damaged by high pressure vents. Some were kept on high pressure for much longer than is normal.

There was a lot of bad advice coming from doctors in Europe, and also there was the idea if you had them on a vent, they were on a closed air system and couldn't spread COVID in the hospital. This was disastrous.

Doctors do not use them unless necessary today, but it's no doubt this is why many of the early death counts, especially among younger people, was so high in places with high vent use.


Can you cite anything on this? I've heard it claimed before but haven't seen a primary source.

Could you please share any sources? I know they're not used as much now but haven't seen any evidence that they are specifically to blame for deaths.

The majority conclusion I've seen in Europe about why earlier death rates were so high in some places was that the hospitals were overloaded and therefore didn't have enough capacity (staff, equipment, etc) and therefore some died due to there not being enough ventilators.

This isn't my field of expertise so I'm very open to finding out that my impression is wrong, but my gut feeling is that your comment is not accurate.


I don't have any sources at hand, but the explanation I heard is that ventilators are generally used for people who have healthy lung tissue but are unable to breathe properly.

Coronavirus weakens the lung tissue, but the ability to breathe (inhale / exhale) is unaffected.

Basically the body was forcing people to have shallow breath to preserve the damaged lung tissue and allow it to recover. The ventilator essentially restored their breathing back to full force, which turned people's lungs into soup basically.

Makes sense as an explanation to me, but like I said, I don't have any official sources for that.


People are not put on ventilators for no reason. They are put because their oxygen level is so level that they will die if it deteriorates. People ended up on ventilators after they received maximum possible level of supplementary oxygen.

This explanation sounds very implausible and simplistic. When a person has extremely low oxygen level and you are giving them maximum oxygen possible, what can you do? Ventilator or ECMO (which is probably even more dangerous).


This [1] seems to be a fairly representative article of the sort of thing I've seen. Not peer reviewed, but it hardly seems like fringe lunacy.

[1] https://elemental.medium.com/how-one-covid-19-doctor-became-...


Can you provide a source that wasn't written by a (checks notes) magician?

I don't particularly care about the topic, so no.

Not an expert, but as far as I understand with COVID people were not in major distress breathing even with very poor O sats, which is confusing.

The standard was to move people with terrible O2 sats at the start of the outbreak to ventilation immedatley, even if they did not seem to bad.

That seems to be replaced with providing high levels of O2/CPAP and only moving people to ventilation when that is not sufficient, even if O2 sats would normally indicate ventilation. This is why vent usage is a lot lower this second time round, even with more patients in hopsital.


I am not an expert either.

I would be surprised if they put someone on a ventilator just because his O2 level was low without first putting him on O2 and maxing out the flow. Little experience that I do have is that people are first put on O2, then if their saturation remains low they increase the flow until they can increase no more. At that moment they are a candidate for a ventilator.

Maybe they "relaxed" the criteria after a while if ventilators showed bad outcomes but when people are maxed out on O2, there is little you can do.


Conclusions: The incidence of [ventilator-associated lower respiratory tract infections (VA-LRTI)] is significantly higher in patients with SARS-CoV-2 infection, as compared to patients with influenza pneumonia, or no viral infection after statistical adjustment, but residual confounding may still play a role in the effect estimates.

https://pubmed.ncbi.nlm.nih.gov/33388794/

https://pubmed.ncbi.nlm.nih.gov/?term=ventilator+covid19&fil...


This is interesting, however, if I had covid and knew I was going to soon be on a ventilator. I'd much rather overdose on morphine or kill myself than rely on a raspberry pi based ventilator.

Yeah, the title is misguided, it is not the whole story : https://news.ycombinator.com/item?id=25671318

(And as much as I hate the Pi's reliability, I'd still take that bet if it was indeed relying on a Pi).


Hello! I work on this project.

Don't worry, the breathing system does not rely on the Rasberry at all.

We use an electronic board that was made on purpose by a Medical company and relies on STM32 hardware.

This board sends telemetry to the Rasberry PI and we have a Rust based interface that shows charts and some controls.

If the Raspberry fails, the Firmware still run fine, and you can still change the settings on the machine using physical buttons and a LCD screen that is directly connected to the firmware


A good friend of mine had the experience of nearly dying after a mobile ventilator in an ambulance failed after he was involved in a serious car accident. It was later found that the ambulance operator was using devices that hadn't been cleared by the FDA yet. Although they came from a Turkish "medical device" company, they were not cleared for use in the US and left my friend with brain damage and PTSD.

I don't care that the hardware involved in your project was "made be a medical company", it's not hardened tech. Also, rust is by no means hardened - look into "provably complete" languages if you want to see what a true "hardened" lang is. There's a reason why medical devices and serious "hardened" tech (military or otherwise) is validated and cost tens if not hundreds of thousands of dollars. It's because teams of engineers spent weeks or years coming up with every possible problem or failure pattern.

To be frank, I'd rather pay a nurse $50k in cash to pump a vent bag next to me than rely on your "project".


While I don't disagree with your overall sentiment (I can't imagine relying on a RPi powered device -- even if it is just a display -- for clinical use), I think you're overthinking the motivation here...

> To be frank, I'd rather pay a nurse $50k in cash to pump a vent bag next to me than rely on your "project".

From what I've read (admittedly not much) -- this project isn't trying to disrupt the ventilator industry or make a bunch of sales. It isn't designed to give you a choice of a ventilator to remove a nurse. It's for situations when you don't have another choice... for when a hospital has run out of proper ventilators or there isn't a nurse available. This is not a first-choice device (even if it could be adapted to that in the future).


I agree that this project can be incredibly dangerous if people try to sell them in countries with well-developed, well-tested systems of healthcare.

However, billions of people don't have the luxury of tested and verified medical devices. The price of a single machine might be close to the monthly budget of the entire hospital. In those cases, any small hacks are welcome if they can help save a patient's life. A crappy, half-decent ventilator is way better than no ventilator at all. Until rich countries start buying hospital devices for poor countries en masse, providing cheap alternatives to proper medical devices can save lives.

The company behind this seems to be French and if it ever gets used in France without certification then they've probably got a huge lawsuit and potential criminal liability on their hands.

According to the project's website, they are trying to comply with European medical regulation (if Google translate got that right) and their Github mentions they're working with regulators. This isn't a hobby project by a bunch of bored students, the project seems to be a proper attempt at making capable medical devices that can be extended upon without IP problems.


To be frank, more people would be saved with fallible yet cheap medical hardware than 'proven correct' hardware that costs $100,000 plus.

Sorry for your friend.

Problem with vent bag is that you cannot maintain a positive expiratory pressure (around 10mmHg of pressure during the expiration to prevent lung to collapse alveoli). For Covid-19, all the projects based on mechanized vent bag where useless because of the type of disease.

There are several companies behind the project. The company who makes the electronics is Tronico (https://www.tronico-alcen.com/en/markets/medical). It has all the medical certifications needed.

We are currently going on with ANSM certification (equivalent of US FDA). It is a long 2 years way, with lots of papers and tests... If it is approved, sure it can save life everywhere in the world. If it is not, it was a project where we learned a lot.

By the way, ambulance ventilators are harder to develop and to approve. Hardware must resist huge shocks and accelerations.

As said previously, the Rpi part and the software is not critical at all, it is here to fill a gap between the minimal UX and the expected UX. See https://news.ycombinator.com/item?id=25671617 and https://news.ycombinator.com/item?id=25671318.


> If it is approved, sure it can save life everywhere in the world.

It's worth noting that mostly regulatory approval is jurisdiction specific, so the device will need to be separately approved by a bunch of different bodies. ANSM is the french local body, but it is EU MDR you probably have to meet; this at least gets you the EU countries but for example will allow your device to be used in the USA, you would still need FDA there. Some jurisdictions, particularly smaller ones, will rubber stamp things if you have the right approvals but it's still finicky and of course with a physical device you have to deal with things like different power standards.

The approaches are similar but annoyingly different enough that this isn't easy. Luckily they are both reliant on ISO13485 at core, so there is overlap. It's not just paperwork either, you can definitely design something that will not pass in another jurisdiction if you aren't careful (e.g. due to materials used). Further, you need separate certification to a standard as both a manufacturer and developer, and these don't carry over automatically either.

People are working on making this easier to do worldwide, but it still isn't easy. For example you can use MDSAP to get a regulatory audit that meets multiple countries requirements at once.


How big portion of these approvals is to have right people to get paid and to actually make sure the product is safe? We're the any "blunders" like with Boeing?

Fwiw in my experience, a huge portion. Not that the system is perfect, but it’s trying to do the right things.

There is many STM32 cpus, which ones are designed for use in life support applications?

You'd be fine, most patients on ventilators are AFAIK heavily sedated anyway. So don't overdose yourself, please

When hospitals reach critical levels of occupancy or patients that are "near death" the option of a terminal morphine drip is more common than you'd think. However, I feel it's important to mention that anyone who wants decent medical care while alive should never arrange a DNR. There's actually clinical evidence to suggest that a DNR can actually markedly lower your level of care in a hospital or ICU [0]

0 - https://pubmed.ncbi.nlm.nih.gov/10448716/


That's fair for you individually. For a lot of people, "I'd rather try to live than die" is a much more realistic viewpoint.

If there was nothing else available, I'd surely pick a chance of survival while connected to a Pi-based ventilator than zero chance of survival.

Note: the project was started during the first lockdown by the staff of Clever Cloud [1], a French PaaS based in Nantes.

[1] https://clever-cloud.com


Legal | privacy