Nitrox Stick auto adjusting blender

Please register or login

Welcome to ScubaBoard, the world's largest scuba diving community. Registration is not required to read the forums, but we encourage you to join. Joining has its benefits and enables you to participate in the discussions.

Benefits of registering include

  • Ability to post and comment on topics and discussions.
  • A Free photo gallery to share your dive photos with the world.
  • You can make this box go away

Joining is quick and easy. Log in or Register now!

brysonjk

Contributor
Messages
155
Reaction score
21
Location
Pasadena, MD
# of dives
I'm a Fish!
Someone recommended I post this here.

This is a work in progress, but a fun project.

I have created a nitrox blending solution using a Arduino microcontroller, and a proportional control valve. The Arduino has a PID algorithm coded into it that will allow the user to set a specific setpoint and it will maintain that setpoint. For example, turn on the compressor. Long press the knob to calibrate (@20.9%), double click the knob to enter setpoint mode, set the setpoint, and single click to exit. within about 30 seconds the valve will auto modulate and maintain the setpoint.

What makes this nice is that as the pressure increase in the compressor, this will auto-compensate for the additional dwell time of the o2 in the stick. You no longer have to make small adjustments during the filling process.

You can find some of the info here.

and here

Have fun! If there are any other coders/engineers that can help me increase the efficiency of the code, or better tune the PID, that would be awesome!
 

Attachments

  • mixer1 (1).jpg
    mixer1 (1).jpg
    121.4 KB · Views: 108
  • mixer2.jpg
    mixer2.jpg
    118 KB · Views: 96
  • Mixer3.jpg
    Mixer3.jpg
    93.5 KB · Views: 111
  • auto mixer.jpg
    auto mixer.jpg
    81.1 KB · Views: 108
Just a notice to someone who might have specific interest in following what you are doing.

I'll also be following from general interest and the possibility of doing something similar in the future.

Sorry, but I haven't done PID coding in 25 years ...
 
Someone recommended I post this here.

This is a work in progress, but a fun project.

I have created a nitrox blending solution using a Arduino microcontroller, and a proportional control valve. The Arduino has a PID algorithm coded into it that will allow the user to set a specific setpoint and it will maintain that setpoint. For example, turn on the compressor. Long press the knob to calibrate (@20.9%), double click the knob to enter setpoint mode, set the setpoint, and single click to exit. within about 30 seconds the valve will auto modulate and maintain the setpoint.

What makes this nice is that as the pressure increase in the compressor, this will auto-compensate for the additional dwell time of the o2 in the stick. You no longer have to make small adjustments during the filling process.

You can find some of the info here.

and here

Have fun! If there are any other coders/engineers that can help me increase the efficiency of the code, or better tune the PID, that would be awesome!
I think it's a cool idea. In reality I don't know how well that it would all hold up over time? I would assume there's some type of fail safe if O2 went too high?

I have read that a lot of people depend on 2 O2 regulators to dial in the flow. This supposedly really helps stabilize the mix.

I'm really close to having my stick up and running... the heat here has brought everything to a halt (and I'm kind of lazy).

It's very cool though. Do you have any videos of it working?
 
The main read/update loop is artificially capped at 100hz. If one wanted maximum efficiency, you could simply break out the ADC read/DAC write calls out into the top level of loop(), where they would run as fast as possible. Probably be updating the valve position in the kilohertz range or more.

Would this result in any difference in the gas it generated? Almost certainly not, but it's a more ideal form of the code, breaking the 'update valve' and 'update screen' code apart.

It all looks reasonable otherwise, but as rob.mwpropane mentions, it could use some more safety checks on the valves it reads and writes.
 
Do you think the code needs to be more efficient? If so why?
I mean it works, but I'm just a very part engineer/developer. The days of doing this kind of work are behind me. I accept that my coding may not be up to snuff when compared to many people much better at it than me.
 
I think it's a cool idea. In reality I don't know how well that it would all hold up over time? I would assume there's some type of fail safe if O2 went too high?

I have read that a lot of people depend on 2 O2 regulators to dial in the flow. This supposedly really helps stabilize the mix.

I'm really close to having my stick up and running... the heat here has brought everything to a halt (and I'm kind of lazy).

It's very cool though. Do you have any videos of it working?
One safety is to set the setpoint to 40 and dial back the o2 regulator to a max of 1-2 PSI above what you are really wanting (eg. 34% for a 32% mix). Then change your setpoint to what you really want. This will provide an upper bound if the proportional control valve gets stuck open. One nice thing about a PID control is that it works off of the error reported between the setpoint and reading. So if the compressor cuts off, and the o2 in the mixer goes up, and up as if it is trying to go to 100%, the proportional valve will keep trying to reduce the o2. Quickly closing the valve and cutting off the o2. I tested this last night. I had the mixer set to 32%. This is an 8 cuft/min compressor. When the compressor shut off, the spike in o2 across the mixer chamber in the nitrox stick only spiked to 35% before the valve closed entirely. A lower-volume compressor would most likely experience less of a spike.
 
The main read/update loop is artificially capped at 100hz. If one wanted maximum efficiency, you could simply break out the ADC read/DAC write calls out into the top level of loop(), where they would run as fast as possible. Probably be updating the valve position in the kilohertz range or more.

Would this result in any difference in the gas it generated? Almost certainly not, but it's a more ideal form of the code, breaking the 'update valve' and 'update screen' code apart.

It all looks reasonable otherwise, but as rob.mwpropane mentions, it could use some more safety checks on the valves it reads and writes.
Thank you. I will look into this. These kinds of pointers are exactly what I was hoping to receive by posting the project online. I really appreciate it.
 

Back
Top Bottom