I bought a new LG tv, and with my surprise, it doesn't have an analog output to connect to an external amplifier in order to override the terrible internal speakers. So having already a small amplifier and a pair of decent loudspeaker, i bought a cheap optical dac, but again... the optical output has fixed volume.
So I developed this project taking the idea from this:
Remote Volume Control for Old Stereo Amp by Vitim
In order to reduce the size, I removed the display and used a Digispark board (but you can use a single ATtiny85 chip) instead of the Arduino nano.
Having two free pins remaining, I used them to get the circuit capable of learning on the fly the remote controller codes used by the TV, instead of statically programming in the firmware code.
This is done with two header jumpers:
-short the first and press the volume down button on remote until led blinks;
-short the second and press the volume up button on remote until led blinks;
-short both and press the mute button on remote until led blinks;
-remove jumpers; the codes are saved;
This is the schematic: