EMR DRIVER

EMR DRIVER
Context

● You are developing an embedded application using one or more members of the 8051 family of microcontrollers.

● You are designing an appropriate hardware foundation for your application.

Problem

How do you ‘switch on’ or ‘switch off’ a piece of high-power (AC) electrical equipment using a microcontroller?

Solution

We consider in this pattern how, where appropriate, we can use an electromechanical (EM) relay to control an AC supply.

An EM relay is, in essence, a mechanical switch controlled by the current flowing through a solenoid. These devices have been used for many years to switch on and off the AC loads, often at very high power levels. In most cases, large electromechanical relays cannot be driven directly from the microcontrontroller port and will require the use of some form of transistor or IC drive circuit (for example, see Figure 8.1).

More recently, some electromechanical relays have become available that operate at logic levels (a few mA, 5V). Typical examples of such devices are small ‘reed relays’ of the type illustrated in Figure 8.2.

Reed relays of this type are available that will switch mains voltages (up to 250V AC) at powers of up to around 10W. Note that many devices have internal diodes across the relay coil and that various combinations of switch (normally open, nor- mally closed, multiple switches) are available.

Pull-up resistors

When using this pattern, you may need to incorporate pull-up resistors in your hard- ware design. See NAKED LED [page 110] for further details.

Driving AC loads-0154

Reliability and safety issues

Working with mains voltages

Always keep in mind that people and circuits that deal with mains electricity do not mix. You must design mains switching circuits in such a way that the dangerous voltages are not accessible to the user.

Pin reset values

After the system is reset, the contents of the various port special function registers (SFRs) are set to 0xFF. This fact has very important safety and reliability implications.

This issue is discussed in BJT DRIVER [page 124]: please refer to this pattern for details. Briefly, because the output pins are ‘reset high’ it is important to ensure that any devices which have safety implications are connected to the microcontroller in such a way that they are ‘active low’: that is, that an output of ‘0’ on the relevant port pin will activate the device.

Zero-crossing detection

Take a radio and hold it next to a (mechanical) light switch in your house or office. Turn the lights on and off while listening to the radio. The ‘crackles’ you hear are a symptom of electromagnetic interference (EMI), generated by an ‘arc’ that forms between the mechanical switch contacts as the switch is opened or closed. This form of EMI can be annoying for radio listeners: for embedded systems, it can be fatal. You therefore need to take care when switching high-power loads. This is a particular problem with AC loads, because such loads tend to be at high voltages.

Solutions are available. To understand how these work, consider a simple source of alternating current illustrated in Figure 8.3. We can greatly reduce the interference caused by switching at an appropriate point in the cycle: in Figure 8.3 switching at Point A will cause maximal interference, while switching at Point B will cause almost no interference. Therefore, to minimize interference, we need to detect the time at which the waveform ‘crosses zero’ and switch at this point.

A key disadvantage of EM relays is that they do not incorporate zero-crossing detection circuitry.

Driving AC loads-0155

Switching on lamps and other inductive loads

As we discussed in Chapter 7, not all loads present a fixed resistive load. For example, when controlling lamps or AC motors, the initial current required may be very high. This surge of current may last several hundreds of milliseconds, before it settles to the steady- state value. Your drive circuit needs to be capable surviving the initial current surge.

One way of dealing with inrush currents is to ‘over rate’ your drive circuit. This means that if, for example, your load is a lamp or motor with a steady-state current requirement of (say) 1A, you should rate your drive circuit at (say) 10A or more, so that you can deal with the inrush current. Note that it is seldom possible to guess the likely inrush currents. Check the data sheets – they will provide this information. In the absence of accurate data, assume a factor of at least 10.

Remember also that, as we saw in BJT DRIVER [page 124], another way of solving this problem is to use a thermistor in series with the load.

Not all drive circuits will fail immediately if subjected to excessive loads and your test circuit may operate reliably on the bench. However, stressing any drive circuit beyond its maximum ratings will dramatically shorten its useful life and it will fail in the field. If in any doubt: over rate by at least a factor of 10 and add a thermistor.

Switching off inductive AC loads

As we discussed in connection with DC loads (Chapter 7), an inductive load is any- thing containing a coil of wire: common examples are electromechanical relays and motors. Switching off such loads must be carried out with great caution because, when the current is removed, the back EMF across the inductive load can cause damage to the switching device.

To protect any form of switch controlling an inductive DC load, a diode can be used to block the back EMF (‘inductive kick’) as shown in Figure 8.4.

Driving AC loads-0156

In the case of AC loads, this approach will not work, since the diode will simply block one phase of the drive voltage. However, we also discussed an alternative approach suitable for use with DC loads in Chapter 7: this involved the use of a resis- tor to block the back EMF (Figure 8.5).

Driving AC loads-0157

A variation on the resistor-based protection scheme is effective and widely applied to AC load switching: this is known as the RC snubber (Figure 8.6). In most cases, resistor values (Rsnubber) of 10 to 10 KΩ and capacitor (Csnubber) 0.01 µF–1 µF are used (Lander, 1993): values of 100Ω and 0.05 µF will be acceptable in many circumstances, but you should investigate this issue carefully for safety-critical applications.

Portability

EM relays may be used with any microcontroller, microprocessor or DSP chip.

Overall strengths and weaknesses

clip_image011EM relays can control both DC and AC loads, with current from a few mil- liamps to several thousand amps.

When the contacts are open, there is no leakage: that is, there is a very high (near infinite) off-state resistance at voltages up to around 1500V.

When closed, the switch contacts present a very low resistance, so that the power losses in the relay are very low. The relays do not therefore get hot and usually do not require a heat sink.

Purchase costs of EM relays are often lower than semiconductor equivalents (but see comments about maintenance cost).

Switching times are typically measured in milliseconds rather than the microsecond values found in semiconductor switches.

Like all mechanical switches, the relay contacts will usually exhibit ‘bounce’ behaviour when opened or closed (this bounce behaviour is considered in detail in Chapter 19).

clip_image016Because EM relays generally do not incorporate zero-crossing detection (see ‘Reliability and safety issues’), they can generate arcs at the switches and, thereby, cause higher levels of EM interference than semiconductor relays.

clip_image016[1]Unlike semiconductor switches, relays contain moving parts and moving parts wear out. The mechanical life spans vary, but typical values are around 10 million to 30 million cycles. At ten cycles per day, a 10 million cycle life span is ‘for ever’: however, at one cycle per millisecond, 10 million cycles translates into around three hours.

If you subject an EM relay to vibration, it is possible to move the switch contacts. This can be dangerous and / or lead to general system reliability problems.

Driving AC loads-0158

Related patterns and alternative solutions

It is possible to use EM relays to switch DC loads, but this is rarely a good idea. For better solutions to the DC load control problem, see BJT DRIVER [page 124], IC DRIVER [page 134] and MOSFET DRIVER [page 139].

For alternatives to EM relays for AC load control, see SSR DRIVER ( AC ) [page 156].

Example: Controlling a central-heating pump with an EM relay

Many central-heating systems require the control of small, low-power pumps. An example of a typical pump is a Grundfos Selectric UPS 15–50: this requires 240V AC (50 Hz) and 0.17–0.42A.

Control of central heating is a good use of an EM relay. The heating is switched on a small number of times per day, so relay life will be long. Maintenance is possible, in the event of a relay failure. The occasional EM spikes from the system are unlikely to be troublesome in most domestic environments.

In this case, a reed relay will be capable of carrying the required current. Figure 8.7 shows a possible circuit.

Driving AC loads-0159

Leave a comment

Your email address will not be published. Required fields are marked *