Oxygen concentration controller
Archiver
Posts: 46,084
Help me out here guys and gals. I was never too good at the analytic
stuff.
Here's what I want to do:
Use a Stamp to cycle the oxygen concentration in a one cu ft chamber
between 21% and 10% O2 every 90 sec. I hope to flood the chamber
with N2 till the O2 is 10%, hold it there for a while, and then use
O2 to bring it back again to 21% as quickly as possible. A company
called Biosperix (www.biospherix.com) makes a system that can do
this, but the boss wants to build our own.
We could use a fast and expensive O2 sensor in an active feedback
loop to control the O2, just by cycling a set point back and forth
and opening solenoid valves to let gas in when the gas concentration
deviated too much from the desired level, but the fast sensors
are VERY expensive.
The problem with the cheap sensors is that they are pretty slow.
They take about 10 sec. to settle. I assume that there would be
too much overshoot in the gas concentrations while the sensor
responded. I want to fill the chamber faster than the sensor can respond.
I figured that to use a cheap sensor, I would have to measure
the current O2 level, then knowing the gas pressure, flow rate
and chamber volume, calculate how long to open a valve to bring
the O2 concentration to the new desired level.
(I hope this is clear.) I would also have to periodically
inject gas to compensate for leakage, etc.
Can anyone help me to do these calculations with a Stamp? I
assume the gas concentrations would follow a logarithmic
time course, probably could be modeled by a capacitor charge
curve.
Any suggestions?
Bob Nienhuis
nienhuis@w...
stuff.
Here's what I want to do:
Use a Stamp to cycle the oxygen concentration in a one cu ft chamber
between 21% and 10% O2 every 90 sec. I hope to flood the chamber
with N2 till the O2 is 10%, hold it there for a while, and then use
O2 to bring it back again to 21% as quickly as possible. A company
called Biosperix (www.biospherix.com) makes a system that can do
this, but the boss wants to build our own.
We could use a fast and expensive O2 sensor in an active feedback
loop to control the O2, just by cycling a set point back and forth
and opening solenoid valves to let gas in when the gas concentration
deviated too much from the desired level, but the fast sensors
are VERY expensive.
The problem with the cheap sensors is that they are pretty slow.
They take about 10 sec. to settle. I assume that there would be
too much overshoot in the gas concentrations while the sensor
responded. I want to fill the chamber faster than the sensor can respond.
I figured that to use a cheap sensor, I would have to measure
the current O2 level, then knowing the gas pressure, flow rate
and chamber volume, calculate how long to open a valve to bring
the O2 concentration to the new desired level.
(I hope this is clear.) I would also have to periodically
inject gas to compensate for leakage, etc.
Can anyone help me to do these calculations with a Stamp? I
assume the gas concentrations would follow a logarithmic
time course, probably could be modeled by a capacitor charge
curve.
Any suggestions?
Bob Nienhuis
nienhuis@w...
Comments
nienhuis@w... writes:
Help me out here guys and gals. I was never too good at the analytic
stuff.
Here's what I want to do:
Use a Stamp to cycle the oxygen concentration in a one cu ft chamber
between 21% and 10% O2 every 90 sec. I hope to flood the chamber
with N2 till the O2 is 10%, hold it there for a while, and then use
O2 to bring it back again to 21% as quickly as possible. A company
called Biosperix (www.biospherix.com) makes a system that can do
this, but the boss wants to build our own.
We could use a fast and expensive O2 sensor in an active feedback
loop to control the O2, just by cycling a set point back and forth
and opening solenoid valves to let gas in when the gas concentration
deviated too much from the desired level, but the fast sensors
are VERY expensive.
The problem with the cheap sensors is that they are pretty slow.
They take about 10 sec. to settle. I assume that there would be
too much overshoot in the gas concentrations while the sensor
responded. I want to fill the chamber faster than the sensor can respond.
I figured that to use a cheap sensor, I would have to measure
the current O2 level, then knowing the gas pressure, flow rate
and chamber volume, calculate how long to open a valve to bring
the O2 concentration to the new desired level.
(I hope this is clear.) I would also have to periodically
inject gas to compensate for leakage, etc.
Can anyone help me to do these calculations with a Stamp? I
assume the gas concentrations would follow a logarithmic
time course, probably could be modeled by a capacitor charge
curve.
Any suggestions?
Bob Nienhuis
nienhuis@w...
++++++++++++++++++++++++++++++++++++++
One possible O2 sensor option is a Lean Air Fuel Ratio Sensor (LAF) used on
many SULEV's (super ultra low emission vehicles). I don't remember the a/f
range of this sensor off the top of my head. When I get to work on Monday, I
will
look it up and re-post.
[noparse][[/noparse]Non-text portions of this message have been removed]
> [noparse][[/noparse]...] the boss wants to build our own.
Been there. Always worried me when a person, hypothetically "a manager",
wanted to substitute the high hourly cost of my engineers for that of a
clerk to cut an invoice for a production item with all the bugs worked out
already. The least worrying explanation was the complete absence of an
arithmetic bone. The possibilities go downhill from there.
On the other hand, I learned a new knowledge niche every time it happened,
so what the heck. Gas flow wasn't one of those niches, but the Basic Stamp
would not be my choice for solving simultaneous differential equations
anyway. Here's a quick tablecloth analysis of a solution that is very likely
to work, and is within the practical range for a Stamp:
Objective:
> [noparse][[/noparse]...] cycle the oxygen concentration in a one cu ft chamber
> between 21% and 10% O2 every 90 sec.
Constraint:
Use cheap oxygen-concentration sensors with a settling time around ten
seconds.
Observations:
You're right. Trying to control the gas flow with a direct feedback loop
won't work with sensors that slow. A practical method would uses tuning of a
control loop that is essentially running open loop for any given cycle.
Fashion changes. I've seen this called multi-cycle feedback, low frequency
feedback, feed-forward, and less respectful names.
Like this, in your case:
1. Inject a dollop of oxygen we estimate in advance will produce the 11%
rise in concentration. For the sake of argument, let's suppose one dollop=26
seconds to flow. Call that T1.
2. Wait 45 seconds less T1, or about 19 seconds.
3. Read that slow-rate oxygen sensor. It's had time to settle. Consider the
delta between the measured concentration and our target of 21%. If it is
within the deadband value, do nothing. (See below for explanation.) Let's
say the actual concentration was 21.5%, so the delta is five tenths of one
percent. Decrease T1 by 1.18 sec. (We were high by 1/22 of our target change
in concentration, so we'll decrease the flow time by 1/22.) For simplicity,
if we can get a resolution of one tenth percent out of that cheap sensor,
each tenth error will require a correction of 0.91% of the last T1.
4. We've reached the end of the oxygen-rich 45 seconds of our cycle. Now
inject Nitrogen for 26 seconds. Call that T2.
5. Wait 45 seconds less T2, or again about 19 seconds using my example.
Measure the oxygen concentration again. And again the change in
concentration should be 11%, and we will have an error value in tenths of a
percent. Adjust T2 accordingly.
6. Loop to one, which will be using the updated value of T1.
By no great coincidence, I have a medical oxygen regulator beside me. It
goes up to eight liters per minute. A cubic foot is 28.3 liters unless my
personal O2 flow rate is set too low right now. Turning on that valve for 26
seconds while the regulator is set to 8 lpm will deliver 3.47 liters of
oxygen. 11% of 28.3 liters is 3.11 liters. However, inserting 3.11 liters
would not provide the enrichment we need, because the new gas is mixing with
the old and we have outflow of that mixed gas going on.
This is where simultaneous differential equations would arise in the closed
form solution. A couple of the reasons I have oxygen nearby caused me to
give up trying to do such things these days. Someone may take pity on us
both and provide the answer neatly calculated to a hundredth liter, but we
don't strictly have to have a closed form solution. It will be muddied a
good bit by reality in any case: the valve is not going to open in a
millisecond, so you'll have intervals of reduced flow at the start and end
of each dollop injection; the gas mixing won't be perfect so you'll have
more or less concentration in the outflow than a perfect calculation would
suppose; ambient temperatures will find some way to trip us up; the moon
will be in Aquarius some days and not others; and so forth and so on.
That practical technique will converge quickly to a flow time for the oxygen
and nitrogen tanks (a different one for each) that will take all those
factors into account, and then it will adjust from minute to minute as the
moon moves into Scorpio.
Minute to minute is a little too precise, actually. If anything significant
happened quickly, it would take many minutes to settle to new times for T1
and T2 -- but frankly, I can't see much happening that is quick. If you use
medical regulators on the tanks, their flow rate is pretty steady I'd
suppose. Not greatly affected by the changing pressure in the tanks, I mean.
And certainly any such change is not a rapid one. (I'd notice.<g>) The
algorithm will be able to keep up with any slow rate of change.
Oh, yes. Deadband. Not worth a long discussion, but never try to react to
small changes in the error value. All sorts of nasty behavior can arise. You
may have to experiment to see what a value is for the deadband that gives
you stability, because it depends on the sensor repeatability, precision,
accuracy, drift, et cetera. And all those same things with respect to the
valves and so on. If the usable values from that sensor are in tenths, then
we should ignore any difference less than two tenths. At least for a first
estimate. Adjust that deadband value while the computer between your ears is
monitoring the process.
And that assumed tenth percent precision from the oxygen concentration
sensor may be terribly optimistic or the converse. I have no idea what
accuracy and precision we can expect from cheap gas sensors. Once you have a
feel for their usable precision, your deadband should be something like
double that effective precision for a first guess.
The outflow valve is another form of regulator, but I've never tried to buy
one with a low delta from one side to the other. I assume you don't want a
large pressure differential above ambient, or you'd have mentioned it. It
will require some differential to avoid ambient gas inflow upsetting all
this work, but not much. Half a psi sound okay? If ambient contamination is
not a big deal, then even a tenth psi ought to do it. Basically, you just
want a controlled leak and if they want fortune for a proper outflow
regulator, I'd experiment with creating a leaky outflow of my own that
achieves the same effect.
Hope all this helps. It's pretty off the cuff and I haven't checked my
oxygen flow rate recently<g>.
GWS
#1) Fill as needed to get the concentrations as needed. adjust over
time as needed, say a minute to get that cheap sensor to become rock
stable. This is your starting point.
#2)insert some fixed change. let it stabilize. record the levels.
go back to step 1
#2a) insert some other fixed change, let it stabilize, read the
levels.
plot the differences and guess at the correct valve times.
#2b,c,d....) repeat step 1 and 2 with your calculated times.
Reverse the order, get the higher O2 level and change the N and do it
all over agin.
with a small box, your data should offer a pretty fast result.
This is the calibrate in posistion method.
Also, look for your O2 sensor to be replaced at some future time with
a fast unit. design for both so when that day comes, you look good.
Note, ANY SMALL change in regulator pressure WILL effect the results
so you need a precision regulator on both units. Check the regulator
specs as regards input pressures and environmental temperatures.
Any calculations you do will be tossed aside with changes in the
system pressures or flows. There are too many variables to considder
as fixed to make theoretical projections.
Change the pressues (both up, both down, one up-one down) and repeat
to see how far off you will be.
Suggest you do a daily calibration at the start and end of each day
(test) to get imperical data on repetitiveness of the control at
least until you are comfortable with the system.
Look for a better gas sensor.
Explain to the boss that a valve leak will cause errors.
a low pressure will cause errors
someone touching the settings will cause errors.
look for a better gas sensor.
Dave
--- In basicstamps@yahoogroups.com, "Bob Nienhuis" <nienhuis@w...>
wrote:
> Help me out here guys and gals. I was never too good at the analytic
> stuff.
>
> Here's what I want to do:
> Use a Stamp to cycle the oxygen concentration in a one cu ft chamber
> between 21% and 10% O2 every 90 sec. I hope to flood the chamber
> with N2 till the O2 is 10%, hold it there for a while, and then use
> O2 to bring it back again to 21% as quickly as possible. A company
> called Biosperix (www.biospherix.com) makes a system that can do
> this, but the boss wants to build our own.
>
> We could use a fast and expensive O2 sensor in an active feedback
> loop to control the O2, just by cycling a set point back and forth
> and opening solenoid valves to let gas in when the gas concentration
> deviated too much from the desired level, but the fast sensors
> are VERY expensive.
>
> The problem with the cheap sensors is that they are pretty slow.
> They take about 10 sec. to settle. I assume that there would be
> too much overshoot in the gas concentrations while the sensor
> responded. I want to fill the chamber faster than the sensor can
respond.
>
> I figured that to use a cheap sensor, I would have to measure
> the current O2 level, then knowing the gas pressure, flow rate
> and chamber volume, calculate how long to open a valve to bring
> the O2 concentration to the new desired level.
> (I hope this is clear.) I would also have to periodically
> inject gas to compensate for leakage, etc.
>
> Can anyone help me to do these calculations with a Stamp? I
> assume the gas concentrations would follow a logarithmic
> time course, probably could be modeled by a capacitor charge
> curve.
>
> Any suggestions?
>
> Bob Nienhuis
> nienhuis@w...
pressure is the way to go. Look at boyles laws and use pressure to
control the mix. This is how we do it in Diving and it is dead on
every time. The satmp setup should be fairly simple too.
Scott
--- In basicstamps@yahoogroups.com, "Bob Nienhuis" <nienhuis@w...>
wrote:
> Help me out here guys and gals. I was never too good at the
analytic
> stuff.
>
> Here's what I want to do:
> Use a Stamp to cycle the oxygen concentration in a one cu ft
chamber
> between 21% and 10% O2 every 90 sec. I hope to flood the chamber
> with N2 till the O2 is 10%, hold it there for a while, and then
use
> O2 to bring it back again to 21% as quickly as possible. A company
> called Biosperix (www.biospherix.com) makes a system that can do
> this, but the boss wants to build our own.
>
> We could use a fast and expensive O2 sensor in an active feedback
> loop to control the O2, just by cycling a set point back and forth
> and opening solenoid valves to let gas in when the gas
concentration
> deviated too much from the desired level, but the fast sensors
> are VERY expensive.
>
> The problem with the cheap sensors is that they are pretty slow.
> They take about 10 sec. to settle. I assume that there would be
> too much overshoot in the gas concentrations while the sensor
> responded. I want to fill the chamber faster than the sensor can
respond.
>
> I figured that to use a cheap sensor, I would have to measure
> the current O2 level, then knowing the gas pressure, flow rate
> and chamber volume, calculate how long to open a valve to bring
> the O2 concentration to the new desired level.
> (I hope this is clear.) I would also have to periodically
> inject gas to compensate for leakage, etc.
>
> Can anyone help me to do these calculations with a Stamp? I
> assume the gas concentrations would follow a logarithmic
> time course, probably could be modeled by a capacitor charge
> curve.
>
> Any suggestions?
>
> Bob Nienhuis
> nienhuis@w...