Use USB camera to take pictures on UR5e

Hi there,

we would like to connect a USB camera to the UR5e. In a program we would then like the robot to move to a position and then the camera to take a photo and save it on an inserted USB stick.
How can this be implemented? Via a URScript, using URCap and OpenCV Daemon or are there easier ways?
We don’t want to buy an expensive camera now, we have a small budget for this project.

Best Regards

Not a direct answer but I have used a Pi zeroW ($5) and the Pi camera ($20) module to take and save a picture when a handheld barcode reader triggered.

You could be something similar over a Pi GPIO pin that connects to the UR with just a little scripting.

in the Pi the command is raspistill -0 {output name}.jpg

We have currently solved this with a Raspberry Pi and via TCP socket, but we would like to get away from it because it takes up space in the control box that we like to use for other things and the scripting is prone to errors because sometimes the Pi hangs or crashes. the camera is sometimes not ready for a photo and the robot stops moving because there is no response that the function has been carried out correctly.

We also don’t want to relocate the pi to the outside because of cable management and unhandiness in the workplace.

Hello Dominik,

I have not done this myself, but if you’re into Linux then maybe you can access the Linux behind PolyScope and install the driver for the camera.
Then you will need to write a script in Linux to accept a TCP Socket connection from the robot controller, and then you should be able to get going without the RPI. :slight_smile: But you might run into the same issues as you have with your current RPI setup.

It can most likely be achieved with a URCap, as well, as you mention yourself.


You can take a look at this post as well: Connect USB Webcam to UR Control Box USB3.0 just to take images