CO2 Test lung regulator

Hello,

I am new to arduino and I wondered if anyone would like to help me. For a project I am making a test lung where I have to regulate the amount of CO2 that is going in. I do this using a arduino.
I am using:

-Arduino Uno
-Continious rotation servo (to open the valve of the CO2 bottle)
-CO2 sensor (MQ 135)
-Pontentiometer (to control the servo)

Right now i have the code:
-To control the servo
-To measure the ppm CO2

What I need is that i can use to potentiometer to set te % CO2 I am releasing and want the arduino to measure if that % is reached. If the % is higher it needs to close the valve a bit with the servo. If the % is lower than the % it needs to open the valve a bit.

I really need this code for a school project and am willing to pay someone with paypal if needed.

Greeting,

Thymen

Thymen:
Hello,

I am new to arduino and I wondered if anyone would like to help me. For a project I am making a test lung where I have to regulate the amount of CO2 that is going in. I do this using a arduino.
I am using:

-Arduino Uno
-Continious rotation servo (to open the valve of the CO2 bottle)
-CO2 sensor (MQ 135)
-Pontentiometer (to control the servo)

Right now i have the code:
-To control the servo
-To measure the ppm CO2

What I need is that i can use to potentiometer to set te % CO2 I am releasing and want the arduino to measure if that % is reached. If the % is higher it needs to close the valve a bit with the servo. If the % is lower than the % it needs to open the valve a bit.

I really need this code for a school project and am willing to pay someone with paypal if needed.

Greeting,
Thymen

This is potentially dangerous as a school project. And should you really be getting others to do your school work for you?

Also, I'm not sure that a std continuous-rotation servo would be powerful enough to open and fully close the gas valve. Be careful. You don't want the valve "almost" closing.

But what I really wanted to say is that if you want to get someone to do it for you, possibly for payment, the "Gigs and Collaborations" section would be more appropriate. Maybe you could ask a moderator to move the thread for you. (Don't double-post, just have this thread moved. :slight_smile: )

Thanks for your response. I allready did al the testing and a servor can turn the knob pretty easy.
It is a small Co2 bottle ment for fish aquariums. The arduino is programmed to fully close the knob when turned off. It is not that I need someone to do my schoolwork. Its just a big project where I need other people to succeed. On my school i cant find someone that is cappable to make this code. And I dont have that much
time for the project to learn arduino myself :slight_smile:

If you are able to measure the CO2 concentration, and you know the concentration you want, a simple if statement can be used to determine if the actual concentration is above the set point, at the set point, or below the setpoint.

If above, turn the servo one way. If below, turn the servo the other way. If the same, do nothing.

The question is how much to move the servo. The answer is that it depends on the relationship between the actual concentration and the setpoint. The farther apart, the greater the movement.

The actual process should probably involve PID.

thanks for your reaction. what do you mean with pid?

what do you mean with pid?

Google is your friend.

A PID provides a mechanism to give a reaction proportional to an output from a system as opposed to a bang-bang on/off reaction.

Proportional, integral, differential or PID.
The first level of control is what you're basically thinking.
The amount of CO2 controlled by measuring a %.
This control will usually track poorly. It will often over and undershoot
quite a bit. Depending on the parameters of the system, it will
often break into oscillation. If the system is slow enough the oscillation
may be tolerable.
The integral part looks at error and adds small amounts over time to
reduce the difference between the expected and the measured
The differential looks at the rate of change of the system and
slows it down if it looks to be changing too fast.

If it can handle a tolerable range of error, you can do a simple
hysteresis, on/off, control, like the heater control in most houses.

What kind of control do you need, what is the response time of the
system? How much over/undershoot can you tolerate?
What rate of change can the CO2 valve control?
The coding is relatively simple.
For anyone to help you on any of these, you'd need to answer these
questions.

I'm not offering to do it. I'm just describing things.
Dwight

Thanks for your reaction.

The test lung is to train medical personal. The test lung is connected to a breathing device that makes the test lung breath in and out and shows the amount of Co2 in the breath. On a distance a trainer can turn of the Co2 of the testlung. The people that are being trained can only notice this on the breathing device. Then they have to response on the situation.

The trainer is able to set the amount of Co2 in the breath. The response time has to be around 2 seconds.
Under and overshoot can be 5%. The amount that the valve can regulate is around 5% per 10 degrees rotation.

I really hope someone can help me with this. again, I am willing to give a reward for it :slight_smile:
I dont need the exact code, just the setup of the code where i can change the variables.
So bassicly I only need the code structure

I suspect you best option is to have a pressure regulator
and a solenoid on/off valve,
You pulse modulate the valve.
Longer on for higher percent.
You feed this into your mixer and then into the simulated lung.
You use the sensor to calibrate the pulses used.
Try to keep it simple.
If you want, you can look up PID control on the web
but I think a simple flow mixer and a well controlled pulsed source
is the better answer.
Dwight