Connecting Arduino to configurable inputs

I am trying to connect my Arduino to my UR5E robot. The Arduino has a push button and limit switch circuit connected to it. When the push button and limit switch are pressed, the Arduino should read that and send a signal out to the robot. How do I connect the Arduino output to the robot’s input? I just need the robot to read a HIGH on the configurable or digital inputs.

The robot’s inputs/outputs are 24v, while the Arduino is likely 3.3v or 5v outputs. This is a common application for a relay. A relay allows you to switch a higher voltage using a lower voltage control. Like programmatically flipping a light switch. Some key terms when looking at relays would be the “coil voltage” and the “contact ratings.” In this case, you would want the coil voltage to operate on the 3.3/5v level (from your Arduino) and your contact voltage rating would need to be 24v (to support the robot).

Here’s the first result on google for “Arudino relay.” This one switches off 12v, and can support 30v 10a on its contacts, which is more than enough. If you don’t have 12v output capability on your Arduino, you will need to find another module. In this particular example, you would take 24v from the robot’s terminal block and wire it into the “com” terminal on the bottom, and then wire your robot input to the NO (normally open) terminal.


Your arduino’s DC+/- wires into the other side, and the “in” is what you wire the arduino signal to. So if you want output1 on your Arduino to activate the robot input, you’d wire Arduino output1 to the “in” terminal on the relay. When this output is high, the relay engages and shorts the COM terminal and the NO terminal together, thus connecting the robot’s 24v to its input.

Thanks for you help, but I’ve run into another problem. I am trying to connect an ultra sonic sensor to the robot now. I currently have the sensor trig and echo pins connected to the arudino and a output from the arduino to a 5v relay. The relay is connected to a robot input. The arduino should send out a signal when the sensor detects a certain distance, but the robot is only detecting always on or always off. Am I missing a part or is my circuit wrong?

Do you have access to a multimeter or a continuity tester? I would start by isolating the issue. You can remove the robot completely from the equation and focus on your sensor + the relay. Meter across the contacts of your relay and make sure they are closing when you expect it to with your sensor. If you want to trigger it on only a certain distance and it’s either always on or off, my guess would be the sensor is not configured properly, or your Arduino code is not behaving the way you expect it to.

Hi, Can you help please ?

I would like to execute ROBOT’S TRAJECTORY with Universal Robot (110 TARGETS) after receiving INPUTS from Arduino (after turning a dynamixel servomotor for a while) but the motor should TURN and STOPS when approching EACH TARGET.

I was wondering how to do this for each target ??

I mean :

  • 1 Approach First Target.
  • 2 Run motor (for 5 seconds).
  • 3 Stops the motor.
  • 4 Do the actions for that target.

Move to another target and do the operations: 2 , 3 , 4

and so On for the all the targets.

How can we inform the robot that when he will jump to another target that he should wait for the motor to be run before doing the actions for each target.?

Probably going to have to be a bit clearer in your wording here. Do you mean that you want the motor to run for 5 seconds while the robot is APPROACHING the waypoint? Or simply reach the waypoint, then run the motor for 5 seconds, then do whatever else you have to do there?

Doing it in the timespan of the approach would be a bit more difficult. If you want to do it AT the waypoint, just include it in the Actions:


As I mention in the comment, I would put these 3 instructions in a folder, which would allow you to copy paste them into every waypoint. You could make the argument for making it a short subprogram, and in fact I WOULD if it were anything but UR. But since you can’t (easily) call subprograms within subprograms, doing so may limit your program’s usability.

Thanks for your answer.

Yes, the principle is like this:

-Approach the Waypoint.
-Turn On the motor for 5 seconds.
-Turn off the motor
-Do the actions in that waypoint

Move to another way point
Turn On the motor again for 5 seconds
Turn off the motor
Do the actions

and SO ON …

I’m thinking of using ROS for that actually.

Motor will be controlled via ARDUINO
Arduino is connected to Raspberry Pi and exchanges msgs through ROS
Raspberry Pi which is running ROS will pubblish into UR robot to execute the URP program (robots trajectory) whenever the motor turn OFF (Raspberry pi subscribe to msg str from arduino to know that)

  1. What do you think ABOUT THIS approach ?

  2. The problem I’m thinking of is: is there a way to start the motor whenever the program reaches the way point before doing the actions?

The robot’s trajectory is done by using Palette function because I have 100 hundred targets. It’s not practicle to declare all the targets.

The URP program is ready I runned it I just want to add the motor

  1. What do you think ABOUT THIS approach ?

Sounds complicated to me, but I haven’t used ROS.

is there a way to start the motor whenever the program reaches the way point before doing the actions?

Yes. I would just do simple handshaking. If you want to do that through ROS, go for it. Otherwise a cheap relay and a digital output is all you need. Just signal to the Arduino in the Actions section by sending a ROS command or turning on a digital output. Follow this immediately with a Wait instruction for either a ROS command from the Arduino, or another relayed input before completing the other actions.

Do I have to use Relay or just communication through ethernet cable in order to connect to UR5e ?

You don’t need a relay, no. That’s just if you want to use discrete wiring to talk to your Arduino. You can use ethernet if you’re comfortable talking TCP/IP