# Context
As India begins a protracted battle against coronavirus, one of the key issues identified is that the global supply of ventilators and spares have depleted. India, like many other countries, could face a severe shortage of the respiratory devices
At present, ventilators are mainly imported, assembled in India or partially produced here. India does not have a single indigenously manufactured ventilator as the companies that produce ventilators import some or many of their components. Although demand from the government machinery has gone up, the industry is not equipped to meet the requirement.
## [COVID-19 Disease Progression](https://git.fablabkerala.in/pub/projects/respiratory-apparatus/blob/master/COVID-19_Disease_Progression.md)
# Breath of Hope
Breath of Hope is a volunteer group building solutions with the objective of solving the potential shortage of emergency medical supplies across India. The group, supported by Kerala Startup Mission and the Super Fablab at Kochi, has social workers, doctors and engineers from different areas of expertise. One of the key projects this group is working on is to design a machine which can act as a respiratory assistant for COVID-19 patients who have trouble breathing.
## Objective
As per a report published by ICMR half of the patients at Critical Stage will need to be intubated and given mandatory ventilation, without which they cannot survive. The objective of the project is to **_design and manufacture low cost machines which can help patients with respiratory distress to continue breathing_**. The medical staff can control the volume of air and rate of breath provided by this machine to the patient. This device can also be used by patients who are in the early stages of ARDS so that their condition does not deteriorate due to lack of air supply to their lungs.
Note: This machine is not a replacement for ventilators and is intended for use only in the case of a shortage of ventilators to treat people suffering from respiratory failure due to COVID-19
## [Brief on Ventilators](https://git.fablabkerala.in/pub/projects/respiratory-apparatus/blob/master/Brief_on_Ventilators.md)
## Design Considerations
### Purpose
Breaths are classified as spontaneous or mandatory based on both the trigger and cycle events. A spontaneous breath is a breath for which the patient both triggers and cycles the breath. A spontaneous breath may be assisted or unassisted. A mandatory breath is a breath for which the machine triggers and/or cycles the breath. A mandatory breath is, by definition, assisted. A breath sequence is a particular pattern of spontaneous and/or mandatory breaths. The 3 possible breath sequences are:
* Continuous Mandatory Ventilation or CMV: patients makes no effort to breath and all breaths are mandatorily provided by the machine
* Intermittent Mandatory Ventilation or IMV: patient may take spontaneous breaths in between mandatory breaths
* Continuous Spontaneous Ventilation or CSV: all breaths are spontaneous, i.e, initiated by the patient.
The use of high-flow nasal oxygenation and mask CPAP or BiPAP should be avoided due to greater risk of aerosol generation.
The purpose of the machine is to primarily provide CSV for COVID-19 patients who have milder respiratory issues. If a shortage arises for the normal ventilators, this machine can be used to provide CMV for patients with severe respiratory distress.
### Constraints
India’s efforts to shore up manufacturing of ventilators to deal with the rapid spread of Covid-19 infections has suffered due to the absence of a local electronics components industry. The ban on international flights has made the issue worse, with manufacturers struggling to lift sensors, chips and controllers from suppliers in China. With the recent country-wide lockdown, moving material within the country is also challenging. Given the situations the following constraints have been factored into the design of the RespiratorApparatus
* Material: Easy availability of all components and material locally
* Prototyping: Design which can be prototyped in any Fab Lab across the world
* Manufacturing: Simplified processes for manufacturing at scale
### Technical Requirements
Medical staff who are treating COVID-19 patients who need ventilator support will need to adjust the following parameters:
* **Tidal Volume (Vt)**: Volume of gas exchanged with each breath. A lower Vt is indicated in patients with stiff, non-compliant lungs. Higher Vt may cause tachycardia, decreased blood pressure and lung injury. Vt is calculated as 6-8 mL/kg of ideal body weight (IBW) to prevent barotrauma.
* **Respiratory Rate (RR)** or Breaths per Minute (BPM): Set number of ventilator breaths per minute. Actual RR includes the spontaneous breaths taken by the patient. Hypoventilation may cause respiratory acidosis; hyperventilation may cause respiratory alkalosis.
* **Positive End Expiratory Pressure (PEEP)**: Pressure remaining in the lungs at end expiration. Used to keep alveoli open and “recruit” more alveoli to improve oxygenation for patients. High levels may cause barotrauma, increased intracranial pressure and decreased cardiac output. Low levels may cause the lung to collapse.
### Approach
In this situation, the quickest solution, and the most widely used solution is to create a RespiratorApparatus which can automate BVMs (Bag-Valve-Mask). A Bag Valve Mask (BVM), sometimes known by the proprietary name Ambu bag or generically as a manual resuscitator or "self-inflating bag", is a hand-held device commonly used to provide positive pressure ventilation to patients who are not breathing or not breathing adequately. The device is a required part of resuscitation kits for trained professionals in out-of-hospital settings (such as ambulance crews) and is also frequently used in hospitals as part of standard equipment found on a crash cart, in emergency rooms or other critical care settings.
While it is possible to use this bag manually only for short periods on patients who need respiratory support, the RespiratorApparatus automates the use of the bag for respiratory support for longer durations. Unlike manual pumping of BVMs by paramedical staff, electronic circuits and software in the RespiratorApparatus also allow precise control of the pressing so that the doctors can set the Tidal Volume and Respiration Rate (Breaths per Minute) as per the condition of the patient.
Ambu Bags or BVMs come with PEEP valve connectors, for maintaining the positive airway pressure maintenance and a pressure relief valve (often known as a "pop-up valve"), the purpose of which is to prevent accidental over-pressurization of the lungs. These safety features make use of Ambu Bags ideal for the current scenario faced by the country today.
### Project Status
The working prototype is ready after preliminary tests with a test lung. The current features include the ability to control the Tidal Volume, Breaths per Minute and PEEP.
The team is currently converting the design into a manufacturable version that can be taken to production by industries.
# Solution
## Mechanical Design
#### Common problems assosiated with Ambu Bag Automation devices
**1. Life of Ambu bag (BVM)**
- Bag Valve masks are designed to be used for a short time like in an emergency or when moving the patient. They are not designed for continous operation over long periods. We might get a few hundred thousand cycles of operation before it fails completely. The average time of a pateient in the hospital is about 14 days, of that he amy need ventilation for about 7-10 days. A 20bpm rate equals 1,200 cycles an hour and 28,800 cycles a day.
*Possible Solution* - Using good quality bags, and stress releiving all the hoses in the breathing circuit can help increase the life of the bag. The machine should also not put too much pressure on one part of the bag.
**2. Mechanism of Actuation**
- Many creative designs for actuating Ambu bags have come up lately, a few ground principles are, use mechanisms and materials that are simple and robust. If we are really trusting the health of a patient using the device, we don't want our Hobby servo's to fail or our Rasberry Pi's freezing. A minimalist approach, means less things to break. Keep in mind the million of cycles it has to work continously.
- Ventilation is not a fixed state, the parameters of opeartion need to be continously adjusted, so strict CAM based mechanism with only one setting cannot be used in a live setting. The compression of the Ambu bag must be controlled, both position and velocity.
- Steppers make for excellet open loop controls, but care must be taken so that acompaniying electronics are robust and can survive the continous use.
- Mechanisms with lots of moving components are troublesome as, it is only as strong as the weakest link.
*Possible Solution* - Using industrial grade components that are rated for continous operation are a good starting point. In our mechanism, we choose a Car wiper motor, as they are simple and rated for 3-5 million cycles of operation, but there is a problem that it is not backdrivable.
**3. Dead space in the Breathing circuit**
- All BVM based designs suffer from a common problem, their limited Tidal volumes,they are designed to be used at or near the patients mouth, if we connect an Ambu bag based machine with a long tube to the patient, there is a serious problem called 'Dead space' in which the patient breaths in the same air that was expelled, for a 1m tube, this might be as big as 300ml.
*Possible Solution* -One way to solve it is to keep exhaust valve as close to patient as possible. Another way is to use a dual limb ciruit made out of two **'Y-connectors'** the Y- connectors have one way valves in them. this means the BVM constantly delivers air to the patient using one tube and the exhaust tube is fed via another Y-connetor to the 'Peep' valve.
**4. Measuring Pressure in the breathing circuit**
- There is host of ventilator induced injury of which Barotrauma is a main concern, we cannot raisethe pressure in the sytem beyond a certain value, most comonly 40CmH20. Provisions must be made to measure the pressure and to ensure that the system does not over pressure the lung.
- To main pressures, we need ot measure and display are, Peak inspiratory pressure and Plateau pressure.
- Peak inspiratory pressure is the max pressure reached in the inspiration cycle. Plateau pressure is the pressure in the circuit when the inspiration has finished. They both are vital sources of information indicating the state of the patient.
**5. Filtration of exhaust**
- Due to the contagious nature of COVID 19, filtration of the breathing circuit and exhaust is highly recomended. Using a HEPA filter near to the patient is recomended to keep the system and exhaust free from containation.
**Note 1-** We have seen some designs online, which have wide plates and compress the Ambu Bag fully. From our testing, we found that this may not be the best approach. The Ambu bag has a cylindrical middle section where the bag can be depressed. There are two ring like structures which holds the bag's shape and help it return to bak to the original position. When the whole bagis compressed, the ring structures wil get fatigued and the bag will fail to return to its original shape, this is prominent at higher bredths per minutes, and tidal volumes.
Hence we opted to model our mechanism after the human hand, with the thumb being the arm that the machine moves. The bag is supported in a convex shape by the base structure. Though this does create two concentration points on the bag, we believe this will be a better approach for the life of the bag.
### Version 3 with Clamp type Arm, DC WormGear Motor, feedback sensors and enclosure
###

###

###

### Design considerations
* The use of an optical encoder as a deedback device is explored as they are more reliable than Mechanical encoders.
* The encoder disc is made from laser cut 3mm Acrylic sheets and attached to the arm.
* Al limit switch is provided at the end of the arm to set the home position which can be replaced by an optical limit switch later .
* The enclosure is designed in a minimal way to make the unit compact and to make room for all the electronics.
* The side walls of the enclosure support the Ambu Bag and makes it easy to remove and replace bags in use.
* The user interface must be easy to use, and quickly accessible. Safety switch is also provided in case the arm needs to be moved back to remove the bag in an emergency.
* The interface consists of an LCD with a rotary selector switch to set the Tidal volume, Breath rate etc.
* The machine operates on 12V and is controlled by a general purpose Arduino Mega board.
### Test Build
The body is made by laser cutting 6mm Acrylic sheets press-fit together to make the structure. The knob for adjusting the menu selection is made by 3D printing. The Mechanical assembly of moving the arm and motor is fitted inside the enclosure to provide a clean working machine.
[Here is the link to working video](https://twitter.com/Fablab_Kerala/status/1244627769163538433)
### Learnings
* The design is a viable option, the tidal volume of the bag can be controlled using the position of the arm and the setting can be changed using the rotary selector and LCD display.
* The use of an incremental encoder has advantages and disadvantages, it is reliable but the resolution is limited as we can achieve a maximum of 30 points for the range of motion of the arm, this makes the control algorithm difficult.
* A limit switch is provided as a safety feature as well as a reference point, since we are using an incremental encoder, there is no absolute position of the arm.
* The enclosure provides some stability to the Ambu bag and helps in keeping all the electronics contained within the machine.
## Electronics design
**Design Constraints**
* The design should be very simple.
* It should be easy to replicate .
* Components should be locally available .
* It should be reliable and capable of working for long time.
* Everything should be electronically adjustable.
* The device should be a stand alone device .
Based on the above constraints we have figured out some mechanism .
**Actuation options available**
* **Pneumatic supply and solenoid valves**
* Opportunities
* Easy to implement, small number of moving parts.
* Reliable and proven technologies.
* Suitable if compressed air supply is available.
* Challenges
* Size of the machine will increase.
* Compressed air required .
* Decision made
* Difficult to implement as a stand alone device (difficult to source small pneumatic pumps/actuators.
* Decided to try later after completing a stand alone ventilator.
* **Stepper motor with homing switch**
* Opportunities
* Steppers could be controlled in an open loop(No position feedback required).
* Easy to control velocity and position.
* Challenges
* If the torque exceed holding torque chances of missed steps are high
* Additional torque multiplication mechanisms are required
* Can’t ensure the availability of motors and drivers for mass production
* Higher torque motors are costly and difficult to source.
* Decision made
* We tried two designs with stepper motors one of them was successful.
* While considered the foam factor, torque to weight ratio and complexity of mechanical structure required - we considered it as a second choice.
* **Stepper with feedback and homing**
* Opportunities
* To avoid missing steps, we can use an encoder along with the stepper.
* Challenges
* Cost and complexity increases.
* **DC motor with potentiometer feedback (DC Servo)**
* Opportunities
* Absolute position feedback of the arm at all points.
* Easy to implement and control.
* DC geared motors have sufficient torque and low cost.
* Challenges
* Due to continuous operations over a small range of motion, potentiometers may get damaged.
* Decision made
* Completed a prototype but later moved on due to the potentiometer issue
* **Worm gear DC motor with incremental encoder and homing switch**
* Opportunities
* Can replace the potentiometer with an optical limit switch and a laser cut encoder disk and an extra optical limit switch for homing.
* optical limit switches are cheap and encoder disks could be laser cut easily
* Challenges
* Incremental encoders are relative and cannot give exact location.
* Problems when the motor is loaded and the position is in between optical disks
* Decision made
* A limit switch with incremental encoder has been tried successfully, with some room for improvement that can be explored further.

Block Diagram
## Software design
**Requirements**
* Accurate control of angle and angular velocity of the arm
* The software should dynamically control the torque to match the velocity .
* An LCD user interface for controlling parameters
* The program should update the values from the user interface to the motor control algorithm
**Inputs to the controller**
* Motor control
* A limit switch (optical prefered) for homing the motor.
* An optical encoder for measuring position increment of the arm.
* User interface
* An emergency stop switch for the arm to access the ambu bag in case of an emergency.
* A rotary encoder to incense or decrease control parameters.
* Rotary encoder switch for selecting between options.
**Output from the controller**
* Motor control
* Control outputs to the motor driver
* Motor terminal 1 direction(0 or 1)
* Motor terminal 2 direction(0 or 1)
* PWM signal to control motor speed
* User interface
* LCD control
* Update control parameters
**Interrupts Required**
* External interrupt 1 - optical encoder
* To measure the state change of optical position encoder - this will update the current address of the arm with respect to the homing position
* External interrupt 2 - UI rotary encoder switch
* Changes the parameter screens in the lcd.
* External interrupt 3 - UI rotary encoder
* Changes the parameter values (increase or decrease)
* Timer interrupt
* Update the PID values for motor control.
**Software Control Flow**

**Wiring diagram**

### Bill of Materials (BOM)
Sl No | Item | Qty |
1 | Windshield wiper motor (Lucas-TVS, Part No-26071041) | 1 |
2 | Arduino Mega 2560 | 1 |
3 | L298N Motor Driver | 1 |
4 | IR Optical Encoder | 1 |
5 | Micro Limit Switch | 1 |
6 | 20x4 LCD screen (i2c) | 1 |
7 | SPST Switch (or any on/off switch) | 1 |
8 | Rotary encoder - Mechanical incremental | 1 |
9 | 12V to 5V Voltage regulator | 1 |
10 | 12V 5A power supply | 1 |
11 | M5x20 SHCS t, Washers | 1 |
12 | M3x15 SHCS | 10 |
13 | 3mm,6mm Acrylic sheets | 3 Sqft |
14 | 10mm Delrin sheet | 2 Sqft |