The goalAdd sleep mode to Creative T20 speakers after no sound over 1 minute.
UsabilityAdditional comfort, no need to turn off you speakers. Volume knob always in the same place.
- 1 x Attiny45 (or any other with 2 ADC, one PWM and one HW interrupt)
- 1 x Bright led, blue 3V
- 2 x 4,7k resistor
- 1 x 9k resistor
- 3 x 1k resistor or one in 200-300 ohms, this is for led only
- 1 x LM78L05 - 5V low current
- 1 x microswitch
- some cable
I don't like speakers with power switch in volume knob. Every time, when I leave my desk for longer than 15 minutes, I switch them off. Continuous ON and OFF and searching right volume is a bit of annoying.
I bought Creative T20 couple years ago, because they sound just great. Despite almost perfect sound, I've decided to open the case and see what is T20 belly :)
T20 power stage is made from TPA3123, which is 25W stereo Class-D amp (it's popular, you can google application note in pdf).
TPA3123 has build in two useful functions - MUTE (pin 4) and SHUTDOWN (pin 2). Looking at the application note you can find that in MUTE state amp is eating more power than on SD (shutdown).
I didn't check behavior on MUTE, but when amp is waking from SD it need some seconds to boot up. I think changing form MUTE-on to MUTE-off state would be instant and without additional time to warm up, but I prefer SD over MUTE.
Amp shutdown mode
To put TPA3123 into SHUTDOWN mode, you need to short pin 2 over 4.7k resistor with ground. Voltage will drop form 6.2V to less than 2V. This is recognized as pin in low state. High state is above 2V to VCC which in case of Creative T20 is about 30V, so be careful and check twice SD voltage before connecting SD pin to microcontroller. To be honest, 6.2V as pin state on Attiny supplied from 5V is too much, but ... it works ;) You could secure your MCU by adding 5V diode or drive SD pin through additional transistor.
I fully agree with you! Circuit is ugly, but ... it works ;)
This was simple, connect Left and Right input (from back of T20) to Attiny's ADC input pins. There is a continuous loop that reads from ADC (in 20x gain mode), and when values are smaller than threshold (200 times in a row), MCU puts TPA3123 in shutdown mode by changing SD pin to low state. When ADC gets value above defined threshold, SD pin is put into high (back from < 2V to 6.2V).
I've used differential ADC input so i need only one read from ADC.
For me, this is working well. I've used to listen music on 50-80% volume level on my laptop when audio is connected to T20. MCU puts TPA3123 into sleep just below 40-45% volume.
It may behave different on your equipment, if so - change ADC threshold, or even build better ADC circuit.
Disable sleep mode
T20 has additional AUX input at front. My MCU is connected only to back input, so when listening only from AUX, speakers would go into sleep mode (no sound on back input). To avoid this I added microswitch mounted on back of main speaker, which is connected to INT0 (interrupt nr. 0) and serves as disable/enable sleep mode switch.
Sleep mode notification
I removed original led diode from volume knob and put my own 3V blue led connected to Attiny's PWM output. When TPA3123 is in sleep mode, led is in a pulse state (from dark to bright and backwards). On regular work led has full brightness. Disabling sleep mode (by microswitch) makes led flash 2 times, enabling sleep mode - one time.
|Creative T20 circuit board with sleep mode added.|
|Led and resistors view.|
|Attiny45 in holder.|
|MCU holder is glued to plastic case.|
|Microswitch is glued too.|
|Additional button looks as original (well, almost).|