Servo Motor is not functioningHow to flush output of print function?Servo/audio synchronization in animatronics on RPi. Considering FFT solutionCan't control any servo with my RaspberryPi 2RF motor/servo controlTCP connection to control servo motorcontrol servo motor speed by raspberry piPython: Passing a class member function to another class's callbackInconsistency Issues With Stepper MotorTrying to find a good way to control servos at different speeds using johnny-five.ioControlling the speed of 2 Servo motors with the Raspberry Pi

Why is 'additive' EQ more difficult to use than 'subtractive'?

Computing elements of a 1000 x 60 matrix exhausts RAM

Which values for voltage divider

Unary Enumeration

Is being an extrovert a necessary condition to be a manager?

A nasty indefinite integral

What is this dime sized black bug with white on the segments near Loveland Colorodao?

Passport queue length in UK in relation to arrival method

Why the work done is positive when bringing 2 opposite charges together?

Team member is vehemently against code formatting

How could the B-29 bomber back up under its own power?

What is the required burn to keep a satellite at a Lagrangian point?

Adobe Illustrator: How can I change the profile of a dashed stroke?

why "American-born", not "America-born"?

Writing "hahaha" versus describing the laugh

VHDL: Why is it hard to desgin a floating point unit in hardware?

Download app bundles from App Store to run on iOS Emulator on Mac

How could Dwarves prevent sand from filling up their settlements

Is it normal to "extract a paper" from a master thesis?

One word for 'the thing that attracts me'?

Coloring lines in a graph the same color if they are the same length

Department head said that group project may be rejected. How to mitigate?

How does the Earth's center produce heat?

How would a physicist explain this starship engine?



Servo Motor is not functioning


How to flush output of print function?Servo/audio synchronization in animatronics on RPi. Considering FFT solutionCan't control any servo with my RaspberryPi 2RF motor/servo controlTCP connection to control servo motorcontrol servo motor speed by raspberry piPython: Passing a class member function to another class's callbackInconsistency Issues With Stepper MotorTrying to find a good way to control servos at different speeds using johnny-five.ioControlling the speed of 2 Servo motors with the Raspberry Pi






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








-1















I have a servo motor, specifically a SG90, connected to an external power source and it is not supplying power.



The power source consists of 3 1.5v AA batteries taped together end to end.



I have tried switching the positive and negative ends and using other batteries, nothing seems to work.



Here is my code in case that is the issue



import RPi.GPIO as GPIO
from time import sleep

GPIO.setmode(GPIO.BOARD)
GPIO.setup(21,GPIO.OUT)
print("setup complete")
pwm=GPIO.PWM(21,50)
pwm.start(5)
sleep(2)
pwm.ChangeDutyCycle(3)
sleep(3)
GPIO.cleanup()


I expect the motor to be powered and to move.



Thanks In Advance










share|improve this question




























    -1















    I have a servo motor, specifically a SG90, connected to an external power source and it is not supplying power.



    The power source consists of 3 1.5v AA batteries taped together end to end.



    I have tried switching the positive and negative ends and using other batteries, nothing seems to work.



    Here is my code in case that is the issue



    import RPi.GPIO as GPIO
    from time import sleep

    GPIO.setmode(GPIO.BOARD)
    GPIO.setup(21,GPIO.OUT)
    print("setup complete")
    pwm=GPIO.PWM(21,50)
    pwm.start(5)
    sleep(2)
    pwm.ChangeDutyCycle(3)
    sleep(3)
    GPIO.cleanup()


    I expect the motor to be powered and to move.



    Thanks In Advance










    share|improve this question
























      -1












      -1








      -1








      I have a servo motor, specifically a SG90, connected to an external power source and it is not supplying power.



      The power source consists of 3 1.5v AA batteries taped together end to end.



      I have tried switching the positive and negative ends and using other batteries, nothing seems to work.



      Here is my code in case that is the issue



      import RPi.GPIO as GPIO
      from time import sleep

      GPIO.setmode(GPIO.BOARD)
      GPIO.setup(21,GPIO.OUT)
      print("setup complete")
      pwm=GPIO.PWM(21,50)
      pwm.start(5)
      sleep(2)
      pwm.ChangeDutyCycle(3)
      sleep(3)
      GPIO.cleanup()


      I expect the motor to be powered and to move.



      Thanks In Advance










      share|improve this question














      I have a servo motor, specifically a SG90, connected to an external power source and it is not supplying power.



      The power source consists of 3 1.5v AA batteries taped together end to end.



      I have tried switching the positive and negative ends and using other batteries, nothing seems to work.



      Here is my code in case that is the issue



      import RPi.GPIO as GPIO
      from time import sleep

      GPIO.setmode(GPIO.BOARD)
      GPIO.setup(21,GPIO.OUT)
      print("setup complete")
      pwm=GPIO.PWM(21,50)
      pwm.start(5)
      sleep(2)
      pwm.ChangeDutyCycle(3)
      sleep(3)
      GPIO.cleanup()


      I expect the motor to be powered and to move.



      Thanks In Advance







      python-3.x raspberry-pi electronics






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 23 at 21:11









      TylerTyler

      41




      41






















          2 Answers
          2






          active

          oldest

          votes


















          0














          Are you using the correct pinouts? For PWM it looks like you need either PWM0 or PWM1 which is pin combos 12/32 & 33/35.



          All GPIOs are not PWM capable.






          share|improve this answer























          • Can you give me an example of what I should do?

            – Tyler
            Mar 23 at 21:24











          • Checkout this example: rpi.science.uoit.ca/lab/servo

            – SlowlyButSurely
            Mar 23 at 21:28






          • 2





            For a well-rounded answer, I'd suggest adding a code snip related to the OPs with the fixes you're recommending within the answer itself. Note also, that unless absolutely necessary, put everything pertinent to your answer as text (or code etc) in the answer as opposed to links. Links die eventually, oftentimes rendering answers/comments useless.

            – stevieb
            Mar 23 at 21:52












          • Thanks. You're right, I was just in a rush because it's nice outside and I wanted to take the dog for a walk :)

            – SlowlyButSurely
            Mar 23 at 22:08






          • 1





            So to answer the original question, I think you (maybe) just mixed the order of numbers for your pin assignment (21 vs 12). Go back through the code and replace 21 with 12: Here--->GPIO.setup(21,GPIO.OUT) print("setup complete") and Here ---> pwm=GPIO.PWM(21,50)

            – SlowlyButSurely
            Mar 23 at 22:13



















          0














          Make sure you have sufficient battery voltage.



          Check your wiring.



          Make sure Raspi and servo share GND.



          Make sure you're using a PWM pin. On Raspi 3 pin 12 (GPIO18) should work fine.



          enter image description here






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55318430%2fservo-motor-is-not-functioning%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Are you using the correct pinouts? For PWM it looks like you need either PWM0 or PWM1 which is pin combos 12/32 & 33/35.



            All GPIOs are not PWM capable.






            share|improve this answer























            • Can you give me an example of what I should do?

              – Tyler
              Mar 23 at 21:24











            • Checkout this example: rpi.science.uoit.ca/lab/servo

              – SlowlyButSurely
              Mar 23 at 21:28






            • 2





              For a well-rounded answer, I'd suggest adding a code snip related to the OPs with the fixes you're recommending within the answer itself. Note also, that unless absolutely necessary, put everything pertinent to your answer as text (or code etc) in the answer as opposed to links. Links die eventually, oftentimes rendering answers/comments useless.

              – stevieb
              Mar 23 at 21:52












            • Thanks. You're right, I was just in a rush because it's nice outside and I wanted to take the dog for a walk :)

              – SlowlyButSurely
              Mar 23 at 22:08






            • 1





              So to answer the original question, I think you (maybe) just mixed the order of numbers for your pin assignment (21 vs 12). Go back through the code and replace 21 with 12: Here--->GPIO.setup(21,GPIO.OUT) print("setup complete") and Here ---> pwm=GPIO.PWM(21,50)

              – SlowlyButSurely
              Mar 23 at 22:13
















            0














            Are you using the correct pinouts? For PWM it looks like you need either PWM0 or PWM1 which is pin combos 12/32 & 33/35.



            All GPIOs are not PWM capable.






            share|improve this answer























            • Can you give me an example of what I should do?

              – Tyler
              Mar 23 at 21:24











            • Checkout this example: rpi.science.uoit.ca/lab/servo

              – SlowlyButSurely
              Mar 23 at 21:28






            • 2





              For a well-rounded answer, I'd suggest adding a code snip related to the OPs with the fixes you're recommending within the answer itself. Note also, that unless absolutely necessary, put everything pertinent to your answer as text (or code etc) in the answer as opposed to links. Links die eventually, oftentimes rendering answers/comments useless.

              – stevieb
              Mar 23 at 21:52












            • Thanks. You're right, I was just in a rush because it's nice outside and I wanted to take the dog for a walk :)

              – SlowlyButSurely
              Mar 23 at 22:08






            • 1





              So to answer the original question, I think you (maybe) just mixed the order of numbers for your pin assignment (21 vs 12). Go back through the code and replace 21 with 12: Here--->GPIO.setup(21,GPIO.OUT) print("setup complete") and Here ---> pwm=GPIO.PWM(21,50)

              – SlowlyButSurely
              Mar 23 at 22:13














            0












            0








            0







            Are you using the correct pinouts? For PWM it looks like you need either PWM0 or PWM1 which is pin combos 12/32 & 33/35.



            All GPIOs are not PWM capable.






            share|improve this answer













            Are you using the correct pinouts? For PWM it looks like you need either PWM0 or PWM1 which is pin combos 12/32 & 33/35.



            All GPIOs are not PWM capable.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 23 at 21:17









            SlowlyButSurelySlowlyButSurely

            508




            508












            • Can you give me an example of what I should do?

              – Tyler
              Mar 23 at 21:24











            • Checkout this example: rpi.science.uoit.ca/lab/servo

              – SlowlyButSurely
              Mar 23 at 21:28






            • 2





              For a well-rounded answer, I'd suggest adding a code snip related to the OPs with the fixes you're recommending within the answer itself. Note also, that unless absolutely necessary, put everything pertinent to your answer as text (or code etc) in the answer as opposed to links. Links die eventually, oftentimes rendering answers/comments useless.

              – stevieb
              Mar 23 at 21:52












            • Thanks. You're right, I was just in a rush because it's nice outside and I wanted to take the dog for a walk :)

              – SlowlyButSurely
              Mar 23 at 22:08






            • 1





              So to answer the original question, I think you (maybe) just mixed the order of numbers for your pin assignment (21 vs 12). Go back through the code and replace 21 with 12: Here--->GPIO.setup(21,GPIO.OUT) print("setup complete") and Here ---> pwm=GPIO.PWM(21,50)

              – SlowlyButSurely
              Mar 23 at 22:13


















            • Can you give me an example of what I should do?

              – Tyler
              Mar 23 at 21:24











            • Checkout this example: rpi.science.uoit.ca/lab/servo

              – SlowlyButSurely
              Mar 23 at 21:28






            • 2





              For a well-rounded answer, I'd suggest adding a code snip related to the OPs with the fixes you're recommending within the answer itself. Note also, that unless absolutely necessary, put everything pertinent to your answer as text (or code etc) in the answer as opposed to links. Links die eventually, oftentimes rendering answers/comments useless.

              – stevieb
              Mar 23 at 21:52












            • Thanks. You're right, I was just in a rush because it's nice outside and I wanted to take the dog for a walk :)

              – SlowlyButSurely
              Mar 23 at 22:08






            • 1





              So to answer the original question, I think you (maybe) just mixed the order of numbers for your pin assignment (21 vs 12). Go back through the code and replace 21 with 12: Here--->GPIO.setup(21,GPIO.OUT) print("setup complete") and Here ---> pwm=GPIO.PWM(21,50)

              – SlowlyButSurely
              Mar 23 at 22:13

















            Can you give me an example of what I should do?

            – Tyler
            Mar 23 at 21:24





            Can you give me an example of what I should do?

            – Tyler
            Mar 23 at 21:24













            Checkout this example: rpi.science.uoit.ca/lab/servo

            – SlowlyButSurely
            Mar 23 at 21:28





            Checkout this example: rpi.science.uoit.ca/lab/servo

            – SlowlyButSurely
            Mar 23 at 21:28




            2




            2





            For a well-rounded answer, I'd suggest adding a code snip related to the OPs with the fixes you're recommending within the answer itself. Note also, that unless absolutely necessary, put everything pertinent to your answer as text (or code etc) in the answer as opposed to links. Links die eventually, oftentimes rendering answers/comments useless.

            – stevieb
            Mar 23 at 21:52






            For a well-rounded answer, I'd suggest adding a code snip related to the OPs with the fixes you're recommending within the answer itself. Note also, that unless absolutely necessary, put everything pertinent to your answer as text (or code etc) in the answer as opposed to links. Links die eventually, oftentimes rendering answers/comments useless.

            – stevieb
            Mar 23 at 21:52














            Thanks. You're right, I was just in a rush because it's nice outside and I wanted to take the dog for a walk :)

            – SlowlyButSurely
            Mar 23 at 22:08





            Thanks. You're right, I was just in a rush because it's nice outside and I wanted to take the dog for a walk :)

            – SlowlyButSurely
            Mar 23 at 22:08




            1




            1





            So to answer the original question, I think you (maybe) just mixed the order of numbers for your pin assignment (21 vs 12). Go back through the code and replace 21 with 12: Here--->GPIO.setup(21,GPIO.OUT) print("setup complete") and Here ---> pwm=GPIO.PWM(21,50)

            – SlowlyButSurely
            Mar 23 at 22:13






            So to answer the original question, I think you (maybe) just mixed the order of numbers for your pin assignment (21 vs 12). Go back through the code and replace 21 with 12: Here--->GPIO.setup(21,GPIO.OUT) print("setup complete") and Here ---> pwm=GPIO.PWM(21,50)

            – SlowlyButSurely
            Mar 23 at 22:13














            0














            Make sure you have sufficient battery voltage.



            Check your wiring.



            Make sure Raspi and servo share GND.



            Make sure you're using a PWM pin. On Raspi 3 pin 12 (GPIO18) should work fine.



            enter image description here






            share|improve this answer



























              0














              Make sure you have sufficient battery voltage.



              Check your wiring.



              Make sure Raspi and servo share GND.



              Make sure you're using a PWM pin. On Raspi 3 pin 12 (GPIO18) should work fine.



              enter image description here






              share|improve this answer

























                0












                0








                0







                Make sure you have sufficient battery voltage.



                Check your wiring.



                Make sure Raspi and servo share GND.



                Make sure you're using a PWM pin. On Raspi 3 pin 12 (GPIO18) should work fine.



                enter image description here






                share|improve this answer













                Make sure you have sufficient battery voltage.



                Check your wiring.



                Make sure Raspi and servo share GND.



                Make sure you're using a PWM pin. On Raspi 3 pin 12 (GPIO18) should work fine.



                enter image description here







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 25 at 22:55









                PigletPiglet

                8,94421123




                8,94421123



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55318430%2fservo-motor-is-not-functioning%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript