Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Controlling a servo with lopy (library or manually)

    Scheduled Pinned Locked Moved LoPy
    servolopy
    16 Posts 3 Posters 3.8k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • sorenS Offline
      soren @robert-hh
      last edited by

      @robert-hh no worries mate, but yes - i did pull OE low. Connected it directly to GND on the lopy. Maybe a stupid question, but what is "SW" ?

      robert-hhR 2 Replies Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @soren
        last edited by

        @soren Software

        1 Reply Last reply Reply Quote 0
        • robert-hhR Offline
          robert-hh @soren
          last edited by

          @soren I just looked into the 74HCT125 data sheet. The minimum level for high is 3.15 V, close to the output level of the lopy. In that case I would check with an oscilloscope or logic analyzer whether the output of the gate really switches.

          sorenS 1 Reply Last reply Reply Quote 0
          • sorenS Offline
            soren @robert-hh
            last edited by

            @robert-hh I can see with my multimeter that it's switching, but maybe that isn't accurate enough?

            robert-hhR 1 Reply Last reply Reply Quote 0
            • robert-hhR Offline
              robert-hh @soren
              last edited by robert-hh

              @soren Switching while you toggle manually? or between duty cycle 0 and 1?
              Edit: I see 74HCT125 has a high input level of 2V, like the 74LS125. It's the 74HC125 with the 3.15 V level. So theer should be no problem with the levels.

              1 Reply Last reply Reply Quote 0
              • L Offline
                livius @soren
                last edited by livius

                @soren said in Controlling a servo with lopy (library or manually):
                For me setup 1 not worked when i tested it in the past with MG996R.
                It does not react properly on 3v3 range pwm.
                Setup 2 should work but i do not use convertes in chip
                i trust simple design as converter on simple transistor eg. 2N7000.

                and to test if it work - try first run commands from terminal
                pwm_c.duty_cycle(0.127 )
                look at result but do not put sleep command
                and decrese value
                pwm_c.duty_cycle(0.117 )
                pwm_c.duty_cycle(0.107 )
                pwm_c.duty_cycle(0.097 )
                ...

                any results?
                P.S. pwm_c.duty_cycle(1) is not good at all ;-)
                i have done same mistake previously - as you can see in my post from the past

                think about people first, then computers

                robert-hhR sorenS 2 Replies Last reply Reply Quote 0
                • robert-hhR Offline
                  robert-hh @livius
                  last edited by

                  @livius sleep() does not turn off the PWM.

                  L 1 Reply Last reply Reply Quote 0
                  • L Offline
                    livius @robert-hh
                    last edited by

                    @robert-hh
                    yes, but it is not needed from terminal - this was my intention

                    think about people first, then computers

                    1 Reply Last reply Reply Quote 0
                    • sorenS Offline
                      soren @livius
                      last edited by

                      @livius I took everything apart, put it together and double cross checked several times the connections and then tried the pwm_c.duty_cycle() command from console - and it WORKED! @robert-hh I think time.sleep actually does affect pwm. At least it works now for me from console where I'm not using sleep - in contrast to what I did in the code.

                      robert-hhR 1 Reply Last reply Reply Quote 0
                      • robert-hhR Offline
                        robert-hh @soren
                        last edited by

                        @soren Good that it works. But omitting the sleep() commands are hardly the reason. I checked with an oscilloscope that PWM output stays when sleep() is performed. It's more something else you did. I worked with these servos decades ago, and remember that the pulse width range they expect is pretty small, from 1 ms to 2ms, at a 20ms period, resulting at a PWM duty cycle range between 5% and 10%

                        1 Reply Last reply Reply Quote 0

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better 💗

                        Register Login
                        • 1 / 1
                        • First post
                          Last post

                        Pycom on Twitter

                        Pycom