1

The servo motor(I'm using MG996R) needs lots of power to run through the raspberry pi board power supply. so I decided to supply it externally using an SMPS box. when the servo is connected to 5v of pi on board(+ve,gnd and signal) the program rotates the servo, but when connected( +ve and gnd to SMPS and signal to pi) to 5v of SMPS it doesn't rotate. I also noticed that if my program runs for too long when it is connected to the pi board, it completely shuts down after 5-6 rotations. So my doubt is why isn't it working when powered externally with SMPS box? and what is the possible solution The code given below is the test code I'm trying to run

from gpiozero import Servo
from time import sleep

myGPIO=17

myServo = Servo(myGPIO)

print("Using GPIO17")
print("Using Gpiozero defaults for the servo class")

while True:
  myServo.mid()
  print("Set to middle position")
  sleep(1)
  myServo.min()
  print("Set to minimum position")
  sleep(1)
  myServo.mid()
  print("Set to middle position")
  sleep(1)
  myServo.max()
  print("Set to maximum position")
  sleep(1)
  • 2
    Light on detail. Photos of wiring, description of wiring, software listing. – joan Mar 2 '20 at 17:33
  • 1
    when servo motor(MG996R) powered through pi board of 5v supply - works fine but when it is powered through SMPS 5v doesn't work – SPURTHY M Mar 2 '20 at 18:06
  • 1
    So you said in your question. You need to add detail. – joan Mar 2 '20 at 18:10
  • 2
    Just as remark: I experienced comparable behavior when the GND of the Pi and the external power supply were not connected (faulty wire in my case). But agree with Joan: at least add a schematic diagram of your servo, pi and SMPS. – Ljm Dullaart Mar 2 '20 at 18:30
1

you need to wire the RPi ground to the ground of the servo power supply.

  • servo power supply as in SMPS box? – SPURTHY M Mar 3 '20 at 8:09
  • Yes... you need the SMPS box's ground to be connected to the RPi's ground... if later you find there is too much noise causing the RPi to glitch then also use a capacitor across the 3.3V and Ground as close to the RPi as possible... usually 0.1 to 10 micro farads depending on the noise frequency.... but start by just connecting the RPi ground to your SMPS's ground and see how that works. – Leumas Mar 3 '20 at 23:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.