ESP Logo
 Elliott Sound Products Project 111 

PIC Based Speaker Protection

© October 2005, Rod Elliott (ESP)

Introduction

So, why would one use a PIC microcontroller to control a loudspeaker DC protection circuit? In a word, flexibility.  This project uses a simple one transistor detector that has been optimised to give almost perfectly symmetrical detection thresholds.  The output of the detector is then sent to the PIC, and that's where all the good things happen ... well, they would, but this project is on semi-permanent hold for a variety of reasons.

Unlike circuits such as P33, the control that is available from the PIC is far greater.  It features several functions, including a LED output that shows the fault condition, fast AC failure detection, and even optional thermal protection.

Naturally enough, the cost is slightly higher than the P33 circuit, but there are so many other benefits that many people will consider that it is worth the extra.

Please note that the PCB and PIC for this project are not available.  The details here are retained only because there are some interesting concepts used.


Description

The schematic is shown in Figure 1, and it probably doesn't look particularly special in any way.  The DC detection is pretty normal for this type of circuit, there is a dual transistor relay driver, an AC voltage detector and a simple zener regulator.

fig 1
Figure 1 - Protection & Mute Circuit Diagram

The nominal supply voltage is 5.1V, obtained via R13 and regulated by ZD1, and this powers the complete circuit.  Q1 and associated resistors, diodes and capacitors form the DC detector.  Operation is fairly straightforward, but it does require some explanation.  Looking only at the Left channel input, R1 and C1 form a low pass filter.  Without that, the circuit would operate as soon as the signal exceeded about 5V, positive or negative, from DC all the way to well over 100kHz (this has been verified during testing).

A positive DC signal at the input will turn on Q1 via D1 directly to the base.  The emitter circuit is completed by D6.  The detection threshold is about 5V, although the PIC will not react to that - final detection threshold is around ±7V.  Note that this is a simplified version of the detector - the complete circuit will be made available when (if) PCBs are requested.  With the addition of a couple of resistors, the basic circuit shown above (which is the same as that in Project 33) can be improved quite dramatically.

Additional detectors may be built on Veroboard or similar, and connected to the points marked +D and -D.  Make sure that all external detectors are wired correctly.  Essentially, you will simply duplicate R1, C1, D1 and D2 for each additional channel you wish to monitor.  Different capacitor values may be used for each detector in a triamped system (see the table below), depending on the minimum frequency of operation.

As mentioned above, U1 is where all the interesting things happen.  When power is first applied, there is a 10 second delay before anything happens at all (other than the power LED (connected between the LED terminal and ground) flashing at 1Hz (500ms on, 500ms off).

At the end of the power-on mute period (provided there is no fault), the LED stops flashing, and Pin 7 goes high, turning on Q2 and Q3, activating the relay and connecting the loudspeakers to the amplifier.

Meanwhile, Pin 4 monitors the applied AC.  There is a simple timer, based on R8, R9 and C5.  This will keep Pin 4 of U1 low for as long as AC is applied to the AC terminal.  When AC is present, the transistor (Q2) remains on, holding Pin 4 low.  A loss of AC is detected by a voltage at Pin 4 (Q2 turned off).  Should the PIC detect 5V, there is no AC.  While it is possible to perform the AC detection within the PIC, the additional programming is not worth the effort (and it may react inappropriately with different mains frequencies).  Only the positive peak is detected, so the timeout before C5 discharges must be greater than a full ½ cycle (10ms at 50Hz , or 8.3ms at 60Hz).  Such a short delay is not practical in real terms, as it is too short, and requires precision timing.

This process means that the PIC will usually detect that AC has been removed within about 100ms.  If mains failure detection is too fast, even a momentary glitch in the mains will cause the circuit to release, but all attached preamps (etc) will function quite happily with momentary loss of mains supply (a few cycles is typical).  As long as AC voltage is present, the PIC continues normal operation, monitoring for output DC or over-temperature.

After this simple detection system, things become more interesting.  Should the system trip because of a fall in the collector voltage of Q1, it will check the DC level continuously.  If a small drop in voltage occurs (low level or 'transient' DC) then goes away again, the relay will re-activate and normal operation will resume.  Should the DC remain (indicating a faulty power amplifier), the relay will not be reset - it will remain in the mute position until power is removed.  For a DC fault, the LED will flash at 10Hz (10 flashes per second).  No worries about powering on the amp again either - the very first check that is done is for the DC detector output.  Should a DC fault exist, the LED will flash fast, and the relay will not be activated.

But wait! There's more! DC detection in the PIC is done using an ADC (analogue to digital converter).  This means that something else can be used to reduce the voltage on the detection pin.  Provided it behaves differently, the program can differentiate between the two.  This now allows us to add some thermal sensors, and because the rate of change (slew rate) of temperature is relatively slow, the PIC can now also monitor the temperature of the output stage(s), and activate a thermal shutdown if the temperature exceeds the preset limit.

The LED will flash in a different sequence (2 flashes/ second) to show that the amp is hot, rather than faulty.  Considering that a great many amp failures are a direct result of overheating, this may even save the DC protection from ever having to operate.  The program will check the voltage, and if it has not changed by more than a few tens of millivolts, the problem must be thermal.  The circuit will reset automatically, but the temperature must fall (i.e. the collector voltage of Q1 must rise) by a significant amount because the software introduces hysteresis to prevent rapid cycling.

Flash RateAmp Condition
SteadyNormal (no faults - after 10 second power-on mute)
1.0HzPower-on Mute
2.0HzOver Temperature (recovers when amp cools)
10HzDC Fault (remains locked out until power off)
Table 1 - Flash Rate Fault Indications

Consider the circuitry needed to achieve all of the above (including precise timings, LED flash rates, etc.) without using the microcontroller.  Scary, isn't it? Of course, this has its down side too - rather than a bunch of components that you can analyse to figure out how it works, the majority of the functionality is embedded in software.  You can't see it, and only the description allows you to know what goes on in that tiny little brain.

While this is a disadvantage for those wanting to learn more, the circuit works so well (and is comparatively so simple) that it is hard to ignore all the benefits.  Not that the extra functionality is always essential, but if you want the very best DC and/or thermal protection circuit available, this is probably the one.

It does not (and is not intended to) replace the P33 unit - although rather basic, the original does work well, and is quite a bit cheaper too (the PCB is smaller, there are fewer parts overall, and you don't have to buy the programmed PIC microcontroller).

The benefit of using a PIC for this sort of application becomes quite obvious - the entire operation of a circuit can be changed in software, based on the user's needs, or if a problem is found.  Rather than having to design and make different PCBs one simply reprograms the PIC.

And what of the 'FAN' pin? This is a current limited logic signal, so FAN will go high to indicate an over-temperature condition.  This will normally be used to turn on a fan (somewhat predictably), and will activate just before the speakers are disconnected.  If the temperature stops increasing, the fan will run until the temperature is back to normal (the input voltage on Pin 3 will be at about 4.6V), after which it will turn off again.

Because of the relay driver used on the P111 PCB, there will be no problem operating quite a few relays (for example, if you have a triamped system).  Additional channels can be added easily - an external P33 board (suitably stripped of all unnecessary parts) will add an extra 2 channels, or you can wire up the extra detectors on Veroboard or similar.  There are two additional pin locations on the PCB for connection of external detectors (1 resistor, 1 capacitor and 2 diodes for each channel).

Note that with the transistors shown for the relay switch, the maximum DC voltage used should be under 65V.  The BC546 is rated to 80V (VCBO - i.e. Collector to Base, with Emitter open), but VCEO is only 65V.  It is probable that the 1k base resistor will allow close to 80V under normal conditions.

Detection Details
The DC detector performance is dependent on a great many factors, including the value of C1 (or C2), the applied voltage, and your desired sensitivity and expected low frequency power.  Make the circuit too sensitive, and you will get nuisance tripping from 'wandering' DC levels caused by asymmetrical programme material.  Not sensitive enough, and your speakers will not be properly protected.  The table below shows the detection times for various voltages with different values for C1 and C2.

VoltageCapacitance / Delay / Min. Frequency
22µF10µF4.7µF1µF100nF
7V500ms225ms105ms23ms2.25ms
15V185ms84ms41ms8.6ms850us
30V88ms40ms19ms4.0ms400us
45V57ms26ms12ms2.6ms260us
60V42ms19ms9.2ms1.9ms193us
Frequency5Hz10Hz20Hz100Hz1kHz
Table 2 - Detection Time Vs. Voltage and Capacitance, and
Suggested Minimum Frequency of Operation

Use of 10µF for C1 and C2 will normally be quite sufficient - this allows full power from a +/-70V amplifier at 20Hz.  Use 22µF only if you expect to have significant energy at extremely low frequencies, and especially if the signal is allowed to clip (even briefly) - a subwoofer amp would be a typical example.  Clipping of asymmetrical waveforms can cause significant DC offsets, so this must also be considered.  The frequency shown is a recommendation, based on a ±35V amplifier (such as P3A or similar).

Using 100nF caps will be perfect for dedicated tweeter amps - at a typical maximum signal of +/-25V, the detector will not activate even with a 500Hz signal, but as seen from the table will deactivate the relay in less than 1ms in case of an amplifier fault.  Faster operation is possible, but is completely unnecessary in practice, largely because of the time the relay takes to operate.

Note that the detection thresholds are almost perfectly symmetrical, differing only by a factor of less than 5%.  The figures shown above are average of positive and negative detection times.  This is also determined (to some extent) by the PIC input voltage at which DC is deemed to exist.  Testing has shown that the optimum is at about 70% of the supply voltage.

Using the tweeter amp example from above, a 25V DC fault is detected in around 500us.  This is a great deal faster than any typical relay will activate, so the relay becomes the limiting factor, not the detection circuit.


Adding a Fan
For any high power amplifier, a fan is a useful addition.  Because there is a fan output, it is a simple matter to use a simple transistor switch to turn on the fan when needed.  The limiting resistor is included to limit the current applied to the base of the switching transistor.

The fan output must not be used to power a 5V fan directly, as there is not enough current available from the PIC or its power supply.


Construction Tips

Since operation is dependent on the PIC, there is obviously no way to build the unit without it.  The PCB and PIC will be offered as a short-form kit should there be a demand (all other parts are readily available).  The two BC549 transistors can be substituted with any small signal NPN transistor, and the BD139 exchanged for any device with similar ratings (80V, 0.5A).  If you do substitute transistors, make sure you get the data sheet and double-check the pinouts!

All unmarked diodes are 1N4148 or similar, and all resistors apart from R13 are 0.25W carbon or metal film.  5% tolerance is fine for all resistors.  Resistor and diode hole spacings are 10mm (0.4") for all except R13 (holes will be available for 20mm or 25mm resistors).

Note that C1 and C2 must be bipolar (non-polarised) electros (or polyester for low values).  If the unit is being used for tweeter protection, the value may be reduced to increase the detection speed (see the details above).  For frequencies above 1kHz, you can use 0.1µF polyester caps.  Table 2 (above) shows the capacitance vs. detection time and frequency recommendation - you may use smaller capacitors than indicated, but false (nuisance) tripping may become a problem.

The value (and power rating) of R13 is determined by your supply voltage.  The resistance is calculated by ...

R13 = (Vcc - 5.1) / 0.03   Where Vcc is the raw supply voltage, and 0.03 is the zener current (30mA)

For example, using the suggested 5.1V zener and you have a DC supply of 35V, R13 will work out to be ...

R13 = (35 - 5.1) / 0.03   = 996 Ohms (1k)

Power rating is calculated by ...

P = (Vcc - 5.1)² / R   = 0.9W   (use a 1W resistor)

There is enough room on the PCB to accommodate a 5W resistor, and this is recommended to keep temperatures down and ensure reliability in the long term.  30mA is pretty much optimum, but you can supply a little more if you desire.  Even with a +/-70V supply, the resistor will never be greater than 5W.

One final point on resistor values involves R9.  With a value of 22k as shown, the usable AC voltage range is from about 15V RMS to 50V RMS.  At the lower limit (15V), loss of AC is detected in around 40ms, rising to about 50ms at 50V.  If the voltage is lower than 15V RMS, I recommend that you use a lower value for R9 (about 10k is ideal), and for voltages above 50V RMS the value should be increased to about 47k.

Temperature Detection
While there are many IC temperature detectors available, a simple transistor circuit is very cheap and highly sensitive.  In the diagram below, the sensitivity is such that the collector voltage will vary by almost 100mV / °C, with a collector voltage of around 4V (based on a 5V supply and a temperature of 60°C).  This makes temperature sensing quite easy, with lots of variation to ensure reliable detection.  Short term transients are easily ignored in software (not that they are likely in this application).

fig 2
Figure 2 - Very Sensitive Transistor Temperature Detector

The only negative point is that you need 3 wires to the sensor(s), as well as the biasing resistors.  The bias resistors can always be attached directly to the leads, and you could even use surface mount resistors for minimum space utilisation so the sensor can be made to fit into very small spaces.

You can parallel as many of these sensors as you wish, and the lower base resistor (R2) can be made variable if you want to get precise temperature sensing (a 20k multiturn trimpot is recommended).  Because the emitter-base voltage of transistors is somewhat variable, you will need to calibrate the sensors anyway, but if you are looking for a general sensor that will trip at about 60°C and costs peanuts, this is by far the easiest.  Consider using a tiny piece of prototype board (Veroboard or similar) for each sensor.  The transistors can be epoxied into holes in the heatsink - the holes should be around 5-20mm from the power transistors, with the ideal place being between two devices.


Finishing Off

All in all, this is the most complex DC protection circuit imaginable, yet uses relatively few common parts and is reasonably inexpensive to make.  Considering the cost of a single high quality power transistor or tweeter, it is very cheap insurance indeed.  In addition, it is also very flexible, providing a suite of functions that would require a great many discrete parts - so complex that no-one would consider trying to build it!

The DC detection circuit has been tested and simulated very carefully, and optimised for symmetry, yet again, uses a single transistor and a few passive components.

fig 3
Figure 3 - Relay Wiring

The essential details for the relay contact wiring are shown above.  For complete details on relay connections, coil dropping resistors, drop-out times (etc.) please see the original Project 33 article, as there is no point duplicating all of that information here.

Of particular importance is the relay dropping resistor (marked as 'See Text').  If you don't know how to work this out, then refer to the P33 article.  Note that the back-EMF protection diode is on the P111 PCB, and the series resistor will help the relay(s) to disconnect faster - this is also cheaper than the method described in the P33 article, although not quite as good.  You may substitute the method described in Project 33 if you wish, and leave D9 off the board.


 

HomeMain Index ProjectsProjects Index
Copyright Notice.This article, including but not limited to all text and diagrams, is the intellectual property of Rod Elliott, and is © 2005.  Reproduction or re-publication by any means whatsoever, whether electronic, mechanical or electro-mechanical, is strictly prohibited under International Copyright laws.  The author (Rod Elliott) grants the reader the right to use this information for personal use only, and further allows that one (1) copy may be made for reference while constructing the project.  Commercial use is prohibited without express written authorisation from Rod Elliott.
Page Created and Copyright © Rod Elliott 10 Oct 2005