Show Posts
Pages: [1]
1  Using Arduino / General Electronics / Re: Potentiometer on a Servo on: July 18, 2011, 06:59:39 am
It is stranded copper wire. CAT5 Ethernet cable. It is about 500mm long. It plugs into a socket soldered onto a arduino prototype board, which then leads to digital pin 9 and analog pin 0. The setup works fine, with the cable ties as in the picture, but it becomes erratic if they are removed.

The servo is a HITEC HS-300. Im not sure how much current it draws. It is out of an old model aeroplane I had. Im using a 9 volt 800mA power supply. Either with the 9V or the USB cable I get the same problem.
2  Using Arduino / General Electronics / Re: Potentiometer on a Servo on: July 18, 2011, 06:37:09 am
Here is the code:
Code:
#include <Servo.h>
 
Servo myservo; 
 
int potpin = 0;
int val;   
 
void setup()
{
  myservo.attach(9);
Serial.begin(9600);
}
 
void loop()
{
  val = analogRead(potpin);           
  val = map(val, 0, 1023, 0, 179);     
  myservo.write(val);                 
  delay(15);                           
  Serial.println(val);
} [code]
 Everything is soldered and heat shrinked.
[/code]
3  Using Arduino / General Electronics / Potentiometer on a Servo on: July 18, 2011, 05:54:29 am
Hi, everyone i'm new here. I have been working with Arduino for a few months now. I have some basic electronics knowlege.
I am trying to control a servo motor with a potentiometer, which I have managed to do, however sometimes the servo will go out of control, back and forth. I managed to isolate the problem down to the potemtiometer and the wires connecting to it. If I twist the wires to a certain position there is no erratic behaviour, also if I squeeze the pot or the 3 wires leading to it really hard it works fine. I have placed a cable tie tightly around the wires on the pot contacts, and it is working quite well. It is like there is some interferance coming from somewhere. All the connections are soldered well, and I have tried different pots with the same result, so it cant be a loose contact.

I dont understand what is going on???
Pages: [1]