Answers.Body: <p>I figured it out :-)
  Using pi.set_PWM_dutycycle(c1, 128) # PWM 1/2 on makes it move.</p>
  
  <p>In hindsight kinda obvious :) </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-05T19:52:13.280Z
Answers.Text: 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
Answers.UserDisplayName: Michael Verschaeve
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-05T12:52:35.143Z
Answers.LastActivityDate: 2018-04-05T12:52:35.143Z
Answers.UserDisplayName: Jonas Primdahl
Body: <p>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). </p>
  
  <p>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).</p>
  
  <p>Anyone have a suggestions to this problem?</p>
  
  <p>"Kinda" working python code.</p>
  
  <pre><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()
  </code></pre>
  
Tags: <python>
Title: LEGO servo (88004) controlled by Raspberry Pi using python pigpio
UserDisplayName: Jonas Primdahl
ThreadText: # LEGO servo (88004) controlled by Raspberry Pi using python pigpio
  
  (Asked by: username_0 on 2018-04-04)
  
  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()
  
  **Tags:** python
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-04-05. Score: 1
  
  I figured it out :-)
  Using pi.set\_PWM\_dutycycle(c1, 128) # PWM 1/2 on makes it move.
  
  In hindsight kinda obvious :)
  
  > **Comments:**
  > **username_1**: 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  
  
  ---
  
  