Compressor controller

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!

I found it, this is the old code. I know that several libraries have been updated over the last two years, so some lines might require a different syntax.
 

Attachments

  • compressorcode.txt.zip
    4.4 KB · Views: 68
Arduino is simpler than a Raspberry Pi, and in many cases more reliable because of the simplicity. Anything that is to run stand-alone, can probably be done the easiest with an Arduino.

The whole thing on a display is a gimmick, the only things that really count (and doesn't require a color display):
1. Stop the compressor is the oil pressure in the last stage drops (below 35bar*).
2. Drain the condensate every 15 minutes*.
3. Stop the compressor when the maximum pressure has been reached.

For option 1 I use the standard oil pressure switch that's already used on nearly all Bauer compressors. It closes above the pressure that can be set with the turn wheel. During the first few seconds of the compressor startup, low oil pressure shouldn't cut the power since it takes a couple of rotations to build up.

Connect from the ground (GND pin) to the switch, and the other switch connection goes to a digital pin, which you set as input with an internal pull-up option. Once the compressor has been running for 10 seconds, an oil pressure drop (= switch opens) will pull the input pin to HIGH, the program should then cut the power (through a relay).

For option 2 just a relay is needed. Close the relay on startup. Count 900 seconds, open the relay, count 6 seconds, close the relay. Repeat until compressor stops and open the relay.

Option 3 requires a pressure sensor. The industry standard for sensors is the current-loop: 4-20mA. AE has some pretty good sensors for roughly $25 for 250bar*, 300bar*, 400bar*. But....Arduino (or Raspberry) can't read currents, only voltages. So a current-voltage-converter is required. And since Arduino does a piss-poor job when it comes to changing an analog voltage into a digital value, I used an ADS1115. And then....it's measuring, calibrating, programming.

All nice as long as it runs standalone. One could add bluetooth or ethernet to Arduino, but this is where a Raspberry pi has benefits. For example, in my compressor room, a Raspberry Pi takes care of the following:
  1. Keep track of the pressure in the banks by measuring every 5 minutes and use rrdtool to graph it.
  2. Check who is filling tanks, by reading an NFC tag. Tags are stored in a database. The Raspberry Pi checks the tank pressure (sensor 1), if it's lower than bank 1 (sensor 2) it opens the solenoid 1 to bank 1. Next, it closes solenoid 1 and opens solenoid 2 to bank 2 (which has sensor 3). Once the final pressure has been reached, it turns off solenoid 2. The total bank volume before and after the fill are stored in the database and are used to calculate how much breathing gas was delivered.
  3. The RPi also measures the temperatures of all the tanks on the bank, which is used in calculating the practical volume with air compressibility factors.
  4. The RPi can also be used for blending: I simply select EAN32, EAN50 or EAN80, and the RPi first opens the (O2 cleaned) solenoid to the oxygen bank, waits while the tank is slowly filled to the required pressure, and then tops up with air as in 2.

View attachment 618646 View attachment 618647
The panel and a closer look at the electronics: PN532 NFC reader, 2 OLED screen (SSD1306) and 3 menu buttons.

The RPi communicates with a hosted server for the database and rrd-data. Below is an example of the pressures. It's still slowly dropping since a check valve is not properly sealing. Still work to be done....
View attachment 618650


* Yes. Metric system. Feel free to convert to the impaired system.
Man that is a nice setup, love the effort that you have put in.
Nearly all automation dreams come true.

Nice work.

My system although fairly large is setup very simply and mostly manual not including the proprietary drains and cut off.

I will have to one day get on to this sort of thing.

Auto mixing, I am very impressed. And jealous.

Again, Nice Work.
 
https://www.shearwater.com/products/peregrine/

Back
Top Bottom