G-Code for releasing a part

189 views
Skip to first unread message

Tjaart van aswegen

unread,
Dec 29, 2025, 6:53:30 AM12/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 AM12/29/25
to OpenPnP

Tjaart van aswegen

unread,
Dec 29, 2025, 11:17:52 AM12/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 PM12/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 PM12/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 PM12/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 AM12/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.

Artem Stanchak

unread,
Jan 4, 2026, 7:23:07 AMJan 4
to OpenPnP
Hello!
One question: Why do you need an optical end stop for the nozzle axes?

середа, 31 грудня 2025 р. о 14:35:24 UTC+2 henrik5...@gmail.com пише:

Mike Menci

unread,
Jan 4, 2026, 7:36:45 AMJan 4
to ope...@googlegroups.com
It is not needed - use soft end stop instead ! 


Dne 4. jan. 2026 ob 13:23 je oseba Artem Stanchak <tyom...@gmail.com> zapisala:

Hello!
--
You received this message because you are subscribed to the Google Groups "OpenPnP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpnp+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/openpnp/03422355-cb2d-47d0-9c28-36635b4c1f29n%40googlegroups.com.

Artem Stanchak

unread,
Jan 4, 2026, 7:48:24 AMJan 4
to OpenPnP
I don't have it)))11062.jpg

неділя, 4 січня 2026 р. о 14:36:45 UTC+2 mike....@gmail.com пише:

simpl...@tuta.io

unread,
Jan 4, 2026, 9:19:48 AMJan 4
to Openpnp, OpenPnP
> One question: Why do you need an optical end stop for the nozzle axes?

Some
designs do not require a limit switch on the Z-axes.

However, on my heads with individually driven Z-axes, i use a magnetic encoders to determine the position and home the axes.

It has often been said that accuracy on the Z-axis is not that important, but in my experience, it is definitely helpful to be able to position the nozzle with repeatable accuracy in terms of height, especially when picking up small components at high speed and nailing them on the circuit boards.




Artem Stanchak

unread,
Jan 4, 2026, 10:54:01 AMJan 4
to OpenPnP
I was asking about nema8 nozzle motors. C1 C2

неділя, 4 січня 2026 р. о 16:19:48 UTC+2 simpl...@tuta.io пише:

simpl...@tuta.io

unread,
Jan 4, 2026, 12:12:53 PMJan 4
to Openpnp
> I was asking about nema8 nozzle motors. C1 C2

Ah - now I understand what you mean. The reference switches on the C axes are a relic from very old designs where bottom vision and, of course, runout correction were not yet commonplace, so that large rectangular or asymmetrical nozzle tips, for example, could also be handled.

Tjaart van aswegen

unread,
Jan 4, 2026, 12:52:01 PMJan 4
to OpenPnP
Hi Artem

To be completely honest, I bought the motors with a metal slide attached, and the endstops were there, so when I drew the 3d models, I added the mounting holes just to keep everything as close as possible to what it was when I bought it.

With the Marlin firmware, it can be used to home those axes; however, I also see no need for that, as I will be using smaller nozzles, as my components range from 0804 to 1206 for the passives, and I will be placing SOIC8 chips, too. Maybe something like a  SOT-223-4 for the 7805 voltage regulators 

Correct me if I am wrong, but it is a nice-to-have at this point and is not required by openPNP

Artem Stanchak

unread,
Jan 5, 2026, 4:22:08 AMJan 5
to OpenPnP
I'll be brief. I use 4 types of nozzles "502, 503, 504, 505" everything from 0402 to the one that can be used with a 505 nozzle is installed.

неділя, 4 січня 2026 р. о 19:52:01 UTC+2 prot...@gmail.com пише:

Mike Kiebitz

unread,
Jan 5, 2026, 1:56:56 PMJan 5
to OpenPnP
I use the magnetic end-stop SN04-N.
I have tested it.
3,85V@193µA - 3mm
5,0V@263µA - 4mm

The device starts working at 3.85 Volt with a current consumption of 0.193mA, but the recognition distance is then only 3mm.
I have increased the voltage to 5,0 Volt, there the current consumption was 0.263mA and the recognition distance was now 4mm like in the specifications of the datasheet.
If the LED is on, the current consumption is a bit higher. The price was 1.59€ at Aliexpress in the Bundle offers.

This is better as the mechanical end-stop, because they can fail mechanically and the metal contacts internally.
The optical end-stop could get dirty, so this is in my opinion the best solution and it is not even more expensive.

 Abstandssensor_induktiv_1.jpg

Artem Stanchak

unread,
Jan 6, 2026, 2:42:00 AMJan 6
to OpenPnP
I have been using optical limit switches for 6 years. And everything is fine. Carry out maintenance once a month and everything will be ok.

понеділок, 5 січня 2026 р. о 20:56:56 UTC+2 mikrop...@gmail.com пише:

Tjaart van aswegen

unread,
Jan 15, 2026, 2:40:23 AMJan 15
to OpenPnP
So I have not spent a lot of time on my build this December and January is always a mad month; however, I have made some progress over the last few days, and here are some pics, obviously still a work in progress, and it still makes my living room an obstacle course; however i am enjoying this build.

I have decided to keep the blow off in the system and have opted not use a collection tank for this build. I will do that with my next build, and I will also look at using faster motors and ball screws in the next build for some speed 

Also attached are some pics of the PCBs I populate daily. They do not require a lot of parts, but it takes time for me to do this by hand. You can see on the smaller PCBs that I do have a placement problem with the 28 pin ssop ICs, and that will be sorted out with the correct solder stencil and the PNP machine 

WhatsApp Image 2026-01-15 at 08.39.57.jpegWhatsApp Image 2026-01-15 at 08.40.02 (1).jpegWhatsApp Image 2026-01-15 at 08.40.02.jpegWhatsApp Image 2026-01-15 at 08.39.57.jpegWhatsApp Image 2026-01-15 at 08.40.00 (1).jpegWhatsApp Image 2026-01-15 at 09.32.59 (1).jpegWhatsApp Image 2026-01-15 at 09.32.59.jpegWhatsApp Image 2026-01-15 at 09.33.00.jpegWhatsApp Image 2026-01-15 at 09.33.01.jpeg
Reply all
Reply to author
Forward
0 new messages