• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

running two DC motors at the same speed

PG1995

Active Member
Hi,

A DC gear motor with gear ratio of 35:1 means that for every 35 turns of motor, the output shaft makes only one turn. Do I have it right?

How to make sure that two DC motors run at the same speed without using any speed encoders. If one motor is running too fast than others, I think using a variable resistor in series with the fast running motor might solve the problem. I know it's a very crude solution but I was thinking of a simple solution. You can think of two motors beings used in such a kit: https://www.amazon.com/Smart-Chassis-Motors-Encoder-Battery/dp/B01LXY7CM3 . If the motors run at the same speed, the thing would go straight.

Thank you!
 

Diver300

Well-Known Member
Most Helpful Member
You are right above the gear ratio.

To get two DC motors to run at the same speed you need some sort of control to vary the voltage to one or both as the speed changes. The speed will be affected by load.

Adding a resistor in series will slow a motor but it isn’t practical as big variable resistors are expensive and can’t easily be automatically controlled. A resistor in series will make the motor speed more sensitive to load.

It may be possible to measure the motor speed without an encoder by measuring the current variation as the motor rotates. I think your motors are 3 pole so the current will go up and down three times per motor revolution.

The robot you are looking at may go straight enough if you just supply both motors at the same voltage.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
It'll never run straight (for more than a very short distance) without using the encoders, which is why they are there.

Minute differences in motor speed, loading, and the surfaces the individual wheels are running on will ensure small variations and drifting off course.

Exactly the same in a human - put a blindfold on and try and walk in a straight line - it doesn't happen. Humans need the feedback encoder as well, in our case the eyeballs!.
 

MaxHeadRoom78

Well-Known Member
One typical way to do it without any kind of feedback is to use stepper motors, although if you happen to lose a step or so, the sync will be lost.
But if using high gearing such as 35:1, a loss of steps should not happen.
The DIY CNC crowd have been doing it this way for a long time, also a few Industrial machines have done it also.
Max.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
One typical way to do it without any kind of feedback is to use stepper motors, although if you happen to lose a step or so, the sync will be lost.
But if using high gearing such as 35:1, a loss of steps should not happen.
The DIY CNC crowd have been doing it this way for a long time, also a few Industrial machines have done it also.
Max.
Different matter to a wheeled vehicle though - as slippage on the ground will still produce drift from a straight line, although to be fair so does using the encoders on the DC motors.

To get a straight line you need some kind of 'navigation', although such a vehicle isn't likely to need to go 'straight' anyway, merely to follow some kind of 'course'.

A classic example of course would be a line follower.
 

gophert

Well-Known Member
Most Helpful Member
Just a small amount of difference in flash trimming on molded tire seam will cause a difference in diameter. From experience with high-school robot builders (or wanna-be robot builders) confirms that stepper motors do not maintain a straight line and noticeable error occurs at six feet (at best). Once trying to pivot or make an arcing turn, all bets are off.

I would even forget about encoders. A two-axis (or three axis) accelerometer with gyroscope and compass is possible at high-school and club-level college teams. Arduino with I2C is well documented on YouTube at this level.

also, PWM is a much better solution to motor speed control than variable resistors that control voltage.
 

PG1995

Active Member
Thank you!

As suggested by Diver300 and Nigel Goodwin using some control through voltage is better so I think it'd be better to use encoders.

I was looking at these motors with hall effect speed encoders: https://www.sparkfun.com/products/16413

I would even forget about encoders. A two-axis (or three axis) accelerometer with gyroscope and compass is possible at high-school and club-level college teams. Arduino with I2C is well documented on YouTube at this level.
Not sure if someone at high school level would employ gyroscope and accelerometer. I know that ICM-20948 and MPU-6050 could be used for this purpose.
 

gophert

Well-Known Member
Most Helpful Member
Not sure if someone at high school level would employ gyroscope and accelerometer. I know that ICM-20948 and MPU-6050 could be used for this purpose.
You'd be surprised. The Arduino libraries and YouTube videos, the high school kids follow directions and tweak the code for their project. To maintain a straight line, just read the x and y values and adjust motors to keep the values the same. Update a couple hundred times per second and you'll be fine. It works better if you log the error and intentionally overshoot to cancel a bit of the accumulated error with some intentional (damped) oscillation.
 

PG1995

Active Member
Hi,

I was looking at the datasheet of this motor: https://www.sparkfun.com/products/16413

Datasheet: https://cdn.sparkfun.com/assets/8/3/b/e/4/DS-16413-DG01D-E_Motor_with_Encoder.pdf

I think that the motors use quadrature encoders where each encoder outputs two signals. Please correct me if I'm wrong. This link might be helpful here: https://www.dynapar.com/technology/encoder_basics/quadrature_encoder/ .

But I'm confused about the number of poles being used by the disc of this magnetic hall effect sensor. Is this encoder using 4-pole magnetic disc? (2- pole would mean one north pole and one south pole).

Thanks.
 

rjenkinsgb

Well-Known Member
Most Helpful Member
I think it may have rather more poles than that?

The specs say 90 RPM out, via a 48:1 reduction. That's 72 revolutions per second for the motor itself, at nominal speed.

The scope displays show a square wave frequency from the encoder of around 890Hz, which indicates around 12 pole pairs.
If that is the actual motor rather than a generic quadrature display.

I cannot see any specification for the encoder pole or line count in that data.
 

PG1995

Active Member
Hi,

I was watching the following video.

www.youtube.com/watch?v=oLBYHbLO8W0

Question 1:
Around 2:12 the following is said.

02:12
hey depending on the voltage applied to
02:14
them that means as your battery slowly
02:16
drain the motors will begin to spin more
02:18
slowly over time so unless you can use a
02:21
DP voltage supply or guarantee that your
02:24
batteries will always be at the same
02:25
voltage then spinning the motors for one
02:28
second will result in a different
02:29
distance every time second
What is DP supply voltage?

Question 2:
Then around 4:45 the following is said.

04:45
we
04:49
need to pull up on the Hall effect
04:50
sensor because it's an open drain output
04:52
that means the sensor will only pull the
04:55
line low but it won't pull it high
04:57
it'll just leave it's floating so we
04:59
need to pull it up to a voltage
Do you think what I'm saying below is correct?

This is how I understand it. The section in green is hall effect encoder. The section in green is microcontroller with its internal resistor. The dot in red shows the connection between hall effect encoder and microcontroller pin.

M1 would get turned on/off depending upon if the hall sensor comes across north pole or south pole repectively.

The instruction "INPUT_PULLUP" notifies the microcontroller that an internal pull up resistor needs to be connected to its pin.


1602042747294.png


C++:
const int enc_pin = 2;

unsigned long ticks = 0;

void setup() {
Serial.begin(5600);
pinMode(enc_pin, INPUT_PULLUP);
attachlnterrupt (digitalPinToInterrupt (enc_pin), countTicks, CHANGE);
}

void loop() {
Serial.println(ticks);
delay(100);
}

void countTicks() {
ticks++;
}

Helpful links:
1: https://forum.digikey.com/t/what-does-open-drain-mean/716
2: https://electronics.stackexchange.c...nd-open-drain-the-same-concept-in-electronics

1602037431494.png
 
Last edited:

rjenkinsgb

Well-Known Member
Most Helpful Member
For the first one, I cannot make out exactly what he is saying.
Whatever it is, I think he means a [voltage] regulated supply.

You have the concept of pullups correct, but I'd not rely on the internal ones in the MCU for long wires or fast / possibly noisy signals.
The cable and the resistor form an R-C delay circuit; a high value resistor such as in the MCU will mean a slow rise and a signal that can easily be affected by noise.

I'd use eg. a 1K resistor at the MCU end of the cable, for each open collector or open drain signal, to give a fast response and fairly low impedance.
 

JimB

Super Moderator
Most Helpful Member
What is DP supply voltage?
After listening to it several times, I think that he is saying "beefy voltage supply",
ie a supply which is very strong and the voltage does not drop when loaded.

JimB
 

gophert

Well-Known Member
Most Helpful Member
I agree with Jim. He says, "unless you use a BEEFY VOLTAGE SUPPLY..."
 

PG1995

Active Member

alec_t

Well-Known Member
Most Helpful Member

gophert

Well-Known Member
Most Helpful Member
Hi,

What is that gluey material called? I have circled it in the attached picture. Thank you for the help.
yes, it is hot melt glue. The hot melt glue made a "strain relief" for the wires.

Be careful when you encapsulate with adhesives or structural polymers that cure from liquids to solids. They usually shrink during cure by about 0.5% (range 0.3% to just over 1%) and that small shrinkage is essentially unstoppable so the shear force is very strong. It can warp In unpopulated PCB or just wipe some of the components off of a populated board.

I suggest taking the corners. Using 3M high-bond adhesive double-side tapes. Unfortunately, full rolls are expensive but one version with foam inter layer is available as short rolls (e.g. from the auto store to apply trim). Even though it is tape, it takes about 24h to achieve full strength after assembly. For bigger rolls, search for "VHB" and "3M". If you want a tape with a foam core, make sure too look for that (usually with red or green backer film). The brown backer film tapes are usually just a film carrier or no carrier (a.k.a. "Adhesive transfer tapes").

https://www.walmart.com/ip/3M-Super...MI1tjz-Iaq7AIVjZOzCh2-9wFAEAQYAyABEgKFEPD_BwE
 

schmitt trigger

Well-Known Member
What Gopher said;
Very true; I have personally seen the effect.
Most vulnerable components are small 2 terminal SMT devices. I.e. resistors and capacitors.

Usually what happens is that one of the solder joints shears with a microscopic crack, and creates an intermittent failure.
There are ways to relieve stress while curing, but usually involve long temperature profiles
 

Latest threads

EE World Online Articles

Loading
Top