Tiny weekend project(s) - Page 1
Forum section: electronics / projects

author: newbrain
author_rank: Super Contributor
timestamp: September 25, 2016, 11:33:38 am
content: 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 1kin seriesBeing 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, U1both negative and positive going edges (U2) are derived by the RC networks, with about 50ms time constantsThe 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: 6Capacitors: 2 + decoupling (not shown in the diagram)ICs: 2 (74HC14 + 4N28)MOSFET: 1Diodes: 2Total: 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 millisecondsWhenever a change has been stable for more than 1 second, generate a suitable pulse on the outputRinse and repeatThe 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!

author: SeanB
author_rank: Super Contributor
timestamp: September 25, 2016, 12:01:53 pm
content: I did a similar thing using a CD4066 analogue switch, though there all I was looking for was a power on delay of 10 seconds and then a single emulated switch closure. Did that using only 3 of the 4 gates, and fitted it all on a piece of veroboard only 1 hole larger than the DIP IC on all sides. Sure you could do it with one here as well, and even have the rigt operation.Where is the 5V coming from, I assume the amplifier has a standby 5V rail. Nice thing using CMOS is you can use any rail from 5V to 15V to run it, just has to be reasonably smooth, and you can easily use a RC circuit and zener to run off the higher voltage rails if there is no 5V supply.

author: newbrain
author_rank: Super Contributor
timestamp: September 25, 2016, 12:19:26 pm
content: Quote from: SeanB on September 25, 2016, 12:01:53 pmI had also some 4066 laying around, but when I saw the HC14 I thought that would be easier. I'm not so sure I could manage with a single 4066 in my case.The remote unit has got a nice 5V rail for the VFD display controller, when the ampli is off a (dimmed down) clock is displayed so that's no problem!My first though was actually to simply use a relay off the USB port, but unfortunately the ampli will forget some of the settings if completely disconnected from mains.

author: Ian.M
author_rank: Super Contributor
timestamp: September 25, 2016, 01:54:08 pm
content: This is probably the absolute crappyest way it *could* be done with minimal discretes. It needs sharpish rise and fall times on USB Vbus so wont work in real life unless its a blue moon, with the wind in the east and your tongue held just right!However the simplest non-MCU solution would probably be the correct brand of 74HC05 hex open drain inverter, Diodes Inc. saytheirshas Schmitt triggers on all inputs, + a handful of passivesOf course the sane way to do it is, as you realised, the smallest 5V MCU you've got. However it my be possible to save one component by using the MCu's internal pullup resistors for the optocoupler. Parallel a couple of inputs if you need more pullup current than one can provide!

author: newbrain
author_rank: Super Contributor
timestamp: September 25, 2016, 04:45:33 pm
content: Quote from: Ian.M on September 25, 2016, 01:54:08 pmThanks Ian!I was not sure I could use the internal pull up with the comparator, but it works perfectly: so it's now down to three components.Your fully analog circuit is quite clever, but I would be out of luck: no p-channel MOSFETs in my drawers, and the Vusb on the TV seems to switch on and off quite slowly.One question, though: the 1G resistor is just to keep LTSpice happy, isn't it?The HC05 solution still uses 13 parts (if I'm not mistaken), you spare the diodes, but there's pull-ups aplenty!And the only 74xx05 I have is LS, and about 3000km from here...Screenshots for both solutions included.

author: Ian.M
author_rank: Super Contributor
timestamp: September 25, 2016, 05:47:21 pm
content: Yes, I've gone fairly wild with the pullups on the 74HC05 version as I wanted a separate timing stage for a well-defined pulselength. If a shorter and more variable pulse is OK you could omit everything to the right of U1C ,U1D and set the timing purely by the differentiator caps, which gets it down to 8 passives total (10 parts).Quote from: newbrain on September 25, 2016, 04:45:33 pmYes the 1G resistor is your basic 'all parts of this circuit are on the same planet' resistor to stop the SPICE engine freaking out. You can get rid of it if you set the parallel resistance of C2 appropriately. You can also do stuff like removing the sources and load from the main part of the schematic and connecting them by named nets if you want it to look more realistic - e.g for explanations to novices. I've moved all the stuff needed for simulation off into a box on its own but that's purely cosmetic . . . .I should point out that a further problem with it is those 10Meg resistors - it wont take much surface leakage to FUBAR it so don't expect it to work well in a humid climate!

author: newbrain
author_rank: Super Contributor
timestamp: September 25, 2016, 06:30:45 pm
content: Now it's installed, and it's working (we'll see with time...)In the end, even cutting the veroboard was too much hassle, for 3 components: there are enough bypass caps in the remote unit, and the wires are very short...So I just assembled the whole thing on a narrow 24 pins DIP socket...and taped it to the back of the remote (no space inside, unless I go for SMD).ATtiny84 code attached, worked atfirstsecond (I forgot thesei();) try.