replace SPDT with button and indicator

General project discussion / help
Did you make a robotic coffee pot which implements HTCPCP and decafs unauthorized users? Show it off here!

Moderator: phalanx

Post Reply
FoG
Posts: 1
Joined: Fri Nov 03, 2017 9:29 am

replace SPDT with button and indicator

Post by FoG » Fri Nov 03, 2017 9:36 am

Yes, in advance I am a total noob, and I have tried to find this information already. My goal is to replace a single pole double throw switch with a temporary push button circuit. Press once to toggle from one option or the other (also intend to put dual color LED in to show what option is selected). If there is a resource that could help me figure out how this is supposed to work, I would greatly appreciate a point in that direction.

Many thanks in advance,
FoG

theropod
Posts: 97
Joined: Tue Sep 20, 2016 11:12 am

Re: replace SPDT with button and indicator

Post by theropod » Sat Nov 04, 2017 4:11 am

Hey,

If you are planning on driving this application with an Arduino it is a simple thing.

Your code should look to turn on an output pin when the first button push is enacted. When the second button push is encountered that pin is turned off and a second output pin is activated. The loop would constantly be “looking” for that pushbutton input. You would probably be best served to drive those output pins by using the analog input pins. A couple “if-else” condition statements should take care of your needs.

Basically what you would be doing is creating a software (sketch) environment to emulate a latching relay. If you are not interested in using an Arduino a latching relay could be used, but could be more power hungry and rely on mechanical means to achieve your goal.

Make sense?

lyndon
Support Volunteer
Posts: 1607
Joined: Thu Jul 17, 2008 6:37 pm
Location: Minnesota, USA

Re: replace SPDT with button and indicator

Post by lyndon » Tue Nov 07, 2017 8:37 am

Simplest way is to use a 4017 counter with the pushbutton on the Clock input and your LED on the Output 0 output. Connect RESET to ground and Enable to +5V. Each button press toggles Output 0 on and off.

theropod
Posts: 97
Joined: Tue Sep 20, 2016 11:12 am

Re: replace SPDT with button and indicator

Post by theropod » Wed Nov 08, 2017 4:27 am

Excellent use of the decade counter!

I think the OP wanted a single push button to select one of two conditions, unless I read it wrong. This would just require two output pins from the 4017, with self reset enabled, and use the pulse to the counter from the push button to toggle back and forth between option “A” or option “B” driven by the counter (and drive components for larger loads).

Hmm, multiplexing input to Arduino! Hadn’t even thought of using these devices as external inputs. Variable frequency inverter driver?

theropod
Posts: 97
Joined: Tue Sep 20, 2016 11:12 am

Re: replace SPDT with button and indicator

Post by theropod » Wed Nov 08, 2017 5:48 am

Alternatively a simple flip flop circuit could do this, like a 4013. An either-or state is what flip flops do.

http://www.learningaboutelectronics.com ... ircuit.php

Post Reply