1

I'm trying to control a LEGO servo (88004) using a Raspberry pi. I would like to use pigpio to get a more precise control (no shaking, like with gpio PWM).

It's work with a regular servo (3 wires). It kinda works with the 88004, it buzz when I test it (both with c1 and c2), but I can't make it move :-( (see code below).

Anyone have a suggestions to this problem?

"Kinda" working python code.

import time
import pigpio

pi = pigpio.pi()

if not pi.connected:
   exit()

#sudo pigpiod -s8
c1 = 23
c2 = 24
pi.set_PWM_frequency(c1,1250)
pi.set_PWM_frequency(c2,1250)
print(pi.get_PWM_frequency(c1))

#use NAME (GPIO02 = 2)

while True:
   pi.set_servo_pulsewidth(c1, 0)
   pi.set_servo_pulsewidth(c2, 0)
   print "reset"

   try:

      pi.set_servo_pulsewidth(c1,2000)
      pi.set_servo_pulsewidth(c2,2500)
      print "c1"
      time.sleep(3)
      pi.set_servo_pulsewidth(c1,0)
      pi.set_servo_pulsewidth(c2,2500)
      print "c2"
      time.sleep(3)


   except KeyboardInterrupt:
      break

print("\nTidying up")

pi.set_servo_pulsewidth(c1, 0)
pi.set_servo_pulsewidth(c2, 0)

pi.stop()
Alexander O'Mara
  • 13,302
  • 4
  • 43
  • 97

1 Answers1

1

I figured it out :-) Using pi.set_PWM_dutycycle(c1, 128) # PWM 1/2 on makes it move.

In hindsight kinda obvious :)

  • Interesting to learn that power functions are controlled by PWM. I thought they were controlled analogously with a proportional voltage on the C1 and C2 pins – Michael Verschaeve Apr 05 '18 at 19:52