Published using Google Docs
AusOcean Pressure Vessel Testing Guide
Updated automatically every 5 minutes

AusOcean Pressure Vessel Guide

Revised: 10th February 2020

Authors:

Saxon Nelson-Milton <saxon@ausocean.org>

Scott Baranard <scott@ausocean.org>

Frank Cui <frank@ausocean.org>


Copyright

Copyright © The Australian Ocean Laboratory Limited (AusOcean) 2020.

The information contained herein is licensed under a Creative Commons Attribution 3.0 Australia License.

Notice

AusOcean is not liable for any losses, damages, costs and/or other consequences resulting directly or indirectly from using or relying on the information in this document.


Table of contents

1.0 Introduction        3

2.0  READ FIRST:
Important safety notes
        4

2.1 Pressure        4

2.2 Electric Current        4

3.0 Overview        5

3.0 Materials        6

4.0 Instructions        6

4.1 Pressure vessel        6

4.2 Electronics Box        7

5.0 Testing Cameras        9

6.0 Code        9

1.0 Introduction

This document describes fabrication and assembly of a PVC based pressure vessel intended for the testing of underwater sensing/actuation equipment. Emulation of pressures to about 30m (considered safe pressure) are possible.

This system is not only helpful for R&D of possible waterproof housings, but also testing underwater equipment in pre-deployment testing procedures.


2.0  READ FIRST:
Important safety notes

2.1 Pressure

The pressure vessel by default maintains pressure in the range of 120 to 150kPa. This can be changed, however do not exceed 300kPa maximum pressure.

In case of a fault, it is possible for the vessel to have a higher pressure which could cause a rupture. Keep the pressure vessel stored in an enclosed space away from people.

2.2 Electric Current

The pressure vessel uses a car battery to operate the pump. This has the potential for high currents, which can be dangerous. Keep fingers away from the wires, and disconnect from the battery before handling.


3.0 Overview

The pressure vessel is a self regulating pressure testing chamber that can be used for the testing of underwater housings, even with cabling. An arbitrary number of cable glands can be adopted on the roof of the vessel in order to test multiple housings simultaneously. Some air will invariably escape, therefore a pressure sensor and microcontroller is used to control a 12V pump to maintain target pressure range.

3.0 Materials

NB: links are only to provide examples of materials; you do not have to use these specific items.

4.0 Instructions

Instructions are for standard configuration, i.e. 1 cable gland in lid of vessel.

4.1 Pressure vessel

NB: PVC cement usually requires 24 hours for full cure. Please read the directions of PVC cement. DO NOT pressurize until the cement has cured.

  1. Glue 150mm cap to 500mm long 150mm PVC pipe using pressure grade PVC cement. Apply cement liberally; this connection must be watertight. Apply pressure for at least 5 minutes.  
  2. Glue threaded coupler to 500mm long 150mm PVC pipe using pressure grade PVC cement. Apply cement liberally and cover all surfaces. Apply pressure for at least 5 minutes.

3.

4.2 Electronics Box

Step 1:

Step 1

  1. Cut a rectangular hole at one end that is approximately 20mm wide and 10mm high.
  2. Solder the microcontroller to the protoboard. Connect ...

TODO: complete this section


  1. Place the circuit inside the box and push all the wires out of the rectangular hole.
  2. Close the box and label the box.
  3. Connect the battery to the control box using the jumper cables. Also, connect the battery to the wall charger, so it does not become empty.

Step 3

Step 4

Step 5


5.0 Testing Cameras

6.0 Code

/*
AUTHORS
 Saxon Nelson-Milton <saxon@ausocean.org>

LICENSE
 Copyright (C) 2020 the Australian Ocean Lab (AusOcean)

 It is free software: you can redistribute it and/or modify them
 under the terms of the GNU General Public License as published by the
 Free Software Foundation, either version 3 of the License, or (at your
 option) any later version.

 It is distributed in the hope that it will be useful, but WITHOUT
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
 for more details.

 You should have received a copy of the GNU General Public License
 in gpl.txt.  If not, see http://www.gnu.org/licenses.
*/


// Display pins.
#define MAX7219DIN 3
#define MAX7219CS 4
#define MAX7219CLK 5

// Display parameters.
#define DISPLAY_BRIGHTNESS 15

// Pin numbers.
#define PRESSURE_PIN 0
#define RELAY_PIN 2
#define LED_PIN 13

// Pressures.
#define MAX_PRESSURE 150 //kPa
#define RANGE 30 // kPa
#define MIN_PRESSURE MAX_PRESSURE - RANGE
#define ABS_MAX_PRESSURE 300 // kPa

// Max pump running time.
#define MAX_PUMP_TIME 0.5 // Minutes

// Misc consts.
#define NO_OF_READINGS 500

// This will put arduino into an alarm state i.e. something
// went wrong.
void alarmed(){
 
// Again force relay pin low, we don't want pump on.
 digitalWrite(RELAY_PIN,LOW);

 
// Now flash LED to warn of alarm state.
 
while(true){
   digitalWrite(LED_PIN,HIGH);
   delay(
500);
   digitalWrite(LED_PIN,LOW);
   delay(
500);
 }
}

float v_to_kPa(float v){
 
float p = (((1600.0-0.0)/(4.5-0.5))*v)-(((1600.0-0.0)/(4.5-0.5))*0.5);
 
return p;
}

float reading_to_v(unsigned int r){
 
float v = float(r) * (5.0/1023.0);
 
return v;
}

int read_pressure(){
 byte readings[NO_OF_READINGS];
 
for(int i = 0; i < NO_OF_READINGS; i++ ){
   readings[i] = adjust(v_to_kPa(reading_to_v(analogRead(PRESSURE_PIN))));
 }
 
return median(readings,NO_OF_READINGS);
}

int median(byte* nums, unsigned int n){
 bubbleSort(nums,n);
 
int i =  n / 2;
 
return nums[i];
}

void swap(byte *xp, byte *yp){
   byte temp = *xp;
   *xp = *yp;
   *yp = temp;
}

// An optimized version of Bubble Sort
void bubbleSort(byte arr[], int n){
 
int i, j;
 
bool swapped;
 
for (i = 0; i < n-1; i++)
  {
    swapped =
false;
   
for (j = 0; j < n-i-1; j++)
    {
       
if (arr[j] > arr[j+1])
       {
          swap(&arr[j], &arr[j+
1]);
          swapped =
true;
       }
    }

   
// IF no two elements were swapped by inner loop, then break
   
if (swapped == false)
       
break;
  }
}

bool pumpOn = false;
float zero = 0;
float startPumpTime = 0;

void setup() {
 pinMode(RELAY_PIN,OUTPUT);
 pinMode(LED_PIN,OUTPUT);

 MAX7219init();
 MAX7219brightness(DISPLAY_BRIGHTNESS);

 Serial.begin(
9600);
}

void startPumpTimer(){
 startPumpTime = millis();
}

float getPumpTime(){
 
return (float(millis())-startPumpTime)/(1000.0*60.0);
}

int adjust(float p){
 
if( p < 0 ){
   
return 0;
 }
 
return int(p);
}

void loop() {
 
// Get pressure from pressure sensor.
 
float pressure = read_pressure();

 
// Print pressure to serial monitor.
 Serial.println(
"Pressure (kPa):");
 Serial.println(pressure);

 
// Print pressure to display.
 MAX7219shownum(
int(pressure));

 
if( pumpOn ){
   
float pumpTime = getPumpTime();

   Serial.println(
"Pump time (minutes)");
   Serial.println(pumpTime);

   
if( pumpTime > MAX_PUMP_TIME ){
     Serial.println(
"Pump has been running too long! Alarmed!");
     alarmed();
   }
 }

 
if( pressure > ABS_MAX_PRESSURE ){
   Serial.println(
"Pressure too high! Alarmed!");
   alarmed();
 }

 
// If the pump is on and we're above max pressure, then turn it off.
 
if( pumpOn && pressure > MAX_PRESSURE ){
   digitalWrite(RELAY_PIN,LOW);
   pumpOn =
false;
   MAX7219init();
 }

 
// If pump is off but below min pressure, turn it on.
 
if( !pumpOn && pressure < MIN_PRESSURE ){
   digitalWrite(RELAY_PIN,HIGH);
   pumpOn =
true;
   startPumpTimer();
   MAX7219init();
 }
}


void MAX7219shownum(unsigned long n){
 
unsigned long k=n;
 byte blank=
0;
 
for(int i=1;i<9;i++){
   
if(blank){
     MAX7219senddata(i,
15);
   }
else{
     MAX7219senddata(i,k%
10);
   }
   k=k/
10;
   
if(k==0){blank=1;}
 }
}

void MAX7219brightness(byte b){  //0-15 is range high nybble is ignored
 MAX7219senddata(
10,b);        //intensity
}

void MAX7219init(){
 pinMode(MAX7219DIN,OUTPUT);
 pinMode(MAX7219CS,OUTPUT);
 pinMode(MAX7219CLK,OUTPUT);
 digitalWrite(MAX7219CS,HIGH);  
//CS off
 digitalWrite(MAX7219CLK,LOW);  
//CLK low
 MAX7219senddata(
15,0);        //test mode off
 MAX7219senddata(
12,1);        //display on
 MAX7219senddata(
9,255);       //decode all digits
 MAX7219senddata(
11,7);        //scan all
 
for(int i=1;i<9;i++){
   MAX7219senddata(i,
0);       //blank all
 }
}

void MAX7219senddata(byte reg, byte data){
 digitalWrite(MAX7219CS,LOW);  
//CS on
 
for(int i=128;i>0;i=i>>1){
   
if(i&reg){
     digitalWrite(MAX7219DIN,HIGH);
   }
else{
     digitalWrite(MAX7219DIN,LOW);
   }
 digitalWrite(MAX7219CLK,HIGH);
 digitalWrite(MAX7219CLK,LOW);  
//CLK toggle
 }
 
for(int i=128;i>0;i=i>>1){
   
if(i&data){
     digitalWrite(MAX7219DIN,HIGH);
   }
else{
     digitalWrite(MAX7219DIN,LOW);
   }
 digitalWrite(MAX7219CLK,HIGH);
 digitalWrite(MAX7219CLK,LOW);  
//CLK toggle
 }
 digitalWrite(MAX7219CS,HIGH);  
//CS off
}