Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Needing help to replace rotary switch with digital circuit

Not open for further replies.


New Member
Hi and thanks to all that help. I am wanting to build a circuit that will take the place of a rotary switch. I like to have one push button for up sequence and another push button for down sequence. The circuit will be off 12vdc battery. The output will control a 5v input that will be set to output different voltages on 4 of the switch options. the 4 switch pin location full 5 volts. Also like each of the 5 outputs to light an LED to indicate position. I hope i described this well enough.

I have search here and not found exactly what I am looking for. The idea is based on this post.
Now the idea I am wanting is like mentioned in #1 poseveryone t. Now post #9 looks good but of course one way and single button. If understand that chip right you put clkinh to the positive side when you press the button it sequence is backwards.

Now of course this controls 10 LEDs. So if i wired the output of the 6th led to the reset it will goto output #1 on that key press?helps

Now the only other thought is once power is removed I believe any device return to output #1 once powered. Probably not a big deal but be nice it retain memory of position. Of course if not a power hungry circuit it may not drain a car battery over night. The best I idea for that to me is turn off the LEDs and the output the relay to limit to bear minimum power draw.

The way I see it the output powers a LED and a relay coil to the switched item. So I like the design of the #9 drawing but like up and down sequence control, limit to 5 outputs, and if possible retain last switch location.

Thanks to everyone that helps.
I don't know your level of experience so for now I'll leave my suggestion of chips to use. If you need help with the implementation post back.

I recommend a 4510 BCD up/down counter and a 74154 4-Line to 16-Line Decoder/Demultiplexer. The mentioned selection of chips will allow you to have all desired features for your project.
Thanks for the help. I will look them up and see what I can figure out from them. I am by no means and electronics expert but I have built simply circuits from plans and try to understand the functions of the devices and to what the input is and the finally output being. If you have and idea using them and welcome to share I thank you. From the search on here it looks pretty good way to do it. So you any help on a circuit using them to display and control relay or use some other device to make the switch item that be great.

Thanks again for all your help.
Last edited:
Well being playing around and have got this to work as either up or down change the U/D input as needed. I think I can design something to actually use to seperate buttons for for up and down but trying to figure out if it possible that the circuit always starts on 1 at power up instead of 0 on the display. Any help be great. Also I thought once it hit 6 I could make it go back 1 on the display by sending power to the reset.

Thanks for all that help.


  • test1.jpg
    35.8 KB · Views: 1,963
Last edited:
might help if you let us know what you are building?

I see you mentioned automotive. that presents another aspect of design as an automotive electrical system presents an electrical enviroment that dosn't like electronics. Lots of noise and varying voltages to start out with.
I myself am confused?? you want 7 segment digits or just LEDs??
you do want up/down controlled by one push-button
memory would be nice
but what is this creation
it would help
Ok I have put this together to do the following.
1. The up button to increase one increment

2. The down button to decrease one increment.

3. The reset button to start back to output 0. The is not needed for the project.

4. A 7 segment display showing which output is on.

5. On output #6 of 4528 I send to reset of 4510 to start back to zero.

6. The LEDs on output of the 4528 will be replaced with relay coils.

Now the issue I have runned into.Timer
1. I want to not start on zero. i want to start on 1.

2. I only want to use 1-5 outputs

3. So if i up to 6 output it will goto number 1 and skip zero.

4. Another option if i turn off power it would be nice if I could repower the circuit to the previous out whether 1,2,3,4,or 5.

5. Now of course maximum voltage to not blow the 4511 IC is 7volts. I plan to use 12volts so wonder what to use to get from 12vdc to 5 vdc. For that I am thinking of a circuit like this. Simple 5V power supply . Known of a better way?

6. Is there a better solid state circuit to make a switched contact other than using a relay?

Want to Thank the OP in post #7 for the up and down button sequence.

And this link for part of the 4510 and 4511.
**broken link removed**

Thank you for all the help.


  • test2.jpg
    76.9 KB · Views: 1,303
Thanks for the help MrDeb. I was trying to post yesterday with picture but the forum server was flakey and not allow attachments.

Post #6 has got me close to what I am after. The 7 segment LED is not needed but is nice idea I have be playing with. Ok I see what you mean by noising electrical system. Figure I could use a capacitor to level out the noise but may be wrong on that. Now if I figure out how to start on 1 instead of zero that be great. I say it has to do with the inputs but figure that out yet. Memory not a big deal but is just a thought. Just one more nice thing to add. The time delay for up and down can be done on a cd4093. Just not one in the yenka stuff I have been toying with. So single components there.

Again thanks to all that help.
Last edited:
OK I been messing with it more. I added some and gates to trigger a reset of the circuit if it hits output #6 if going forward and output #9 if going backwards. But once it hits output 0 I have sent the output to the UD pin on 4510BCD but if the UP button is pressed to long it locks to zero till I break the circuit from output #0 on 4028 and UD. It is not drawn there but that does work as long as not press to long on the UP button. Just lost as to what I can do there.

thanks again to all that help.


  • test3.jpg
    78.6 KB · Views: 858
Ok been making changes. I seen a circuit in this post #17 .

Now I need to add debounce circuit to each up and down switch. I think I can do that but not much luck yet. Know trying to figure out a way to skip zero output on power up and make output 6 revert back to output 5. So all that works is 1-5 output.

Issue with the other circuit it lock if down or up button pressed to long.

Thanks for any input.


  • test4.jpg
    60.4 KB · Views: 1,005
Ok I figured out how to make it goto output 1 on startup and also if your on 1 and try to go backwards. Same for output 6 making it go back to 5. Happy with the results.

Now I need to figure out a debounce circuit for the up and down buttons.
Any help on this be great.

The output of 4028 will goto relay coils or I believe I can use a solid state relay. Anyone think that be a problem.

The device controlled has 5volts coming in and and using resisters to vary from 0 to 5 volts to the 2-5 position on the switch. I have that info based on the manual rotary switch the device uses.

Also this is going into a truck so I need to go from 12volt to 5vdc.
I hear there is some noise on 12volt circuits but if tap at the battery will that help?
If not what would you add to clean it up?
This is on a 2007 truck so I figured it would be pretty clean to start with all the modules they use in GM vehicles.

Thanks for all the help again.


  • test5.jpg
    75 KB · Views: 686
Last edited:
possable solution to 0

decode the outputs of the 74192 using gates (decode when 74192 = 0 then it clocks the 74192 once.
preset the counter using pins 9,10,1,15 (D, C, B, A )
also, using a 7400 gate as input you only need a single up-down input
LOW = up
HIGH = down
Mr Deb is your post #11 based on the latest revisions I did to post #10. Please re read it to make sure what you are talking about. I will not alter it any more. I like the way I got the limits set to output 1-5. I see what you are saying but you may be referring to my post #9.

Would a capacitor across the up down switches be enough for a debounce circuit and if so what size would you say.

Again thank you for your time.
one up down plus no 0

here is the start of a programable up down with 0 detect so when 0 is present at outputs it automatically goes to 1
same basic circuit as you posted, just add your display
a 74154 would be ideal for your leds


  • updown counter.PNG
    updown counter.PNG
    27.2 KB · Views: 1,024
OK I need some finally input on my circuit.
* It does start off at zero output but quickly goes to output 1 on the 4028 IC.
* Then as one presses Down switch at output 1 it goes to zero and back to 1.
* Also when pressing UP switch at output 5 it goes to 6 and back to 5.

Now not sure.
* Does the debounce circuit I built look good or would you recommend different resistor and capacitor values?
* I assume the debounce circuit would work good.
* I asume no problem using a solid state relay on the outputs of 4028?
* Would one use less gates or different gates to achieve anything better?
* Also I need help on 12vdc from an automobile to 5vdc to circuit. My concern I hear of is noise on the 12volt system. But not sure a big thing with this going on a 2007 GM truck. Not sure if a 12vdc to 5vdc regulator circuit be enough. I can tap power at the battery to make it cleaner if that will help.

Now the design is to replace a rotary switch that has a resister on 2-5 pins to vary voltage. Pin 1 would be straight through 5 volts. That portion is no problem I have that covered.

Over all it does everything I need except the memory of the position if power is lost. But to do that I say it be an entire new design that at this time is above what I have learned here and search on google. If you know of a way I thank you for the help there.

Thank you to all that have helped.



    13.1 KB · Views: 241
  • test6.jpg
    82.8 KB · Views: 1,045
Last edited:
Sorry there MrDeb I did not see your post till I made the post before. I will check it out. I had made the following debounce before I seen your post. I do thank you for your time with me. Making this circuit has helped to understand gates and how IC works. If you get a chance check over my post #14 with the remaining question I have.

Thanks to all input.
Here is a thought on the 12vdc to 5dvc. Could I use one of those ready made adapters like used to power Ipods from cigarette lighter socket? I have a few around that come with stuff I don't use plus I got some old charger for cell phones as well. Think be quick and simply?


I have a 2005 GM truck, and I am trying to build the same circuit for my truck too. I am guessing that this is to replace a DSP5 rotary switch. Anyways, I'm sorry, but I dont have much input for your circuit, but think its a great idea. I have a limited knowledge when it comes to building simple circuits which is why I had to research this one on the forums. I would like to build one of these as well, and I noticed it has been some time since your last post in this thread. Did you end up getting this circuit to perform as desired? If so, do you have any pointers for me when I start building mine. Thank you in advance.

Not open for further replies.

Latest threads

New Articles From Microcontroller Tips