Pulse Width
Modulation motor control
By Michael Adler
The control of electric motors is something which interests nearly everyone involved with Meccano model building. Every model has its own motor requirements with regard to the space available, the power of the motor, its speed, whether it must stop and start frequently, and the need for reduction gearing.
On the face of it, simple methods of control are perfectly adequate, with a regulated voltage supply, a simple on off switch, and the means to reverse the motor. Speed can be controlled with a potentiometer. In reality, this provides very unrealistic results. The main problem is poor starting performance, the motor tending to jump almost instantly from a stationary position to what is often more than half speed. The main cause seems to be the starting characteristic of the motor itself which when under load seems reluctant to start. A motor has a relatively low resistance when it is stationary. As the speed control is advanced, the current through the motor increases, but the voltage across the motor remains quite low. The speed control therefore has to be well advanced before the voltage and power fed to the motor are high enough to overcome its reluctance to start. As the motor speed and the load on it changes, there are changes in the internal resistance. Speed regulation is not very good under these circumstances, particularly at low speed.
Pulse
Width Modulation (PWM) is a common technique for speed control. A good
analogy is bicycle riding. You peddle (exert energy) and then coast
(relax) using your momentum to carry you forward. As you slow down (due to wind
resistance, friction, road shape) you peddle to speed up and then coast again.
The duty cycle is the ratio of peddling time to the
total time (peddle + coast time). A 100% duty cycle means you are peddling
all the time, and 50% only half the time.
PWM for motor speed control works in a very similar way. Instead of peddling, your motor is given a fixed voltage value (say +5V) and starts spinning. The voltage is then removed and the motor ‘coasts’. By continuing this voltage on-off duty cycle, motor speed is controlled.
The concept of PWM inherently requires timing. The classic 555 timer chip and some potentiometers can be used to generate PWM. The pots are manually adjusted for the desired duty cycle. However, if you use a PC, you can change the duty cycle by having your PC control your motor's speed.
Rather than feeding the motor with a simple DC voltage, it is fed with a pulsed signal. The waveforms of figure 1 help to explain the way in which this method of control operates. In each case the signal has maximum and minimum voltages of 12V and 0V. In the top waveform the signal has a mark-space ratio of 1:1. With the signal at 12V for 50% of the time, the average voltage is 6V. In the middle waveform the mark-space ratio is 3:1, which means that the output is at 12V for 75% of the time. This clearly gives an average output voltage of 9V. In the bottom waveform, the mark-space ratio is 1:3, giving an output signal that is 12V for just 25% of the time. The average output voltage of this signal is just 3V.
By varying the mark-space ratio of the signal, it is possible to obtain any desired average output voltage from 0V to 12V. The motor will work perfectly well, provided that the frequency of the pulsed signal is set correctly, and this is at about 25Hz. Setting the frequency too low give jerky operation, and too high might increase motor impedance.
Continued in issue 7
Contrast with: Simple
motor control , Rotary
switch motor controllers
Digital electronics: Logic gates
In a digital system, only two voltages, Vs and 0V are used. These are called ‘high’ and ‘low’ respectively. We have already seen these terms used in previous issue of Electronics in Meccano when discussing the uses of the NE555 Integrated Circuit (IC). The NE555 output is a digital output; it is either high at Vs or low at 0V, but never in-between.
The NE555 is partly analogue and partly digital, but completely digital ICs are available which accept digital inputs and produce digital outputs. These ICs can perform logical and mathematical tasks and the simplest ones, the Logic Gates, will be explained later in this article. First we need to find out what these ICs look like and what their common features are.
Properties of logic ICs
Most logic ICs have either 14 or 16 pins arranged as shown in figure 2. When the IC is held horizontally so that the writing on it is the right way up, the bottom right pin (7 or 8) is normally connected to 0V. The top left pin (14 or 16) is normally connected to Vs.
Logic families
There are two basic families of logic technology: Transistor Transistor Logic (TTL) and Complementary Metal Oxide Semiconductor (CMOS). Within the TTL family there are several sub-families, but the commonest one now is the 74LS series. As the name suggests, these ICs all have identification numbers starting with 74LS. All of the CMOS ICs have numbers starting with 40 or 45. Other numbers on the IC are the manufacturers codes and can be ignored.
The table below shows some of the main differences between the two families. The values are typical of each series, but may vary depending on which IC you are using. More will be said about the different properties later on in this series.
Property |
TTL |
CMOS |
Power Supply |
5V DC ± 0.25V |
3 – 15V DC |
Power Dissipation |
8mW per IC |
0.01mW per IC |
Fanout |
Typically 10 |
Typically 50 |
Output Current |
Source: 2mA |
At Vs = 5V: 0.8mA At Vs = 9V : 3.5mA At Vs = 15V: 5mA |
In this series we will be using ICs from the CMOS family because they are able to have a power supply between 3V and 18V, which makes them more flexible for Meccano applications.
If you have some surplus TTL ICs you can use them instead, remembering that the pinouts are not the same for both families and that they need a 5V supply. Exceeding this voltage will usually destroy them, but they will normally work with a 4.5V supply, which is useful for battery powered applications.Logic Gates
There are three fundamental logic gates that are used to make every type of digital system. Each of them has one or more inputs (marked as In) and one output (marked as Out). Figure 2 shows each logic IC with the circuit symbol, Boolean expression and truth table of the logic gates inside it.
The
NOT gate
The simplest CMOS IC, the 4069
shown in figure 2a houses six identical NOT gates. These gates have one input
and one output each. If the input is high, then the output will be low. If the
input is low then the output will be high.
The NOT gate ‘inverts’ its input, and for this reason it is also known as an
‘inverter’. Notice the circuit symbol for the NOT gate has a small circle on
the output. This circle actually means ‘invert’, so you will see it also on
other circuit symbols meaning that the output is inverted. The truth table shows
what the output of the gate will be for every possible input situation. In this
case there are only two possible inputs, high (1) and low (0).
![]() |
4069 6x NOT Gate Datasheet 297Kb |
The AND gate
The 4081 (figure 2b) houses four identical
2-input AND gates. These gates have two inputs and one output each. Only when
both inputs are high will the output be high.
The output will be low in all other cases. The truth table now has four rows
since there are four possible input situations.
![]() |
4081 4x AND Gate Datasheet 272Kb |
The OR gate
The 4071 (figure 2c) houses four identical
2-input OR gates.
These gates have two inputs and one output each.
When either or both inputs are high, the output will be high. If both inputs are
low, the output will be low. The truth table for the OR gate also has four rows
because there are four possible input situations.
![]() |
4071 4x OR Gate Datasheet 282Kb |
The number of inputs that the AND and OR gates can have can be greater than two – you will find that 3, 4 and 8 input versions are available if required.
These gates can be used on their own for simple systems where a decision needs to be made. Perhaps a motor should only turn when two parts of a model are in a certain position. You could use two switches and an AND gate to do this. Maybe a motor should turn when either of two parts of a model are in a certain position. You could use two switches and an OR gate to do this. These simple examples could have been achieved using just switches in parallel and series, but if the function required is more complex, it would be easier to use digital logic than lots of multi-pole switches. Every other digital IC that we will be covering in this series is made from individual logic gates, although there is no need to explain how this is done, just how the ICs are used.
There are three more types of logic gate are available:
The NAND gate
The NAND gate works in exactly the same way as a normal AND gate, but its output is inverted (that’s why there is an inverting circle on its symbol.)
![]() |
4011 4x NAND Gate Datasheet 288Kb |
The NOR gate
In the same way as the NAND gate has the opposite output of an AND gate, a NOR gate has the opposite output of an OR gate.
![]() |
4001 4x NOR Gate Datasheet 291Kb |
The XOR gate
This gate is similar to the OR gate, except that when both inputs are high, the output is low. The XOR gate looks at the difference in the two inputs — it tells you if they are the same or not.
![]() |
4070 4x XOR Gate Datasheet 274Kb |
Experimenting with logic gates
To try out any of the ICs above, plug one into your breadboard and connect up the power supply to pins 7 and 14. The power supply must be regulated, like the one described in issue 4 of Electronics in Meccano. Attach loose wires to the inputs of the logic gate you are using (for example, pins 1 and 2 of the 4069) so that you can easily set them to high (Vs) or low (0V). The outputs of the logic gates can drive an LED, so connect one (via the appropriate resistor) from the output of the logic gate (in our example, pin 3) to 0V. Switch on the power and use the loose wires to go through the sequence in the truth tables. You will find the LED light when appropriate to reflect the output column in the truth table. In the case of the AND gate, the LED will only light when both inputs are connected to Vs.
In the next issue we will see how all of the logic gate functions above can be achieved using just NAND gates, thereby saving on cost and space on circuit boards. The next issue will also explain the use of counter ICs.
See
also: Digital electronics: Logic IC reduction
, Digital electronics: Counters
All
about reed switches
By James Johnston
A reed switch consists of two or three springy metal reeds having plated, long-life contacts at the tips and encapsulated in a sealed glass tube. The two-reed type has normally open (NO) contacts which close when operated, and the three-reed type is a changeover, i.e. it has a pair of normally open (NO) and a pair of normally closed (NC) contacts. When the switch is operated, both these pairs change to the opposite state.
Reed switches are actuated by the field from an external permanent magnet or electromagnet placed in close proximity. This field causes the reeds to become magnetic, the ends are attracted and the contacts either open or close. Removal of the magnetic field allows the springy reeds to restore the contacts to their original state.
A couple of important points arise here. First, the strength of a magnetic field decreases very rapidly at quite a short distance away from the magnet. In fact, at twice the distance there is only one quarter of the field strength. This means that the operating magnet must pass very close (1cm or less - Meccano tolerances permit small clearances to be achieved) to the reed switch otherwise the field strength will be insufficient.
The second point is that reed switches have only a momentary action — their contacts revert back to their original state as soon as the magnetic field diminishes.
So if you want a circuit triggered by a reed switch to remain on (or off), it will be necessary to use a latching relay circuit like the one given in issue 1 of Electronics in Meccano.
Advantages of reed switches
Advantages of reed switches to the Meccano modeler are their small size, which makes them easy to mount and unobtrusive, and the fact that the operating force required to operate the switch is very small, thus doing away with cumbersome cams or cranks. Reed switches, and suitable magnets, are also cheap and easily obtainable.
Disadvantages of reed switches
It
should, however, be pointed out that reed switches do have a few disadvantages
— nothing is ever perfect!
First, the contacts and reeds are fairly small and delicate, so they won’t handle large voltages or currents which cause the reeds to spark when switched. Heavy currents also overheat the reeds causing them to lose their springiness. If the reed contacts do become welded together (e.g. due to trying to switch a high current) you can often free them by sharply tapping the reed switch - but not too hard or the glass breaks! It is always worth trying - you have nothing to lose because welded contacts make the switch useless.
Maplin give typical voltage and current ratings for the switches that they supply. A wattage rating simply means multiplying current and voltage, but remember not to exceed the current rating — e.g., 10V at 1A equals 10W, but 1V at 10A also equals 10W, but in this case the current would be too high. If you are switching large currents, it will be necessary to use a relay circuit with the reed switch operating the relay coil only.
Second, since reed switches are rather fragile, particularly if you are soldering onto the thick lead-out wires, it’s easy to break the glass and seals. If you need to bend the lead-out wires, make sure that you grip them securely with pliers between the glass seal and the bend point, as shown in the top diagram in figure 4.
The
following lists the electrical parts that are discussed in the
articles. Prices and order codes given are taken from the current
Maplin catalogue, which is the probably best source of electronic
components for the hobbyist in the UK.
If you have access to a company account with Rapid Electronics or RS Electronics you may find these companies are cheaper.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Maplin charge £2.50 for delivery on orders under
£30.00 inc. VAT.
Prices are taken from the September 2000 - August 2001 Maplin catalogue, and
include VAT at 17.5%
Contact their order line on 0870 264 6000 or visit one of their shops.
Their customer service line is 0870 264 6002 and
they have a website at www.maplin.co.uk where on-line ordering is
available.
www.eleinmec.freeserve.co.uk |
Electronics in Meccano January 2000 -- Issue 6 Edited by
Tim Surtell |
| Home | Contents of Issues | Index | About | Letters | Printed Edition | Circuits Shop | Wizards | SELMEC | Links |