Continue to Site

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.

  • 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.

DC motor position control (not speed/direction)

Status
Not open for further replies.

rngd

New Member
Hi,

I have a question, is it possible to control the position of a DC motor? Meaning, I want it to rotate a few degrees only each time I supply power (when using gears to reduce speed and increase torque) ? Kind of like the operation of an open loop stepper motor. If open loop is not possible, what about closed loop operation ? I am using the PIC16F877A.


I have seen a lot about speed/direction control using h-bridge, etc but I cant seem to find any info on this.

Thanks for the info.
 
Of course. THe primary difference is that you use an absolute position encoder (or an incremental encoder with a reference point) as feedback to the driver.

The control scheme wher eit rotates only a few degrees each time you supply power more has to do with the code used to control the driver than the driver itself.
 
Of course. THe primary difference is that you use an absolute position encoder (or an incremental encoder with a reference point) as feedback to the driver.

The control scheme wher eit rotates only a few degrees each time you supply power more has to do with the code used to control the driver than the driver itself.

Can u pls elaborate on this ? What kind of driver do you mean ? It goes in between the PIC and motor I assume ? I'm hoping that I won't have to use those expensive dc motor driver ICs.

You're looking at either a stepper, or a servo controlled DC motor system - but you don't give enough information to suggest which would be best?.

Actually, I mean just a DC motor, not servo or stepper because I want to reduce the cost of my project.

Thanks.
 
rngd said:
Hi,
I have a question, is it possible to control the position of a DC motor? Meaning, I want it to rotate a few degrees only each time I supply power (when using gears to reduce speed and increase torque) ?

Your question is not clear.

If you want the final drive *after* reduction gear to rotate a few degree, then it is possible if the gear ratio is high.

If you want the DC motor rotor shaft to rotate a few degrees, then no. Most DC motors uses two brushes separated at an angle of 180 degrees and cannot be made to rotate just a few degree.
 
eblc1388 said:
Your question is not clear.

If you want the final drive *after* reduction gear to rotate a few degree, then it is possible if the gear ratio is high.

If you want the DC motor rotor shaft to rotate a few degrees, then no. Most DC motors uses two brushes separated at an angle of 180 degrees and cannot be made to rotate just a few degree.


Yes, I want the final drive to rotate a few degrees. My question is, let's say I have connected the reduction gears, can I set the motor to accurately rotate a few degrees (for example 10 degrees) each time I want it to operate ? For example, each time I send a current pulse of predetermined length, it will rotate 10 degrees.

I am building a 2 axis solar tracker with two motors, with a PIC.
 
As suggested, either a stepper or a servo system, there's no other way.

It doesn't have to be a commercial 'all in one' servo, you could build your own external servo - you need to arrange for mechanical position feedback indicating the solar panel position - you could use a potentiometer for this (as small RC servos do). I would also suggest you add limit switches at either end of travel.

So basically, feedback potentiometer on the panel, read this position with a PIC, compare it to where it needs to be, then move the panel using an H-bridge until it's in the right place.

BTW, there's no need for two axis tracking, check how satellite dishes track using a single axis and copy that!.

A quick extra thought though, now you've actually told us what it's for, you could use two LDR's as sensors either side of the panel (in angled tubes), and simply adjust the panel for equal light falling on them - plus limit switches as before.
 
Last edited:
The only alternative would be a solenoid operating a ratchet mechanism.
 
Nigel Goodwin said:
BTW, there's no need for two axis tracking, check how satellite dishes track using a single axis and copy that!.

Hi Nigel,

very much to my surprise the sun doesn't behave like a geostationary satellite. It moves in two directions, one azimuth and the other elevation. Living far in the north, the elevation changes very little. I'm living at 10deg north latitude and during "summer" the sun appearantly moves over the top and reaches its zenith from 13.5deg north at noon. Even in GB you can observe the sun "moving" upwards at the sky.

Kind regards

Hans


BTW, my suntracker takes care of that too.
 
Rather than use 2 LDR's just use 2 green led's and hook them up to 2 AD pins. I'm currently trialling out this method for my PV tracker and the first tests are proving quite good. As far as the drive for my tracker I'll be using a 56:1 worm drive gearbox with a standard DC motor rated for 24 volts, when the unit needs to move simply providing a pwm to the motor will move it to the required position. Redrock.com have some circuit based around the led's so that can give you a starting point but their circuits do seem to hunt a fair bit so by using a pic to controll things hunting shouldn't be a problem.

Cheers Bryan
 
bryan1 said:
Rather than use 2 LDR's just use 2 green led's and hook them up to 2 AD pins. Cheers Bryan

Hi Bryan,

I'm using four (two for each axis, antiparallel) 10mm red LEDs with clear domes. Their voltage output at bright sunlight is about 300mV, easily to be amplified to the desired level. Using a PIC or an ATMEL seems to me like wasted engineering.

Regards

Hans
 
Nigel Goodwin said:
As suggested, either a stepper or a servo system, there's no other way.

It doesn't have to be a commercial 'all in one' servo, you could build your own external servo - you need to arrange for mechanical position feedback indicating the solar panel position - you could use a potentiometer for this (as small RC servos do). I would also suggest you add limit switches at either end of travel.

So basically, feedback potentiometer on the panel, read this position with a PIC, compare it to where it needs to be, then move the panel using an H-bridge until it's in the right place.

BTW, there's no need for two axis tracking, check how satellite dishes track using a single axis and copy that!.

A quick extra thought though, now you've actually told us what it's for, you could use two LDR's as sensors either side of the panel (in angled tubes), and simply adjust the panel for equal light falling on them - plus limit switches as before.

Nigel,

Actually I'm currently thinking of using the same concept above, except I'm using 4 LDRs, 2 for each axis.

Do you mean that when equal light falls on the LDRs, the LDRs signal my PIC and the PIC cuts off the motors ?

If I still need the pots, can I have more info/links about it ? Where do I connect it ? I've tried Google but can't seem to find any info.


bryan1 said:
Rather than use 2 LDR's just use 2 green led's and hook them up to 2 AD pins. I'm currently trialling out this method for my PV tracker and the first tests are proving quite good. As far as the drive for my tracker I'll be using a 56:1 worm drive gearbox with a standard DC motor rated for 24 volts, when the unit needs to move simply providing a pwm to the motor will move it to the required position. Redrock.com have some circuit based around the led's so that can give you a starting point but their circuits do seem to hunt a fair bit so by using a pic to controll things hunting shouldn't be a problem.


Hi Bryan,

That was what I have been meaning to ask, whether it is possible to use a PWM to the DC motor to rotate it a few degrees. Can you give me more information about how you drive your motor ? How much does the motor rotate after each pulse ? Nigel posted above that the only way was to diy my own external servo, so I'm a bit unsure.

About using the LEDs as sensors, I have seen them being used at that website but I'm not familiar with the concept yet (I did not know LEDs could be used for other functions other than to emit light!) so I haven't decided which type of sensor to use. Either LDRs, LEDs or even small PV cells.


Thanks for the replies guys.
 
Last edited:
rngd said:
That was what I have been meaning to ask, whether it is possible to use a PWM to the DC motor to rotate it a few degrees. Can you give me more information about how you drive your motor ? How much does the motor rotate after each pulse ? Nigel posted above that the only way was to diy my own external servo, so I'm a bit unsure.

About using the LEDs as sensors, I have seen them being used at that website but I'm not familiar with the concept yet (I did not know LEDs could be used for other functions other than to emit light!) so I haven't decided which type of sensor to use. Either LDRs, LEDs or even small PV cells.

Simply do some maths mate 56:1 worm drive gearbox, say 4:1 V-belt reduction drive to the pv frame. As you should know a DC motor's speed is controlled by voltage so depending on the condition required the voltage can be selected.
ie: 1. finding the right equal position for both led's to output the same voltage say 6-12 volts
2. Go to sunrise position at dusk pump 24 volts in for quicker travel.

By using an industrial wormdrive gearbox and further reduction with the V-belts will ensure enough rigidity to withstand huge gales.

Now for the led's do a simple test wire 2 led's up in parrallel with the output going to a gate on a fet which is connected to another led to show the circuit works. Now powerup a third led to shine directly into the 2 led array and watch the fet turn on. Simple isolated supply and a good test proving that led's DO output a voltage when exposed to light.

Hope that helps

cheers Bryan :D
 
bryan1 said:
led's DO output a voltage when exposed to light.

Especialy green LEDs. I have seen a few designs which have optical isolation AND power via a string of LED. I modified a mains timer with watch battery backup to use a small NiMh cell charged by a white LED pointing at a few SMD green LEDs. This was because the area did not have reliable mains and the watch battery did not last long. Worked great.
 
bryan1 said:
Simply do some maths mate 56:1 worm drive gearbox, say 4:1 V-belt reduction drive to the pv frame. As you should know a DC motor's speed is controlled by voltage so depending on the condition required the voltage can be selected.
ie: 1. finding the right equal position for both led's to output the same voltage say 6-12 volts
2. Go to sunrise position at dusk pump 24 volts in for quicker travel.

By using an industrial wormdrive gearbox and further reduction with the V-belts will ensure enough rigidity to withstand huge gales.

Now for the led's do a simple test wire 2 led's up in parrallel with the output going to a gate on a fet which is connected to another led to show the circuit works. Now powerup a third led to shine directly into the 2 led array and watch the fet turn on. Simple isolated supply and a good test proving that led's DO output a voltage when exposed to light.

Hope that helps

cheers Bryan :D


Actually, I'm just building a very small tracker with a 5W panel, 12 V battery and a small DC motor, so I can't change up the voltage for quicker travel. Doesn't matter though, I'll just run it at the same speed. The motor will be <12V and running on low current.


Anyway, I just wanna get your confirmation and see whether I understand things correctly : Each time I send a pulse of current of a certain length from my PIC to my DC motor (which is connected to a gearbox), the motor will make my panel rotate, take for example, 5 degrees.
Increase in the gearbox ratio decreases the degrees of panel rotation (when the pulse length is kept constant).
Increase in the pulse length increases the degrees of rotation (when gear ratio is constant).
The amount of rotation (degrees) is calculated using the values of the gearbox ratio and also the pulse length. And when these values are set the panel will rotate the same amount each time a pulse is sent.


Is this correct ? Sorry to make something simple sound so complicated !


Thanks.
 
rngd said:
Anyway, I just wanna get your confirmation and see whether I understand things correctly : Each time I send a pulse of current of a certain length from my PIC to my DC motor (which is connected to a gearbox), the motor will make my panel rotate, take for example, 5 degrees.
Increase in the gearbox ratio decreases the degrees of panel rotation (when the pulse length is kept constant).
Increase in the pulse length increases the degrees of rotation (when gear ratio is constant).
The amount of rotation (degrees) is calculated using the values of the gearbox ratio and also the pulse length. And when these values are set the panel will rotate the same amount each time a pulse is sent.


Is this correct ? Sorry to make something simple sound so complicated !

Only very roughly correct, by using simple timed pulses the motor will move varying distances, depending up on load etc.

Like I suggested, a pair of light sensors (or four for two axis) would allow you to track the sun - it doesn't even need a processor, there have been many such circuits for doing this using just opamps as comparators.
 
Nigel Goodwin said:
Only very roughly correct, by using simple timed pulses the motor will move varying distances, depending up on load etc.

Like I suggested, a pair of light sensors (or four for two axis) would allow you to track the sun - it doesn't even need a processor, there have been many such circuits for doing this using just opamps as comparators.


So I just let the motor run until equal light falls on the sensors, then open the limit switches to stop the motor.
OK, thanks.
 
rngd said:
So I just let the motor run until equal light falls on the sensors, then open the limit switches to stop the motor.
OK, thanks.

No, the limit switches are only to stop the mechanism going further than it should, your control system shuts the power off during normal tracking.
 
Nigel Goodwin said:
No, the limit switches are only to stop the mechanism going further than it should, your control system shuts the power off during normal tracking.


Oh, OK, for turning off the motor during normal tracking I just use transistors.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top