Hydraulic valve control with encoder
09 Mar 2015 18:48 #56561
by adoyle88
Hydraulic valve control with encoder was created by adoyle88
Hello everyone,
I'm working on a home built CNC tubing bender. We've got a stepper motor that feeds a piece of tube before each bend. The feed was easy enough to setup. Now we are trying to control the bend.
The hydraulic ram on the bend axis is controlled by a 4 way 3 position solenoid operated valve. Power is sent to one end of the valve to extend the ram and the other end to retract. When neither end is charged the ram stays locked in place.
We are using a homemade encoder wheel with an optical sensor to count every half degree as the bender mandrel turns.
Best case scenario is to use the A or B axis to control the ram. It'd be nice to use simple g code like a90 to turn the bend axis 90 degrees. I would need to compare the current position to the target position to determine which way the ram needs to move, and then apply power to the proper end of the hydraulic valve. Once the encoder counts to (or passes) the target angle, the valve needs to be turned off so the ram will stay in place. At this point, the g code needs to continue on to disconnect a couple of latches (I'm going to use M-codes for these) and feed the tube to the next position. Then I would use a0 to power the other end of the hydraulic valve to retract the hydraulic cylinder back to the starting position.
Someone in the LinuxCNC IRC suggested the idea of setting it up as a servo in torque mode. This idea seems viable, but, at that time, no one in the chat (including the guy who suggested it) knew how to do this. I tried to adapt the etch.hal file but since it uses velocity, I was stumped.
I appreciate any help you guys can give.
-Adam Doyle
I'm working on a home built CNC tubing bender. We've got a stepper motor that feeds a piece of tube before each bend. The feed was easy enough to setup. Now we are trying to control the bend.
The hydraulic ram on the bend axis is controlled by a 4 way 3 position solenoid operated valve. Power is sent to one end of the valve to extend the ram and the other end to retract. When neither end is charged the ram stays locked in place.
We are using a homemade encoder wheel with an optical sensor to count every half degree as the bender mandrel turns.
Best case scenario is to use the A or B axis to control the ram. It'd be nice to use simple g code like a90 to turn the bend axis 90 degrees. I would need to compare the current position to the target position to determine which way the ram needs to move, and then apply power to the proper end of the hydraulic valve. Once the encoder counts to (or passes) the target angle, the valve needs to be turned off so the ram will stay in place. At this point, the g code needs to continue on to disconnect a couple of latches (I'm going to use M-codes for these) and feed the tube to the next position. Then I would use a0 to power the other end of the hydraulic valve to retract the hydraulic cylinder back to the starting position.
Someone in the LinuxCNC IRC suggested the idea of setting it up as a servo in torque mode. This idea seems viable, but, at that time, no one in the chat (including the guy who suggested it) knew how to do this. I tried to adapt the etch.hal file but since it uses velocity, I was stumped.
I appreciate any help you guys can give.
-Adam Doyle
Please Log in or Create an account to join the conversation.
10 Mar 2015 00:10 #56588
by andypugh
Replied by andypugh on topic Hydraulic valve control with encoder
Is the valve proportional at all?
Typically a servo-hydraulic system will use a Moog valve which is a proportional pressure control valve which applies a differential pressure across the cylinder piston proportional to voltage.
You ought to be able to make your system work, though.
You need to use a PID component to operate the valve based on the difference between encoder position and commanded position.
Your setup will look a lot like the normal servo config, except that you need to convert the PID output to two digital values to drive the valve. The "abs" HAL component can do this
www.linuxcnc.org/docs/html/man/man9/abs.9.html
Using the is-positive and is-negative pins to drive the valve.
You probably need a significant deadband in the PID settings.
www.linuxcnc.org/docs/html/man/man9/pid.9.html
Typically a servo-hydraulic system will use a Moog valve which is a proportional pressure control valve which applies a differential pressure across the cylinder piston proportional to voltage.
You ought to be able to make your system work, though.
You need to use a PID component to operate the valve based on the difference between encoder position and commanded position.
Your setup will look a lot like the normal servo config, except that you need to convert the PID output to two digital values to drive the valve. The "abs" HAL component can do this
www.linuxcnc.org/docs/html/man/man9/abs.9.html
Using the is-positive and is-negative pins to drive the valve.
You probably need a significant deadband in the PID settings.
www.linuxcnc.org/docs/html/man/man9/pid.9.html
The following user(s) said Thank You: adoyle88
Please Log in or Create an account to join the conversation.
10 Mar 2015 00:14 #56589
by ArcEye
Replied by ArcEye on topic Hydraulic valve control with encoder
A link for you
www.pirate4x4.com/forum/shop-tools/73282...-bender-build-2.html
I know other people have done the same, just can't find any more at present
regards
www.pirate4x4.com/forum/shop-tools/73282...-bender-build-2.html
I know other people have done the same, just can't find any more at present
regards
The following user(s) said Thank You: adoyle88
Please Log in or Create an account to join the conversation.
10 Mar 2015 01:51 #56592
by adoyle88
Replied by adoyle88 on topic Hydraulic valve control with encoder
The hydraulic valve is not proportional. We might upgrade to a proportional system in the future.
I assume my PID gain values aren't too critical since I will only be using the is-positive and is-negative from the abs HAL component. Since I am essentially going full throttle all the way to my target angle, will there be any changes by tuning the gain values?
I'm not sure about the deadband. Let's say we were bending to 90 and we have a deadband of .6 degree and the encoder measures .5 degree. It would bend to 89.5, then compare the error and the deadband value and see that the error is smaller. It would stop bending at 89.5. It's almost like deadband doesn't matter for my setup because of the low resolution of my encoder. Is this right?
Thanks for your help andypugh and ArcEye.
I assume my PID gain values aren't too critical since I will only be using the is-positive and is-negative from the abs HAL component. Since I am essentially going full throttle all the way to my target angle, will there be any changes by tuning the gain values?
I'm not sure about the deadband. Let's say we were bending to 90 and we have a deadband of .6 degree and the encoder measures .5 degree. It would bend to 89.5, then compare the error and the deadband value and see that the error is smaller. It would stop bending at 89.5. It's almost like deadband doesn't matter for my setup because of the low resolution of my encoder. Is this right?
Thanks for your help andypugh and ArcEye.
Please Log in or Create an account to join the conversation.
10 Mar 2015 01:56 #56593
by andypugh
Maybe. Or you might find that your valve dithers in a nasty way that it isn't intended for when very close to the setpoint.
It is something that I wouldn't like to predict the behaviour of.
Replied by andypugh on topic Hydraulic valve control with encoder
It's almost like deadband doesn't matter for my setup because of the low resolution of my encoder. Is this right?
Maybe. Or you might find that your valve dithers in a nasty way that it isn't intended for when very close to the setpoint.
It is something that I wouldn't like to predict the behaviour of.
Please Log in or Create an account to join the conversation.
11 Mar 2015 03:02 #56642
by adoyle88
Replied by adoyle88 on topic Hydraulic valve control with encoder
I've got my ini and hal files written to control a stepper on the X axis and a servo with an encode on the A axis. I've got a button connected to pin 10 to press to simulate the encoder.
When I watch halmeter, I can see pid feedback change as I press my encoder and the dro shows the same degree value, but the A velocity remains up even after the display shows that I've arrived at my target angle. It seems like it turns for a specific amount of time before stopping instead of stopping when the encoder is at the right angle.
I've played around with the PID gains but they don't seem to make a difference.
Any ideas?
When I watch halmeter, I can see pid feedback change as I press my encoder and the dro shows the same degree value, but the A velocity remains up even after the display shows that I've arrived at my target angle. It seems like it turns for a specific amount of time before stopping instead of stopping when the encoder is at the right angle.
I've played around with the PID gains but they don't seem to make a difference.
Any ideas?
Please Log in or Create an account to join the conversation.
11 Mar 2015 03:54 #56643
by adoyle88
Replied by adoyle88 on topic Hydraulic valve control with encoder
Disregard my previous message. Found pid.0.ouput. I thought that vel was the output you had mentioned and I didn't realize output was its own thing.
Looks like it will work perfectly.
I'll let you know when we get it all connected to the machine.
Thanks a lot for you help.
Looks like it will work perfectly.
I'll let you know when we get it all connected to the machine.
Thanks a lot for you help.
Please Log in or Create an account to join the conversation.
11 Mar 2015 04:24 #56644
by andypugh
I am glad about that, because I really didn't understand your description.
Replied by andypugh on topic Hydraulic valve control with encoder
Looks like it will work perfectly.
I am glad about that, because I really didn't understand your description.
Please Log in or Create an account to join the conversation.
22 Apr 2015 00:14 #57978
by Poma
Replied by Poma on topic Hydraulic valve control with encoder
Interestingly I have an almost identical project that just cropped up today. It's a rebuild of a 30-year-old machine that is starting to loose its mind.
Would you mind sharing your configuration files? What kind of control hardware did you use?
Would you mind sharing your configuration files? What kind of control hardware did you use?
Please Log in or Create an account to join the conversation.
01 May 2015 21:19 - 01 May 2015 21:23 #58296
by adoyle88
Replied by adoyle88 on topic Hydraulic valve control with encoder
Sorry for the delay. I can answer your questions about the hardware but I can't get to the config files at the moment.
I'm using a breakout board, relay board (to control the hydraulic valves), stepper+driver and other accessories from probotix.com. Here is the kit we purchased: 2-Axis Monster CNC Stepper Motor Driver Kit
Here's an image of the control hardware installed in the copmuter case:
As for the encoder portion, we bought some simple photo interrupter sensors and machined out a slotted encoder with .25 degree resolution when using two photo sensors. We are very happy with how the encoder has worked out.
The stepper motor drives a chain that is connected to what we call the tractor. This is what feeds the tube. Our max feedrate is 250 ipm.
Here are some shots of the bender during final assembly. We still have a few things to finish up but we are getting very close to being done.
We've bent a few tubes so far and everything is working well. I'll post about the software when I get the files.
I'm using a breakout board, relay board (to control the hydraulic valves), stepper+driver and other accessories from probotix.com. Here is the kit we purchased: 2-Axis Monster CNC Stepper Motor Driver Kit
Here's an image of the control hardware installed in the copmuter case:
As for the encoder portion, we bought some simple photo interrupter sensors and machined out a slotted encoder with .25 degree resolution when using two photo sensors. We are very happy with how the encoder has worked out.
The stepper motor drives a chain that is connected to what we call the tractor. This is what feeds the tube. Our max feedrate is 250 ipm.
Here are some shots of the bender during final assembly. We still have a few things to finish up but we are getting very close to being done.
We've bent a few tubes so far and everything is working well. I'll post about the software when I get the files.
Last edit: 01 May 2015 21:23 by adoyle88. Reason: forgot to put wider views of the whole assembly
Please Log in or Create an account to join the conversation.
Time to create page: 0.083 seconds