Using Servo32v7Demo; my servo want to keep turning to the left
vanmunch
Posts: 568
Hello,
I'm new to the propeller and I'm about half way through the PE kit, but I've been really interested in getting back to working on my robot so I though that I would see if I could control a servo (hitec HS-485HB). I'm using Servo32v7 from the exchange and I've been trying the demo program exactly as it is except that I've changed "ServoCh1 = 0" to "ServoCh1 = 1". I have a 1k resistor between pin 1 and the yellow servo wire. After I load the program in to propeller RAM, the servo quickly turns to the left until it can't turn any more and strains until I turn off the power (more than 60 secs). I've tried changing the "width" values from 1500 to 1000, 500, 2000, and 2500, but it keeps turning at the same speed to the left. Does anyone know what I might be doing wrong? Thanks!
Dave
I'm new to the propeller and I'm about half way through the PE kit, but I've been really interested in getting back to working on my robot so I though that I would see if I could control a servo (hitec HS-485HB). I'm using Servo32v7 from the exchange and I've been trying the demo program exactly as it is except that I've changed "ServoCh1 = 0" to "ServoCh1 = 1". I have a 1k resistor between pin 1 and the yellow servo wire. After I load the program in to propeller RAM, the servo quickly turns to the left until it can't turn any more and strains until I turn off the power (more than 60 secs). I've tried changing the "width" values from 1500 to 1000, 500, 2000, and 2500, but it keeps turning at the same speed to the left. Does anyone know what I might be doing wrong? Thanks!
Dave
Comments
Do you have all of the grounds connected? The servo ground (black or brown wire) should be in common with Vss of the Propeller.
Your description to the left is typical if the grounds are not connected. The servo expects updates every 20ms, that comes out to be 50Hz ... 60Hz AC 'noise' is close enough for the servo to think it has a valid signal. Since the width of the signal is greater than 2ms (about 8.3ms) it causes your servo to swing all the way to the left.
Properly grounding the servo with the Propeller will eliminate the 50Hz or 60Hz noise from entering and becoming a problem.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
It works! Thank you for the help, I feel honored to get help from the man himself. I was using a separate power supply for the servo and it worked once I connected the Propeller and servo to a common ground. Anyhow, I'm hoping to do a brain and code transplant on my hexapod (currently a BS2sx with two PSC in time for the Chicago propeller expo. Thanks again for the help!
Dave