Led flashing when contact... challange to make it small

Papabravo

Joined Feb 24, 2006
21,159
You did not say there was an error in the schematic or any of the component values. Would it make a difference if I change the frequency or dutycycle of the ON/OFF state of the switch U1? The pulses at V(OUT1) on the edges of the clock U2 are 3-5 μsec wide.
 

sghioto

Joined Dec 31, 2017
5,379
Yes with the values of the caps listed the duty cycle of Vin is important. You have the switch pressed 5 times a second which explains why the LED is mostly on.
Try setting the duty cycle at 1 sec on and 1 sec off.
 
Last edited:

Papabravo

Joined Feb 24, 2006
21,159
I see it now, there has to be enough time for V(g1) and/or V(g3) to decay from approximately Vcc to Vgs(th)
1678504248421.png
I had to change the component values from the schematic you posted in post #12 in order to get observable behavior on both edges. In particular R5 (my schematic) needs to be much larger than 10K. You could have been more forthcoming about the necessity of choosing the component values appropriately. I naively assumed you had chosen them appropriately for the button pressing exercise.
1678505045048.png
Had I tried to breadboard your post #12 it would have been a major fire drill for days trying to understand what was going on.
 

sghioto

Joined Dec 31, 2017
5,379
The TS only mentioned a flash duration of a fraction of a second and with a supply voltage from 3 to 12 volts. It's hard to select exact component values with those specs and certainly didn't expect someone pushing the button 5 times every second.
 

Papabravo

Joined Feb 24, 2006
21,159
The TS only mentioned a flash duration of a fraction of a second and with a supply voltage from 3 to 12 volts. It's hard to select exact component values with those specs and certainly didn't expect someone pushing the button 5 times every second.
A fast typist can hit that speed without breaking a sweat. 200 ms with a break and a make is about what you might expect on a keyboard. Also you did not specify VCC and that has a considerable effect along with Vgs(th) for the FETs. Having some idea of pulse width and duty cycle would have been helpful. No matter it became clear after playing around with it for a while. It's all good.
 

AnalogKid

Joined Aug 1, 2013
10,987
Extracting action from both the press and release of a SPST switch increases the circuit complexity. It pains me to say this, but the absolutely smallest way to do this is with a microcontroller. One 8-pin chip, one switch pull-up resistor (internal pull-up or pull-down resistors have fairly high values, leading to noise pickup), and one decoupling capacitor. That's it. Detecting both the switch press and release, debouncing both switch transitions, setting the flash period - everything is done in firmware.

You don't say if you can do SMT (surface-mount) assembly, but either SOT-8 or DIP parts are less than 60 cents in ones (!!!).

https://media.digikey.com/pdf/Data Sheets/Atmel PDFs/ATTINY11,12_summary_Rev07.pdf

You don't say what the LED current is. This part has 6 I/O pins. It might be able to drive one LED per pin, eliminating an external driver transistor.

ak
 
Last edited:

Papabravo

Joined Feb 24, 2006
21,159
Extracting action from both the press and release of a SPST switch increases the circuit complexity. It pains me to say this, but the absolutely smallest way to do this is with a microcontroller. One 8-pin chip, one switch pull-up resistor (internal pull-up or pull-down resistors have fairly high values, leading to noise pickup), and one decoupling capacitor. That's it. Detecting both the switch press and release, debouncing both switch transitions, setting the flash period - everything is done in firmware.

You don't say if you can do SMT (surface-mount) assembly, but either SOT-8 or DIP parts are less than 60 cents in ones (!!!).

https://media.digikey.com/pdf/Data Sheets/Atmel PDFs/ATTINY11,12_summary_Rev07.pdf

You don't say what the LED current is. This part has 6 I/O pins. It might be able to drive one LED per pin, eliminating an external driver transistor.

ak
All of this is true and I never got around to playing with the switch bounce generator to see what effect it would have.
 

ElectricSpidey

Joined Dec 2, 2017
2,758
If the OP wants to use 12 volts they will also need a regulator...something a lot of people recommending micros tend to forget, when bragging about component count.

Of course, they could always use a dev board...but kind of defeats the purpose.
 

ElectricSpidey

Joined Dec 2, 2017
2,758
This is my version using a SPST button instead of the SPDT.

Additional components: 1 transistor, 1 resistor.

1678566402699.png

This one is just to clarify how to wire a SPDT button.

1678567173955.png

Here I was just refreshing my symbol skills a little, but I also wanted to show the waveform at the trigger.

1678568414495.png
 
Last edited:

vu2nan

Joined Sep 11, 2014
345
Here's a simple circuit employing an electromagnetic relay and an electrolytic capacitor.

A single-pole, two-way, momentary push button switch is required.

The LED will flash, momentarily, as the capacitor charges in one position of the switch and again as it discharges in the other.

1.png

The capacitor and relay coil resistance values determine the time constant.

Nandu.
 
Last edited:

ElectricSpidey

Joined Dec 2, 2017
2,758
@sghioto
So, I was able to remove the diodes on the SPDT version after adjusting the switches to act more like a manual switch.

(Can you tell I'm still a total LTSpice noob?)

I was also able to remove one of the diodes on the SPST version.

And yea, I was able to remove R1 on both but not R7 on the SPST version.

So instead of reposting the work I'll wait to see if the OP has any interest in my versions.

Thanks for the suggestions.
 

Thread Starter

Piastrengo

Joined Mar 10, 2023
8
Wow thanks everybody so much.
I have update and more space for the components.
I understand now the flash pulse has to be more and more a fraction of a second, as they might be very near pulse to pulse (trigger to untrigger). Even 0.001sec and in order to see the light, do you think a single powerful LED will be visible in a dark room?
 
Top