Roman Black - April 2001How to get speed feedback from a small DC motor.
This shows how to get speed feedback suitable for input to a logic input (ie, PIC input pin) from a small DC motor with no optical encoder needed, and no mods to the motor. It can be used with no mechanical mods to the device. It gives X pulses per motor revolution, X depends on the motor type. ------------- Requirements: ------------- A small DC motor (brush/commutator type) 1x small NPN transistor 2x 22k ohm resistor 1x 5k ohm trimpot some small ceramic caps 1x IN4148 small signal diode (see notes for parts details) (multimeter and CRO handy for setup) -------- Details: -------- I have used this circuit to get speed information and even count revolutions from a number of small DC motors. It is not perfect, and won't give perfect position feedback like a proper optical encoder disk, but it is great for measuring motor speed with motors that DON'T have an encoder disk. It's cheap, easy to do, and works best on small cheap style DC motors like the ones found in toys or small hand drills etc. These are also the hardest motors to fit optical encoders to. ------- Theory: ------- The motor must be a brush/commutator type. Small motors usually have two brushes and 3 or 5 commutator segments. There are 6 or 10 places per rotation where a brush hits the "join" between commutator segments and a small electrical spike is generated. This circuit uses a small capacitor to couple that spike to a sense transistor and with every spike the transistor turns on for a short time. The output from the transistor can be coupled directly into a PIC input pin or other logic type input (into any IC). The spikes are short and fast, they contain very little energy but they do couple well through a small capacitor, even if the two grounds are not connected. The spikes are NOT evenly spaced around the revolution of the motor, but the number of spikes per revolution is constant and can be used to give pretty good motor speed sensing if a little software averaging is used. This is a good way to speed-control a tiny DC motor, like in a small robot or those little high speed hand-drills (supertools?) that people use to drill PCBs. You don't need to modify any of the mechanicals in the device, which is great. (Circuit diagram)------------- How it works! ------------- As the motor turns the brushes pass over the joins between the commutator segments. When a brush hits a join this is like a little switch contact opening or closing, and as the motor coils have inductance this switch effect makes little back-emfs or "spikes". These spikes are short and have very little energy. Generally a few microseconds. Fast little spikes like this are about the only thing that passes through a very small capacitor, like 330pF. Slower waves and DC won't pass through the very small cap. The spikes will even pass if the grounds of the two systems are not connected. It works slightly better if they are connected. The trimpot is for BIASING the transistor. It varies the constant voltage at the base of the transistor between 0v and about 1v. The transistor turns ON at about 0.7v. The trimpot can be turned through 3 basic stages: 1. Transistor is always OFF. 2. Transistor is not-quite on, and sensitive to spikes. 2. Transistor is always ON. Setup is quite simple, you turn the trimpot right down (transistor OFF, output to PIC = +5v) then run the motor and slowly turn it up until you get good reliable triggering. With each spike, the transistor will briefly turn on and there will be a short 0v pulse to the PIC. Ten or twenty microseconds length is typical. ------------- Important Notes!! ------------- D1. If the motor is small you don't need the diode. If the motor is large, or a small high-current motor like in dustbuster vacuum cleaner's etc, use the diode. I would guess for under 2amp motor running you don't need the diode. R1. The resistor R1 is not needed with most circuits. Especially with DC motors in tools where the power leads are long. If the 12v battery (etc), is close to the motor you may need a small resistor here, try 0.5 ohm for a small motor or 0.1 ohm for a larger motor. This makes the spike more likely to go to the encoder circuit than back to the battery. C1. The values of the two capacitors, C1 and C2 are fairly critical. I can't give exact values as it all depends on the type of motor you are using. A value of 100pF to 470pF is a good start for C1. If C1 is too small you will miss some pulses, and they will be short and weak. If it is too large you may get extra pulses. C2. You may not need C2 at all, but C2 will help reduce the short fast spike to a "hump" that is lower and longer. Hence it can increase the length of the pulse at the output, which is a good thing. Try using a C2 that is about the same value as C1, maybe going to twice as large as C1. A CRO will help a lot when tuning these. Motor. This circuit works best where there is a bit of motor load. This makes the motor draw more current and the tiny spikes at the commutator are larger. You will find that the circuit gives the most reliable output pulses when the motor is under some load. Generally I have found this circuit works well with almost every motor, even with some unloaded motors like spinning a small mirror or paper disk, etc. Do NOT put a capacitor directly between the motor terminals. If RF filtering is needed use a capacitor across the motor power, leaving R1 in series with the motor. Adjustment. The easiest way is to set the trimpot so the transistor is fully off, (output=5v) and run the motor at it's minimum load. Then turn the trimpot until the triggering and output pulses become reliable. After that, when motor load is increased the pulses will become slightly longer and more reliable. When it is done you should check that disconnecting the motor still gives 5v at the output, so the PIC only gets 5v or 0v levels at it's input pin. Filtering. As the encoder senses fast spikes it may pick up extra pulses from noise in the system. If the encoder is mounted more than a few inches from the motor you should use coax shielded cable for the main wire to C1. Only connect the shield at the circuit end, not the motor end. If you get the parts values tuned right for your motor this circuit will perform quite well, and you will not get many extra spikes. Software. A simple software averaging is enough, like measuring how many pulses are made in 0.1 seconds, etc. With most motor speeds this number will be in the hundreds and the rare "suspect" extra pulse will not cause any great effect. You should be able to control motor speed quite well and even measure the number of revolutions over a given time period. :o) -Roman
Questions:
file: /Techref/au/net/ezy/www/http/~fastvid/encoder.htm, 7KB, , updated: 2005/11/10 15:17, local time: 2024/8/14 22:27,
18.226.150.44:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/Techref/au/net/ezy/www/http/~fastvid/encoder.htm"> Simple encoder-less encoder for speed control small DC motor</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to ecomorder.com! |
.