Co2 Filling Machine

Hello everybody,
I have read many lines of code, of course some books of programming Arduino, I have tryed many of sketches of IDE. I like the approach of forums, specially this one. Because Arduino (I mean something just like this, but maybe and other compiler used for same purpose) was my dream more than 20 years ago, when I was school boy learning Pascal for programming (the most powerful machine at school uses 386 processor) I tryed to use it to create my own project - upgrade machine , filling CO2 into aerosol bottles, for a factory of my friend. Now the machine uses a man who steps on a pedal and holds it till filling is complete, the man decides when is done, looking at a clock style gauge pressure manometer 0-16 Bar. When the man decides it's enough - he releases the pedal and machine ejecting nozzle releases the bottle. I mean not to spit out any leakage at the same time the botthle nozzle leaves the bottle , the last is released. The next is some shaking of bottle (sometimes this shaking decreases the pressure inside), and second recharge to some higher pressure. This is the whole process. I have tryed some functions of code , but I decided it would be better to have and an Emergency Stop.
So when trying to implement and the E-Stop I met some difficulties, like the time it is scanned, during the work time ot process. So the machine stops when it finishes the cycle and then gets the E-Stop is pressed. But because I decided to not rely on code for emergency, the E-Stop is made to cut the current of gas valve and the valve ot holding bottle pneumatics, so it really immediate releases the bottle if E-stop is pressed. But this freezes the code and nothing happens any more, until stopping the machine supply. So I left this code away and tried to write a brand new one, using interrupts, but because I use and display, the lcd library sometimes makes trouble, and the screen flickers some strange characters. Of course this does not makes E-stop to work correctly. So I would like to ask you for help. How could you organize the code for instant stop when E-stop is pressed, and to fill bottles safely ?

regards
toncho_b4

toncho_b4:
Hello everybody,
I have read many lines of code, of course some books of programming Arduino, I have tryed many of sketches of IDE. I like the approach of forums, specially this one. Because Arduino (I mean something just like this, but maybe and other compiler used for same purpose) was my dream more than 20 years ago, when I was school boy learning Pascal for programming (the most powerful machine at school uses 386 processor) I tryed to use it to create my own project - upgrade machine , filling CO2 into aerosol bottles, for a factory of my friend. Now the machine uses a man who steps on a pedal and holds it till filling is complete, the man decides when is done, looking at a clock style gauge pressure manometer 0-16 Bar. When the man decides it's enough - he releases the pedal and machine ejecting nozzle releases the bottle. I mean not to spit out any leakage at the same time the botthle nozzle leaves the bottle , the last is released. The next is some shaking of bottle (sometimes this shaking decreases the pressure inside), and second recharge to some higher pressure. This is the whole process. I have tryed some functions of code , but I decided it would be better to have and an Emergency Stop.
So when trying to implement and the E-Stop I met some difficulties, like the time it is scanned, during the work time ot process. So the machine stops when it finishes the cycle and then gets the E-Stop is pressed. But because I decided to not rely on code for emergency, the E-Stop is made to cut the current of gas valve and the valve ot holding bottle pneumatics, so it really immediate releases the bottle if E-stop is pressed. But this freezes the code and nothing happens any more, until stopping the machine supply. So I left this code away and tried to write a brand new one, using interrupts, but because I use and display, the lcd library sometimes makes trouble, and the screen flickers some strange characters. Of course this does not makes E-stop to work correctly. So I would like to ask you for help. How could you organize the code for instant stop when E-stop is pressed, and to fill bottles safely ?

regards
toncho_b4

I'd recommend you start a new topic, and post your code as well as your schematics

Split from an old topic

" So I would like to ask you for help. How could you organize the code for instant stop when E-stop is pressed, and to fill bottles safely ?"

You might start by posting your code using the tool bar </> code tags so people can see what you have going on.

It would almost certainly be better if the Emergency Stop were implemented in hardware rather than in software. Programs have been known to go wrong in unexpected ways and during an emergency is not the time to find out no matter how much the software has been tested

Hello ,
First I’d like to thank you UKHeliBob for topic, and second for advice of Emergency Stop. I have read I think enough about it in many differrent topics here and not only here.
Second I’d like to thank you TimMJN , about your advice, so here is a kind of wiring , but not precise one, just to figure how things should look at first view. Sorry for ugly
mspaint picture, but when the project finishes, I would post the complete wiring.

Here are some explanations about schematic, what is supposed to happen (now happens without complicated electronics, and electronics).

Controller : Now it is Uno, but it will be changed to Pro Mini , because I found some more pins (A6, A7 - extra functionality, no internal power supply for any other electronics);

LCD : Ordinary LCD display 16x2 usually used with Arduino, but maybe changed to 20x4 with cyrilic;

Pressure Transmitter AKS32R : manufactoried by Danfoss , I have already mounted it, to meassure the pressure at output of CO2 Valve , when bottle is connected to machinery ,
if there is no bottle, no pressure to measure, output is about 0.7 Volts, when maximum pressure is exceeded (33-34 Bar) output is about 4.56 Volts, but whe must not get more
than 8 Bar in any case, which outputs about 1.64,1.65 Volts , the value is read by PressurePin A0 ;

E-Stop , or Emergency Alarm Stop is normally closed contact switch, which opens when pressed.I need just to see when pressed (LCD displayes the situation of Alarm, better with
ficker about 2 times per second) - there are additional contacts, to cut real supply of valves, so when E-stop is pressed the program checks only when E-stop is released, so the cycle
is ready to start from begining or with additional button “Refill CO2 Button”

AlarmLedPin is digital output which same way like LCD flickers Alarm with a led;

RefillCo2Button, this second (additional button) the man uses to fill more than preset , again not more than 8Bar into bottle, but programmable safe quantity, it copies almost same
process like StartPedalPin, difference is that the man may stop filling any time, or when reached the programmed preset value machine releases the bottle.If pressed again the
program checks if preset value is reached, and if not continues to refill again, but the man may stop pressing the button , and machinery instantly releases the bottle;

StartPedalPin is the main button (normally closed contact of pedal , when pressed opens contact).

SetPressurePin is analog input that the man sets a potentiometer to a value that the bottle should be filled, actually I missed a resistor in series, which presents the limitation of
maximum pressure , for example 7.5Bar, probably it is better when the program starts filling process, the value of this preset is displayed ;

AirPositionPin is digital output, it just activates in the Air Positioner System one electrovalve;

InPositionPin is digital input, which reads magnetis NPN No/Nc sensor.The last detects when the bottle is in position for filling with CO2 by nozzle;

Co2 Valve Charging System is a small circuit which manages the process of filling bottle with CO2, contents only 1 electrovalve, but uses 2 different supplies for it.This is
because the process of filling is long (about 20 seconds), and if I use only one power of 24 Volts, for example, the electrovalve coil heats up the complete valve, (and CO2
cannot cool down), so there will be very much differencies between bottles filled in cold morning, and these filled in the warm afternoon, same day. So firstly for 1 or 2 seconds
the valve is opened with 24 Volts (by Co2ValvePin2 A2), and then till finishes the coil is supplied with 11 Volts (Co2ValvePin 11);

The process :

At first the man places a bottle in correct way to machine, then presses the pedal , which starts Air Positioner System, opening an air electrovalve which activates a cylinder ,
when the bottle gets to nozzle , this is detected by a magnetic NPN No/Nc sensor . If sensor is not activated in 10 seconds , for example, program exits to check for start over.
When sensor is activated , that bottle is in position and controller checks for preset of SetpressurePin and activates parallel Co2ValvePin2 and Co2ValvePin, a second or 2
late it sets only Co2ValvePin to continue filling. When both values , SetPressurePin and PressurePin are very close , or equal , the process is almost finished. Machinery
cuts the power of air cylinder (AirPositionPin), and when sensor (InPositionPin) detects the bottle is not in position with nozzle , cuts the supply of Co2ValvePin, so no more
CO2 is getting out of charge cylinder (big cylinder filled with couple cubic meters of high pressure CO2). This is because if cut supply before releasing bottle , some liquid
gets out, and man may be injuried.
Almost the same way things happens when instead of StartPedalPin , the RefillCo2Button is pressed . The difference is that the man may stop filling any time, just releasing
button, and the pressure is little higher than maximum preset may be set by potentiometer (SetPressurePin), but the value of preset is software managed. When the man uses
pedal he just need to press it once , and the controller completely finishes the process. I case of button the man may stop anytime, or process finishes when pressure is reached.

I appreciate any questions and help for this little project. Thank you
Sorry for some mistakes if there are, this is 3rd time I try to edit…