Projects

Automating a Touch Dimmer Switch

Written by Alice Easter | Jan 9, 2023 5:30:11 PM

Working with AC electricity is always a risk. Every time I do it I make sure I do tons of research, write out diagrams of everything I'm doing, and test out circuits virtually where possible. When working with computer circuits, vehicles, or electric bikes are all fairly safe, but once I tap into the power of a wall outlet I inherently put myself at risk of death via electric shock.

With all this in mind, I've been trying to regulate lights automatically as of late, and I searched far and wide for the safest way to do so without hurting myself or burning down my house. In my exploration of options, I ran across the common touch dimmer switch.

Also known as the 3-phase switch, the touch dimmer switch allows for a safe way to regulate AC electricity to a light bulb. The three phases are low, medium, and high, and there is a zero-phase of off. Coming in at $6, this seemed like a cheap, safe, and effective way to do what I needed to do.

 

Figure 1: Touch Dimmer Switch

 

Touch lamps were popularized in the 70s and 80s, and anyone who lived through that era or had immediate family who did can probably remember the magical feeling of just touching a random part of a lamp to turn it on. While they aren't as common today, in their era they swept across the US due to their novelty. As a child, I thought this type of technology really did work off of magic, and considering how it's influenced the world it just may be. 

The concept that the touch dimmer switch works off of is capacitive touch, the same principal that your smart phone's touch screen uses. This tech utilizes the fact that the human body is effectively a really small battery. Your body has about 100 pico-farad of battery capacity, or capacitance, to it. When you touch your phone, that capacitance can be read to indicate a touch. With the touch dimmer switch, we connect the touch sensor wire to the metal of the lamp, so you can touch it anywhere to connect your body's capacitance to the circuit.

Now, what's interesting about capacitive touch is that it's something that we can generally fool. YouTuber The LabOtomy has a great video about utilizing large pieces of metal to trigger a touch screen. What's happening here is that utilizing a large enough piece of metal will ground the circuit. I decided to use this concept to facilitate my usage of the dimmer switch, albeit a bit differently.

 

Figure 2: Touch dimmer switch wired into micro-controller circuit

 

Instead of using a large piece of metal, I wanted to connect everything to a micro-controller I had lying around. In this case, I went with the RP2040 Feather by Adafruit, and the process was fairly simple. At first I connected the touch switch to ground via a relay module, but I realized that I could accomplish my goals faster by directly connecting the touch sensor wire to a pin on the micro-controller and swapping that pin between input and output to trigger a touch. 

 

@codewonderland regulating ac current with a microcontroller and a dimmer switch! #techtok #electronics #engineering #circuitpython #adafruit ♬ original sound - Alice Easter

 

After I got the basic code working, I added in a little bit of logic to keep track of what state the light was in, a calibrate function in case the internal state gets out of alignment with the light state, and then I could swap to whichever state I wanted on command.

I plan to use this setup in a few different upcoming projects, but for now this has definitely been a successful research venture on cheap and safe AC regulation. Stay tuned to see what this ends up turning into!