[sdiy] Rotary Switch -> illuminated PB w/ multicolor LED?

Brian Willoughby brianw at audiobanshee.com
Wed Feb 16 07:10:02 CET 2022

Bad idea to wait for the supply voltage to drop before writing to non-volatile memory, because the write operation requires more power. It will not be reliable unless you completely over-engineer the supply to be able to sustain sufficient power after it's turned off. Sure, it can be done, but there are other ways to solve this that don't increase size and cost of the circuit.

Some of the modern non-volatile devices have onboard firmware that detects drooping voltage, and actually refuse to write to the NV memory unless the power is at full levels. They'll cache the data in internal SRAM and only write it after power is restored. If power is never restored, that data is lost rather than risk starting a write operation that cannot be completed due to falling power.

An easier approach is to set a timer every time the value is changed. If the user changes the value before the timer expires, then simply restart the timer from the beginning again. But if the timer expires without any further changes, that's a good time to save the most-recent value. There aren't many musical uses for changing a setting right before turning off the power, and users probably won't be upset if such an erratic change is lost. In contrast, if the value if left steady and used musically for a while then it makes sense for it to be retained. You can choose whether the timeout is 1 second, 10 seconds, 30 seconds - anything that makes sense for the typical workflow.

The replies about EEPROM versus Flash are correct. An EEPROM will last through 10 times as many writes as a Flash device. Some of the high capacity devices are actually 1/100 of an EEPROM's duration, but I doubt anyone is putting 16GB of NV memory in a module. The only downside is thet EEPROM memory sizes are much smaller, but that won't affect storage of a 2-bit or 3-bit setting. Many PIC and other micro controllers have both Flash and EEPROM for code and settings, respectively.

But, yeah, nothing beats a mechanical rotary switch ... provided the price is reasonable.


On Feb 11, 2022, at 13:05, Roman Sowa wrote:
> Power off and one button + LEDS was discussed here exactly 8 years ago.
> There's no endurance issue, because how many times do you plan to turn off the modular? Some people never do it at all. But let's say everyday for 40 years, so that's still about 15% of typical EEPROM endurance in microcontrollers, and probably less than 1% of standalone good quality EEPROMs.
> EEPROM should be written only when supply voltage is detected to fall below some threshold. Those 8 years ago I've made an example with PIC12F683 and even posted video about it. Of course at the moment you can forget about getting any PIC12F683, but it can be rewritten to anything else with self-writing capability.
> Surely nothing beats Grayhills, although for me they are too stiff for 1/2'' knob. OTOH the already mentioned NKKs work with perfect feel.
> Roman
> W dniu 2022-02-11 o 18:52, grant pisze:
>> I haven't found one small enough and even the closest competitors seem
>> like $10+ (recent prices).  The Grayhill 56 series is pretty tiny as
>> rotary switches go.
>> The other thing that's nice about a rotary switch versus an electronic
>> pushbutton/MCU/LEDs is memory. Not only does the switch already tell you
>> what bank you are on as you switch it, but it remembers it when the
>> power goes off.  :-)  So that needs to be factored into the MCU probably
>> (EEPROM or emulation in flash, but endurance could be an issue).

More information about the Synth-diy mailing list