Laziness is the mother of invention.
Switching on and off the amplifier connected to my TV was definitely too tiring and bothersome, and I managed to forget it on more often than not.
So, let's make a simple circuit (or two) to take care of the chore for me.
Luckily, the TV provides a couple of USB ports, whose power is switched on with the TV and switched off after ~5 minutes after the TV.
Double luckily, the ampli (a Pioneer XC-L7 salvaged from the garbage room, including speakers and sub-woofer) includes a display+keys cabled remote unit.
This remote uses the old resistor ladder + ADC trick for its keys, so it is easy to emulate a key-press with a MOSFET or OD MCU port, see the picture: the KEY3 signal is just 5V with 1k
in series
Being a week-end project, I can only rely on my components stockpile, so let's see...mmh a 74HC14, some optoisolators, these might come handy!
So after some head scratching you can see the resulting schematic in the Analog (OK, it's not really fully analog) attachment.
It works as follows (for the occasional newbie around):
- The input signal is fed to an optoisolator so that I don't have to worry about different grounds and ground loops)
- then, it's squared by the first Schmitt trigger, U1
- both negative and positive going edges (U2) are derived by the RC networks, with about 50ms time constants
- The pulses, squared by U3 and U4 are combined in a NAND gate (D1+D2+U5)
- The resulting signal is then used to drive an open drain MOSFET, that emulate a button press.
Breadboards are evil, but for this kind of slow stuff are quite handy...the circuit works as advertised!
And yes, I'm relying on the HC14 clamp diodes to dump the capacitors charge at the negative edge...
Components count:
- Resistors: 6
- Capacitors: 2 + decoupling (not shown in the diagram)
- ICs: 2 (74HC14 + 4N28)
- MOSFET: 1
- Diodes: 2
Total: 13 components (+decoupling, and maybe some protection diodes)
OK, maybe someone smarter than me could devise a way to spare some passives...but that's how I did.
Of course, no PCB: this has to go on an experiment board (stripes).
But something is telling me I had some more stuff around, I rummage a bit more in the bottom of a drawer and come out with a ATtiny 84 I've never used.
It's even overkill, in a DIP 14 and with 8kB of flash...but I'm definitely out of smaller MCUs.
Back to the drawing board (what an exaggeration!
).
The result is in Digital.PNG...from 13 components, down to four!
The code is quite simple:
- Poll the input (using the internal comparator, how convenient) every n milliseconds
- Whenever a change has been stable for more than 1 second, generate a suitable pulse on the output
- Rinse and repeat
The only "smart" thing is using the data direction register to simulate an open drain output pin.
I have not yet built the final version, but I'll probably go for the digital one, you know, laziness...
It's not worth a poll, but I'm curious to know which one you prefer!