jcl5m1 / ventilator

Low-Cost Open Source Ventilator or PAPR
MIT License
1.66k stars 236 forks source link

Basic pump / inflator use :why not? #62

Open fredohmygod opened 4 years ago

fredohmygod commented 4 years ago

What about using a basic pump like the one on amazon proposed in the read me ? Has someone tried ? Any help with which Arduino extension card to purchase to pilot such a motor?

Pinponcito commented 4 years ago

Yes my friend you are rigth, and thanks for excelent video, but the video show using arduino Uno, I have arduino Nano V3.0 and sketch arduino from @adamcullen project.

thanks for help to make my project cut work.

BLDC is brushless 3 phase, L298N is brushed DC, diagram attached. The full video is here. L298N

Pinponcito commented 4 years ago

no voltage in arduino nano 3.0 and L298N, using the diagram from adamcullen

any idea?

Yes my friend you are rigth, and thanks for excelent video, but the video show using arduino Uno, I have arduino Nano V3.0 and sketch arduino from @adamcullen project.

thanks for help to make my project cut work.

BLDC is brushless 3 phase, L298N is brushed DC, diagram attached. The full video is here. L298N

adamcullen commented 4 years ago

no voltage in arduino nano 3.0 and L298N, using the diagram from adamcullen

any idea?

My advice is to just start with your arduino and the L298N board. If you have a small 12v motor, just wire up one of the motor outs to it and see if you can just control one small motor. if you dont have a motor, a voltmeter or even a 12v light would help fault find. What you are aiming for is to see if you can control the voltage from one of the motor outputs to make it different from the 12v in. You can run a code that just goes High Low High Low on the pin 9 output and see if you can see a change in voltage at the motor output terminals. Once you can do that, you can then try bridging both sides of the L298N so that the voltage at motor 1 and motor 2 is the same and changes at the same time with your code.

Have a look at this video: https://www.youtube.com/watch?v=wjFW-TNq8Og and this how to: https://howtomechatronics.com/tutorials/arduino/arduino-dc-motor-control-tutorial-l298n-pwm-h-bridge/

Pinponcito commented 4 years ago

Thanks my friend, the setup and sketch mots have the 4 potentiometter? or can run with out them, I Mean not exist a sketch that can changue the speed (simulation breath ) with out use potentiometer

thaking the exaple from sketch of Johnny Lee @jcl5m1

https://github.com/jcl5m1/ventilator/blob/master/ventilator_control/ventilator_control.ino

thanks Adam

no voltage in arduino nano 3.0 and L298N, using the diagram from adamcullen any idea?

My advice is to just start with your arduino and the L298N board. If you have a small 12v motor, just wire up one of the motor outs to it and see if you can just control one small motor. if you dont have a motor, a voltmeter or even a 12v light would help fault find. What you are aiming for is to see if you can control the voltage from one of the motor outputs to make it different from the 12v in. You can run a code that just goes High Low High Low on the pin 9 output and see if you can see a change in voltage at the motor output terminals. Once you can do that, you can then try bridging both sides of the L298N so that the voltage at motor 1 and motor 2 is the same and changes at the same time with your code.

Have a look at this video: https://www.youtube.com/watch?v=wjFW-TNq8Og and this how to: https://howtomechatronics.com/tutorials/arduino/arduino-dc-motor-control-tutorial-l298n-pwm-h-bridge/

adamcullen commented 4 years ago

Thanks my friend, the setup and sketch mots have the 4 potentiometter? or can run with out them, I Mean not exist a sketch that can changue the speed (simulation breath ) with out use potentiometer

thaking the exaple from sketch of Johnny Lee @jcl5m1

https://github.com/jcl5m1/ventilator/blob/master/ventilator_control/ventilator_control.ino

Try this. I've just hard coded values in my original sketch where the analog read would be to simulate values it would read from the variable pots. It should breath in for about 2 seconds at full power, then breath out for about 1 second at half power. This should get you started.

int breath = 1;

void setup() {
  Serial.begin(9600);
  pinMode(9, OUTPUT);
}

void loop() {
  int inP = 1028; // was: analogRead(A0); // pot 1 - in breath pressure
  int outP = 512; // was: analogRead(A1); // pot 2 - out breath pressure
  int inT = 512; // was: analogRead(A3); // pot 3 - in breath time
  int outT = 256; // was: analogRead(A2); // pot 4 - out breath time

  int inP_v = round(inP/100)*25.5;  // take the value from the pot, divide by 100 and round, then multiply by 25.5 so the output value is a multiple of 255
  int outP_v = round(outP/100)*25.5;  // take the value from the pot, divide by 100 and round, then multiply by 25.5 so the output value is a multiple of 255
  int inT_v = round(inT/100)*400;  // take the value from the pot, divide by 100 and round, then multiply by 400 to get a proportion of 4000ms
  int outT_v = round(outT/100)*400;  // take the value from the pot, divide by 100 and round, then multiply by 400 to get a proportion of 4000ms

  if (breath !=0) {breath = 0;}
    else breath = 1;

  switch (breath) {
    case 0:
      Serial.print("Breath In. Pressure: "); Serial.print(inP_v); 
      Serial.print(". In Time: "); Serial.print(inT_v); Serial.println("ms.");
      analogWrite(9, inP_v);
      delay(inT_v);
      break;

    case 1:
      Serial.print("Breath Out. Pressure: "); Serial.print(outP_v); 
      Serial.print(". Out Time: "); Serial.print(outT_v); Serial.println("ms.");
      analogWrite(9, outP_v);
      delay(outT_v);
      break;
  }
}

With wiring like this.

https://user-images.githubusercontent.com/23371950/78415437-69fe2e80-766d-11ea-85b1-486723096fc9.JPG

Pinponcito commented 4 years ago

Excellent Adam I wil try. in my case Im using a arduino nano V3.0 the wiring are sames pines? thanks for time to help me on my proyect

Thanks my friend, the setup and sketch mots have the 4 potentiometter? or can run with out them, I Mean not exist a sketch that can changue the speed (simulation breath ) with out use potentiometer thaking the exaple from sketch of Johnny Lee @jcl5m1 https://github.com/jcl5m1/ventilator/blob/master/ventilator_control/ventilator_control.ino

Try this. I've just hard coded values in my original sketch where the analog read would be to simulate values it would read from the variable pots. It should breath in for about 2 seconds at full power, then breath out for about 1 second at half power. This should get you started.

int breath = 1;

void setup() {
  Serial.begin(9600);
  pinMode(9, OUTPUT);
}

void loop() {
  int inP = 1028; // was: analogRead(A0); // pot 1 - in breath pressure
  int outP = 512; // was: analogRead(A1); // pot 2 - out breath pressure
  int inT = 512; // was: analogRead(A3); // pot 3 - in breath time
  int outT = 256; // was: analogRead(A2); // pot 4 - out breath time

  int inP_v = round(inP/100)*25.5;  // take the value from the pot, divide by 100 and round, then multiply by 25.5 so the output value is a multiple of 255
  int outP_v = round(outP/100)*25.5;  // take the value from the pot, divide by 100 and round, then multiply by 25.5 so the output value is a multiple of 255
  int inT_v = round(inT/100)*400;  // take the value from the pot, divide by 100 and round, then multiply by 400 to get a proportion of 4000ms
  int outT_v = round(outT/100)*400;  // take the value from the pot, divide by 100 and round, then multiply by 400 to get a proportion of 4000ms

  if (breath !=0) {breath = 0;}
    else breath = 1;

  switch (breath) {
    case 0:
      Serial.print("Breath In. Pressure: "); Serial.print(inP_v); 
      Serial.print(". In Time: "); Serial.print(inT_v); Serial.println("ms.");
      analogWrite(9, inP_v);
      delay(inT_v);
      break;

    case 1:
      Serial.print("Breath Out. Pressure: "); Serial.print(outP_v); 
      Serial.print(". Out Time: "); Serial.print(outT_v); Serial.println("ms.");
      analogWrite(9, outP_v);
      delay(outT_v);
      break;
  }
}

With wiring like this.

https://user-images.githubusercontent.com/23371950/78415437-69fe2e80-766d-11ea-85b1-486723096fc9.JPG

adamcullen commented 4 years ago

Excellent Adam I wil try. in my case Im using a arduino nano V3.0 the wiring are sames pines? thanks for time to help me on my proyect

Ricardo, you should be able to use my sketch with an arduino nano. Use the same wiring and the same sketch. You just need to select the nano from the boards manager.

timhurdle commented 4 years ago

Hi All, I have been working on a similar device in the UK. I tried to engage with the One Million Ventilators Group with not much response. I am still working on it anyway but been considering that carbon and copper particles from the motor can contaminate the air as there is deliberate low pressure pull through the motor core through the backplate of the impeller rotor (for cooling). Also I heard that brushless motors are needed as 03 (ozone) can be generated by sparks from brush commutation. I think the voltage are too low for that but I have come up with a possible solution if anyone is interested.

brian-mckeon commented 4 years ago

Hi Tim, have a look back at my post on Apr 11. I was also concerned about ozone. However I found that the motor cooling airflow in this mattress inflator seemed to be bled off the output pressure side and then out the vents below the motor. A bit different to vacuum cleaners etc but makes sense as the small motor ducts could often be facing a dirt campground and you wouldn't want to be drawing cooling air in from there. I used deflection of a small piece of paper to try and determine airflow and it seemed to be exiting these vents. Let me know if you find different. If you want to go brushless you could simply buy a 12V CPAP motor and pump from DHgate or others, https://www.dhgate.com/product/daniu-wm7040-dc-12v-24v-high-pressure-blower/505193494.html?dspm=pcen.sp.list.1.E97VPnotXnnR3Wuw0dtf&resource_id=#s1-0-1;searl|2412079574:1. They are not that expensive although shipping times would be pretty poor at the moment.

Pinponcito commented 4 years ago

Hi Tim, Im from Mexico. with the sipporth of this guys I make my own sketch and make a ventilator made in home with a air pump rigth now are in 24hr work test, and next day we makeing test in pressure PEEP. Sent to me a email and i cant share my projetc, i will post here in next days but for more quick anser and you can get a ventilator contact to me. bes regard

Hi All, I have been working on a similar device in the UK. I tried to engage with the One Million Ventilators Group with not much response. I am still working on it anyway but been considering that carbon and copper particles from the motor can contaminate the air as there is deliberate low pressure pull through the motor core through the backplate of the impeller rotor (for cooling). Also I heard that brushless motors are needed as 03 (ozone) can be generated by sparks from brush commutation. I think the voltage are too low for that but I have come up with a possible solution if anyone is interested.

brian-mckeon commented 4 years ago

Thought I'd mention for anyone thinking about these mattress pumps - they are very noisy! Especially when you are ramping the power up and down. If you listen to a CPAP machine you can appreciate the huge effort that those designers have put into the design of their air pumps to keep them quiet. However I guess if you need a ventilator you aren't going to be too bothered about noise?

sean4545 commented 4 years ago

There is one problem for me with this pump. It inflate at both direction +/-. Somebody can help? Anyway excellent project Adam Cullen!

timhurdle commented 4 years ago

Yes, very true, for people with sleep apnea that a prime requirement, but for people struggling to breath it might be a nice reassuring sound

On Sun, Apr 19, 2020 at 6:18 AM brian-mckeon notifications@github.com wrote:

Thought I'd mention for anyone thinking about these mattress pumps - they are very noisy! Especially when you are ramping the power up and down. If you listen to a CPAP machine you can appreciate the huge effort that those designers have put into the design of their air pumps to keep them quiet. However I guess if you need a ventilator you aren't going to be too bothered about noise?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jcl5m1/ventilator/issues/62#issuecomment-616036581, or unsubscribe https://github.com/notifications/unsubscribe-auth/APHXBNLFIJUNA3TQPPIQALLRNKCR3ANCNFSM4LS24XKQ .

timhurdle commented 4 years ago

the flow is fixed, centre port for suction, peripheral port for pressure

On Sun, Apr 19, 2020 at 5:00 PM sean4545 notifications@github.com wrote:

There is one problem for me with this pump. It inflate at both direction +/-. Somebody can help? Anyway excellent project Adam Cullen!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jcl5m1/ventilator/issues/62#issuecomment-616169730, or unsubscribe https://github.com/notifications/unsubscribe-auth/APHXBNJQO3DW2NCUIQYCRSDRNMNY3ANCNFSM4LS24XKQ .

timhurdle commented 4 years ago

Hi brian, Thanks for the tip on the brushless motors, that probably the best way if the are reliable, but can they push the high volume flow at 40cmH20? . It doesnt work for my aim of an ultra easy/cheap/quick respirator for less than $20 though. I seek to use an unmodified pump as changing the motor over is destructive, prone to error and time consuming. I will do some tests on the flow direction though as i assumed that as it drew from the center it would be a low pressure area but i may be wrong. Cheers Tim

On Sun, Apr 19, 2020 at 1:13 AM brian-mckeon notifications@github.com wrote:

Hi Tim, have a look back at my post on Apr 11. I was also concerned about ozone. However I found that the motor cooling airflow in this mattress inflator seemed to be bled off the output pressure side and then out the vents below the motor. A bit different to vacuum cleaners etc but makes sense as the small motor ducts could often be facing a dirt campground and you wouldn't want to be drawing cooling air in from there. I used deflection of a small piece of paper to try and determine airflow and it seemed to be exiting these vents. Let me know if you find different. If you want to go brushless you could simply buy a 12V CPAP motor and pump from DHgate or others, https://www.dhgate.com/product/daniu-wm7040-dc-12v-24v-high-pressure-blower/505193494.html?dspm=pcen.sp.list.1.E97VPnotXnnR3Wuw0dtf&resource_id=#s1-0-1;searl|2412079574:1. They are not that expensive although shipping times would be pretty poor at the moment.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jcl5m1/ventilator/issues/62#issuecomment-615988028, or unsubscribe https://github.com/notifications/unsubscribe-auth/APHXBNIXULYK34OXF4SOQJLRNI6Z5ANCNFSM4LS24XKQ .

sean4545 commented 4 years ago

the flow is fixed, centre port for suction, peripheral port for pressure On Sun, Apr 19, 2020 at 5:00 PM sean4545 @.***> wrote: There is one problem for me with this pump. It inflate at both direction +/-. Somebody can help? Anyway excellent project Adam Cullen! — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#62 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/APHXBNJQO3DW2NCUIQYCRSDRNMNY3ANCNFSM4LS24XKQ .

Yes, I see that. But can't imagine, how can it work with this arduino setap? No matter if procedure breath in or breath out- pum is still do thesame- do pressure. Should I connect two pipes? Or do something else? I've not sufficient 12v souce yet, so cant connect pump phisically.

timhurdle commented 4 years ago

output port only, pump to inhale, slow down pump to exhale. need a small pressure to stop lung tissue collapsing , about 2 to 4cm of water.

On Sun, 19 Apr 2020, 22:42 sean4545, notifications@github.com wrote:

the flow is fixed, centre port for suction, peripheral port for pressure … <#m-140302477150017201> On Sun, Apr 19, 2020 at 5:00 PM sean4545 @.***> wrote: There is one problem for me with this pump. It inflate at both direction +/-. Somebody can help? Anyway excellent project Adam Cullen! — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#62 (comment) https://github.com/jcl5m1/ventilator/issues/62#issuecomment-616169730>, or unsubscribe https://github.com/notifications/unsubscribe-auth/APHXBNJQO3DW2NCUIQYCRSDRNMNY3ANCNFSM4LS24XKQ .

Yes, I see that. But can't imagine, how can it work with this arduino setap? No matter if procedure breath in or breath out- pum is still do thesame- do pressure. Should I connect two pipes? Or do something else? I've not sufficient 12v souce yet, so cant connect pump phisically.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jcl5m1/ventilator/issues/62#issuecomment-616229745, or unsubscribe https://github.com/notifications/unsubscribe-auth/APHXBNKG376HJLET7RJVZGTRNNV4JANCNFSM4LS24XKQ .

sean4545 commented 4 years ago

output port only, pump to inhale, slow down pump to exhale. need a small pressure to stop lung tissue collapsing , about 2 to 4cm of water. On Sun, 19 Apr 2020, 22:42 sean4545, @.> wrote: the flow is fixed, centre port for suction, peripheral port for pressure … <#m-140302477150017201> On Sun, Apr 19, 2020 at 5:00 PM sean4545 @.> wrote: There is one problem for me with this pump. It inflate at both direction +/-. Somebody can help? Anyway excellent project Adam Cullen! — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#62 (comment) <#62 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/APHXBNJQO3DW2NCUIQYCRSDRNMNY3ANCNFSM4LS24XKQ . Yes, I see that. But can't imagine, how can it work with this arduino setap? No matter if procedure breath in or breath out- pum is still do thesame- do pressure. Should I connect two pipes? Or do something else? I've not sufficient 12v souce yet, so cant connect pump phisically. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#62 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/APHXBNKG376HJLET7RJVZGTRNNV4JANCNFSM4LS24XKQ .

Thank you! Now, I understand

sean4545 commented 4 years ago

output port only, pump to inhale, slow down pump to exhale. need a small pressure to stop lung tissue collapsing , about 2 to 4cm of water. On Sun, 19 Apr 2020, 22:42 sean4545, @.> wrote: the flow is fixed, centre port for suction, peripheral port for pressure … <#m-140302477150017201> On Sun, Apr 19, 2020 at 5:00 PM sean4545 @.> wrote: There is one problem for me with this pump. It inflate at both direction +/-. Somebody can help? Anyway excellent project Adam Cullen! — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#62 (comment) <#62 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/APHXBNJQO3DW2NCUIQYCRSDRNMNY3ANCNFSM4LS24XKQ . Yes, I see that. But can't imagine, how can it work with this arduino setap? No matter if procedure breath in or breath out- pum is still do thesame- do pressure. Should I connect two pipes? Or do something else? I've not sufficient 12v souce yet, so cant connect pump phisically. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#62 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/APHXBNKG376HJLET7RJVZGTRNNV4JANCNFSM4LS24XKQ .

Thank you! Now, I understand

timhurdle commented 4 years ago

i believe you need a small voltage to maintain PEEP during exhale but needs to be calibrated with water manometer to a couple of cm water. calibrate inhale pressure also, maybe 25 cm water but can be less or more depending on patient. you need to calibrate the pressures against voltage with all your filters etc in place.

On Sun, 19 Apr 2020, 23:03 Tim Hurdle, tim.hurdle@gmail.com wrote:

output port only, pump to inhale, slow down pump to exhale. need a small pressure to stop lung tissue collapsing , about 2 to 4cm of water.

On Sun, 19 Apr 2020, 22:42 sean4545, notifications@github.com wrote:

the flow is fixed, centre port for suction, peripheral port for pressure … <#m_9208433651541181752m-140302477150017201_> On Sun, Apr 19, 2020 at 5:00 PM sean4545 @.***> wrote: There is one problem for me with this pump. It inflate at both direction +/-. Somebody can help? Anyway excellent project Adam Cullen! — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#62 (comment) https://github.com/jcl5m1/ventilator/issues/62#issuecomment-616169730>, or unsubscribe https://github.com/notifications/unsubscribe-auth/APHXBNJQO3DW2NCUIQYCRSDRNMNY3ANCNFSM4LS24XKQ .

Yes, I see that. But can't imagine, how can it work with this arduino setap? No matter if procedure breath in or breath out- pum is still do thesame- do pressure. Should I connect two pipes? Or do something else? I've not sufficient 12v souce yet, so cant connect pump phisically.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jcl5m1/ventilator/issues/62#issuecomment-616229745, or unsubscribe https://github.com/notifications/unsubscribe-auth/APHXBNKG376HJLET7RJVZGTRNNV4JANCNFSM4LS24XKQ .

zero48 commented 4 years ago

Hi @adamcullen , I'm still waiting for my PCBs to arrive , however I found a sensor I used few years back in a project, which is a MPX5010DP Datasheet . My Idea is to create a sort of spirometer and monitor mass flow air so it can be displayed as well (KPA,PSi,cmh2o). I'm writing some code , would you adapt this calculations to your Sketch? .

timhurdle commented 4 years ago

Hi Brian, I've done some pressure tests which confirm your findings that flow is positive from the motor housing. Approx 2cmH2O with both ports open and up to 10cm with output blockage. Suction blockage can be a problem though as a even a modest restriction will cause suction through the motor core. There needs to be care not to put restrictive filters in place unless there is a balancing restriction in the supply side also.

On Sun, 19 Apr 2020, 01:13 brian-mckeon, notifications@github.com wrote:

Hi Tim, have a look back at my post on Apr 11. I was also concerned about ozone. However I found that the motor cooling airflow in this mattress inflator seemed to be bled off the output pressure side and then out the vents below the motor. A bit different to vacuum cleaners etc but makes sense as the small motor ducts could often be facing a dirt campground and you wouldn't want to be drawing cooling air in from there. I used deflection of a small piece of paper to try and determine airflow and it seemed to be exiting these vents. Let me know if you find different. If you want to go brushless you could simply buy a 12V CPAP motor and pump from DHgate or others, https://www.dhgate.com/product/daniu-wm7040-dc-12v-24v-high-pressure-blower/505193494.html?dspm=pcen.sp.list.1.E97VPnotXnnR3Wuw0dtf&resource_id=#s1-0-1;searl|2412079574:1. They are not that expensive although shipping times would be pretty poor at the moment.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jcl5m1/ventilator/issues/62#issuecomment-615988028, or unsubscribe https://github.com/notifications/unsubscribe-auth/APHXBNIXULYK34OXF4SOQJLRNI6Z5ANCNFSM4LS24XKQ .

brian-mckeon commented 4 years ago

Hi Tim, excellent point about suction blockage possibly changing airflow direction through the motor.

timhurdle commented 4 years ago

thanks. now on second day of continuous endurance test at 7.2v, looks good as 2 pumps in series gives good results with redundancy and less heat

On Thu, 23 Apr 2020, 09:57 brian-mckeon, notifications@github.com wrote:

Hi Tim, excellent point about suction blockage possibly changing airflow direction through the motor.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jcl5m1/ventilator/issues/62#issuecomment-618274448, or unsubscribe https://github.com/notifications/unsubscribe-auth/APHXBNMXE6BCHCFAKJLSFADRN77HHANCNFSM4LS24XKQ .

gaurav12294 commented 4 years ago

Hi, I've just had a go at building an open source ventilator using the main thread as inspiration. I didn't have access to a CPAP pump, so I decided to give an air mattress pump a go. Here are my findings.

I used (all prices in Australian dollars):

  • 12v DC air pump (A$19)
  • Arduino (I've used a mega as that's whats in my test lab, but in reality I'd use a nano) (about $5)
  • WB291111 motor driver board (which looks to me like an L298N knock off) (about $2)
  • 4 potentiometers (less than $1)
  • washing machine flexible hose (about $30, but I'm sure there must be cheaper options)
  • 3M 6800 full face respirator mask (about A$90, but I had one following the bushfires!)
  • 1 1/4" to 1" BSP reducer (A$2.50)
  • 1" to 3/4" BSP reducer (A$2.50)
  • 3/4" to 20mm pressure pipe adaptor (A$2)

Here are some pics of the testing setup: IMG_20200325_134845 1 IMG_20200325_134903 1 IMG_20200325_134929 1

IMG_20200325_135533 1 IMG_20200325_135624 1

I decided to re-use my 3M 6800 full face respirator mask, which I have following the last disaster to strike Australia earlier in the year - bushfires. This mask has 3 filter ports, and the large one at the front takes a very course 1 1/4" thread. I found the 1 1/4" BSP thread will get about a 3/4 turn and make a reasonable seal, threadtape or plumbing sealant would make a solid seal in an emergency. This mask has the added advantage of being able to hook up an air feed line to the other 2 ports, which I can add in concentrated oxygen if needed. https://www.ebay.com.au/itm/Indusry-Safety-Spray-paint-Supplied-Air-Fed-Respirator-System-For-6800-Gas-Gask-/264207440778

I used the 4 potentiometers to control the strength of the pump on in and out, as well as the length of the in and out breath. As you'll see in my crude arduino code, the pots basically divide the analogue signal by 100 and round (so instead of reading 0-1028 on the analogue port, they get a value of 0-10) making the pots able to have 10 steps from 0 to max volume, and I have arbitrarily set the breath (in and out) length to 4000ms.

The only other tricky part was wiring up the L298N motor driver so that it used the A and B motor outs in parallel. The L298N will only drive up to 2A, I needed at least 2.5A, so by running it in parallel I could get up to 4A. This is possible per the spec sheet on page 7, by bridging inputs 1 & 4 and 2 & 3. https://www.st.com/resource/en/datasheet/l298.pdf Input 1&4 go to 5v, 2&3 to ground, enable A&B go to the arduino analogue pin out (in my code pin 9).

Here's my code for the arduino.

int breath = 1;

void setup() {
  Serial.begin(9600);
  pinMode(9, OUTPUT);
}

void loop() {
  int inP = analogRead(A0); // pot 1 - in breath pressure
  int outP = analogRead(A1); // pot 2 - out breath pressure
  int inT = analogRead(A3); // pot 3 - in breath time
  int outT = analogRead(A2); // pot 4 - out breath time

  int inP_v = round(inP/100)*25.5;  // take the value from the pot, divide by 100 and round, then multiply by 25.5 so the output value is a multiple of 255
  int outP_v = round(outP/100)*25.5;  // take the value from the pot, divide by 100 and round, then multiply by 25.5 so the output value is a multiple of 255
  int inT_v = round(inT/100)*400;  // take the value from the pot, divide by 100 and round, then multiply by 400 to get a proportion of 4000ms
  int outT_v = round(outT/100)*400;  // take the value from the pot, divide by 100 and round, then multiply by 400 to get a proportion of 4000ms

  if (breath !=0) {breath = 0;}
    else breath = 1;

  switch (breath) {
    case 0:
      Serial.print("Breath In. Pressure: "); Serial.print(inP_v); 
      Serial.print(". In Time: "); Serial.print(inT_v); Serial.println("ms.");
      analogWrite(9, inP_v);
      delay(inT_v);
      break;

    case 1:
      Serial.print("Breath Out. Pressure: "); Serial.print(outP_v); 
      Serial.print(". Out Time: "); Serial.print(outT_v); Serial.println("ms.");
      analogWrite(9, outP_v);
      delay(outT_v);
      break;
  }
}

driver [sorry, there was a mistake in my image, I had wired the pins wrong in the previous image. Again, Pins 2&3 must be wired togehter and Pins 1&4 must be wired together for parallel use of the driver. Very sorry if people have blown their L298N's because of this].

Hopefully this helps someone. I've spoken with an ER doctor friend, who said using an inflation pump cant be any worse in an emergency than someone having to manually "bag" a patient for a couple of weeks! I haven't been able to run a water lift test as my hose isn't opaque, but I'll try to find some and report back. I'd also like to do a test running the pump overnight to see if the motor burns out cycling up and down.

Edit: I can report that the pump has survived an 8 hour test, I'll keep it running for the rest of the day to test for 24 hours. Seems promising so far, no obvious loss of power.

Hey, sorry for being late to the party

Can I use SmartElex 15S DC Motor Driver 15A (30A Peak) (https://robu.in/product/smartelex-15s-dc-motor-driver-13a-30a-peak/?gclid=CjwKCAjwps75BRAcEiwAEiACMazatx_J8pUB3IL4915iBznwlnsVFXsPhPsdaNhSU3eIoQcyIARvUhoC64IQAvD_BwE) with a 75W (12V) pump

To make the circuit less complex, while using the same code and connections?

adamcullen commented 4 years ago

Hi, sure, I think that motor driver would work fine. Exactly the same inputs, simpler driver.

⁣Get BlueMail for Android ​

On 13 Aug 2020, 5:03 am, at 5:03 am, gaurav12294 notifications@github.com wrote:

Hi, I've just had a go at building an open source ventilator using the main thread as inspiration. I didn't have access to a CPAP pump, so I decided to give an air mattress pump a go. Here are my findings.

I used (all prices in Australian dollars):

  • 12v DC air pump (A$19)
  • Arduino (I've used a mega as that's whats in my test lab, but in reality I'd use a nano) (about $5)
  • WB291111 motor driver board (which looks to me like an L298N knock off) (about $2)
  • 4 potentiometers (less than $1)
  • washing machine flexible hose (about $30, but I'm sure there must be cheaper options)
  • 3M 6800 full face respirator mask (about A$90, but I had one following the bushfires!)
  • 1 1/4" to 1" BSP reducer (A$2.50)
  • 1" to 3/4" BSP reducer (A$2.50)
  • 3/4" to 20mm pressure pipe adaptor (A$2)

Here are some pics of the testing setup: IMG_20200325_134845
1 IMG_20200325_134903
1 IMG_20200325_134929
1

IMG_20200325_135533
1 IMG_20200325_135624
1

I decided to re-use my 3M 6800 full face respirator mask, which I have following the last disaster to strike Australia earlier in the year - bushfires. This mask has 3 filter ports, and the large one at the front takes a very course 1 1/4" thread. I found the 1 1/4" BSP thread will get about a 3/4 turn and make a reasonable seal, threadtape or plumbing sealant would make a solid seal in an emergency. This mask has the added advantage of being able to hook up an air feed line to the other 2 ports, which I can add in concentrated oxygen if needed.

https://www.ebay.com.au/itm/Indusry-Safety-Spray-paint-Supplied-Air-Fed-Respirator-System-For-6800-Gas-Gask-/264207440778

I used the 4 potentiometers to control the strength of the pump on in and out, as well as the length of the in and out breath. As you'll see in my crude arduino code, the pots basically divide the analogue signal by 100 and round (so instead of reading 0-1028 on the analogue port, they get a value of 0-10) making the pots able to have 10 steps from 0 to max volume, and I have arbitrarily set the breath (in and out) length to 4000ms.

The only other tricky part was wiring up the L298N motor driver so that it used the A and B motor outs in parallel. The L298N will only drive up to 2A, I needed at least 2.5A, so by running it in parallel I could get up to 4A. This is possible per the spec sheet on page 7, by bridging inputs 1 & 4 and 2 & 3. https://www.st.com/resource/en/datasheet/l298.pdf Input 1&4 go to 5v, 2&3 to ground, enable A&B go to the arduino analogue pin out (in my code pin 9).

Here's my code for the arduino.

int breath = 1;

void setup() {
  Serial.begin(9600);
  pinMode(9, OUTPUT);
}

void loop() {
  int inP = analogRead(A0); // pot 1 - in breath pressure
  int outP = analogRead(A1); // pot 2 - out breath pressure
  int inT = analogRead(A3); // pot 3 - in breath time
  int outT = analogRead(A2); // pot 4 - out breath time

  int inP_v = round(inP/100)*25.5;  // take the value from the pot,
divide by 100 and round, then multiply by 25.5 so the output value is a
multiple of 255
  int outP_v = round(outP/100)*25.5;  // take the value from the pot,
divide by 100 and round, then multiply by 25.5 so the output value is a
multiple of 255
  int inT_v = round(inT/100)*400;  // take the value from the pot,
divide by 100 and round, then multiply by 400 to get a proportion of
4000ms
  int outT_v = round(outT/100)*400;  // take the value from the pot,
divide by 100 and round, then multiply by 400 to get a proportion of
4000ms

  if (breath !=0) {breath = 0;}
    else breath = 1;

  switch (breath) {
    case 0:
      Serial.print("Breath In. Pressure: "); Serial.print(inP_v); 
      Serial.print(". In Time: "); Serial.print(inT_v);
Serial.println("ms.");
      analogWrite(9, inP_v);
      delay(inT_v);
      break;

    case 1:
      Serial.print("Breath Out. Pressure: "); Serial.print(outP_v); 
      Serial.print(". Out Time: "); Serial.print(outT_v);
Serial.println("ms.");
      analogWrite(9, outP_v);
      delay(outT_v);
      break;
  }
}

driver [sorry, there was a mistake in my image, I had wired the pins wrong in the previous image. Again, Pins 2&3 must be wired togehter and Pins 1&4 must be wired together for parallel use of the driver. Very sorry if people have blown their L298N's because of this].

Hopefully this helps someone. I've spoken with an ER doctor friend, who said using an inflation pump cant be any worse in an emergency than someone having to manually "bag" a patient for a couple of weeks! I haven't been able to run a water lift test as my hose isn't opaque, but I'll try to find some and report back. I'd also like to do a test running the pump overnight to see if the motor burns out cycling up and down.

Edit: I can report that the pump has survived an 8 hour test, I'll keep it running for the rest of the day to test for 24 hours. Seems promising so far, no obvious loss of power.

Hey, sorry for being late to the party

Can I use SmartElex 15S DC Motor Driver 15A (30A Peak) (https://robu.in/product/smartelex-15s-dc-motor-driver-13a-30a-peak/?gclid=CjwKCAjwps75BRAcEiwAEiACMazatx_J8pUB3IL4915iBznwlnsVFXsPhPsdaNhSU3eIoQcyIARvUhoC64IQAvD_BwE)

with a 75W (12V) pump

To make the circuit less complex, while using the same code and connections?

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/jcl5m1/ventilator/issues/62#issuecomment-673054475

gaurav12294 commented 4 years ago

Thanks for all the help, but I am coming across a problem related to the switch control of the motor that I am using.

My switch responds to 1 click (CPAP mode) and 2nd click (BiPAP mode), but does not turn the device off for the 3rd click., additional clicks do not do anything. Below is my code, please suggest some solutions.

int pwm = 5; int dir = A1; byte switchPin = 2; // switch is connected to pin 2

byte buttonPresses = 0; // how many times the button has been pressed byte lastPressCount = 0; // to keep track of last press count

void setup() { pinMode(switchPin, INPUT); // Set the switch pin as input digitalWrite(switchPin, HIGH);
pinMode(pwm, OUTPUT); pinMode(dir, OUTPUT); Serial.begin(9600); // Set up serial communication at 9600bps }

void loop(){ if (digitalRead(switchPin) == LOW) // check if button was pressed { buttonPresses++; // increment buttonPresses count delay(100); } if (buttonPresses == 4) buttonPresses = 0; // rollover every 4 press if (lastPressCount != buttonPresses) // only do output if the count has changed

if (buttonPresses == 1){
  digitalWrite(dir, HIGH);
  analogWrite(pwm, 40);   

}

if (buttonPresses == 2){
  digitalWrite(dir, HIGH);
  analogWrite(pwm, 250);   
  delay(2000);                      
  analogWrite(pwm, 40);   
  delay(2000);
}

if (buttonPresses == 3){

  digitalWrite(pwm, LOW);

}

lastPressCount = buttonPresses;

}

adamcullen commented 4 years ago

You've been using analogWrite for the pwm pin.

if (buttonPresses == 2){   digitalWrite(dir, HIGH);   analogWrite(pwm, 250);   delay(2000);   analogWrite(pwm, 40);   delay(2000); }

Try it again here

if (buttonPresses == 3){   analogWrite(pwm, LOW); }

⁣Get BlueMail for Android ​

On 18 Aug 2020, 9:39 pm, at 9:39 pm, gaurav12294 notifications@github.com wrote:

Thanks for all the help, but I am coming across a problem related to the switch control of the motor that I am using.

My switch responds to 1 click (CPAP mode) and 2nd click (BiPAP mode), but does not turn the device off for the 3rd click., additional clicks do not do anything. Below is my code, please suggest some solutions.

int pwm = 5; int dir = A1; byte switchPin = 2; // switch is connected to pin 1

byte buttonPresses = 0; // how many times the button has been pressed byte lastPressCount = 0; // to keep track of last press count

void setup() { pinMode(switchPin, INPUT); // Set the switch pin as input digitalWrite(switchPin, HIGH); // set pullup resistor pinMode(pwm, OUTPUT); pinMode(dir, OUTPUT); Serial.begin(9600); // Set up serial communication at 9600bps }

void loop(){ if (digitalRead(switchPin) == LOW) // check if button was pressed { buttonPresses++; // increment buttonPresses count delay(500); } if (buttonPresses == 3) buttonPresses = 0; // rollover every 8 press if (lastPressCount != buttonPresses) // only do output if the count has changed

if (buttonPresses == 1){ digitalWrite(dir, HIGH); analogWrite(pwm, 40);

}

if (buttonPresses == 2){ digitalWrite(dir, HIGH); analogWrite(pwm, 250);
delay(2000);
analogWrite(pwm, 40);
delay(2000); }

if (buttonPresses == 3){

 digitalWrite(pwm, LOW);

}

lastPressCount = buttonPresses;

}

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/jcl5m1/ventilator/issues/62#issuecomment-675427531

gaurav12294 commented 3 years ago

Hello everyone, I had built a working prototype with a commercial inflator pump which had a brushed DC motor; but it gave a maximum of 15 cm H2O. I want to improve it by keeping the same housing of the pump and replacing the motor by a better brushless or brushed DC motor.

Can you guys help me with the specifications required for the motor to get pressure of 40 cm H2O. I did not find a concrete motor which was selected in this thread. Any links will be very helpful.

timhurdle commented 3 years ago

Hi everyone. I am persuing an approach that uses 2 low cost dc brushed motor pumps in series, this allows up to 40 inches of water pressure delivery with less voltage so the pumps will last longer and you have some redundancy if one fails. You only modulate one pump and set the other for the minimum pressure to prevent lung collapse. If a motor fails, an emergency mode can kick in which triggers an alarm and provides a safe respiration mode with the single working pump. Testing showed good pump life and performance. cheers. tim

On Wed, 23 Sep 2020, 21:52 gaurav12294, notifications@github.com wrote:

Hello everyone, I had built a working prototype with a commercial inflator pump which had a brushed DC motor; but it gave a maximum of 15 cm H2O. I want to improve it by keeping the same housing of the pump and replacing the motor by a better brushless or brushed DC motor.

Can you guys help me with the specifications required for the motor to get pressure of 40 cm H2O. I did not find a concrete motor which was selected in this thread. Any links will be very helpful.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jcl5m1/ventilator/issues/62#issuecomment-697879923, or unsubscribe https://github.com/notifications/unsubscribe-auth/APHXBNMBC3PKZNMK4KWPL6TSHI7VBANCNFSM4LS24XKQ .