Kayo-A4 conversion to OpenPnP

294 views
Skip to first unread message

Jonathan Oxer

unread,
Aug 20, 2022, 10:38:46ā€ÆPM8/20/22
to OpenPnP
Late last year I bought 3 x Kayo-A4 machines that had been lightly used: 2 were modified to run a custom Python-based control system, and one was factory original but missing its computer. I bought them from Glen English, who did an extensive review of them:


The machines I have are actually the ones he shows in that thread.

My ultimate goal was to convert them to OpenPnP, and I've now made enough progress to begin sharing the results in case it's useful to anyone else.

Glen's control system is written in Python, so my first attempts were based on Python code that exposed a TCP socket to receive commands from OpenPnP, then used his protocol code to send messages to the Kayo. However, I had endless trouble with the GCodeDriver when set to "tcp" as the connection method, and I've already written a GCode parser previously in C so I gave up on that approach and changed course.

My current approach is to use an ESP32-based board that connects to the host computer via USB, and to the Kayo on a second hardware serial port via the Kayo's host connector (a 3-pin pluggable terminal block) with protocol conversion code running on the ESP32. The goal is for the board to simply connect between the Kayo and the host, making the Kayo appear as a USB-serial device that can accept GCode.

I now have basic motion control operating under GCode control from OpenPnP. This video shows the machine homing and then being manually jogged:


The homing sequence is:
Ā - Run conveyor until a board is detected at the output end (and halt with an error) or enough time has passed that there's no board detected.
Ā - Home the conveyor width.
Ā - Home the nozzle Zs.
Ā - Home X and Y.

The Kayo has a lot of onboard smarts and safety interlocks, so part of this process is learning how it works and how to deal with situations like telling the machine to home, but it refuses because it discovers there's a PCB sitting on the conveyor.

By manually sending raw bytes to the Kayo using a serial terminal, I can already:
Ā - Home the machine
Ā - Move X, Y, and Z on any nozzle
Ā - Rotate nozzles
Ā - Run / stop conveyor
Ā - Set conveyor width
Ā - Lock / release PCB in position on conveyor
Ā - Open / close Yamaha feeders
Ā - Control camera lights, including brightness
Ā - Control vac / blow per nozzle

So far I've only implemented homing and X/Y moves in my protocol converter, so the next step is to work through each of those operations listed above and implement them with matching GCode handled by the parser.

It's looking extremely likely that very soon it'll be possible to plug this converter into a Kayo, load a machine config in OpenPnP, and immediately start driving it and running jobs. My goal is to make it a sub 5 minute job to take a factory Kayo and have it running OpenPnP.

However, there is a big hurdle to overcome: cameras!

The A4 has 6 cameras:
Ā - 1 top camera (moving)
Ā - 1 precision camera (fixed, looking up)
Ā - 4 high-speed cameras (fixed in an array to match the nozzles, looking up)

The cameras are typical industrial cameras with BNC connectors, which are connected to a PCI capture card used by the factory software. I've had zero luck getting access to the video feed. This leaves a few options:
Ā - Replace the capture card with a set of USB TV tuners. However, I don't think OpenPnP can read these either.
Ā - Write a driver for the card that exposes the inputs as webcams. This is totally outside my expertise, so not feasible for me.
Ā - Replace the cameras.

Because OpenPnP doesn't yet support camera arrays, I think my best approach is to ignore the 4 high-speed cameras and to replace the down camera and the precision camera with two of the USB cameras commonly used by OpenPnP. I'd like to use the existing cameras but I don't think I have the ability to solve that problem.

If anyone else has done a Kayo conversion, or is interested in doing this, please let me know.

Jonathan Oxer

vespaman

unread,
Aug 21, 2022, 2:08:26ā€ÆAM8/21/22
to OpenPnP
Hi Jonathan,

I have zero knowledge about Kayo, but if the cameras are good, would it not be nice to try to keep them? If you are running linux, wouldn't most capture cards (also simpler TV etc) just present a regular video device to you, for use in OpenPnP? This is my experience.
I would spend some time to test this if I where you. If the cameras are so-so, it makes more sense to swap them out though.


Ā Micael

Jonathan Oxer

unread,
Aug 21, 2022, 2:19:20ā€ÆAM8/21/22
to OpenPnP
Hi Micael,

I would definitely prefer to keep the cameras, yes. I've spent many hours trying to work out a way to make them appear to the computer in a way that OpenPnP can detect them, but haven't had success yet.

The 8-channel analog capture card that is used by the factory Kayo system doesn't seem to have any way to make its inputs appear to the OS as cameras. I also have several USB TV capture devices, and they don't appear as webcams either. They can only be accessed by TV tuner software.

I would love it if someone told me I'm wrong, and there's a solution :-)

Jon

--
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 on the web visit https://groups.google.com/d/msgid/openpnp/9747520f-09f8-47c0-8a3f-5cbc34153f7en%40googlegroups.com.

mark maker

unread,
Aug 21, 2022, 3:31:31ā€ÆAM8/21/22
to ope...@googlegroups.com

Hi Jonathan,

I think the CHMT machine have such a USB capture device that works with OpenPnP, including a switcher, to switch between the two analog camera, which OpenPnP supports. Perhaps the CHMT users could tell you the product name, and perhaps the switcher could be extended to four, five or all six cameras, because frankly, I guess running 6 good quality MPEG cameras as web cams (full video streaming) requires too much CPU power (outside OpenPnP).

Furthermore, like I said earlier, I would be ready to try and implement the "pseudo-ganged-up" approach in OpenPnP if somebody had a machine and was willing to do some thorough testing and videoing of the result (just for the coolness of it šŸ˜Ž). "Pseudo-ganged-up" means camera capture would not be truly simultaneous, but almost. I assume it would still save a lot of job time:

https://groups.google.com/g/openpnp/c/0VRTK6-hUBQ/m/YXPUh4h7BgAJ

(Side note: the "multi-shot bottom vision", I mentioned there, was implemented in the mean-time)

_Mark

Roland Exler

unread,
Aug 21, 2022, 4:48:40ā€ÆAM8/21/22
to ope...@googlegroups.com
Hi Jonathan,
just a short note on the capture card options. While TV tuner cards might have a similar connector, they are not capable of reading native analog video. They have to be tuned to a TV channel and demodulate this frequency either analog or additional decoding the digital stream e.g. DVB-T/DVB-T2. This is completely different.

I think there should be capture USB sticks which could be used with the analog output (typically using Chinch connectors) from digital cameras, video recorders / camcorders, ... But
* I have no idea if their drivers expose them to the operating system as Webcam.
* And if these cameras are high speed cameras they will use a different frame rate where it is unlikely such a cheap interface could deal with at all.
So unless you find a way to do / use a driver using the existing PC interface card I think you won't be able to use these cameras.
Roland


--
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.

Jonathan Oxer

unread,
Aug 21, 2022, 5:41:24ā€ÆAM8/21/22
to OpenPnP
Hi Mark,

The Charmhigh approach sounds like it could be a good solution. I'm fine with running a single bottom camera, because overall these machines areĀ so superior to my DIY machine in every other way that it'll be a huge win.

I think you're right about the ganged cameras saving time even when used sequentially, because it would save 3 moves of the head. It would be much faster to read from each of 4 cameras in turn without any movement.

I'm very happy to experiment with this and do tests, but first I'd need to get a working capture method for those cameras.

Jon

Litterio Andrea Guainella

unread,
Aug 21, 2022, 6:20:00ā€ÆAM8/21/22
to OpenPnP
Hi Jonathan,
maybe this can be useful and maybe can be used from openpnp as webcam. Unfortunately there is no further information online about kayo cameras.

LAG

Jonathan Oxer

unread,
Aug 21, 2022, 7:03:39ā€ÆAM8/21/22
to OpenPnP
Ooh, that's an interesting device! It's not clear from the docs if it appears as a regular USB camera, but if it does, that'd be ideal.

I already have a few HDMI capture devices that I use for streaming, so I'm going to try using either a composite-to-HDMI converter like the one linked below, or one of my old HD video cameras which have analog in and HDMI out, to link the camera:


So there's hope yet that I'll get video into OpenPnP from the factory cameras.

Jon

bing luo

unread,
Aug 21, 2022, 7:17:32ā€ÆAM8/21/22
to OpenPnP
O1CN0156Zbkp1xgE5ptDa9m_!!3414426472.jpg
Can this camera be used? Should I buy one to test ļ¼Ÿ

Jonathan Oxer

unread,
Aug 21, 2022, 7:21:29ā€ÆAM8/21/22
to OpenPnP
Hi Roland,

You're absolutely right, I said the wrong thing when I said a TV tuner. What I meant is an analog capture device :-)

Jon

Jonathan Oxer

unread,
Aug 21, 2022, 7:24:11ā€ÆAM8/21/22
to OpenPnP
Hi Bing,

There's been discussion about using those (or similar) multi-camera devices in the thread about bottom camera arrays. I haven't been following it closely though. Best to check with the posts in that thread.

Cheers

Jon

vespaman

unread,
Aug 21, 2022, 7:30:13ā€ÆAM8/21/22
to OpenPnP
sƶndag 21 augusti 2022 kl. 08:19:20 UTC+2 skrev j...@oxer.com.au:
I would definitely prefer to keep the cameras, yes. I've spent many hours trying to work out a way to make them appear to the computer in a way that OpenPnP can detect them, but haven't had success yet.

The 8-channel analog capture card that is used by the factory Kayo system doesn't seem to have any way to make its inputs appear to the OS as cameras. I also have several USB TV capture devices, and they don't appear as webcams either. They can only be accessed by TV tuner software.


So is this a PCIe capture card, or something else? Did you check the kernel boot log, lspci, lsusb etc etc?
Can you make out what kind of main chip that is used?

It might of course be a China thing, without linux support, but before searching for other solutions...

Personally I would avoid USB frame grabbers, since USB in it self, at least USB2, brings problems on its own, especially since you have so many cameras that needs to be "grabbed". But as a temporary solution it might be ok. But not sure about the actual picture quality those devices gives.

Ā 

vespaman

unread,
Aug 21, 2022, 7:36:06ā€ÆAM8/21/22
to OpenPnP
If the Kayo card cannot be used, I'd be looking into something like this https://www.ampltd.com/products/pcie-video-avc8000s/

(Have not looked deeply into if that one does the job, just as a starting point)

Ā  - Micael

vespaman

unread,
Aug 21, 2022, 7:41:25ā€ÆAM8/21/22
to OpenPnP

mark maker

unread,
Aug 21, 2022, 8:33:43ā€ÆAM8/21/22
to ope...@googlegroups.com

Hi Bing,

The cameras need to be aligned with the nozzles. So I would always prefer two cameras with an adjustable mount. It is much easier to make the cameras adjustable than the nozzles.

As to the number of USB connection. Yes, this is a also a concern.Ā  Two of the recommended 720p ELP cameras can be connected per USB port (more specifically per USB root hub) on your computer, you will need another port for the next pair.Ā  Some cameras have such a high bandwidth that only one can be handled per root USB hub (e.g. FullHD ELP model). Note, USB hubs are just electrical muxers, so it does not help to add a hub, or that you have USB 3 etc.

https://github.com/openpnp/openpnp/wiki/USB-Camera-Troubleshooting-FAQ

Analog cameras on the other hand can easily be switched in any number, I guess, you just need an analog switch that can take the video bandwidth. The switching of course adds a certain camera settling delay, as it will switch randomly into V-sync, I guess:

https://github.com/openpnp/openpnp/wiki/SwitcherCamera

_Mark

bing luo

unread,
Aug 21, 2022, 11:14:00ā€ÆAM8/21/22
to OpenPnP
HDMI  camera  1.jpg

In this way, the switching of multiple analog video signals can be realized怂

mark maker

unread,
Aug 21, 2022, 3:26:31ā€ÆPM8/21/22
to ope...@googlegroups.com

This is a very expensive and cumbersome way to do it. Be mindful of possible lag. You don't want your camera frames to lag behind by several 100ms.

_Mark

bing luo

unread,
Aug 21, 2022, 7:50:42ā€ÆPM8/21/22
to OpenPnP
Hi , Mark

The following two kinds of equipment may be cheaperĀ  about $50 .Ā  I don't know whether the speed is enough

4-way 720p ADH --USB3.0 full real-time video capture card (UVC)Ā  Ā ,Ā  drive freeĀ  Ā  Ā  Ā  Ā 

4  IN 1.jpg4  IN 1-2.jpg



8-way 720PĀ  Ā full real-timeĀ  AHDĀ  Ā PCI-E video acquisition cardĀ  Ā Ā 


8.jpg

Jonathan Oxer

unread,
Aug 22, 2022, 12:14:29ā€ÆAM8/22/22
to OpenPnP
Hi Bing,

That 8-port PCI-E card looks like the one supplied with the Kayo, which is used by the factory software. The problem is that OpenPnP can't access it.

Today I had success with the existing down-camera and each of the high-speed cameras (in the 4-camera array) by combining this composite AV-to-HDMI converter:


With this HDMI-to-USB capture device:


The HDMI capture appears as a webcam to the computer, so OpenPnP sees it and works fine.

I can't access the precision camera yet (which is USB3) but with 2 of these converters and 2 HDMI capture devices, I can now access the top camera and one of the high-speed bottom cameras.

It's not ideal, but this means I can now use enough of the factory Kayo cameras to make the machine work.

Jon

mark maker

unread,
Aug 22, 2022, 2:22:45ā€ÆAM8/22/22
to ope...@googlegroups.com

Yeah, I think Jonathan needs something like that.

Jonathan Oxer

unread,
Sep 6, 2022, 8:54:14ā€ÆPM9/6/22
to OpenPnP
After being sidelined by COVID I'm back working on this. I now have GCode control of the conveyor, including ingesting, locking, unlocking, and exiting a PCB:


I haven't run any jobs yet, but the current status of the driver should allow everything required for single-nozzle operation. I have partial support for multi-nozzle but I'm going to put that aside until I'm happy with it running with just one.

Jon

Reply all
Reply to author
Forward
0 new messages