This is a switch so lonely it won't work until it is warmed.
What?
This project is part of a series of interactive objects I'm working on.
These are objects that try to remind users the work that goes into even the most mundane actions, such a turning on a light or sitting down. This particular object is a light switch that won't function until it's warmed up slightly.
The goal is to have the user realize this on their own. To that effect there is an RGB LED inside the switch that starts of blue and slowly changes to red as the switch warms up (generally in 5-10 seconds).
Why?
This all stems from playfulness and a desire to have users pay more attention to the world around them in hopes that they will respect it more.
...sure, but ... How?
Ah, now we get to the juicy stuff! Here's a quick overview:
Behind the switch is a digital thermometer that is connected to an
ATtiny85. There is also an RGB LED inside the switch that starts off blue.
When the microcontroller sees a positive variation in temperature in a short
enough time (aka a strong enough tempeterature gradient), it activates a switch
that is ANDed with the value of the actual
light switch, thus
'enabling' the light switch.
The final logical value is sent a wireless outlet controller I bought off
the shelf and hacked into the setup so that I can actually wirelessely
control anything that can be plugged into a wall socket (this was done
because I was in a rush, didn't want to be solder circuits that
cary 220VAC, and wireless light switches is the future!).
Bill of Materials
- ATtiny85
- One Wire Thermometer - DS18B20
- 74HC4066N for emulating button presses on the wireless controller board
- 1000mAh LiPoly Battery
- Common cathode RGB LED
- Wireless controlled wall outlet, I bought mine locally but it's something like this
- Light switch with status light, or some way of letting throug the LED's light
- A piece of wood
- Spray paint
Hand-Drawn Slightly Incorrect Wiring Schematic
Someday I'll do these up in Eagle or something, until then (click to make bigger)...
You'll notice that the mechanical switch's status goes back through the
attiny instead of being somehow directly connected to the wireles controller.
This is because the wireless controller has one button for 'on' and one for
'off', so I punch the right one with some logic on the attiny.
Which gives us this:
Small video before assembly
(Sorry, I start off loud.)Code with a small bug feature
Here's a tarball of the code with
a makefile - 'make flash' even works
(how fancy!). The bug feature that I've included has to do
with turning of the wall socket: once the light switch is 'warmed' and in the
'on' position, moving it to the 'off' position won't properly send the 'off'
signal to the wireless wall socket. I think this can be easily fixed by
increasing the delay time I've place before the activation of the 'off'
button (more on this in the misc. section).
This isn't so bad though, as it kind of makes the switch even more annoying: you have to wait for it to cool down before you can turn things off.
....Oh, I forgot to mention!
A couple of things:- The code uses *all* the pins on the ATtiny85, even the reset pin. To
be able to use it there is a fuse that needs to be flashed (RTFM, I think it's
something along the lines of RSTDSBL or somesuch). After doing this you will
only be able to program the ATtiny85 with the High-Voltage method - bye-bye ISP.
- The wireless switch transmitter I have is a bit wonky - if you click the on
button, and then click the off button too quickly thereafter, it won't register
that you've clicked 'off'. To remedy this situation I've added a short (100ms
or so) sleep routine before each activation of the 'off' button. This works,
but I was unable to test it fully (High-Voltage programming being a pain) thus
the
bugfeature mentioned above.
