Introduction: Make a Sneaky Wearable 'State Change Switch'!

Secretly change settings for your wearable outfits or use this button as a secret prank trigger! Here's a quick & easy tutorial on how to build and program a "state change switch." AKA a button that cycles through different settings. It's super easy and has tons of practical applications!

Read Time: ~ 5 min

Build Time: ~ 30 min

Cost: Super cheap (>$5)

Step 1: Materials

-- Glove (just one.. but you should probably wear two to avoid giving away the secret)

-- Three (3) stranded wire segments (24/26 gauge), approx. 3 ft

Wires should be long enough to reach from your palm to wherever you want to hide the electronics. I hid mine in a belt pouch, but you could also opt for a pocket, backpack, etc.

-- One (1) 10kOhm resistor

-- One (1) pushbutton(aka momentary switch)

-- One (1) 1" x 1" piece of thin wood

Those free wood swatches at hardware stores are perfect!

-- Microcontroller

I used the SparkFun EL Sequencer b/c I was using this switch to select different settings for my Hallowen EL Wire costume. Check out the tutorial to learn how to build your own version of this costume, or you can use this state change switch with any ol' microcontroller for your own awesome project!

Step 2: Build It!

1. Drill holes in a small piece of wood for the button feet.

2. Solder a wire to one of the button legs, and a resistor to the other button leg on the same side. Solder a black wire to the resistor.

3. On the other side of the button, solder a wire to the leg across from the resistor.

4. Test electrical connections, then coat all solder joints in hot glue.

5. Connect the black wire to the microcontroller ground, and the wire on the same side to the microcontroller voltage output (Vcc)

6. Connect the wire on the other side to a microcontroller digital (or analog) input pin (see schematic above), and then onward to programming!

Step 3: Program It!

Most folks that program state change switches use the modular, or mod, operator* to tell different settings apart. It's not perfect, but for how little code is involved it's a good way to cycle through different settings and get back to our original state.

Here's a quick sketch that will allow you switch between three different settings by pushing the button. As is, it's written to switch between three different digital output settings. In other words, if you have a motor connected to your microcontroller, the button will switch the motor from constantly on, to pulsing (i.e. repeatedly on/off), to constantly off, then back to constantly on.

*The mod operator (usually "%") divides the number by the value after the operator and gives you the remainder. For example, if you see: 10%2, it means 10 / 2 = 5, which equals 0, since there is no remainder. Another example is 10%3, which equals 1, since 10 / 3 = 3.33, and 0.33 is one out of three. Here's more info on this or feel free to leave a comment if you have any questions!

Step 4: Finish & Test It!

Connect the button wire leads to your microcontroller inputs, run the full program and test to see that it works as expected. If it's all good, put the glove on and push the state change switch and watch as your costume/insertotherawesomeprojecthere changes through different settings!

Now go forth and show off your project around town!


About This Instructable




Bio: Dabbled in dark matter, settled into engineering with a blend of inventing and teaching, always trying to solve problems + learn new things!
More by jenfoxbot:Anti-Facial Recognition Wearable No. 1Renewable Energy Technology: What It Is and How to Use It!Build & Play Robot Mini Golf!
Add instructable to: