RC Servo Control via Relay

I'm working on a project that requires use of an RC servo to turn a 3D printed rotary valve. The servo needs to be able to turn both directions. I'm able to accomplish this when I power the servo directly from my Uno, but I need it to be externally powered. What's the trick to maintaining this directional control when using a relay? I wired the servo to the relay and still used the signal wire back to the Uno, but every command I send only turns the servo in one direction. I've lost the control I had when powering it directly from the board. Is this an issue with polarity reversal, or what's the deal? Does this require an H-bridge setup with two relays? I tried that and lost all control, so not sure what I did wrong.

Totally new to this, obviously!

Draw a diagram.

Did you connect the external supply's ground (negative) to Arduino's GND?

I did not connect the external power ground to the Arduino ground. Here was my setup:

Relay VCC to 5V on Arduino
Relay GND to GND on Arduino
Relay signal IN to Arduino digital pin

Relay NO to servo POS (+)
Relay COM to POS (+) of external power
External power NEG to servo NEG (-)

Servo signal to Arduino digital pin

With this setup the servo will turn clockwise, but that's it. I ran some test code to allow me to use commands to go left, right, and center. When the servo was attached directly to the Arduino power and ground, that functioned. When I moved the power to the relay and used the Arduino to instead command the relay, I lost any ability to control the direction and was basically just left with on/off.

Am I missing that the external power ground should instead go directly to the Arduino? If that's the case, I'm not tracking how the relay would work.

One of the first things I learned about electricity:
Current flows in a loop (circuit) from source to load and back to source.
Your signal leaves the Arduino (source +) and flows toward the load (servo signal pin), how does it get back to the Arduino (source -)?

1 Like

How is it wired when you do this?

Thanks, I'm starting to track. What's confusing me is how I isolate the external power "loop" of the servo if I have to tie the external power source ground back to the Arduino though.

When I ran the servo direct from the Arduino, it was as simple as having the signal wire to a digital pin, then using the 5V and GND pins for the servo power and GND.

But, in that case the servo ground WAS connected to the Arduino GND. Right?

I gotcha. My hangup was thinking that if I had a ground coming from external power and going to the Arduino board that I was going to fry the board. But thinking in the loop mindset, I see the difference now. Appreciate it!

Servos generally don't turn, they are positioned. Normally, especially in rc applications, this is accomplished by a signal on a third wire. Could you show us a picture of what you're working with?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.