hi, everyone.
my name Raja.
I need to know its possible to control the dc motor like servo motor using Arduino and pot
\
example
when I rotate the pot in clockwise means the motor will rotate clock wish
and then
when I rotate in anti-clock wish mean the motor start rotating in the anti-clock wish
when I stop the rotating the pot mean motor also stop..
it is possible to mean
can anyone write for code.
simple say mean..
the example of servo motor control using pot
What exactly does "DC motor like servo motor" mean? Is it a servo (standard or continuous) or is it a standard DC motor? Please post a link to the actual thing you are talking about.
Rajapalani:
I need to know its possible to control the dc motor like servo motor using Arduino and pot
example
when I rotate the pot in clockwise means the motor will rotate clock wish
and then
when I rotate in anti-clock wish mean the motor start rotating in the anti-clock wish
Yes, you can do what you want but, like a servo, you will need position feedback from the DC motor. You would read the pot, compare it to the feedback from the DC motor, and drive the motor forward or back until the feedback matches the pot position.
If you only need the motor to rotate about 180 degrees (like a servo) you can use a second pot on the output shaft (just like a servo) and connect it to the Arduino just like the control pot. Then you can read both with analogRead().
i have (dc motor liner actuator)the spec was 12volt and 19 amps
so i need control the actuator..
when the actuator ball screw type the dc motor connect to the ball screw
the motor run clock wise mean the shaft will come out
the motor run anti clock wise mean the shaft will go inside
when i rotate the pot as clockwise mean the dc motor also rotate clockwise.
when i rotate opposite dir mean motor also rotate anti clockwise.
when i stop rotate the pot mean motor also stop
i using arduino mega..
You will need to have a variable holding the currentPotValue and compare that to previousPotValue so you know which way it's being turned. Depending which one is bigger, run one function or another to set the motor polarity through an h-bridge to give the direction.
I'd just use an on-off-on switch for direction myself, with limit switches at the ends of the travel. Or, swap the actuator for one which actually acts like a servo, such as the Firgelli "-R" series.
It's still not 100% clear what you want to do. What does the actual position of the pot mean?- why are you using a pot not a switch?
Are you expecting the actual position of the pot to be the actual position of the arm, and the direction of turn to mean the direction of the arm going in or out?
Not clear to me why you need a pot in the first place....
Rajapalani:
can you code for me i have very basic lever programming language
Let's clarify this first: Do you agree that the youtube solution has TWO pots?- Seems there's one on the motor to make it into a servo, and the other one is to control it.
IF you accept that as fact (your call) AND you can create the same hardware, then perhaps someone will help you with the code. Right now it's not clear (not to me anyway) if you have the hardware that can mimic that guy's.
(And if you do have it, and it's essentially a servo, then you can probably use Knob as SteveMann suggested.)
edit: actually that's not true, there's more to it than that, to handle the polarity of the motor to the h-bridge.
Rajapalani:
No that guy use only one pot to controller the dc motor.
Well he talks of "a potentiometer" and "another potentiometer" which reads to me like there are two.
(Although that said it does seem there are only two wires from the motor. So he probably perhaps just compares the current pot value to the previous, to determine direction, and then set the polarity accordingly.)
There is a forum section named Gigs and Collaborations where you either team up with or pay others to make a project.
Where you are now is about teaching so that you can go on to make more and help teach.
If you can form a local group to cover talents needed, work on different projects to get coordinated and have things to show then look for paying work.
OTOH Nishant found his way up, I think through Uni in New Delhi. He has traveled far doing different jobs, he likes California a lot! He had interesting devices working before going pro, one a hand gesture interface, Nish went beginner to pro in maybe 4 years or less but he can code and solder surface mount hardware.
It turns on one or other led to indicate direction, both off for not moving.
Set the variable "slack" to suit your pot: my crappy one sends different values even when not moving.
// https://forum.arduino.cc/index.php?topic=631081
// meltDown 13 august 2019
// dc motor as a servo but with no feedback pot?, only a pot to control?
byte potPin = 0;
int potVal;
int potValPrev;
byte slack = 4; //some pots change value slightly even when not being moved
// these leds could be the polarity of the motor
byte leftLed = 2;
byte rightLed = 3;
void setup()
{
Serial.begin(9600);
Serial.println(".... dc motor as pot ....");
Serial.print("Compiler: ");
Serial.print(__VERSION__);
Serial.print(", Arduino IDE: ");
Serial.println(ARDUINO);
Serial.print("Created: ");
Serial.print(__TIME__);
Serial.print(", ");
Serial.println(__DATE__);
Serial.println(__FILE__);
//turn off L13
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
potVal = analogRead(potPin);
potValPrev = potVal;
pinMode(leftLed, OUTPUT);
pinMode(rightLed, OUTPUT);
Serial.println("turn the pot");
} //setup
void loop()
{
potVal = analogRead(potPin);
Serial.print(potValPrev);
Serial.print(" ");
Serial.print(potVal);
Serial.print(" ");
Serial.print(potValPrev - potVal);
if (potValPrev < (potVal - slack))
{
Serial.println(" going one way");
digitalWrite(leftLed, HIGH);
digitalWrite(rightLed, LOW);
}
else if (potValPrev > (potVal + slack))
{
Serial.println(" going other way");
digitalWrite(leftLed, LOW);
digitalWrite(rightLed, HIGH);
}
else
{
Serial.println(" not moving");
digitalWrite(leftLed, LOW);
digitalWrite(rightLed, LOW);
}
potValPrev = potVal;
} //loop
I also have to add here, speaking as an engineer, that (with the greatest respect) someone who doesn't know what they're doing when configuring and programming what I assume is some kind of industrial plant, is potentially very dangerous