1
\$\begingroup\$

How can I, by analog means, use a single-pole multi-position rotary switch to both mimic a 100 kΩ logarithmic pot AND progressively / evenly light a circle of LED position indicators from 1 to X and then back to 1 (rotary switch goes back to 1 after X)? Pretend the diodes surround the rotary switch and will indicate movement of the switch until all are lit.

To complicate matters, I'd like to use some Edgelec common cathode tri-color LEDs which are R-G-B constant lighting (Red: DC 2.0 - 2.2 V; Blue & Green: DC 3.0 - 3.2 V (IF = 20 mA) / 0.06 Watts / 2-pin / DIP LEDs) so it is a cathode with 3 anodes in one component.

I would like to have the first third light up the blue LED, then switch over all bulbs to the green LED for the 2nd third also switching the first positions from blue to green, and similarly for the final third of the rotation all LED lights switch to red.

trifecta

As a resource: https://learn.sparkfun.com/tutorials/rotary-switch-potentiometer-hookup-guide/all and: https://cdn.sparkfun.com/datasheets/BreakoutBoards/Rotary_Switch_Potentiometer_v10.pdf

By using resistors to step gain up in 6db increments, I believe that using the rotary switch I can replicate the behavior of an analog logarithmic pot. My goal is to create a stepped 100 kΩ logarithmic rotary pot for use as a master volume control on a 4-channel, powered, miniature summing mixer which has a preamp, a 4 in to 1 out mixer, and a power amp section - each driven by one of three 4580 op amp chips. Each of the 4 inputs has its own volume control, but there is no master volume.

I already have some single-pole, 8-position rotary switches

https://www.adafruit.com/product/2925

but I am considering replacing them with 12-position switches to have a finer degree of gain adjustment. The mixer is powered by 12 Vdc so that will be my source.

https://www.amplifiedparts.com/products/switch-rotary-1-pole-12-positions-14-shaft

Since in theory, however many positions are on the switch, it should be the same logic which supports or disqualifies the possibility of achieving the desired result. I suppose using the 8-position as frame of reference would be best - but that is to say I am undecided on which switch will ultimately be used, so more a general understanding of "is there a way to do both with one switch" is the gist of the question.

Unfortunately, I am overambitious and under-educated so please be gentle.

As for lighting the LEDs with a rotary switch in the simplest manner possible, I am referencing this Stack Exchange post:

wire rotary switch with leds that turn one at a time

I do realize that my questions have very little to do with that answer, it's simply a frame of reference. Thanks for your patience. Please explain any answer as though Homer Simpson was your target audience.

\$\endgroup\$
2
  • \$\begingroup\$ I know your requirement is "by analog means" - but really ... just use a microcontroller. A rotary encoder (with detents for that "physical" feel), and a digi-pot for the volume control. Driving the LEDs is ofc child's play. It'll be 1/10th the size and complexity. Maybe less. \$\endgroup\$
    – brhans
    Commented Dec 5, 2022 at 2:17
  • \$\begingroup\$ As I have zero experience with microcontrollers, programming, or any means which does not involve connecting components, please expand on how one would do that from step 1 through however many steps it would take, and in the meantime I'll make us children a pot of coffee. thank you for your patience and input. \$\endgroup\$
    – shigginpit
    Commented Dec 5, 2022 at 2:24

2 Answers 2

0
\$\begingroup\$

To control the LEDs you can use diodes acting as OR gates to light up each LED only on desired switch positions. LEDs that are always on and off together can be wired in parallel (through their current limiting resistors).

Here's the circuit:-

schematic

simulate this circuit – Schematic created using CircuitLab

You may notice that some diodes are not strictly necessary. However including a diode in the path to every LED ensures that they have the same brightness in different switch positions. It may also help in the next part...

The potentiometer function would be easy to implement if the switch had two poles. Such switches are available, but if you can only use a single pole switch you need a way to isolate the analog signal from the switch (which is already putting out DC voltages to operate the LEDs). One way to do that is use analog switches like the CD4066, which has 4 digitally controlled switches in a 16 pin package (so you would need two ICs). Each analog switch would be wired to its associated rotary switch contact like this:-

schematic

simulate this circuit

Note that I have only shown 1 analog switch, and a blank box representing the next one. You would have 8 of these connected to the 'potentiometer' resistors.

Each analog switch in the CD4066 is turned on with a logic '1' (+5 V when the IC is powered with 5 V) on its digital input. When the rotary switch is on another position R1 pulls the voltage down to logic '0' (ground) to turn the analog switch off. Thus the analog switches mimic a second pole on the rotary switch.

There is an LED (or several) connected to each rotary switch position too, but it is isolated by the diode in series which prevents back-feeds from other LEDs. This diode is part of the LED control circuit.

For the analog switches to work properly the signal voltage must be kept within the supply rails (0 V to 5 V). The 2.5 V source at the base of the pot resistors provides a bias voltage to do this, and the coupling capacitors C1 and C2 block DC voltages in the audio path which might upset it.

While this should all work fine, I don't recommend it because mechanical switches are prone to contact bounce and noise which may be audible, and the contacts tend to oxidize and become unreliable. Also the 8 switch positions may not be fine enough for discerning users.

\$\endgroup\$
1
  • \$\begingroup\$ I'm accepting this answer because in looking it over Bruce Abbot is obviously correct and brings to light inherent problems with the fundamental thought process behind both using a single pole rotary switch to serve both functions as well as using a switch with so few positions. So, thank you. That being said, how would I simplify the second part of your answer, removing the mechanical switches to replace the absence of a second pole, and instead use a 2 pole 12 position switch for better effect? I believe the 12 pos would be sufficient since each channel has its own level individually set. \$\endgroup\$
    – shigginpit
    Commented Dec 5, 2022 at 8:00
0
\$\begingroup\$

This is my "frame challenge" answer which ignores your "by analog means" requirement.

schematic

simulate this circuit – Schematic created using CircuitLab

As you can see, it is significantly simpler than anything you'd be able to achieve in the analog domain with lots of discrete components.
The Rotary encoder produces a quadrature output which your MCU decodes into a direction & number of steps turned. This can be done in code, but some MCUs have a dedicated peripheral module which does the conversion for you which would allow you to just read a number from a register (after configuring the module).
As I mentioned in the comment, driving the LEDs is child's play - choose resistor values to set the LED current which results in the brightness you want.
The logarithmic pot is implemented by a digi-pot. I've given some examples (X9119, AD5175) with 1024 resistance steps so that you can choose positions which fit more closely to your desired log curve, but if you're not overly sensitive to the precise shape of the log curve you could get away with less expensive and more easily available 256-step digi-pot options.

\$\endgroup\$
6
  • \$\begingroup\$ Significantly simpler is an understatement. But when it comes to implementation, what is an example of a MCU with a dedicated control module? and what is the approximate cost involved in doing it this way with the 1024 and peripheral? I'm not confident I could learn how to code for this project anytime soon, although I understand your answer might be that it is significantly less expensive to go the coding route. I did find fifty 4066 chips for about $11 in reference to the accepted answer's suggestion but I'm unlikely to implement that 96 chip superstructure in order to use a 12 pos switch. \$\endgroup\$
    – shigginpit
    Commented Dec 5, 2022 at 18:22
  • \$\begingroup\$ STM32F100 MCU: $5.66, AD5175 DigiPot: $5.06, PEC12R Rotary Encoder: $1.25. Thrown in some MOSFETS, and some caps & resistors and you'll probably get to around $15 (excluding your LEDs). \$\endgroup\$
    – brhans
    Commented Dec 5, 2022 at 19:55
  • \$\begingroup\$ You'll certainly be able to find other MCUs capable of decoding a rotary encoder's quadrature output in hardware - I'm just using STM32's most often currently so that's my 1st hit. There would also be lower cost options available if you're prepared to go to the extra effort of doing the quadrature decoding in firmware instead. \$\endgroup\$
    – brhans
    Commented Dec 5, 2022 at 19:58
  • \$\begingroup\$ Thank you for all of this - just to be sure I'm clear, the video linked on digikey which explains ide cube and the nucleo board, those are the peripheral controls you were referencing, is that correct? Because if I'm understanding correctly, they somehow generate and imbed the equivalent of what code a person would write for equivalent functions on other mcu? Thanks again. \$\endgroup\$
    – shigginpit
    Commented Dec 5, 2022 at 20:19
  • \$\begingroup\$ The nucleo boards are ready-made development kits for some of the STM32 MCUs. STM32CubeIDE is a development environment for writing code for the MCU. It includes all the features of STM32CubeMX, which is a sort-of configuration wizard for the MCU where you can choose most of the device configuration settings using drop-down lists & checkboxes and it will then auto-generate code to initialize the MCU for you. It won't give you all the code, but for something like your project, probably about 50-60% of it. \$\endgroup\$
    – brhans
    Commented Dec 5, 2022 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.