Clipping Protection

24 May 2014

How do we add clipping protection, overpower protection and automatic standby to a studio monitor? ...Using a microcontroller! ;-)


Completed board.

Functionality


Block diagram.

The input and output of the LF amp are fed to the differential ADC input of the microcontroller (ATTiny85). When clipping occurs, the output fails to follow the input causing the MCU to mute the power IC (LM4776) until the input signal decreases to a lower level. Similarly when the HF amp overpowers the tweeter (I set the threshold to 15W), the system is also muted.

Below is the main loop state-machine. For better accuracy, the microcontroller halts the core while doing the ADC sampling.

	while(1) {
		switch(state) {
		case STATE_STANDBY:
			if(get_line_in_1024() > MUTE_THRESHOLD) {
				PORTB = PIN_UNMUTE | PIN_LOWVOLT;
				CHANGE_STATE(STATE_ACTIVE_LOW_VOLT);
			}
			break;
		case STATE_ACTIVE_LOW_VOLT:
				if(!low_volt_enough()) {
					PORTB = PIN_UNMUTE | PIN_HIGHVOLT;
					CHANGE_STATE(STATE_ACTIVE);
				} else if(get_line_in_1024() >= MUTE_THRESHOLD) {
					quiet_time32 = 0;
				} else if(++quiet_time32 == TIMEOUT_STANDBY) {
					PORTB = PIN_MUTE | PIN_LOWVOLT;
					CHANGE_STATE(STATE_STANDBY);
				}
			break;
		case STATE_ACTIVE: {
			u8 power_state = get_power_state();
			if(power_state == POWER_OVERPOWER) {
				PORTB = PIN_MUTE | PIN_HIGHVOLT;
				CHANGE_STATE(STATE_POWER_SHUTOFF);
			} else if(power_state == POWER_LOW) {
				if(++quiet_time32 == TIMEOUT_DECR_POWER) {
					PORTB = PIN_UNMUTE | PIN_LOWVOLT;
					CHANGE_STATE(STATE_ACTIVE_LOW_VOLT);
				}
			} else
				quiet_time32 = 0;
			break;
		}
		default: // state == STATE_POWER_SHUTOFF
			if(get_line_in_1024() > 4*ADC_LINE_IN_W_RESUME)
				quiet_time32 = 0;
			else {
				if(++quiet_time32 == TIMEOUT_OVERLOAD) {
					PORTB = PIN_UNMUTE | PIN_HIGHVOLT;
					CHANGE_STATE(STATE_ACTIVE);
				}
			}
			break;
		}
	}

State Machine.

The analog section is similar to my original biamp design. I've added a HiFi-grade opamp as an input buffer and a low-pass filter, to allow differential ADC input clipping detection.


Transfer function.

Finished speaker

I converted another passive Boston Acoustics CS26 to an active bi-amped monitor. I rebuilt the port to resonate at 42 Hz, which combined with minor pre-equalization delivers deep (for the speaker's size) linear bass.





Comments for Clipping Protection

bjv on January 25, 2015

Wonderful project, thanks for sharing. I definitely plan on building a couple of these for my speakers... A couple of questions: Do you have an updated schematic which includes the micro-controller clipping detection, and also when I downloaded your materials BOM wasn't included, would you have that available? Thanks again for sharing..


Post a new comment

Name: Comment:
Email(hidden):
5 + 6:
8 characters word:
visits.