Tag Archives: linuxcnc

Pick and Place – Alpha Setup (Vacuum and Solenoid Control)

My setup uses OpenPnP along with LinuxCNC.

LinuxCNC is running with a Gecko G540 controller which drives the stepper motors as well as a vacuum pump and solenoid valve. Outputs 1 and Outputs 2 are used on the G540. The G540 outputs are low side switches refer to manual.

LinuxCNC Setup

The motor and solenoid valve were found on Amazon. I may change these to something smaller. They were used because they were cheap and I wanted to do a quick proof of concept.

The following circuit can be used to drive the loads:


Before modifying the OpenPnP driver, the loads can be tested with the G540 controller. The Stepconf wizard can be used to map the outputs on the G540. Pins 17 and 1 on the parallel port map to the outputs. Pin 17 is used for Spindle PWM. It could also be used for Spindle ON, but I want the ability to vary the speed of the vacuum pump. Pin 1 is used for Coolant Flood.


The following g-codes are hijacked for vacuum pump and solenoid control. Test with MDI commands in LinuxCNC.

G-Code Original Function Alternate Function
M3 S1000 Spinde On 1000 RPM Vacuum On (100%)
M3 S500  Spindle On 500 RPM Vacuum On (50%)
M5 Spindle Off Vacuum Off (0%)
M8 Flood Coolant On Solenoid On
M9 Coolant Off Solenoid Off
OpenPnP Driver Modification

The LinuxCNC driver for OpenPnP was modified to actuate the vacuum pump and solenoid valve. Steps for recompiling OpenPnP are in the Wiki: https://github.com/openpnp/openpnp/wiki/Developers-Guide.

The file that needs to  be modified is:
<root of git folder>\src\main\java\org\openpnp\machine\reference\driver\LinuxCNC.java.

The pick and place funcions were modified. The pick function doesn’t need to be modified if using the Spindle ON signal.

Pick Command Modification:

In Stepconf wizard I set the PWM frequency to be 100% at 1000 RPM, therefore the g-code to turn the vacuum on 100% is M3 S1000.

Place Command Modification:

M5 is the stop spindle command which will turn off the vacuum pump. M8 turns on the flood coolant which will turn on the solenoid valve to quickly release the air pressure and release the part from the nozzle. G4 is a dwell command and P0.1 is the time delay which means wait for 100 ms. M9 turns off the solenoid returning it to its normally closed position.

Verification with Halscope:

Once OpenPnP is recompiled the pick and place commands can be tested with LinuxCNC. I used halscope which is in the Machine dropdown in the LinuxCNC Axis GUI. Channel 1 is set to motion.spindle-on and Channel 2 is set to iocontrol.0.coolant-flood. The jog controls in OpenPnP can be opened with Ctrl+Tab which let’s you manually run the pick and place commands.




Pick and Place – Nozzle Test

Manually written G-Code to actuate nozzle and vacuum.

Components are 0603 capacitors. They are rotated 90 degrees and placed 1.5mm apart then returned to the cut tape.

This is part of a larger setup that will use OpenPnP. The nozzle dwells to let the vacuum bleed off air, so the parts don’t stay connected to the nozzle. I’m going to add a solenoid valve to release the vacuum to run the machine faster.