Hydraulic Cylinder

A few things, -I'll post what code I have written so far later tonight -Yes, hydraulic. No pneumatic doesn't have enough force. I need to maintain 150psi constant.

Summary. On/Off Button Batch Counter On/Off to sebestos counter Sensor on/off Man/Single/Auto Mode Two button console for actuation Hydraulic bi-directional with middle float (2/24v relay's) Hydraulic pump and pressure all fitted already. Relay Board to control relays. Hall Sensors to determine cylinder position Din Power Suppy 24V 1A

So the main thing that was puzzling me is if no position send it down to start, then it's input driven. However I don't want it to accidentally send down as soon as the cylinder leaves the sensor.

Understanding the modes.

In inch, sensors (to stop press) are disabled. It will default down if no position is found from the two hall sensors. Wiring is din rail 24v 1a to Input buttons, completing the circuit will allow the closed relay to travel in the direction. Reversing when the next position is reached. Releasing buttons stops current of course.

In Single, sensors enabled, batch counter (more sensors to be added later) and default down ect. However the input control with be used to cycle up, but the relay will take over and cycle it down automatically.

In Automatic, sensors… Then first up motion will be input button controlled then switch over to a continuous cycle until broken (sensors/batch counter/stop)

Relay board, connected to two solenoids
Up/R1 - on/off arduino power from button
Down/R2 - on/off arduino power from button
AutoUp/R3 - (auto only) on/off arduino bridged power
AutoDown/R4 (single/auto) bridged and arduino

Can you describe or provide a diagram of the mechanical layout of the device? It's unclear what's the role of the sensors, what will happen when the press reaches some upper or lower limit...

So far we don't even know the name of your project. It's like the first half of this conversation is missing. You've given us the list of parts that you think will do something. Great! But you obviously have a question to ask, like maybe this is not doing the something you want but it's doing a different thing.

I'm sure if we were in your office right now we could see the drawing on the whiteboard and we could understand the project.


I lowered the resolution so these photos should load.

I currently have a cylinder driven by pneumatics, this is a simple single stage no progression press.
This project is for the progressive version. In a similar fashion with direct action as well.

The current sensors would just be to determine position of the cylinder, to select its next action.
Later more “sensors” will be added to stop function is supplies are low (brass/powder/primer ect)

It's a automated bullet press, using a direct action hydraulic cylinder ;)

I will upload my sketched code when I get home.

Primary concern is that I'm not sure how to register the cylinders up or down position. That it might register the down position then try to move up, and then cycle back down when it's in-between the two positions.

You need to look into the concept of a "state machine". When the Arduino switches on, it initially doesn't know where the piston is. But it has limit switches to know if it is at one end or the other. If one switch is active then the position is obvious. If neither then it could drive one way or the other until a switch is touched.

Morgan, Yes I have come to that same conclusion. Especially in the switching of the modes, I wouldn't want it to start in a false position. It's home location will always be down, and upon switching into a mode it will default there.

Okay, So. I'm really out of date here and my coding is so rusty I need to go back to basics. I'm a little ashamed I didn't try to compile this yesterday when I was brainstorming it out since it is so error ridden.. Hopefully, I'll have time to correct it tomorrow, however just posting to get this gist of things. I definitely do not remember how the If statements are, If, &, OR, Else.. Tutorial time tomorrow.

Anyways I did catch this link in my searches "Need Help Proximity Switch Protection to Hydraulic Cylinder"

int SensorUP = 4;
int SensorDown = 7;
int LedUP = 21;
int LedDown = 9;
int Relay1Up = 5;
int Relay2Down = 6;
int Relay3Up = 14;
int Relay4Down = 15;
int Inch = 10;
int Single = 11;
int Auto = 12;
int Batch = 13;
int Sensors = 8;

void setup() 
  int SolVal1;
  int SolVal2;
  int SensorUP = 4;
  pinMode(SensorDown, INPUT);
  pinMode(LedUp, OUTPUT);
  pinMode(LedDown, OUTPUT);
  pinMode(Relay1Up, OUTPUT);
  pinMode(Relay2Down, OUTPUT);
  pinMode(Relay3Up, OUTPUT);
  pinMode(Relay4Down, OUTPUT);
  pinMode(Single, INPUT);
  pinMode(Auto, INPUT);
  pinMode(Batch, INPUT);
  pinMode(Sensors, INPUT);

void loop() 
  int InchOn = digitalRead(Inch);
  int SingleOn = digitalRead(Single);
  int AutoOn = digitalRead(Auto);
  int LastPos = 0;

  if (InchOn == HIGH) //Check Switch Position
      //Declare Varibles

      SolVal1 = digitalRead(SensorUp); //(INCH MODE:) Check Cylinder Position
      SolVal2 = digitalRead(SensorDown);
      digitalWrite (Relay4Down, LOW); // Don't Cross Automatic Relay's 
      digitalWrite (Relay3Up, LOW); // Don't Cross Automatic Relay's 

      if (SolVal1 == LOW)  //Low = Hall Magnetic Sensor Reading //SolVal1 Pos is UP
          int LastPos = 1
          digitalWrite (LedUP, HIGH);    //LED Indicates Up Position
          digitalWrite (Relay1Up, LOW); //Power Off 
          digitalWrite (Relay2Down, HIGH);   //Send Cylinder to Cycle Down Next
          digitalWrite (LedDown, LOW);   //LED Down Light Off
      if (SolVal2 == LOW) //Hall Magnetic Sensor Indicates Position Is DOWN
          int LastPos = 2 
          digitalWrite (LedDown, HIGH); //LED Indicates Down Position
          digitalWrite (Relay1Up, HIGH); //Send Cylinder to Cycle Up Next
          digitalWrite (Relay1Down, LOW);
          digitalWrite (LedUP, LOW);
      else //Neutral Position, However don't want to auto loop and retract prior to full up cycle
           if LastPos = 1;

             //To Stop Mis Cycle or Repeat
           if LastPos = 2;
             //to Stop Mis-Cycle or Repeat 
           if LastPos = 0;
              digitalWrite (Relay1Up, LOW)
              digitalWrite (Relay2Down, HIGH)

They call it a rough draft right?