I am using the BGMC2 (http://www.rovertec.com/products-bgmc2.html) to control a gimbal motor (http://www.iflight-rc.com/ipower-motor-gbm5208h-200t-brushless-gimbal-motor-with-as5048a-encoder.html). I am running the following code on my Raspberry pi to send the controller a PWM signal:
import os import time os.system("sudo pigpiod") #launch GPIO library time.sleep(1) import pigpio ESC = 4 # white wire to 4 (7) # black wire to 23 (6) pi = pigpio.pi(); pi.set_servo_pulsewidth(ESC, 0) max_value = 2500 min_value = 500 def control(): print "Starting motor" time.sleep(1) speed = 1900 while True: pi.set_servo_pulsewidth(ESC, speed) def arm(): print "Connect battery and press Enter" inp = raw_input() if inp == '': pi.set_servo_pulsewidth(ESC, 0) time.sleep(1) pi.set_servo_pulsewidth(ESC, max_value) time.sleep(1) pi.set_servo_pulsewidth(ESC, min_value) time.sleep(1) control() print "Starting..." arm()
I noticed that the controller regularly flashes the RED light labeled D2 and my gimbal motor shakes back and forth while this is happening. I was wondering how I could go about debugging this problem to prevent the motor from shaking back and forth.