Pages: [1]   Go Down
Author Topic: Arduino Starter Kit Servo Problem  (Read 3256 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have encountered a problem with running the potentiometer-controlled servo.
 
The circuit connections were checked physically (visual inspection x 3) and electrically – with continuity tester for connections to power-supply terminals and the Arduino pins
 
The output from the potentiometer wiper was checked with a 4 ½ digit autoranging multimeter to check that it was 1) connected properly to +5V supply, 2) outputting a variable voltage.
The pot wiper is outputting a variable voltage from 0V dc to 4,77V dc depending on wiper position, which seems correct.
 
No other connections are relevant and all connectivity has been checked.
 
Uploading the program compiles without notified errors and uploads (apparently) correctly –
 
Observations: 1) upon upload, the servo shocks three times and positions itself at roughly 85 degrees; when settled there, it remains constant and no potentiometer input makes any difference to it although the voltage can be seen to vary from the pot wiper.
 
The previous simple experiment (servo sweep) operates correctly therefore the servo is operational.
 
Recompiling and re-uploading the program does not solve the problem.
 
It would appear to me therefore, that with all components intact and interconnectivity intact and properly connected, there is something amiss with the program itself.
 
Please advise??
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 241
Posts: 24480
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Post code.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Faraday Member
**
Karma: 60
Posts: 3242
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Post code.

.... and pic  smiley-roll
Logged

Retired from Arduino.
PMs are set to ignore all.

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

With all due respect to replying readers - it appears to me that you have ^not^ read my initial analysis correctly - please ensure that you have done so?

The code used is identical in two instances: 1) the one supplied in the Arduino Starter Kit; 2) the one supplied in the Arduino Kit page online as "KNOB" - in both cases the circuit is also identical.

Please re-read my observations - these effectively answer all questions you have posed so far.

Any help here would be appreciated,
Kind Regards,
FV
Logged

Offline Offline
Faraday Member
**
Karma: 60
Posts: 3242
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Neither of us posed a question, nor can we see the code or the circuit from where we are.
Logged

Retired from Arduino.
PMs are set to ignore all.

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 241
Posts: 24480
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No, we read your initial analysis, which is why we're asking to see exactly what you can see.

It may surprise you, but some of us have never seen a starter kit, its contents or any of the sketches.

It isn't unusual for noobs to miss out something important, or change a line of code inadvertently.

Try this:
Code:
const byte potPin = A0;  //your analogue input pin here
void setup ()
{
  Serial.begin (9600);
}
void loop ()
{
  Serial.println (analogRead (potPin));
}
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is the code - supplied identically in two official instances:

// Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>

#include <Servo.h>
 
 Servo myservo;  // create servo object to control a servo
 
 int potpin = 0;  // analog pin used to connect the potentiometer
 int val;    // variable to read the value from the analog pin
 
 void setup()
{
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}
 
 void loop()
{
  val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023)
  val = map(val, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180)
  myservo.write(val);                  // sets the servo position according to the scaled value
  delay(15);                           // waits for the servo to get there
}

I do not see how to supply copy of circuit as JPG or PNG here but address for ref which shows it is:
http://www.arduino.cc/en/Tutorial/Knob

Thanks for all help,
FV
Logged

UK
Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

FV, your problem is your circuit. I just checked the sketch and it works fine!

For what it's worth, I found that remaking the circuit again a little later using comletely different positions on the board tended to solve things like this. In fact, the only problems I had completing the starter kit were physical, ie either me wiring things in the wrong way or because of badly fitting components.
Good luck!
Logged

Photography nut trying to make the flux capacitor of macro pho

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I had problems with this circuit aswell try googling the servo motor you have and take note of the pinouts the servo motor I have is wired in the plug different to the circuit. It looks like the pins have been put in the wrong holes on the plug reconfigured and all ok.

Adrian
Logged

Offline Offline
Faraday Member
**
Karma: 60
Posts: 3242
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I cut and paste the code you posted, hooked up an HXT900 servo ala the "knob" circuit and it worked as advertised. There is nothing wrong with the code which must have been used a zillion times by now. I use a modified version of that very sketch to run two servos with a 2-pot joystick: no problems.

I don't know what servo comes with the kit though: it might be that it needs more current than the Arduino is happy to supply. Maybe try hook it up with its own power supply, ala attached pic? Edit.... quite a lot of servo "funnies" like disobedience and the shakes can be corrected by a better power supply: so it's a common thing to sort out soon as you experience a problem. If nothing else, it eliminates one possible source of the problem, and who knows, often it fixes it.... (Although it's strange in your case that "sweep" works which would tend to exonerate the power supply and the servo and the connections.)

Jim

PS.... to attach pix to posts, click the Additional Options link just below the typing area.

Edit PPS.... maybe post a photo of your actual setup?


* one servo.jpg (889.78 KB, 2838x1473 - viewed 88 times.)
« Last Edit: May 18, 2013, 03:11:18 am by JimboZA » Logged

Retired from Arduino.
PMs are set to ignore all.

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What program do you use to make these diagrams?

Adrian
Logged

UK
Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It's fritzing.org
Logged

Photography nut trying to make the flux capacitor of macro pho

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks downloaded

Adrian
Logged

Pages: [1]   Go Up
Jump to: