It seems like tinkerers are always being tapped to build or repair exhibit hardware. This time around it’s [Dino’s] turn. He’s been asked to alter a light bulb efficiency demo so that it includes an LED option.
The idea here is that you crank a generator to power different types of light bulbs. There’s an ammeter built in, but possibly the best feedback is knowing how hard you have to crank to illuminate the most inefficient choice. As it stands there is a toggle switch to choose between incandescent and CFL bulbs. [Dino’s] solution is to use a three-position rotary switch. He removes the toggle switch and replaces it with a socket for the LED bulb. A new location for the rotary switch is chosen and he does a bit of work to get it mounted securely. If you haven’t worked with this type of switch before he takes the time in the video after the break to explain how they work.
Continue reading “Light bulb efficiency exhibit updated with LED bulb option”
[hw640] has put together a well written and detail packed explanation of how to interface with a digital rotary switch. These digital opto encoders have just two outputs with four possible logic levels (00, 10, 11, 01). The relative position of the switch is insignificant but the direction of rotation is what matters.
The short and dirty: Each of the switch’s 2 output pins is attached to a pin change interrupt on the microcontroller. Every time the switch moves it generates either a rising edge or a falling edge on one of the two pins; both edges cause an interrupt. By checking which pin caused the interrupt, then comparing the logic levels of the two pins after that interrupt, we can determine the direction the switch was rotated.
Although this explanation uses a PIC and code written in PicBasic Pro the concepts are discussed in the abstract and would easily be adapted to an AVR or another microcontroller of your choice.
[jefffolly] published some straight forward plans for a passive volume control. It uses a resistive ladder built across the contacts of 12W rotary switches. Each resistor provides a 5dB difference, and he recommends using 0.1% tolerance resistors to maintain accuracy. The use of discrete resistors instead of volume pots means that the output is much more predictable. All of the RCA sockets were connected using oxygen-free copper wire.