Hi folks,
At work we moved into brand new offices a while ago. They're quite nice, but they do lack something essential: a lightswitch. Instead, there's an overhead motion detector that turns on the light when you enter your office, even during broad daylight. And turns the lights off if it finds you haven't been moving enough, even when it's dark outside. After much complaining, at least the meeting room now has a lightswitch (hard to use a beamer if the lights won't go off). This switch is glued to the wall, and turns out to use infrared signals to communicate with the overhead sensor. The lightswitch retails for over €140, which is a bit much to put in every office, apparently.
Anyway, a bit of research turned up that the switch (a Philips OccuSwitch) uses the RC5 encoding for IR signals, and so my first project was to build an IR remote control for that.
RC5 uses a 36kHz carrier, with about 30% duty cycle, which I generate using Timer0. An ISR then counts the number of pulses, and turns the modulation on or off in the right pattern. The Digispark now lives in the USB port on my LCD screen, and I can simply override the motion detector by having it transmit an 'on' or 'off' every few minutes. And at home, I can use it to change the TV channel.