Introduction: Remote Controlled Floor Lamp
Make your bedroom floor lamp controlled from your favourite TV or media player (or whatever) remote control. There are always some unused buttons on any remote control we can use for our project. We need three buttons. I picked numerical buttons 7-8-9 since they are located in the bottom row of the remote (easy to feel in the dark) and are not used with my media player.
7 - left lamp,
9 - right lamp,
8 - both lamps
Step 1: Bill of Materials
Step 2: Wiring the Retrofit
Remove an old power cord with manual switch. You no longer need it.
Wiring diagram is in previous step picture. What it looks like in real life is the picture in this step. All the components are located in the base of the lamp stand. I used an old mouse usb cable (5 wires) to put an IR sensor and a state LED outside on the top of the stand.
Step 3: Preparing Your Programming Environment
There are some brilliant instructables how to get the digispark working.
- How to Program an ATtiny 85 Digispark
So I will not instruct in detail this issue. After you install a driver and bootloader you can proceed to the next step and teach your lamp to understand your remote control.
Step 4: Getting Key Codes From Your Remote Control
Open the sketch IRemoteDigispark2relay.ino in Arduino IDE. Choose Digispark board "Tools -> Board -> Digispark". Add zip library TrinketHidCombo.zip "Sketch -> Include library -> Add .ZIP library". We only need it to read the key codes.
Remove remarks (slashes in the beginning of lines) from the lines shown in picture with red boxes.
Press Upload button. The IDE will compile the code and prepare for uploading by shownig the text in bottom console: "Plug in device now...". Follow the command, connect digispark to PC USB port.
When it's uploaded it says: "Micronucleus done!".
Open some text editor like Notepad in your PC. When you press a button on your remote the digispark will type its code in the PC. You should write down the codes of three buttons you wish to use:
- Lamp 1 ON/OFF
- Lamp 2 ON/OFF
- Both lamps ON/OFF
Replace the codes in the sketch with your own ones. Only a part after 0x, for example:
0xF8074040 <- F0F0F0F0
Put remarks back in the beginning of lines you removed in this step. Upload the amended code again. As you just did it.
Step 5: Assembling
Check if it is working with your remote control then assemble the lamp stand.
We have a be nice policy.
Please be positive and constructive.