Hi,
... ignore any AC signals but instantly disconnect the speaker if DC above a certain level is detected.
I can do this except I don't know how to detect DC and ignore AC (audio signal) .....
You cannot "instantly" detect a fault, because
any output voltage between the supply rails could be an ac transient (i.e. the audio signal) not an "offset" dc bias level. If the output voltage is within (say) 1 or 2 volts of the
supply rail(s) then a failed output transistor might be assumed, but it could still be a brief ac (overload) signal (such as a crash of cymbals). Certainly, overloading the output stage is acoustically "bad", but so is disconnecting the loudspeaker. Therefore, reducing/limiting the amplifier gain is generally a preferable method in this case.
Thus, you can only detect the presence of "dc" after a time delay, which can be implemented either by using hardware (e.g. a low-pass R-C filter) or by software (which gives many more possibilities for "intelligent" detection). But first, we must consider the
type of Power Output configuration that the amplifier is using. There are many possibilities but we can consider three broad types:
A "single output, single supply" amplifier will typically have a 50 (or perhaps 100) volt supply rail with an output (dc) bias of (approximately) half that voltage. A very large Output Coupling capacitor blocks the dc which will generally protect the loudspeaker(s) from a "dc fault". But a very low audio frequency could still overheat the "woofer" voice coil, or a full amplitude high frequency signal can certainly destroy a "tweeter". If you do wish to add additional protection, then you will need to decide on which side of the coupling capacitor you're going to connect the PICaxe ADC input (and how).
But there are numerous problems when using a large output coupling capacitor, so high power amplifiers often use Positive and Negative supply rails, such that the output bias voltage can be close to "earth" potential (i.e. zero volts). Now, a "continuous" large output voltage (positive OR negative) might be applied to the loudspeaker(s) if a fault occurs, so a protection system is indeed wise. The PICaxe ADC will of course need to be able to monitor both positive and negative voltage levels (relative to Earth).
A third output configuration is the "(H) Bridge" which uses two output stages (i.e. at least 4 transistors) to drive both sides of the Loudspeaker(s) with opposite phase signals (i.e. one inverted relative to the other). This configuration is particularly useful in Lower Voltage / High Power (e.g. car audio) and/or "Class D" (switching mode) systems, because it needs neither a coupling capacitor nor multiple (+/-) Power Supplies. Of course a (PICaxe) protection circuit will need at least two ADC inputs. A class D amplifier where the Loudspeaker (inductance) is used as the primary Low Pass filter (to remove the PWM switching signal) is the only configuration which will
definitely need an external R-C Low Pass filter on the ADC inputs, but a few millisecond time constant filter will probably enhance any of the above configurations.
The degree and sophistication of a protection system will depend on the magnitude of the available power level (relative to the capabilities of the Loudspeakers) and/or if very Low or High Frequencies are contained within the desired Audio Spectrum. But IMHO a "software" solution can "tailor" the protection much better to the capabilities of the Amplifier/Loudspeaker combination than a basic hardware design. The primary cause of damage is of course overheating, which is a function of time, voltage and current, noting that the Loudspeaker (voice coil) is not simply resistive, but may have a significant inductive (i.e. non dissipating) element. In principle, the PICaxe could monitor both the voltage
and current levels and compute an accumulated power/heating stress.
Cheers, Alan.