3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Generic Switch Hijacker

Generic Switch Hijacker
This article describes how to build a solid state microcontroller device that controls physical switches. It is very inexpensive to make (4$ or so), assuming you have a microcontroller programmer. The circuit itself is of trivial complexity.

This project is very simple, and involves no stunning new techniques. It would serve as a good first microcontroller project. The assembly source code will be provided to you in this article.

I have a really cool boss at work. Sometimes, we like to play practical jokes on each other.

Unfortunately for him, I'm a scientist.

My purpose here is to make various devices in the workplace turn on mysteriously for short periods of time. Radios, noisy printers, even those annoying musical birthday cards hidden in some commonplace object.

Over and above that, the project is an example of how you control heavier loads with an AVR than the output pins can deal with themselves. This is a wide variety of things, since the output pins only give you a small voltage, and very limited current. This circuit could be expanded with a relay to control some very heavy loads indeed.
 
Remove these adsRemove these ads by Signing Up
 

Step 1Design and Circuit.

Design and Circuit.
For this project, you can use almost any microcontroller, 5v voltage regulator, and NPN transistor. I used:

1x ATtiny26L-8PU (~2$)
1x TL780 5v voltage regulator (~0.7$)
1x N2222 transistor (~0.07$)
1x 9v battery, or 12v remote control battery to save space

...and of course my trusty STK500, now with ZIF sockets added!

The basic design is this: The microcontroller goes through two timing loops. A long loop for determining when to turn the device on, and a short loop to determine how long to keep the device on. When it's time to cause trouble, the microcontroller sends a logic high out pin 14 (Least Significant Bit of PORTA). This fires the transistor.

If you have connected the clamps to the leads on a switch, it causes the resistance across the switch to suddenly drop from very high to less than 1 ohm, which is enough for most devices to consider the switch on. Keep in mind that transistors are also diodes, so if it doesn't work... the polarity of the clamps is probably wrong, switch them! Also, this device requires a decent 9v battery, say with over 8v potential left... other than that it doesn't use much power.

There are a lot of unused pins, so of course you could use them to control more switches for more chaos, but this was sufficient for my purposes.

The next step is the source code I wrote to get this thing going. The default lengths for the "on" and "off" states are approximately 10 seconds and 13 minutes respectively. There are comments in the code on how to change these values.

Finally, please excuse the extensive use of the "nop" function (it spends a CPU cycle doing nothing) to tweak the timers. It's inelegant since it can break the rjmp function if you're not careful about how many you use!
« Previous StepDownload PDFView All StepsNext Step »
3 comments
Jun 22, 2009. 6:19 PMShanesmethurst says:
BTW I'm a truck driver not a scientist
Jun 22, 2009. 6:17 PMShanesmethurst says:
Totally amazing!!!!! That is one of the best Instructables I have seen yet! I probably couldn't copy it if my life depended on it but it has SO many possible applications. This is exactly what I was looking for to finish a couple of projects.... Now I can rest. Is there a more simplified way of explaining how to build this?

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
10
Followers
7
Author:legionlabs
I publish my failures and my successes, as my teachers have done before me. I am a member of Foulab, an independent, nonprofit research and engineering group in Montreal. Check out our webpage at...
more »