Swap between 2 laser diodes via 1 momentary switch

Ya’akov

Joined Jan 27, 2019
10,259
Tlc555 states Timer. Can I just double check this doesn't swap on a timed Self program, only via switch input?
The 555 is a "timer" because it's output changes according to the capacitor and resistor used externally. The IC only has circuits that compare the values of inputs and switch things. It doesn't have a "program" of any kind.

The external wiring and component selection determines its behavior.

In this case it is wired as a bistable multivibrator which is a circuit with two states (bi-) that switches between them and holds (stable), so when it is triggered it switches states. People will also refer to them as flip-flops or latches.

A monostable multivibrator has one stable state, and switches to the other temporarily when triggered. It is also called a "one-shot", it generates a pulse.

An astable multivibrator switches states constantly, it is a sort of oscillator.
 

Thread Starter

CobraSteve

Joined Feb 10, 2022
17
The flip-flop circuit was taken straight off the internet.
I patched it a bit.

Pin-4 is reset
pin-6 is set
pin-7 is GND
pin-14 is +V power

The second half of CD4013 is not used.
Connect pins 8, 9, 10, 11 to GND.

The two diodes are your A and B laser pointers.
Value of R is selected to limit the current to the lasers if your supply voltage is higher than 3V.
Transistors are 2N3904.
Base resistor is 470-1kΩ.

View attachment 260333
May try and make this one too. Starting to learn more as we go.
shame there is nowhere to buy these circuits in tiny form l
The 555 is a "timer" because it's output changes according to the capacitor and resistor used externally. The IC only has circuits that compare the values of inputs and switch things. It doesn't have a "program" of any kind.

The external wiring and component selection determines its behavior.

In this case it is wired as a bistable multivibrator which is a circuit with two states (bi-) that switches between them and holds (stable), so when it is triggered it switches states. People will also refer to them as flip-flops or latches.

A monostable multivibrator has one stable state, and switches to the other temporarily when triggered. It is also called a "one-shot", it generates a pulse.

An astable multivibrator switches states constantly, it is a sort of oscillator.
interesting. So why would this not work?
https://m.aliexpress.com/item/32795...gobttckcavke17ee85ae7c6e7f252f0b57cb01&gclid=
 

Ya’akov

Joined Jan 27, 2019
10,259
May try and make this one too. Starting to learn more as we go.
shame there is nowhere to buy these circuits in tiny form l

interesting. So why would this not work?
https://m.aliexpress.com/item/32795...gobttckcavke17ee85ae7c6e7f252f0b57cb01&gclid=
Do you see two outputs on that circuit board? There is only one. It is bistable but only provide an on/off functionality. To use it, you would have to add something that switched between the two pointers, all that board can do is switch power on and off when you press the button but you want to switch power between two devices.

You could, for example connect it a small mechanical relay and wire the input to one laser to the NC (normally closed) contact of the relay, and it would get power when the relay was not energized and wore the other to the NO (normally open) contact which would power the other laser when the relay is energized.

In this way, the bistable would switch the power to the relay on and off, and the on or off state of the relay would determine which laser is powered.
 

ThePanMan

Joined Mar 13, 2020
936
lost me on clock signal…..
Any chance of explaining that to a 10 year old? , thats my understanding on the terminology. Sorry.
I won't speak to you like a child. Rather, I'll explain it as best as I can. If I'm successful you'll understand.

A D type flip flop has two outputs and one input. The two outputs are Q and /Q (Not Q). At nearly all times /Q is opposite of what Q is. If Q is high then /Q is low; and vice versa.
The input is "D". Whatever is on D is passed to Q at the rising edge of the clock pulse.
A clock pulse is anything from a timer based clock pulse or someone pressing a properly bounce protected switch. More on bounce to come.

Now, whatever is on D when the clock pulse rises from 0 to 1 - Q will match whatever is on D. Meanwhile, /Q switches to the opposite state. By looping /Q back to D, the output of both Q and /Q will switch back and forth with each rising edge clock pulse (or switch press). The moment the clock goes high the state of D is passed to Q. /Q switches to the opposite state and presents it to D. However, it's the rising edge of the clock pulse that makes Q match D. So even though D changes after the clock pulse, Q will retain whatever D was when the clock pulse came.

So assume D is high. A clock pulse comes along and changes Q to high. /Q switches to low and presents a low on D AFTER the clock pulse rising edge. D is now low but Q remains high because that was the last state D was at when the clock pulse rose. Sending another clock pulse via a momentary switch will then take whatever is on D and pass it to Q. /Q will switch state and D will change AFTER the clock pulse rising edge. Each time you press the button essentially /Q is being presented to Q via the state of D. So with each press of the button you toggle back and forth from Q being high and /Q being low - to - Q being low and /Q being high. Back and forth every time you push the button.

I mentioned a bouncing switch. Yes, the contacts DO bounce every time they are closed. Those bounces can present several to a hundred or more clock pulses in a very short time. Because the flip flop can change state as fast as the switch can bounce, you won't be certain of the final state when the switch stops bouncing. So you need to debounce a switch in that scenario. I believe a cap needs to be added to the circuit to absorb the bouncing so that the clock sees essentially a single clock pulse. I've never been good at debouncing switches so I'll leave that to someone else to explain bouncing if need be.

I wouldn't attempt to explain this to a 10 year old unless he was exceptionally smart for his age. That's why I'll always treat you like an adult.
 

Thread Starter

CobraSteve

Joined Feb 10, 2022
17
I won't speak to you like a child. Rather, I'll explain it as best as I can. If I'm successful you'll understand.

A D type flip flop has two outputs and one input. The two outputs are Q and /Q (Not Q). At nearly all times /Q is opposite of what Q is. If Q is high then /Q is low; and vice versa.
The input is "D". Whatever is on D is passed to Q at the rising edge of the clock pulse.
A clock pulse is anything from a timer based clock pulse or someone pressing a properly bounce protected switch. More on bounce to come.

Now, whatever is on D when the clock pulse rises from 0 to 1 - Q will match whatever is on D. Meanwhile, /Q switches to the opposite state. By looping /Q back to D, the output of both Q and /Q will switch back and forth with each rising edge clock pulse (or switch press). The moment the clock goes high the state of D is passed to Q. /Q switches to the opposite state and presents it to D. However, it's the rising edge of the clock pulse that makes Q match D. So even though D changes after the clock pulse, Q will retain whatever D was when the clock pulse came.

So assume D is high. A clock pulse comes along and changes Q to high. /Q switches to low and presents a low on D AFTER the clock pulse rising edge. D is now low but Q remains high because that was the last state D was at when the clock pulse rose. Sending another clock pulse via a momentary switch will then take whatever is on D and pass it to Q. /Q will switch state and D will change AFTER the clock pulse rising edge. Each time you press the button essentially /Q is being presented to Q via the state of D. So with each press of the button you toggle back and forth from Q being high and /Q being low - to - Q being low and /Q being high. Back and forth every time you push the button.

I mentioned a bouncing switch. Yes, the contacts DO bounce every time they are closed. Those bounces can present several to a hundred or more clock pulses in a very short time. Because the flip flop can change state as fast as the switch can bounce, you won't be certain of the final state when the switch stops bouncing. So you need to debounce a switch in that scenario. I believe a cap needs to be added to the circuit to absorb the bouncing so that the clock sees essentially a single clock pulse. I've never been good at debouncing switches so I'll leave that to someone else to explain bouncing if need be.

I wouldn't attempt to explain this to a 10 year old unless he was exceptionally smart for his age. That's why I'll always treat you like an adult.
Superb explenation. Thanks for taking the time to educate. Never stop learning.
Really appreciate the helpful comments from everyone!

now I just need someone to create these on a small tiny boards like the chinese flip flops… make and fit into a 15mm tube housing is the next challenge.
 

Thread Starter

CobraSteve

Joined Feb 10, 2022
17
How many do you need? You can get a single flip flop in SMD (surface mount device) form that is 5.3mm wide.
Only need about 10 or 20…
Thats a nice size!
How hard would it be to get these made up onto a tiny pcb? Where should I look?
I dont want something resembling a spider orgy with components fabricobbled together. Tiny micro components not impossible to solder onto a board.
 

djsfantasi

Joined Apr 11, 2010
9,237
Only need about 10 or 20…
Thats a nice size!
How hard would it be to get these made up onto a tiny pcb? Where should I look?
I dont want something resembling a spider orgy with components fabricobbled together. Tiny micro components not impossible to solder onto a board.
Are you looking for someplace to make these for you? Or are you planning on building them yourself?
 

Thread Starter

CobraSteve

Joined Feb 10, 2022
17
Are you looking for someplace to make these for you? Or are you planning on building them yourself?
If someone can make them in the similar form to the flip flops ive mentioned then Id be happy to find out the cost per unit? I wouldnt know where to start after making a spider orgy!
Not scared of soldering tiny surface mount components to a pre made board. Fixed a few broken tracks and rice sized components in the past.
 
Top