Total optical isolation discussion notes

Active today
Viewed 22 times

I have a Pi 3 Model B (powered by its ac adapter) sending multiple PWM control signals to up to 5 servos (SG5010). These servos draw usually 300 mA when they move and up to 1 A each when stalled so I plan to use an external power supply for them.

I know that for the servos to work their power and the PWM signal have to share the same ground. What I’m worried about is if it is safe to connect the Pi ground pin directly to the ground from the external power supply (which is powering the servos). I ask this because (as I understand it) servos usually generate noise that can travel through their ground pin and therefore to the Pi and fry it if it’s high enough.

I’ve seen that in other projects this is not a problem but in all of those projects they only use one or two servos or they don’t draw as much current as I’m going to do.

Do I need to isolate the Pi ground from the external power ground? If so, what methods are usually used?

 New contributor
  • 2
    If by “noise” you mean flyback you should use a zener diode on the ground from the servo(s). This is not essential with small servos, but OTOH, that doesn’t mean you are guaranteed safe without one. – goldilocks 11 hours ago
  • 1
    The back emf should be taken care of inside the servos’ control IC (again, this is what is suposed to happen, I don’t know if some servos don’t take measurements against it). I say noise because I’ve been told that servos are usually noisy (“electricly” speaking). – 7777ale7777 11 hours ago
  • 1
    So I’ve been paranoid this whole time?!?? Actually I don’t use diodes, and I prefer to power servos independently, with a common ground and I don’t have problems (at least, not that I’d attribute to ground noise). These are mostly little SG90s with very little load though (pan/scan camera etc). – goldilocks 11 hours ago
  • Hi @7777ale7777, Welcome and nice to meet you. (1) I agree with you that the back EMF from the servos should be “absorbed” by the MCU (eg TowerPro MG99x has a 4 bit Amtel MCU) (2) Yes, you can connect servo power ground to (a) Rpi signal ground, ie, the duPont pins at the Rpi 40 pin connector, (b) Rpi power ground, ie near (before or after) the micro USB connector giving power to Rpi. (c) As further as from Rpi, eg, near the PSU supplying power to Rpi. – tlfong01 22 mins ago   
  • (3) To play very safe, you can do the following: (a) Use optical isolator to isolate Rpi signal, perhaps also at the same time shift up Rpi 3V3 GPIO signals to 5V to interface with servo. (b) Even the 4 bit Atmel MCU circuit inside the TowerPro servo takes care of the back EMF of the DC motor inside the servo, there may be still some back EMF leaking out and flying back to optical isolated cricuit to the Rpi GPIO pins driving the servo. Of course you can add a Shottky diode some where to further absorb the even tiny back EMF. – tlfong01 15 mins ago   
  • Now something IMPORTANT: for Rpi, even using with optical isolator, controlling 5V relays driving inductive loads such as DC motors and solenoids, there are beside back EMF, other stuff, like spikes, which generate EMI (Don’t ask me about EMI, which I don’t know nothing) noise which escapes through the grounding wire connecting servo and Rpi logical ground, and triggers Rpi to reset (I did experience, through very every rarely.) – tlfong01 8 mins ago   
  • The get around is TOTAL OPTICAL ISOLATION, which means not connecting servo ground to Rpi logical ground. See the following posts for details on total optical isolation using the Forbe relay as an example: (1) (2) raspberrypi.stackexchange.com/questions/98250/… raspberrypi.stackexchange.com/questions/99988/… – tlfong01 8 mins ago   
  • This is the picture showing the optical isolation for relays idea which I think also applies to servo: imgur.com/gallery/YeEa8i3. WARNING: No guarantee that no nothing won’t melt down or blow up. By the way, I learned the noise reducing trick of optical isolation from the EE guys. You might like to move this question to EE StackExchange to see what the EE guys out there think about it! 🙂 – tlfong01 1 min ago   Edit   

2 Answers


As joan has answered you NEED to share a ground to the control interface of your servos.

How this is done is dependent on the physical layout of the wiring, and is somewhat of an art.

Ideally the control interface and servo power should not share any wiring, as any voltage drop in the common wiring will be introduced into the control interface.

The best practice would be to interconnect the Pi ground directly to the ground of the control interface (ideally routing all connections on the same path).

The power should be connected to the servos by separate wiring, and utilise a separate ground connection point (if available).

I doubt that with small servos using decent wiring and short cables there would be any problems, but following the best practice costs nothing.


You need to connect the Pi ground to the servo power supply ground. You will not be able to control the servos unless you do so.

I have controlled a robot arm with 5 servos. I had to use an external PC power supply to get the amperage needed at 5V.

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: