G-Code for releasing a part

74 views
Skip to first unread message

Tjaart van aswegen

unread,
Dec 29, 2025, 6:53:30 AM (4 days ago) 12/29/25
to OpenPnP
Hi all, I am busy setting up a machine for myself to try and boost my own productivity when building PCBs 

Now I went with the cheapest stuff I could find and basically bought everything from either Temu or Aliexpress, and I did this to 1 save money 2 prove it is possible 

So far, I have only completed The Hardware part of the Project, meaning that I have a frame with X, Y, and Z axes, and I have a rack and pinion type dual head with two NEMA 8 hollowshaft stepper motors that can fit the Juki nozzles 

The setup is mainly aluminium extrusions and 3d printed parts. This will limit me in the sense that, although there was a lot of time put into the design of the rack and pinion, it might not be strong enough to actually do a tool change 

I use NEMA17 motors with dual motors for the Y-Axis to add a bit of torque, and all the axes except for the Z axis are belt-driven 

I have endstops in place at max and min for each of the axes, and there is a limit switch on both the rotational axes 

I know that this is definitely not the strongest and most precise machine out there, and it would probably take a lot of upkeep once I start using it. I would like to get this one going as a first attempt at pick and place 

I will have a ton of questions once I start with the actual setup of the machine, and will be using the group to find my answers, but for now, I would just like to introduce myself and let you know where I am with the build, and that there are a bunch of questions coming 

My first question is, when openPNP sends the command to release a part, is it only one command to actuate the positive pressure that will blow into the nozzle and stop the suction, or are there two commands, or have I just not done enough research on the subject yet? 

I have for each nozzle a set of solenoids, one handles suction and the other handles "compressed air", and I have a small pump that generates both positive and negative air pressure for each nozzle. 

My setup depends on the answer. I need to decide if I will be using functions on a RAMPS 1.4 / 1.6 board or if I will be going with a relay for actuating this effect of placing a part 

Mike Menci

unread,
Dec 29, 2025, 8:51:53 AM (4 days ago) 12/29/25
to OpenPnP

Tjaart van aswegen

unread,
Dec 29, 2025, 11:17:52 AM (4 days ago) 12/29/25
to OpenPnP
Hi Mike 

Yes, actually, I have seen those as well as Panda Placer and the index Placer. although they are all good in their own way it is a fun project for me to build this machine myself, I will eventually start replacing some of the "cheaper" parts with better ones for instance i am currently working on my own controller with a G-code translator in C where i am more comfortable programming in and i want to build the hardware with a PIC microcontroller as that is what i am very familiar with.

I will also replace some of the 3d printed parts with CNC-milled parts in the near future; however, this is a project for my son and me, and this would help me with my everyday work, and there will definitely be a V2

Attached are some pictures of the general progress we have made so far. Bear in mind that this is a work in progress. Most of the wiring is in place, but not yet connected at this point 


WhatsApp Image 2025-12-29 at 18.01.13.jpegWhatsApp Image 2025-12-29 at 18.01.13 (1).jpegWhatsApp Image 2025-12-29 at 18.01.12 (1).jpeg

vespaman

unread,
Dec 30, 2025, 12:50:48 PM (2 days ago) 12/30/25
to OpenPnP
Hi Prot, 
Nice build! 

With regards to positive pressure, I'd leave that out for now. It is really hard to accomplish positive "blow" in a controlled manner. And you really only need it if your components are stuck on nozzle tip on discard. Or if you are chasing the last ms of placing time. It is highly likely (in my own experience) that your component will blow away, rater than stick to the PCB.

So if your pump is meant to be running all the time, you only need to send the valve G code. Depending on the speed of your machine, you might want to also shut off the pump. (and maybe also use a vacuum reservoir).

 - Micael

simpl...@tuta.io

unread,
Dec 30, 2025, 4:18:45 PM (2 days ago) 12/30/25
to Openpnp, OpenPnP
Blow-off valves are not actually necessary, but they do help to improve performance. On my machines, I can easily put 0402 components back into the reel pockets, which is particularly helpful when adjusting/testing the vision parameters.

However, a blow-off valve only really makes sense if, after the vacuum valve is closed, the blow-off valve is opened and the nozzle is already moving upward, so that the air can escape and the component is pushed down very slightly from the nozzle tip.

On my homemade controllers, i've implemented an extra parameter for this, similar to a switch-off delayed relay. The G-Codes look something like this:

M908    ; close VAC4
M915    ; open BLOW4
M916 P5 ; close BLOW4 after 5ms
G0 C-12 ; proceed with immediate Z-Move


I use small 10 mm valves directly on the head with the corresponding manifolds. The vacuum pump delivers a constant pressure of approximately -0.4 bar, and a small compressor provides approximately 1 bar for the blow-off valves.

Tjaart van aswegen

unread,
Dec 30, 2025, 6:09:03 PM (2 days ago) 12/30/25
to OpenPnP
Hi Miceal/ simplemount 

Thanks for the reply. I get that it is not necessary, and I will try it without the blow-off on the first go. I think the length of the air tubing from the pump to the head is going to delay the release time of the valve, and that is why I was thinking of using the blow-off. Maybe it will work without the blow-off  


as for the g-code:
M908    ; close VAC4
M915    ; open BLOW4
M916 P5 ; close BLOW4 after 5ms
G0 C-12 ; proceed with immediate Z-Move

Thank you, this makes a lot of sense 
My thoughts on the G-code were 
1. I write a release routing into my controller that will do all the above as a single function when the controller receives "M908" this routine should not take more than 10ms to complete and my idea on the hardware side was to have the positive pressure and negative pressure controlled by a single relay with the negative on the normally open side and positive on the normally closed and then have a second relay interupt the power to the first relay, this way in my software with the g-code to start the suction it would trigger both pins for the two relays at the same time and with tthe release code it will do the one swithching from negative to positive and then the second relay cutting the power to the relay and the pump swithcing everything off 

It seems like overkill, but that would have worked.
I will consider the vacuum reservoir that would actually allow me to remove one of the pumps from the installation and add a sensor to control the vacuum pump. I will start building one at work in the morning 

Thanks for the advice. I really appreciate it, and also, it is always nice to be able to hear someone else's opinions 

Henrik Olsson

unread,
Dec 31, 2025, 7:35:24 AM (yesterday) 12/31/25
to OpenPnP
Try it without blow-off first, hopefully it works but be prepared if it doesn't. 
Mine does not work without positive pressure. I have pump with reservoir and pressure switch off the machine, vacuum line up to head where valves and pressure sensor for each nozzle are located. 

Initially the valves "switched" the nozzle between vacuum and ambient but when, for example, discarding a chip component like 0805 the component would not release (slow bleed-off, slightly magnetic, sticky nozzle tip, I don't know). When I originally built this OpenPnP didn't have provision for blow-off so I implemented it in firmware,. From OpenPnP's view it's just two M-codes for vacuum on/off. On vacuum off the blow-off valve is actuated for 50ms.

The trick is, as have been mentioned, that you need a VERY low positive pressure or the component will get shot off like a bb bullet. I had to buy an extra 0-2bar regulator because I could not reliably get the one on my small air-brush compressor to go down low enough.
Reply all
Reply to author
Forward
0 new messages