PWm Servo shield is not working in Mega-2560

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
adafruit_support_bill
 
Posts: 88092
Joined: Sat Feb 07, 2009 10:11 am

Re: PWm Servo shield is not working in Mega-2560

Post by adafruit_support_bill »

6v is fine. But please measure it when connected to the shield. A drop in voltage could indicate a short circuit or possibly weak batteries.

User avatar
apurba
 
Posts: 37
Joined: Sat Mar 15, 2014 6:25 am

Re: PWm Servo shield is not working in Mega-2560

Post by apurba »

Hi ,

I have checked with Motor Control V1 with trhe same power pack and same servo motor, it's rotating. Below is the code:
// Sweep
// by BANNED <http://BANNED.com>
// This example code is in the public domain.


#include <Servo.h>

Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created

int pos = 0; // variable to store the servo position

void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}


void loop()
{
for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}
I will upload the pics of the connection and video for the same.

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

Re: PWm Servo shield is not working in Mega-2560

Post by adafruit_support_bill »

Please measure the voltage when connected to the V2 shield.

User avatar
apurba
 
Posts: 37
Joined: Sat Mar 15, 2014 6:25 am

Re: PWm Servo shield is not working in Mega-2560

Post by apurba »

Hi Voltage is 5.8 V, and still my motor is behaving in the same way.

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

Re: PWm Servo shield is not working in Mega-2560

Post by adafruit_support_bill »

OK now. Touch the small 3-pin device between the power terminals and the circle marked "C2". Is it hot?
Next, measure the voltage between the the two holes inside the circle marked "C2".

User avatar
apurba
 
Posts: 37
Joined: Sat Mar 15, 2014 6:25 am

Re: PWm Servo shield is not working in Mega-2560

Post by apurba »

soory for the delayed response. I have added new battery pack, Now the input voltage is: 6.1 V, in the c2 voltage is same as input voltage: 6.1 V and the three pin chip is not heated up.

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

Re: PWm Servo shield is not working in Mega-2560

Post by adafruit_support_bill »

That confirms that the power circuit on the board is working. Please post clear photos of the front and back of the board. It is possible that you have a bad solder connection somewhere.

User avatar
apurba
 
Posts: 37
Joined: Sat Mar 15, 2014 6:25 am

Re: PWm Servo shield is not working in Mega-2560

Post by apurba »

Please let me know if you can access the image @ https://picasaweb.google.com/1065477509 ... 9599493138 , I prefer to use to Chrome.
Let me know if you need any specific image of the device?

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

Re: PWm Servo shield is not working in Mega-2560

Post by adafruit_support_bill »

Your soldering on the board looks very good. I don't see anything wrong there. But if the servo is working fine on the V1 motor shield, then the problem must be with the board.

If you contact [email protected] with a link to this thread we can replace the board for you. Please post your results with the replacement board.

User avatar
apurba
 
Posts: 37
Joined: Sat Mar 15, 2014 6:25 am

Re: PWm Servo shield is not working in Mega-2560

Post by apurba »

Hi Team,

I got the new board and got soldered , Many thanks for your support. Unfortunately servo is behaving the same. My problem is not resolved.
I am providing around 6.1 V

Regards
Apurba K Saha

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

Re: PWm Servo shield is not working in Mega-2560

Post by adafruit_support_bill »

Below is the code:
// Sweep
// by BANNED <http://BANNED.com>
// This example code is in the public domain.


#include <Servo.h>
You are using the wrong library. You need to use the library for the servo shield: https://learn.adafruit.com/adafruit-16- ... it-library

User avatar
apurba
 
Posts: 37
Joined: Sat Mar 15, 2014 6:25 am

Re: PWm Servo shield is not working in Mega-2560

Post by apurba »

Hi Team,

Please note that the code you have quoted that's for V1 motor shield.
I am using the below code:
/***************************************************
This is an example for our Adafruit 16-channel PWM & Servo driver
Servo test - this will drive 16 servos, one after the other

Pick one up today in the adafruit shop!
------> http://www.adafruit.com/products/815

These displays use I2C to communicate, 2 pins are required to
interface. For Arduino UNOs, thats SCL -> Analog 5, SDA -> Analog 4

Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/

#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>

// called this way, it uses the default address 0x40
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
// you can also call it with a different address you want
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x41);

// Depending on your servo make, the pulse width min and max may vary, you
// want these to be as small/large as possible without hitting the hard stop
// for max range. You'll have to tweak them as necessary to match the servos you
// have!
#define SERVOMIN 0.0001 // this is the 'minimum' pulse length count (out of 4096)
#define SERVOMAX 0.0001 // this is the 'maximum' pulse length count (out of 4096)

// our servo # counter
uint8_t servonum = 0;

void setup() {
Serial.begin(9600);
Serial.println("16 channel Servo test!");

pwm.begin();

pwm.setPWMFreq(60); // Analog servos run at ~60 Hz updates
}

// you can use this function if you'd like to set the pulse length in seconds
// e.g. setServoPulse(0, 0.001) is a ~1 millisecond pulse width. its not precise!
void setServoPulse(uint8_t n, double pulse) {
double pulselength;

pulselength = 1000000; // 1,000,000 us per second
pulselength /= 60; // 60 Hz
Serial.print(pulselength); Serial.println(" us per period");
pulselength /= 4096; // 12 bits of resolution
Serial.print(pulselength); Serial.println(" us per bit");
pulse *= 1000;
pulse /= pulselength;
Serial.println(pulse);
pwm.setPWM(n, 0, pulse);
}

void loop() {
// Drive each servo one at a time
Serial.println(servonum);
for (uint16_t pulselen = SERVOMIN; pulselen < SERVOMAX; pulselen++) {
pwm.setPWM(servonum, 0, pulselen);
}
delay(500);
for (uint16_t pulselen = SERVOMAX; pulselen > SERVOMIN; pulselen--) {
pwm.setPWM(servonum, 0, pulselen);
}
delay(500);

//servonum ++;
//if (servonum > 15) servonum = 0;
}

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

Re: PWm Servo shield is not working in Mega-2560

Post by adafruit_support_bill »

Please note that the code you have quoted that's for V1 motor shield.
That quote was taken from your post above: http://forums.adafruit.com/posting.php? ... 5#pr260462
Is it working now that you are using the correct library?

User avatar
apurba
 
Posts: 37
Joined: Sat Mar 15, 2014 6:25 am

Re: PWm Servo shield is not working in Mega-2560

Post by apurba »

No, It's not. I have used now 3 v. Still the same issue.

User avatar
apurba
 
Posts: 37
Joined: Sat Mar 15, 2014 6:25 am

Re: PWm Servo shield is not working in Mega-2560

Post by apurba »

I have tested with V2 Motor shield , servo is working on that case.

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

Return to “Arduino Shields from Adafruit”