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 ads by
Signing UpStep 1Design and Circuit.
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 Step | Download PDFView All Steps | Next Step » |
3
comments
|
Add Comment
|
![]() |
Add Comment
|







































