The Gas Feedback system monitors tank pressure and provides outputs to the Fuel Cell Pressure gage and generates signal [K] the Gate Pulse Frequency Generator (K3) that shuts off the cell when the Fuel Cell pressure reaches a preset limit, turns on the Over Pressure LED and generates the [11/12] which is the inverse of [K].
The KGF1 board built from Stanley Meyer’s circuit diagram function but does not have a display device. While it includes the parts to drive Stanley’s display the is no detail on the device he was using. As am process of building a cell I wanted to have a display that would show the tank pressure and limit settings.
Basically, I started out to replace the top half of the KGS1 schematic which has the display preparation functions. As I have a LCD (20 character by 4-line display) driven by an Arduino UNO board. There are existing Libraries that are available to control the interface to LCD so I only need to read, convert and write pressure settings to the display.
As I also needed a pressure transducer, I searched for that and found there are multiple ones available, I purchased one 0-100 psi range that only needs 5-volt as reference.
When I search on hooking this pressure transducer to a UNO I found this YouTube Link
Pressure Sensor - Arduino - YouTube
https://www.youtube.com/watch?v=UrqPxwsPWGk&ab_channel=OvensGarage
He was looking for an oil pressure transducer where he could display pressure. He does a very good job explaining how the pressure transducer works and how to interface it with and UNO and show pressure on the display.
I followed his code though I used the Arduino Map function to map transducer voltage range to the 0-100 psi range. This is done by reading the transducer output (0.5 – 4.5 volts) on one of the UNO analog pins. The Arduino convert this analog 0-5 voltage input range to a number between 0 – 1023. To get a true reading we need adjust the lower and upper values from the pressure transducer as 0 psi is at 0.5v and 100 psi is at 4.5v) you and do this using math the way he did or just use the build in MAP function.
As it is only a couple of lines of code and a single 100K pot I added the ability to also set and display the limit set point. A couple of if statements one to test if at or above limit then write OVER PRESSURE to display. Second to test if below limit and clear OVER PRESSURE message. In the code I included a range that tank pressure can drop before restarting to keep the system from constantly cycling.
For testing purposes, I used a second 100K pot to simulate the 0.5 to 4.5 voltage range of the pot. Though I did hook up the pressure transducer to my compressor to verify that everything worked correctly. (All I need to hook it to compressor was a .50 ½” to ¼” compressor snap on connector).
Once this was all working correctly, I realized I had replaced most of the functions of the original board. So, I added a couple more lines of code that set one of the UNO digital output pins to HIGH (5-Volts) when tank is overpressure and LOW (0-Volts) when it is not.
I then did a couple of tests with the complete system to see if I could use this setup to turn off CELL.
For the first test I pulled GSF1 board and hooked the output of the UNO digital pin to GSF1 K connector on back plane. Setting tank to over pressure had no effect of CELL OFF LED. If I remember correctly what is needed is to pull state to ground which the digital output does not do, only sets value to 0V.
For the second test. I pulled A39 chip (third 741 at determine over pressure by comparing voltage level from sensor to set point voltage level). I then connect UNO digital pin output to pin six of the empty IC A39 socket. This left the components on the board after A39 that driving the K output to still be active. This test worked and CELL light goes OFF with overpressure and back on when pressure drops below setting.
A couple of notes about Arduino code. The UNO connect pins used and constants are set in the constants part of code at beginning so values can be changed with modify the code.
I did not use the pots on the KGS1 board as the VCC is 12V and values over 5v will damage the UNO inputs.
The Serial interface item are used for testing to display the transducer reading to find values that need to be used in the map function. These should be either removed or commented out in running version as they cause reading to slight unstable and slow the system down.
NOTE: An alternate way to find these values without using serial interface is comment out the MAP lines as you then see the analog value being read by UNO board (number between 0-1023). Once you find the value you need to set them in the constant section of code and remove comment marks to make code active with desired values.
Arduino UNO Code
// Read 0-100 psi Pressure Transducer and display pressure on LCD Display
/*The program interfaces with a standard 3-wire pressure transducer, reads
* the analog voltage (0-5v), then converts the signal to a readable output
* and displays it on a LCD screen.
*
* based on program developed by Tyler at Tylerovens@me.com (see his Youtube video)
*/
#include <Wire.h> //allows communication to i2c device in this case LCD display
#include <LiquidCrystal_I2C.h> //interface for LCD screens
const int pressureInput = A0; //set the analog input pin for the pressure transducer
const int pressureZero = 98; //analog reading of pressure transducer at 0 psi
const int pressureMax = 992; //analog reading of pressure transducer at 100psi
const int pressuretransducermaxPSI = 100; //max value of transducer being used
const int limitInput = A1; // set the analog input pin for pressure limit
const int limitZero = 33; //analog reading of limit pot lowest value
const int limitMax = 1023; //analog reading of limit pot highest value
const int baudRate = 9600; //used to set baud rate of serial monitor
const int sensorreadDelay = 250; //used to set the sensor read delay in milliseconds
int pressureValue = 0; //variable to hold value coming from the pressure transducer
int limitValue = 0; //variable to pressure value coming from the limit setting pot
const int pressureStatus = 2; //set the digital pin for results of pressure check
const int limitdropRange = 5; //Once over pressure is reached this is the range tank pressure will drop before allowing pressure to increase
LiquidCrystal_I2C lcd (0x27, 20, 4); //set the LCD communicatin address; Format (address, columns, rows)
void setup()
{
pinMode(pressureStatus, OUTPUT); // sets digital pin specified by pressStatus as output
lcd.init(); //initalize LCD screen
lcd.backlight(); //turn on backlight
// Serial.begin(baudRate); //initalizes the serial port interface at specified baud rate
}
void loop()
{
pressureValue = analogRead(pressureInput); // reads pressure transducer and assigns to varable
limitValue = analogRead(limitInput); //reads limit pot setting and assigns to variable
// Serial.print(pressureValue, 1); //prints analog value read from transducer to serial monitor
// Serial.print(" value from sensor for .5 volts 0 psi \n"); //print label to serial monitor
// Serial.print(limitValue, 1); //prints analog value read from limit pot to serial monitor
// Serial.print(" value from pot for lowest setting 0 psi \n"); //print label to serial monitor
pressureValue = map(pressureValue, pressureZero, pressureMax, 0, pressuretransducermaxPSI); //converts analog input sensor range to output pressure range 0-100
lcd.setCursor(0,0); //set cursor to column 0, row 0
lcd.print("Pressure "); //prints label
lcd.print(pressureValue, 1); //pressure value in psi
lcd.print(" psi"); //prints label after value
lcd.print(" "); //clears the display after large values
limitValue = map(limitValue, limitZero, limitMax, 0, 100); //converts analog input limit range to output pressure range 0-100
lcd.setCursor(0,1); //set cursor to column 0, row 1
lcd.print("Limit "); //prints limit label
lcd.print(limitValue,1); //prints limit value
lcd.print(" psi"); //prints lable after value
lcd.print(" "); //clears the display after large values
//check for over pressure
if(pressureValue >= limitValue) {
digitalWrite(pressureStatus, HIGH); //sets over pressure status high if pressure is at or above limit
lcd.setCursor(0,2); //set cursor to column 0, row 2
lcd.print("TANK OVER PRESSURE"); //prints over pressure warning
}
if (pressureValue <= (limitValue - limitdropRange)) {
digitalWrite(pressureStatus, LOW); //sets over pressure status low to allow pressure to increase again
lcd.setCursor(0,2); //set cursor to column 0, row 2
lcd.print(" "); //clear over pressure warning
}
delay(sensorreadDelay); //delay in msec between read values
}
The KGF1 board built from Stanley Meyer’s circuit diagram function but does not have a display device. While it includes the parts to drive Stanley’s display the is no detail on the device he was using. As am process of building a cell I wanted to have a display that would show the tank pressure and limit settings.
Basically, I started out to replace the top half of the KGS1 schematic which has the display preparation functions. As I have a LCD (20 character by 4-line display) driven by an Arduino UNO board. There are existing Libraries that are available to control the interface to LCD so I only need to read, convert and write pressure settings to the display.
As I also needed a pressure transducer, I searched for that and found there are multiple ones available, I purchased one 0-100 psi range that only needs 5-volt as reference.
When I search on hooking this pressure transducer to a UNO I found this YouTube Link
Pressure Sensor - Arduino - YouTube
https://www.youtube.com/watch?v=UrqPxwsPWGk&ab_channel=OvensGarage
He was looking for an oil pressure transducer where he could display pressure. He does a very good job explaining how the pressure transducer works and how to interface it with and UNO and show pressure on the display.
I followed his code though I used the Arduino Map function to map transducer voltage range to the 0-100 psi range. This is done by reading the transducer output (0.5 – 4.5 volts) on one of the UNO analog pins. The Arduino convert this analog 0-5 voltage input range to a number between 0 – 1023. To get a true reading we need adjust the lower and upper values from the pressure transducer as 0 psi is at 0.5v and 100 psi is at 4.5v) you and do this using math the way he did or just use the build in MAP function.
As it is only a couple of lines of code and a single 100K pot I added the ability to also set and display the limit set point. A couple of if statements one to test if at or above limit then write OVER PRESSURE to display. Second to test if below limit and clear OVER PRESSURE message. In the code I included a range that tank pressure can drop before restarting to keep the system from constantly cycling.
For testing purposes, I used a second 100K pot to simulate the 0.5 to 4.5 voltage range of the pot. Though I did hook up the pressure transducer to my compressor to verify that everything worked correctly. (All I need to hook it to compressor was a .50 ½” to ¼” compressor snap on connector).
Once this was all working correctly, I realized I had replaced most of the functions of the original board. So, I added a couple more lines of code that set one of the UNO digital output pins to HIGH (5-Volts) when tank is overpressure and LOW (0-Volts) when it is not.
I then did a couple of tests with the complete system to see if I could use this setup to turn off CELL.
For the first test I pulled GSF1 board and hooked the output of the UNO digital pin to GSF1 K connector on back plane. Setting tank to over pressure had no effect of CELL OFF LED. If I remember correctly what is needed is to pull state to ground which the digital output does not do, only sets value to 0V.
For the second test. I pulled A39 chip (third 741 at determine over pressure by comparing voltage level from sensor to set point voltage level). I then connect UNO digital pin output to pin six of the empty IC A39 socket. This left the components on the board after A39 that driving the K output to still be active. This test worked and CELL light goes OFF with overpressure and back on when pressure drops below setting.
A couple of notes about Arduino code. The UNO connect pins used and constants are set in the constants part of code at beginning so values can be changed with modify the code.
I did not use the pots on the KGS1 board as the VCC is 12V and values over 5v will damage the UNO inputs.
The Serial interface item are used for testing to display the transducer reading to find values that need to be used in the map function. These should be either removed or commented out in running version as they cause reading to slight unstable and slow the system down.
NOTE: An alternate way to find these values without using serial interface is comment out the MAP lines as you then see the analog value being read by UNO board (number between 0-1023). Once you find the value you need to set them in the constant section of code and remove comment marks to make code active with desired values.
Arduino UNO Code
// Read 0-100 psi Pressure Transducer and display pressure on LCD Display
/*The program interfaces with a standard 3-wire pressure transducer, reads
* the analog voltage (0-5v), then converts the signal to a readable output
* and displays it on a LCD screen.
*
* based on program developed by Tyler at Tylerovens@me.com (see his Youtube video)
*/
#include <Wire.h> //allows communication to i2c device in this case LCD display
#include <LiquidCrystal_I2C.h> //interface for LCD screens
const int pressureInput = A0; //set the analog input pin for the pressure transducer
const int pressureZero = 98; //analog reading of pressure transducer at 0 psi
const int pressureMax = 992; //analog reading of pressure transducer at 100psi
const int pressuretransducermaxPSI = 100; //max value of transducer being used
const int limitInput = A1; // set the analog input pin for pressure limit
const int limitZero = 33; //analog reading of limit pot lowest value
const int limitMax = 1023; //analog reading of limit pot highest value
const int baudRate = 9600; //used to set baud rate of serial monitor
const int sensorreadDelay = 250; //used to set the sensor read delay in milliseconds
int pressureValue = 0; //variable to hold value coming from the pressure transducer
int limitValue = 0; //variable to pressure value coming from the limit setting pot
const int pressureStatus = 2; //set the digital pin for results of pressure check
const int limitdropRange = 5; //Once over pressure is reached this is the range tank pressure will drop before allowing pressure to increase
LiquidCrystal_I2C lcd (0x27, 20, 4); //set the LCD communicatin address; Format (address, columns, rows)
void setup()
{
pinMode(pressureStatus, OUTPUT); // sets digital pin specified by pressStatus as output
lcd.init(); //initalize LCD screen
lcd.backlight(); //turn on backlight
// Serial.begin(baudRate); //initalizes the serial port interface at specified baud rate
}
void loop()
{
pressureValue = analogRead(pressureInput); // reads pressure transducer and assigns to varable
limitValue = analogRead(limitInput); //reads limit pot setting and assigns to variable
// Serial.print(pressureValue, 1); //prints analog value read from transducer to serial monitor
// Serial.print(" value from sensor for .5 volts 0 psi \n"); //print label to serial monitor
// Serial.print(limitValue, 1); //prints analog value read from limit pot to serial monitor
// Serial.print(" value from pot for lowest setting 0 psi \n"); //print label to serial monitor
pressureValue = map(pressureValue, pressureZero, pressureMax, 0, pressuretransducermaxPSI); //converts analog input sensor range to output pressure range 0-100
lcd.setCursor(0,0); //set cursor to column 0, row 0
lcd.print("Pressure "); //prints label
lcd.print(pressureValue, 1); //pressure value in psi
lcd.print(" psi"); //prints label after value
lcd.print(" "); //clears the display after large values
limitValue = map(limitValue, limitZero, limitMax, 0, 100); //converts analog input limit range to output pressure range 0-100
lcd.setCursor(0,1); //set cursor to column 0, row 1
lcd.print("Limit "); //prints limit label
lcd.print(limitValue,1); //prints limit value
lcd.print(" psi"); //prints lable after value
lcd.print(" "); //clears the display after large values
//check for over pressure
if(pressureValue >= limitValue) {
digitalWrite(pressureStatus, HIGH); //sets over pressure status high if pressure is at or above limit
lcd.setCursor(0,2); //set cursor to column 0, row 2
lcd.print("TANK OVER PRESSURE"); //prints over pressure warning
}
if (pressureValue <= (limitValue - limitdropRange)) {
digitalWrite(pressureStatus, LOW); //sets over pressure status low to allow pressure to increase again
lcd.setCursor(0,2); //set cursor to column 0, row 2
lcd.print(" "); //clear over pressure warning
}
delay(sensorreadDelay); //delay in msec between read values
}