Oxygen sensor monitoring and valve control?
Andy_Freediver
Posts: 16
Is a basic stamp a good way to monitor a oxygen sensor and then based on a target oxygen percentage open and close a valve until the desired percentage is reached? The oxygen sensor works by producing a voltage between 0 and 11 millivolts (0 to 100% of o2) I will be working for targets between 4% and 8% ie v small millivoltage changes!
Thanks in advance as my knowledge in this area is very limited........but that is probably obvious
·
Thanks in advance as my knowledge in this area is very limited........but that is probably obvious
·
Comments
Thanks for the reply and I will download the tutorial and do some research on the amp side of things as you suggest. I thought I read on one of the posts that one of the Stamps included a analog to digital convertor already on the PCB. Is that right and can you recommend which stamp I should perhaps use?
thanks
Andy
All of the Stamps are capable of doing simple, relatively slow analog to digital conversion using a few external components (see www.emesystems.com for a discussion of this for battery voltage monitoring). I wouldn't recommend using this for the kind of project you're working on. You need a reasonably good external ADC like the ones discussed in the tutorial.
Any of the BS2 Stamps could do what you need. I would recommend using the BS2p since it has some additional statements and memory (compared to the BS2) that may be useful.
··· I've been somewhat of a lurker here for a while, but your post is right up my alley, so to speak, so I thought I'd register·and reply.
··· I built a Closed Circuit Rebreather conversion, (can be run ECCR or MCCR)·which of course needs to monitor multiple O2 cells, drive a Heads Up Display, and control the O2 Addition solenoid valve.
··· A BS2 worked fine, though I could have made it more sophisticated with·one of the·2p series.
··· I'm curious what O2 sensor you're using with those low output levels.
··· Normally for O2 analysers and RBs, one of the R22 or K1D types is employed.· Each has an output range of 8 to 11mv in air, which translates to about 55mv in a 100% O2 environment.
··· That output level works well with low voltage, (nominally 5V) single sided, rail to rail, precision op amps as a gain stage.
··· If you use a 12 bit ADC with a 4.096V reference, you can read out O2 percentage or PPO2 (if that's what you need) directly, if you use a trim pot in the feedback loop of the gain stage to calibrate the output to 1000 in a 100% O2 environment.
If you give me a more detailed idea of what you want to accomplish and some specifics, I may be able to be more helpful.
Darlene
···
Thanks heaps for coming out of the shadows · as it sounds like you have already solved what I'm trying to do. I'm a freediver(ex tech diver) and use hypoxic/altitude training as part of my pre comp routine. Knowing that Hypoxic training units are essentially a rebreather I built my own and here is a link for it - http://forums.deeperblue.net/freediving-equipment/58742-diy-hypoxicator-mk2.html?highlight=hypoxic
Simple closed circuit unit with scrubber, bladder sensor and analyser that I breathe down to 8%-10% and then maintain at that level by a simple manual valve that allows air to mix in a replenish the consumed O2.
If you can help me with a control system for the the sensor/analyser and valve based on a preset target gas mix then that would be awesome. I have bought the BS2 and the education kit and was going to start mucking around with it this weekend. I'm using the same analyser R17(R22 with 3.5mm connector jack) but because of the low O2·targets I'm on the low end of the mV readings compared to normal rebreather usage.
Any help would be really great
regards
Andy
I'm off to work at the moment, but I'll give you a more detailed reply when I get home.· (today's going to be too hectic to get online time at work,
Darlene
I've been giving thought to your project, and since it's for training on land, (as opposed to underwater use) some aspects are less critical, but since to some extent, your life is still in it's hands, "close" may not be "good enough" so to speak. You'll need to get it right.
The first thing I'd recommend would be changing to ·"high output"· sensors.·· The R-22DHO would be my choice.
The reasoning is that the HO cells have a nominal output of 25 millivolts in air. That translates to about 5mv to 10 mv in the O2 concentrations you're working with, as opposed to 2mv to 4mv for the R-17 or R-22 types.
This gets to be quite an issue as you're going to need to amplify the cell's output to feed it to the ADC, (analog to digital converter) and amplifying very low level signals without adding extraneous noise and level shifts from poor connection methods and·input offset issues with the op-amp, gets exponentially harder as the signal levels get lower. When you're down to a few millivolts of signal, every one counts.
The real "gotcha" here is that when the signal level is lowest, you're at the most hypoxic end of your scale, where reliable data is most critical.
I'd suggest using and monitoring at least 2 sensors, not just 1.· Most all rebreather systems use at least·3, and often a 4th .....· Sometimes things still go horribly wrong. ... You need to have at least 2 and watch to see that they track together.
The good part is, It's about as easy to plan a 2 sensor monitor and display as a single one.
Use a dual op-amp IC for the gain stage,·and a dual channel ADC.··A good·choice for a decent dual·op-amp would be the OPA2340, and for the ADC, the LTC1298. .... buy several 2340s (maybe 5 or 6) and hand pick the one with the lowest input offset. ... I usually use 4340s for 4 channel, and·2340 for duals.· Stay away from the cheapie, jelly bean op amps. 324s, 1458s, or even 358s, they·aren't going to cut it for such low input levels.
Be sure to use a MCP1541 precision voltage reference (4.096V)·to supply the Vcc for the 1298.
Everything else of course, runs off a 5v regulator, which can also provide Vin for the 1541.
In air, and with a gain of 84, (using a 25mv cell)·your op-amp stage will feed 2.1V to the adc, which will output to the basic stamp as 2100. There are several ways you could output that value to a small LCD so you'd see it as 21.00%
The simple Parallax 2X16 serial LCD would be fine.
(in practice, you'd want to divide the output by 10 and display no more than 1 decimal place, (21.0%) as the cell's real accuracy is about 1% anyway)
If you're not familiar with op-amp circuits, you'll want to do some reading up. You'll be building a non-inverting amp, and select a feedback resistor group·of 220K and 2.2K with a 2K ten turn trimpot in series to ground. You'll have an adjustable·gain range of ~50 to ~100, which you'll use to get a reading of 2100 in air·for calibration.
The one thing I don't know right off hand, is whether the HO cells need the same 10K terminating·resistor to ground where they come into the amp as all the other cells do, or if it's a different value.·I'd have to check.
Anyway, I hope I helped more than confused.
Darlene
If you'd like, I can post a couple pics of my·O2 monitor/controller.
Post Edited (Geek_Girl) : 7/14/2007 12:45:38 AM GMT
Heaps of great info, thanks and I will need to go and do some homework on availability of parts in Aus etc. My mV numbers in the first post were way wrong but you figured that out before me once I'd given the part number. Any pics, diagrams, code samples from your project would be great if you are ok with sharing them. I have loaded up the software tested the education board and stamp and everything seems to be working, so the fun and games can begin for me. I just got back from our local electonics shop to explore op-amps but they were not much help, your info gives me a lot more to go on and I might head back there today.
Interesting comments on the HO sensor and I will drop by my old tech diving shop today and raid the fridge to see what they have in stock....this end of the world means internet shopping more than it should.
Thanks for the help and hopefully there is more to come.
Andy
Single supply means it's designed to work with a positive supply voltage and ground.· Many op-amps are designed to work with both a positive and negative supply with respect to ground. You want one that works with +5V and ground.
Rail to Rail means it's designed to accept input and then output from the ground rail level to the full supply rail level.· Some op-amps don't function right with very low or very high (with respect to supply voltage) inputs or can't output closer than a volt or so of the supply on output.· With your low input signal, you need good performance very close to the negative (ground) rail.
Here's·some old pics of my project when it was just coming off the breadboard stage and migrating onto the pcb I made for it.
The original project was to build a "heads up display" (the clear tube with the leds in it) to be able to know·what my PO2 was, without having to reach for and look at the PO2 monitor display module. The project sort of took on a life of it's own from the original plan.
I hadn't yet added the lcd display, which it really needed to do it's calibration. The latter pics shows it.
The 2 dual op-amp gain stages are there on the left, with the 4 trim pots to fine tune the gain for calibration.
The chip in the middle is the MCP3204 4 channel adc, and the one on the right is the 2803 driver for the leds in the HUD·display.
What is yet to be added, is the driver board for the realtime triple digital readouts, and the solenoid control board for the O2 addition valve.
I'll post some of those pics in another post.
Darlene
....please please please let the answer be "yes"
http://www.cisatlantic.com/trimix/analyzer/analyzer.
BTW - from the numbers you can see at this seesion on the unit im breathing 9% o2 and the impact is a blood o2 saturation of 71% with a slightly elevated HR of 85bpm. The next challenge is obviously hooking up and monitoring the pulseoximeter as well.
Ummmmmm, Nope······· ...... unfortunately
The Oxyhacker analyser and countless others of it's general type, were built on the DP128 panel meter. The DP128 is a cheap (about $10 USD) panel mounting digital voltmeter module.·The parts are not discrete, but all in one big blob of black epoxy looking stuff on the board.·It's designed to read from 0 TO 1999 with a 0 to 199mV input at the meter. To measure greater voltages, you had to make an appropriate divider and set the decimal point position with a jumper.··The way it works·(if memory is·correct)·is by counting while a charged capacitor is dischaging, ....· when the cap is discharged, the count is displayed. The longer discharge took, the higher the counter counted. Obviously, the discharging resistor value (and the counting speed) was set so that the count would be·equal to the voltage being measured.
The PO2 meter variants changed the value of one of the voltage divider resistors, such that the counter would count·to 1000 (to crresponde to a display of 100.0% or 1.000ata) with an applied input voltage equal to the output voltage of a cell in 100% oxygen, typically, about 55mV instead of the original 100mV.
For most of us with the electronics bug, internet shopping is a way of life.
I live on a small island in the Caribbean, and the 1·Radio Shack store is the only source of parts on the island.
Darlene
Here's another pic of my project as it was coming together. The module visible at the right in the canister is the driver for the triple digital readout module. Yet to be added at that time was the O2 control module.
Post Edited (Geek_Girl) : 7/14/2007 1:38:40 PM GMT
A little annoyed that I stripped the servo gears but my impatience and curiosity sometimes get the better of me (...... "I wonder what happens if I ask it to move past it's 60 degree spec sheet position") - doh
An island·in the Caribbean! - you need to be a freediver and leave all that gear at home. Have you heard of the new tech dive computer on the market - X1? I have the freediving version the F1 which was the earlier version without the deco software. With it's open system and development kit I can imagine you linking it with your current project.
regards
Andy
Thanks Darlene and Mike for all the advice and I just wanted to let you guys know that i'm up and running as a happy little Stamper, with a working prototype. At this point I'm only using the original sensor, but it seems OK and the values are stable through the two channels of the ADC. The code is pretty simple at this stage as it simply monitors the two channels and opens the valve if I'm below target and closes it if I'm above.
....any thoughts on how the code·could manage it more intelligently would be appreciated. I imagine that something along·the lines of more aggressive servo action on large gaps of target to actual readings and less so on small gaps would make sense. Or would some sort of rate of change calculations be better?
Here is a blurry pic of it on the breadboard.
LCD is next and then time for the production version
regards
Andy
Thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Jay K. Jeffries