Operate a Pneumatic air cylinder for Z-Axis movement

philmurp
Posts: 42
Joined: Sat Oct 12, 2013 5:26 pm

Operate a Pneumatic air cylinder for Z-Axis movement

Post by philmurp » Sat Oct 12, 2013 7:17 pm

Hello,
I am attempting to operate a pneumatic air cylinder in order to move my machine in the z-axis. I know that a solenoid air valve will take impulses and turn this air cylinder on and off. I am using a gshield v4 to run my other two axis stepper motors. Is it possible to connect the solenoid air valve to the z-axis ports on the g shield? If so how would the wiring be done as there are only two wires associated with the solenoid but four ports on the z-axis of the board. Also, I am looking to control it with G-Code still by calibrating the code to send impulses to the solenoid, is this possible to basically trick the software to send impulses to the ports that I have the solenoid hooked up to? Any help is greatly appreciated!

Gadgetman!
Posts: 1061
Joined: Sun Aug 25, 2013 12:44 pm
Location: Norway
Contact:

Re: Operate a Pneumatic air cylinder for Z-Axis movement

Post by Gadgetman! » Sat Oct 12, 2013 9:47 pm

First off, do you have any tech info on the pneumatics?

And second, why do you want to use pneumatics?
Really?
The durn things aren't all that accurate in the first place, and the bounce can be rather nasty if you're not careful.

The 4 connectors for the Z-axis is because it's designed for a STEPPER MOTOR.
These have lots of coils connected to those, and the driver energises them in sequence to turn the motor.
Even more fun, it may energise two at the same time, for 'microstepping'. Also, when the motor stops, it keeps the coil that was lat active still active, to hold the motor. (Unless the microcontroller shuts down the driver)

The chip used doesn't even have an option to function for switching on or off a specific pin, just the options of setting direction and clocking it at the correct speed.
So the port isn't really suited to controlling anything but steppers.

In theory, you could send the chip a 'reset' pulse, then set the DIRection pin, and ONE clock pulse to activate the desired pin, but... no...
These are H-bridges, and they work in PAIRS...
Also, it may mess up the X and Y-axis, too...

you need some sort of RELAY board or something. Something a bit more 'generic' that works well together with the GRBL-shield.
Weird guy...
Shapeoko 2014F: 1000mm X/Y, 300W Quiet Cut spindle, Arduino Uno/G-shield and GRBL 0.9i
15x30 drag chains, custom spindle mount, 9mm belts, 8mm endplates, 6mm motor plates.

philmurp
Posts: 42
Joined: Sat Oct 12, 2013 5:26 pm

Re: Operate a Pneumatic air cylinder for Z-Axis movement

Post by philmurp » Sun Oct 13, 2013 6:26 pm

Gadgetman! wrote:First off, do you have any tech info on the pneumatics?

And second, why do you want to use pneumatics?
Really?
The durn things aren't all that accurate in the first place, and the bounce can be rather nasty if you're not careful.

The 4 connectors for the Z-axis is because it's designed for a STEPPER MOTOR.
These have lots of coils connected to those, and the driver energises them in sequence to turn the motor.
Even more fun, it may energise two at the same time, for 'microstepping'. Also, when the motor stops, it keeps the coil that was lat active still active, to hold the motor. (Unless the microcontroller shuts down the driver)

The chip used doesn't even have an option to function for switching on or off a specific pin, just the options of setting direction and clocking it at the correct speed.
So the port isn't really suited to controlling anything but steppers.

In theory, you could send the chip a 'reset' pulse, then set the DIRection pin, and ONE clock pulse to activate the desired pin, but... no...
These are H-bridges, and they work in PAIRS...
Also, it may mess up the X and Y-axis, too...

you need some sort of RELAY board or something. Something a bit more 'generic' that works well together with the GRBL-shield.
I am using this in an automated retrieval system. So, my x and y axis steppers will move my device the required locations, and then I will use pneumatic air cylinder that is outfitted with vacuum suction heads to move into the shelving unit, pick up product and then return to the original position and drop the product onto a conveyor. I am looking at a way that this x-y movement as well as retrieval can be run using the Gshield so that i don't need to purchase further equipment like a relay etc. I had a rather roundabout way of solving this problem. I was thinking that I can use a small stepper motor connected to my z axis. This motor will be connected to a lead screw as a linear actuator that would depress a push button valve as it is run with my Z-Axis G code. The depression of the button will trigger the air cylinder to operate and retrieve my product from the shelving unit. This seems a little roundabout however so I am looking for a more efficient solution.

In the case of the relay, do you know how/if that can be incorporated with the G-Shield so that I wouldn't have to purchase a separate shield/breadboard etc. (Please excuse my limited knowledge in this area, this is my first project suing this equipment)

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: Operate a Pneumatic air cylinder for Z-Axis movement

Post by cvoinescu » Sun Oct 13, 2013 11:57 pm

If you're very careful about it, you can use one driver to control two relays, valve solenoids or other loads, if they are within the current rating supported by the motor driver, and as long as they can be driven in constant current mode. You need a couple of diodes.

Here's how it works. A stepper driver has two full H-bridges, one for each coil of the motor. In full step mode, both coils are energized at the same time (at 70% of the set current), and each step changes the polarity of one of the coils (if the steps are in the same direction, the changes alternate between the coils). If you wire each solenoid with a series diode instead of a motor coil, each step switches to the next (or previous) state in this circle:

... ---- A off, B off ---- A ON, B off ---- A ON, B ON ---- A off, B ON ---- ...

If you set your Z axis to do, say, one step per mm, Z1 turns on solenoid A, Z2 turns on both, Z-1 turns on only B, and Z0 turns both off. You may have to work out a different sequence to avoid going through states you don't want, but that's the gist of it.

The problem with this approach is that you need to guarantee that the stepper driver starts with its internal indexer in a known state. I like predictability, so on my little board I wired the RESET input of all the drivers into the Arduino RESET: when you begin, the drivers are in a known state. Just make sure your program resets the Arduino at startup (you can do that via serial, but I'd need to look up the details -- I think it's the DTR line that's wired into RESET). I'm pretty sure that, on any board, power-up gives you a consistent position, but on all other boards I've looked at there's no way to reset the stepper drivers without power-cycling.

A different approach would be to use two MOSFETs to drive the pneumatic valves and control them from the spindle pins (D12 and D13). I'm pretty sure both pins can be controlled from G-code, and the approach is less fraught with danger (also, much less cool) than what I suggested above.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

philmurp
Posts: 42
Joined: Sat Oct 12, 2013 5:26 pm

Re: Operate a Pneumatic air cylinder for Z-Axis movement

Post by philmurp » Wed Oct 16, 2013 11:24 pm

cvoinescu wrote:If you're very careful about it, you can use one driver to control two relays, valve solenoids or other loads, if they are within the current rating supported by the motor driver, and as long as they can be driven in constant current mode. You need a couple of diodes.

Here's how it works. A stepper driver has two full H-bridges, one for each coil of the motor. In full step mode, both coils are energized at the same time (at 70% of the set current), and each step changes the polarity of one of the coils (if the steps are in the same direction, the changes alternate between the coils). If you wire each solenoid with a series diode instead of a motor coil, each step switches to the next (or previous) state in this circle:

... ---- A off, B off ---- A ON, B off ---- A ON, B ON ---- A off, B ON ---- ...

If you set your Z axis to do, say, one step per mm, Z1 turns on solenoid A, Z2 turns on both, Z-1 turns on only B, and Z0 turns both off. You may have to work out a different sequence to avoid going through states you don't want, but that's the gist of it.

The problem with this approach is that you need to guarantee that the stepper driver starts with its internal indexer in a known state. I like predictability, so on my little board I wired the RESET input of all the drivers into the Arduino RESET: when you begin, the drivers are in a known state. Just make sure your program resets the Arduino at startup (you can do that via serial, but I'd need to look up the details -- I think it's the DTR line that's wired into RESET). I'm pretty sure that, on any board, power-up gives you a consistent position, but on all other boards I've looked at there's no way to reset the stepper drivers without power-cycling.

A different approach would be to use two MOSFETs to drive the pneumatic valves and control them from the spindle pins (D12 and D13). I'm pretty sure both pins can be controlled from G-code, and the approach is less fraught with danger (also, much less cool) than what I suggested above.
The first approach sounds like it would work out for my system. I am new to these electronics so can you explain a bit more about the diode versus motor coil setup? (I am looking to control something like this: http://www.amazon.com/4v110-06-Outlet-P ... m_sbs_hi_1 to control my two way pneumatic cylinder) ( Not sure exactly how the suction solenoid valve will look but something like the cylinder one)

So the diode is used to basically control voltage to the solenoid so that it isn't burnt out? Can I use something like a breadboard to wire my stepper output to the diode and then to the solenoid? Any schematics or guidance is much appreciated.(Also, just to be clear, a transistor wouldn't be useful in this application? Also, should the diode be the same current rating as my stepper port as 2.5 A?) and Also, do you know if there is any such G-Code that will perform a reset of my stepper driver or is this something that must be done by manipulating hardware?

Using Pins D12/13 with MOSFET's also seems viable. I looked it up and those pins control Spindle and Coolant which is controlled by G-Code. In this case, would I need another power source, or does the power source running the rest of the motor shield also have enough juice to run these two pins as well (My power source is 24V). I am not sure how to actually connect to these pins on the board is there some sort of connector that does this?

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: Operate a Pneumatic air cylinder for Z-Axis movement

Post by cvoinescu » Thu Oct 17, 2013 6:25 pm

Okay, forget about the diodes. They may or may not work, but I'd rather test that configuration first, to make sure it doesn't burn out the drivers.

Most of my earlier suggestions have been based two coils. When I looked at your valve, I realized you needed only one, so that simplifies things. Sorry for confusing you.

The traditional and safe way would be to use a MOSFET controlled by the spindle output (D12) to drive the solenoid of the pneumatic valve. Almost any N-channel power MOSFET will do, for example this MOSFET from SparkFun; it also comes with a tiny PCB to help you make the connections. You also need a diode (e.g. 1N4001) to protect the MOSFET from the inductive load, and, optionally, a 10 Kohm resistor (included with the PCB).

My scanner is broken, so here are a thousand words instead of a picture. Connect:

Source of MOSFET to GND
Gate of MOSFET to GRBL spindle output (Arduino pin D12)
Drain of MOSFET to negative lead of valve solenoid
Positive lead of valve solenoid to positive supply voltage (12 or 24 V depending on valve)
10 Kohm resistor between MOSFET gate and GND
Diode across valve solenoid, cathode (terminal with stripe) to the positive lead, anode to negative lead

You're done. Now you can use spindle control G-code commands to actuate the valve. Alternatively, you can use the coolant control outputs in the same way.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

calica
Posts: 107
Joined: Wed Apr 11, 2012 8:13 am

Re: Operate a Pneumatic air cylinder for Z-Axis movement

Post by calica » Sat Oct 19, 2013 6:48 am

Didn't read the full thread (sorry late and I need to get up in a few hours), but something like this could be useful.

http://www.buildlog.net/blog/2011/10/po ... ay-driver/

If not, sorry for the distraction.

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: Operate a Pneumatic air cylinder for Z-Axis movement

Post by cvoinescu » Sat Oct 19, 2013 1:32 pm

That's also very useful, but can you buy that anywhere?
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

philmurp
Posts: 42
Joined: Sat Oct 12, 2013 5:26 pm

Re: Operate a Pneumatic air cylinder for Z-Axis movement

Post by philmurp » Wed Oct 30, 2013 1:14 am

cvoinescu wrote:Okay, forget about the diodes. They may or may not work, but I'd rather test that configuration first, to make sure it doesn't burn out the drivers.

Most of my earlier suggestions have been based two coils. When I looked at your valve, I realized you needed only one, so that simplifies things. Sorry for confusing you.

The traditional and safe way would be to use a MOSFET controlled by the spindle output (D12) to drive the solenoid of the pneumatic valve. Almost any N-channel power MOSFET will do, for example this MOSFET from SparkFun; it also comes with a tiny PCB to help you make the connections. You also need a diode (e.g. 1N4001) to protect the MOSFET from the inductive load, and, optionally, a 10 Kohm resistor (included with the PCB).

My scanner is broken, so here are a thousand words instead of a picture. Connect:

Source of MOSFET to GND
Gate of MOSFET to GRBL spindle output (Arduino pin D12)
Drain of MOSFET to negative lead of valve solenoid
Positive lead of valve solenoid to positive supply voltage (12 or 24 V depending on valve)
10 Kohm resistor between MOSFET gate and GND
Diode across valve solenoid, cathode (terminal with stripe) to the positive lead, anode to negative lead

You're done. Now you can use spindle control G-code commands to actuate the valve. Alternatively, you can use the coolant control outputs in the same way.
I am unable to use G-Code to operate the coolant controls (codes M 7,8,9). Are these G-Codes not supported? I do actually need two solenoid valves (one for pneumatic air cylinder, one for vacuum suction system) so do you have any ideas on how I can operate a second valve off of G-Codes and pins on the arduino? Thanks again.

-Phil

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: Operate a Pneumatic air cylinder for Z-Axis movement

Post by cvoinescu » Wed Oct 30, 2013 11:00 am

I would look into why the coolant G-codes don't work -- they are supported in current versions of GRBL, as far as I know. Between spindle and coolant control, you have two outputs that could control two valves.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

Post Reply