Reverse Servo Direction Adafruit 16-Channel 12-bit PWM/Servo

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
aswad
 
Posts: 4
Joined: Fri Jan 17, 2014 8:23 am

Reverse Servo Direction Adafruit 16-Channel 12-bit PWM/Servo

Post by aswad »

Hi,

i have the Adafruit 16 Channel PWM/Servo shield and connected 3 servos to it. The Servos run in clockwise direction.
Now I need to run one of the servos in counter-clockwise direction, due to the way they are set up in a testing environment.

From the library reference: setPWM(channel, on, off)

Code: Select all

    for (uint16_t pulselen = SERVOMIN; pulselen < 237; pulselen++) {
      pwm.setPWM(servonum, 0, pulselen);
This drives the servo for a few degrees in clockwise direction, but i need to change the direction. I've been playing around with the off and on values of pwm.setPWM, but to no avail.
I've read, that by changing the length of the pulse (either increasing or decreasing it) i can change the direction, in which the servo moves. But apparently i was unable to change the length of the pwm-signal.
I thought maybe by using a higher "on" value i could influence the pulse length, but that give me the desired result. Instead of going in the other direction, the servo started moving a bit later.
Any thoughts/help would be greatly appreciated :)
Thanks in advance

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Reverse Servo Direction Adafruit 16-Channel 12-bit PWM/S

Post by adafruit_support_bill »

Your for loop is going from SERVOMIN to 237, so you are operating at the lower end of the pulse width range. Try looping from 238 to SERVOMAX to reverse direction.

aswad
 
Posts: 4
Joined: Fri Jan 17, 2014 8:23 am

Re: Reverse Servo Direction Adafruit 16-Channel 12-bit PWM/S

Post by aswad »

Thanks for your reply, Bill.

I tried, as you suggested, but when i do

Code: Select all

    for (uint16_t pulselen = 238; pulselen < SERVOMAX; pulselen++) { //or even going from 380 to SERVOMAX
      pwm.setPWM(servonum, 0, pulselen);
    }
the servo will just "zip" clockwise to the startingposition representing the 238/380 and then move till SERVOMAX :(

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Reverse Servo Direction Adafruit 16-Channel 12-bit PWM/S

Post by adafruit_support_bill »

What kind of servos are you using and what kind of motion are you trying to achieve?

aswad
 
Posts: 4
Joined: Fri Jan 17, 2014 8:23 am

Re: Reverse Servo Direction Adafruit 16-Channel 12-bit PWM/S

Post by aswad »

Those are the servos i am using: http://www.BANNED.com/ce/en/product/275 ... Plastic-JR
Kind of starting to regret getting those servos, since there isn't some kind of datasheet either.
I have a "setup", where a circuit board can be attached and the servos are supposed to operate the buttons on that board. We had to attach one servo in the "other direction" to fit it into the testing environment. Now i'm trying to move this servo from it's "idle position" in counter-clockwise direction, so it pushes down on the button, instead of moving "upwards"/away from the button.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Reverse Servo Direction Adafruit 16-Channel 12-bit PWM/S

Post by adafruit_support_bill »

Those are the servos i am using:
I see now. From the description in your original post it sounded like you were using continuous rotation servos.
Now i'm trying to move this servo from it's "idle position" in counter-clockwise direction, so it pushes down on the button, instead of moving "upwards"/away from the button.
First you need to determine the pulse length that corresponds to those two positions. One you know that, you can just use those values for the start and end values in your for loop.

aswad
 
Posts: 4
Joined: Fri Jan 17, 2014 8:23 am

Re: Reverse Servo Direction Adafruit 16-Channel 12-bit PWM/S

Post by aswad »

We solved the "problem" by making a servo-Inverter, using a pic microcontroller.
For those, who are interested, here is the link to the tutorial (although it's in german. sorry about that): http://www.sprut.de/electronic/pic/proj ... /index.htm

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”