Potentiometer to change speed of DC motor

Hello everyone,

I'm reading the 'Beginning Arduino' book, and now working with Project 15, driving a DC motor and changing the speed of it with a potentiometer.
Now the problem: in the book they say that I need to use a 10kOhms potentiometer, but I don't have that one, so I used an 25kOhm potentiometer.
Now I experience that the motor's speed only changes a little bit with a 25kOhm potmeter, is that normal, and is there a way to let it change the speed more?

I'm using a normal small DC motor that works on 3v.

Regards,
TiboJ

I don't have that book,so i can't help with the details.

Is the motor too fast or too slow? Do you have a transistor or MOSFET driving the motor?

The 25k pot should work fine. Any pot should work... Except, if the resistance is too low (maybe less than 100 ohms), you'll get excess current through the pot. If the resistance is too high, the input resistance/impedance of the Arduio will interfere with "voltage divider" created by the pot, and the center position won't be "half-speed" (half voltage). But, the minimum will still be zero, and the maximum will still be 5V (assuming it's connected to 5V :wink: ).

Also, audio-taper pots are non-linear and the center won't be half-voltage, but again the minimum & maximum will be unaffected.

Is the motor too fast or too slow? Do you have a transistor or MOSFET driving the motor?

It's turning fast, but I don't now it is the fastest it can reach. But I just can't make the motor stop turning with the potmeter.
If the potmeter is fully turned clockwise, and I connect the power source, then the motor starts turning at high speed. If I turn the potmeter fully anti clockwise, then the speed of the motor changes a very little bit.

I use a transistor.

Okay - What is the pot wired to and how is it wired?

A typical pot has 3 terminals. one for each end of the resistive element and 1 for the wiper.

Make sure one end of the resistive element is connected to 5V and the other to ground. Now as you turn the pat the voltage out the wiper pin should change. This voltage from the wiper would be connected to you analog input. If you have all 3 terminals connected, you probably have it connected wrong.

Do you have a voltmeter? even a cheap $5 one?

kf2qd:
Okay - What is the pot wired to and how is it wired?

A typical pot has 3 terminals. one for each end of the resistive element and 1 for the wiper.

Make sure one end of the resistive element is connected to 5V and the other to ground. Now as you turn the pat the voltage out the wiper pin should change. This voltage from the wiper would be connected to you analog input. If you have all 3 terminals connected, you probably have it connected wrong.

Do you have a voltmeter? even a cheap $5 one?

The left pin is going to 5v, the center pin to analog pin 0, the right pin to GND.

And I have a multimeter :wink:

Here are some pictures of the wiring:

Would you post your code and a circuit diagram so we can look at them too.

Here you are:

// Project 15 - Simple Motor Control

int potPin = 0;           // Analog in 0 connected to the potentiometer
int transistorPin = 9;     // PWM Pin 9 connected to the base of the transistor
int potValue = 0;         // value returned from the potentiometer

void setup() {
  // set  the transistor pin as output:
  pinMode(transistorPin, OUTPUT);
}

void loop() {
  // read the potentiometer, convert it to 0 - 255:
  potValue = analogRead(potPin) / 4;
  // use that to control the transistor:
  analogWrite(transistorPin, potValue);
}

Try this and see what the serial monitor prints:

const int potPin = 0;           // Analog in 0 connected to the potentiometer
const int transistorPin = 9;     // PWM Pin 9 connected to the base of the transistor

void setup() 
{
  Serial.begin (9600);
}

void loop() 
{
  int potValue = analogRead(potPin) / 4;
  Serial.println (potValue);
  analogWrite(transistorPin, potValue);
  delay (200);
}

AWOL:
Try this and see what the serial monitor prints:

const int potPin = 0;           // Analog in 0 connected to the potentiometer

const int transistorPin = 9;     // PWM Pin 9 connected to the base of the transistor

void setup()
{
 Serial.begin (9600);
}

void loop()
{
 int potValue = analogRead(potPin) / 4;
 Serial.println (potValue);
 analogWrite(transistorPin, potValue);
 delay (200);
}

I turned the potmeter a few times from right to left.

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
25
91
96
96
96
101
114
139
167
186
194
194
194
243
255
255
255
255
255
255
255
255
255
255
247
213
206
205
205
205
160
122
114
114
114
96
56
25
18
18
19
0
0
0
0
0
0
0
0
15
89
100
100
137
221
247
247
250
255
255
255
255
255
255
255
255
255
255
255
252
248
242
236
230
220
214
201
187
170
154
147
143
142
143
143
107
55
5
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

That's not good.
Looks like a direct short to ground - what happens if you completely disconnect your pot?

AWOL:
That's not good.
Looks like a direct short to ground - what happens if you completely disconnect your pot?

The motor turns and this is what I get on the Serial Monitor:

100
93
91
89
89
88
102
94
91
90
89
88
88
88
87
87
87
87
87
87
87
87
86
86
86
86
85
85
85
85
85
85
85
85
85
85
85
85
85
85
84
84
85
85
85
84
85
84
84
84
84
84
84
84
84
84
84
84
84
83
84
84
83
83
83
83
83
83
83
83
83
83
83
83
83
83
81
81
81
81
81
81
82
79
79
80
82
82
83
83
84
84
84
84
84
84
84
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
84
84

AWOL:
That's not good.
Looks like a direct short to ground - what happens if you completely disconnect your pot?

Why aren't those results good? They look fine to me.

Oops, sorry, posting on a mobile with no proper scroll - I only saw zeroes.
Apologies.

No problem :slight_smile:

What should the problem be? Everything is connected right, the code is right, I tried different potmeters,...

I don't think your wiring is right. But it's hard to see on your pictures. Why do you have so many red wires coming out of your power supply?

The left red wire is going to ground, the center to the motor, and the right one also to the ground.

edit: I just checked the wiring again, and everything is right connected like the wiring diagram in the book.

Well, AWOL's code confirmed that your pot is working correctly. So your using a 25k pot instead of a 10k pot is not a problem.

Your code looks fine. But it appears that your motor is getting full power, or nearly full power, most of the time. Somehow I think your transistor or motor wiring is wrong. I cannot see anything wrong from your picture. I'll keep looking.

Already thank you for help all!

I'm sure it's wired the right way, and I have checked it like 20 times now.
I will try another motor.

I doubt that it is your motor.

Can you use your multimeter to check your power supply wiring? Make sure that what you think is positive is indeed positive. And what you think is ground is ground.

I tested another motor and no luck with that.

The wiring of the power source is also good, I tested the connections with my multimeter.

edit: I will try another power source now.