CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

HOW TO SYNCHRONISE 2 DC MOTORS

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
pklein



Joined: 14 Nov 2007
Posts: 7

View user's profile Send private message

HOW TO SYNCHRONISE 2 DC MOTORS
PostPosted: Tue Dec 04, 2007 8:06 am     Reply with quote

Hi,

I have a project that requires for me to synchronise the positions of two DC motor shafts. Does anyone have any advice on the best way to achieve this. I am considering having an optical encoder on each shaft. A disk that passes through the encoder has only one hole. When the hole passes through the encoder I will set a timer in the interrupt and when the other hole passes through I will get the value of the timer. I will then play with the motors pwm until the time error is within a certain limit.

Is there an easier way to synchronise two shafts?
Am I on the right track?

I appreciate any feedback (excuse the pun :-) )
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Tue Dec 04, 2007 10:24 am     Reply with quote

To get a better help, it would be nice to know:
1) The size (power) of the involved motors.
2) The inertia of the mechanical load.
3) The expected working speed.
4) The synchronizing should be dynamic or static.
5) How do you control the brake procedure and stop position.
6) How do you control the steady position.

Did you thought in using a stepper motor?


Humberto


Last edited by Humberto on Tue Dec 04, 2007 10:27 am; edited 1 time in total
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Tue Dec 04, 2007 10:27 am     Reply with quote

Is there any chance you can use brushless motors? They would be much easier than brush motors.
Tell us more about the application.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Guest








PostPosted: Wed Dec 05, 2007 3:15 am     Reply with quote

Hay guys. Thanks for the responses.

At present I cannot use a stepper motor. I am using the tamiya TMG. I probably have to put the encoders on the output shaft, which will run at around 50RPM at max speed. I cannot really fit the encoders in the gearbox.

The motors drive the legs for a Jansen Walking robot. Basically the idea is to try create a walking machine that will only require two motors instead of one on each leg. It is planned to be able to turn the robot, one motor will be driven faster than the other, then to walk straight again the motors should be synchronised in order to get the robot to walk straight properly.

This is my plan of action so far to get the positions synchronised for forward motion.

Assume shaft one is ahead of shaft two.

1. Determine the speed of 1.
2. Get time difference between 1 and 2. (delta t)
3. Intgrate 1's velocity over delta t to get angular distance between 1 and 2.
4. Get controller to estimate how the pwm of 1 and 2 should be varied so that angular distance would be decreased by next revolution.
Ttelmah
Guest







PostPosted: Wed Dec 05, 2007 4:29 am     Reply with quote

I'd suspect your biggest problem will be the relatively long time between the pulses. I have done similar things in the past, but always had two sensors. A quadrature encoder on the motor itself, and an 'index' pulse from the output. You reset the count on the index pulse, and implement a standard PIR servo algorithm, from the quadrature data. The motors are just told where to move to, and the speed required, and each is adjusting itself continuoulsy all the time through the motion. They are not trying to synchronise to each other, but both try to follow the same motion curve, as accurately as possible. Since the curve defines exactly where the motor shaft should be at any time, the motors remain in sysnc.
The problem is that with the long delay that will be present, and the varying loads (leg motions impose significant variations through the cycle), if one motor sees an increased load, and lags, power is then increased, the other motor hits the same load increase a moment latter, and slows, by the time the next pulse is detected, the error between the two will have got larger, rather than smaller...
I would suggest that you need detection at the motor shaft, rather than any latter in the system, or you will be fighting a losing battle. There are small DC motors available with encoders built in.

Best Wishes
Guest








PostPosted: Wed Dec 05, 2007 8:37 am     Reply with quote

Thanks Ttelmah.

You make an excellent point. I have looked carefully at the motor and gearbox, and with some filling a think a can fit an encoder on a gear that spins around 44 times faster than the output shaft. I cannot get an encoder anywhere near the motor shaft and I dont have any dc motors with encoders on available. Will this shaft be feasable?

If i put encoders on this gear - will my timer plan not be valid anymore. - will i simply be interested in the number of counts that the disk has given.

If possible can you give me a hint on how best to proceed with counts rather than using timing.

I really appreciate everyones input
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Wed Dec 05, 2007 9:01 am     Reply with quote

You might look into using "back EMF" to measure the motor speed. It is a technique used with permanent magnet brush motors running under PWM control, especially on model trains. While the motor is in the OFF part of the PWM cycle you measure the voltage the motor produces as the rotor spins as a generator. The voltage produced is proportional to speed. It is not really accurate but doesn't require any change to the motor and you can get a velocity reading every PWM cycle.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Ttelmah
Guest







PostPosted: Wed Dec 05, 2007 9:42 am     Reply with quote

I'd really suggest heavily, that you start with one motor, and try implementing a PWM servo algorithm, based on the standard PID approach (you may need to tweak this latter...). Prove to yourself, that you can control the motor to move 'to' a specific count on the motor shaft, adjusting it's speed, so it accelerates and decelerates, arriving where required. Once you have this working, what you then do is use this to control one motor, and have the other using the same algorithm, but adjusting it's targets based on where the other motor is.
The back-emf suggestion, is a good one. This approach allows much faster speed measurements, without added mechanical hardware.
Seriously, you may well find it is better to use a single small PIC to control each motor. Handling a movement algorithm well, needs fast adjustments. If you look at the Microchip application notes, there are a couple of servo designs there, and these can be modified to provide the basic algorithms needed.

Best Wishes
pklein



Joined: 14 Nov 2007
Posts: 7

View user's profile Send private message

PostPosted: Thu Dec 06, 2007 2:51 am     Reply with quote

Thanks I will start reading up on PID. Another short question? When I run PWM output to the tamiya motors I get some sort of a surging problem. The motors are speeding up and slowing down slightly all the time. I checked on the scope and I am getting a variation in PWM from my output. The signal gets slightly longer and shorter.

I do not get this problem using any other dc motors. I am using a PICDEM Mechatronics board to drive the motors. The motors are very small dc motors that run up to around 10 000RPm. I dont think back emf is the problem because it does it even at very low speed.

Is there an easy fix to this problem? I dont think my pic is resetting. Not sure where the problem has come from.

Can anyone help
Ttelmah
Guest







PostPosted: Thu Dec 06, 2007 7:42 am     Reply with quote

What controls your PWM?.
Properly wired, there is no way for a load to affect the PWM. If it is changing, it implies:
1) The motor load is changing one of the source signals controlling the PWM.
2) The motor load is affecting the supply to the processor.
3) The motor load is changing the clock to the processor.
Look particularly at how currents flow between the supply, and the motor/drivers. Imagine these as a water source and drain. Visualise wate flowing between these points. Is there anything connected to the PIC, which comes from different points 'along' the flow. If so, you have a potential problem.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group