207Views2Replies

# Logic gate set up with basic principal of "A is I: B is I for 1 click, then O//A is O: B is I for 1 click, then O"? Answered

I've been looking about for awhile now for a solution to this little puzzle I've managed to get myself into. I know the question may have failed to be a proper logical statement, but basically, this is what I need:

When input a is on, output b will toggle on for one second, then toggle off. When input a then goes off, output b will then toggle on for one second, then off. Basically, when the input state changes, the output will go on for a second, then off.

I know the opposite can be done (that is, one second input toggles a on output, or visa vers) with flip-flops, but doing this is a bit outside my realm. Any help would be fantastic! Thanks in advance!

Tags:

## Discussions

What you want is called a "one-shot" or a "monostable".
The easiest way to do it is to use a 555 timer. You can do other clever stuff then by cascading multiple one shots.

I said that I had some ideas about how to make this work, and I decided to go ahead and try these ideas,  using an old mp3 player, plus some other junk that I have.

My crank sensor

The crank sensor I built starts with an optical encoder wheel from an old computer mouse.  The output from the phototransistor conveniently has a minimum lower than (1/3)*Vcc, and a maximum higher than (2/3)*Vcc, so I just feed that signal to the comparators on a 555 timer, and the output from the 555 is nice clean pulses.  I feed those pulses to a voltage doubler, and feed the output from the doubler to another 555, again using a 555 to give me a nice, square, de-bounced signal.

Because the voltage doubler is AC coupled (notice the capacitor in series with its input), the input to it must be changing, i.e have some AC in it, to get any output.  Thus,  when the mouse-wheel stops turning, the doubler output goes to zero.

Play/Pause signal [ > ||]

The Play/Pause signal is generated by a circuit that detects the low-to-high (rising edge) transition of the crank signal, and also the high-to-low (falling edge) transition, and then logically "or"s those two together.

To get a pulse that occurs on a low-to-high transition,  I use a high pass RC filter, followed by a CMOS inverter.  The width of the pulse is proportional to R times C.  Choosing R= 10^6 ohm, and C =10^-7 farad, gives a pulse that is close to 0.1 seconds in duration.

To get a pulse on a high-to-low transition, I do the same thing, except invert the input first.

Then I "or" those two signals together using some fakey diode-resistor-logic, followed by another inverter, and that works.  This is easier than bringing in a whole new IC, just to do the logical OR.

As you can see from the attached circuit diagram I managed to use all six inverters on the CD4069, and that's usually not hard, because inverters are so handy.

Transistor and push button

It turns out for the play/pause button on my mp3 player, one side of this button wants to be pulled low, to the mp3 player's ground, which is, the way I'm defining it (and the way it is usually defined),  connected to the negative terminal of the mp3 player's battery.

So I connect the ground of my circuit and the ground of the mp3 player, and I connect one side of that button to the collector of a NPN (2n3906)
transitor.  Turning that transistor on, does the same thing as pushing the button.

Also I put another push button of my own in parallel with this transistor (from collector to emitter), and it does the same thing.  It's there because it is easier to reach than the button on the mp3 player.

Picture and video links
video
https://www.instructables.com/file/FCDEHL6H6MF2Y3L/

pictures
https://www.instructables.com/file/F556408H6MF2Y3F/
https://www.instructables.com/file/FW3FJUNH6MF2Y3N/
https://www.instructables.com/file/F3VEG6FH6MF2Y3D/
https://www.instructables.com/file/FU1JKVAH6MF4BBY/
https://www.instructables.com/file/FZS9XP4H672TD0P/