''Magic Button'' Remote Switch

8,519

148

15

Introduction: ''Magic Button'' Remote Switch

PROBLEM: The LED panel light (DIY - of course!) installed on the ceiling of my workshop/garage is plugged into a power socket on the ceiling. I needed some way to remotely switch it on and off from where the main light switches are located.

SOLUTION: The "Magic Button" is born.

The Magic Button is a small stand-alone infrared remote with a big button (it is true, I like big buttons - see some of my other Instructables). When pressed a signal is sent by IR LED to a base unit to toggle the panel on and off.

In this situation I have used a specially constructed receiver unit (which also has some extra switching options - a pull switch and experimental light-sensing switch - see later). But the Magic Button can also be used on its own to switch on an IR controlled device, like a TV.

Step 1: Magic Button - Circuit

PARTS

1x ATTINY85 SMD
2x 22pF SMD Capacitors
1x 47R SMD Resistor
1x 5mm TSAL6200 (or Similar) Infrared LED

1x 6pin 2mm Pitch Header
1x 12x12x12mm Push Button with Cap (https://www.ebay.com/itm/131912566751)

24mmx24mm Single-Sided 0.8mm PCB
22AWG (0.7mm) Tinned Copper Wire
USBasp Programmer (http://www.fischl.de/usbasp/)

PCB

The PCB was made using the iron-on toner method on 0.8mm thick board. Mount the surface-mount devices first. Solder a couple of cm of tinned copper wire to the battery terminals (on the copper side of the PCB) to connect to the battery holder later.

FIRMWARE

The firmware needs to be uploaded using the USBasp programmer. The pins of the programmer ( http://www.batsocks.co.uk/readme/isp_headers.htm) need to be connected to the the 6 pin header on the Magic Button (see layout PDF for pin-outs). I used a couple of connectors soldered together to form an adapter, but you could just as easily use jumper wires.

Install ATTiny support on your Arduino IDE (http://highlowtech.org/?p=1695) and open the attached sketch.
Select :
Board: ATtiny25/45/85
Timer 1: CPU
Chip: ATtiny85
Clock: 8Mhz (external)
BOD disabled

Then select the burn bootloader option to burn these settings. Now upload your sketch.

I have included a modified version of the ir-send library ( https://github.com/anorneto/attiny85_ir_send ). I could not get the library to work as it was - the timings from delayMicroseconds() seemed to be out by about a factor of two even though I had the correct clock settings - maybe I had the wrong version of ATTiny core installed?? I have adjusted the calls to delayMicroseconds() by a factor to compensate - but you may have better luck with the library unmodified.

If you are going to use the Magic Button to activate an existing device, then you will need to alter the sketch so that it sends the correct IR code IRCODERAW (see the reference in the Base Unit step of this Instructable).

You can check that the circuit is working by viewing the IR LED using your cell-phones camera, which can 'see' infrared even though your eyes cannot.

Step 2: Magic Button - Housing

PARTS
1x Jamma Long Arcarde Button (https://www.ebay.com/itm/301287758471)
2x 2x3x8mm Rare Earth Magnets
Steel from a Tin Can
Epoxy Glue
3D Printed Parts
4x M2 6mm Screws and Nuts
1x CR2025 3V Battery


CONSTRUCTION

There are four 3D printed parts : Shell, Base, Battery Holder and Button Spacer.

My two prototypes (shown in title photo) have a slightly different design:
- The white one (which I mounted on the wall to switch the LED panel) has the LED mounted at approx 40 degree angle so that it points to the receiver on the ceiling. It also has mounting holes in the base.
- The coloured one is a slightly more rounded shape and has the LED aiming horizontally. This one is designed to be placed on a flat surface to turn on a TV or other device.

As well as attaching .stl files for these two versions, I have also included an OpenSCAD script so you can generate your own Magic Button with different parameters.

The Arcade button needs to be disassembled and cut in two places with a hacksaw as indicated. The button cap (from the 12mm push button) fits into the button spacer which is glued into the top of the Arcade button.

The base is held to the shell magnetically: The two magnets are glued into the slots in the shell - make sure they are flush. Two small pieces of steel (4x10mm) are cut (carefully - sharp! - file the edges) from the tin can. These are glued into the marked spaces on the base. Make sure that they do not overlap the outer edge.

Slot the battery holder over the two wires and screw it to the PCB with the M2 screws. The wires are cut and bent as shown in the photo, so that when the battery is inserted it makes contact with each wire. The pressure of the side wire should hold the battery in position.

Glue the outer bezel of the Arcade button into the hole in the top of the shell. Then it should all just fit together!

Step 3: Base Unit (to Switch a 12v LED Panel)

PARTS (CIRCUIT)

1x Arduino Nano ATmega168 5V
1x 3mm Red LED
1x 3mm Yellow LED
1x 5V Relay
1x LDR (Light Dependant Resistor)
1x 2N2222 NPN transistor
2x 1N4007 Diodes
1x TSOP4138 IR Receiver
1x Mini Slide Switch
1x Micro Switch (from the Arcade Button)
1x 100K Multi-turn Trimpot
1x MINI 3A DC-DC Step Down Module ( https://www.ebay.com/itm/360741066304 )
DC socket and Plug

PARTS (CASE)

1mm Waxed Bead Cord
24mm Diameter Wooden Bead (with 5mm Diameter Hole)
1x 12mm M6 Black Screw
Case 116mmx68m36mm ( https://www.ebay.com/itm/382231522470 )

Black Paint
Epoxy Glue

OVERVIEW

The base unit consists of an IR receiver which will toggle the relay when the Magic Button is pressed. Alternatively, there is also a pull switch which can be used (eg if the Magic Button battery is flat).

There is also an experimental light-sensing feature. This can be switched on or off with the slide switch (I was unsure how well this feature would work). Basically when the main lights in the garage are turned on, it will sense the light and switch on the relay. Some black tube and heat-shrink was placed over the LDR to make it more directional, and is aimed toward the main garage lights. The trimpot is adjusted for the correct light threshold (the yellow LED will light up when the light threshold is reached).

CONSTRUCTION

Solder the power input socket and step down regulator in first, then apply power and adjust the regulator for a voltage of 4.5 - 5 volts. Hot glue the trimpot in position. Make sure you do this before installing the Arduino, or you may blow it due to over-voltage.

There are two 3D printed parts:
- One for the pull switch mechanism. The waxed thread is threaded through the holes as shown, with a large knot tied at the end.
- The other is a plug for the ball. This is glued into the hole in the ball and the other end of the thread passes through. A knot is tied in the other end, and an M6 screw is screwed into the base of the ball (to give it some weight).

FIRMWARE

The firmware uses the IR remote library from here: https://github.com/z3t0/Arduino-IRremote Upload to the Arduino in the usual way.

If you want to emulate an existing remote control (to turn on a TV) then use the IRrecvDump example sketch from this library to read and dump the code from your TV remote. Use the dumped raw codes in the Magic Button sketch. Of course, in this scenario you will not need to construct the base unit, but refer to the schematic as you will need to connect an IR Receiver to an Arduino in order to do the read and dump.

IR RECEIVER

I had originally mounted the IR Receiver on the PCB (plugged into a 3 pin header to raise its height), and visible through a hole in the case. But I found that it was not 'visible' enough to register presses, so I ended up mounting it on the outside of the case, and now it all works perfectly.

Happy button pressing!

Wireless Contest

Runner Up in the
Wireless Contest

Share

    Recommendations

    • Metalworking Contest

      Metalworking Contest
    • Creative Misuse Contest

      Creative Misuse Contest
    • Water Contest

      Water Contest

    15 Discussions

    awesome!

    where can i buy the tools?

    I think they missed the Sir mixalot reference.

    Greetings Allan it looks like we are both doing something similar at the same time. Perhaps we can share with one another. I am working on a universal TV mute button. https://github.com/LightningStalker/TV-Shut-Up It's a modified TV-B-Gone that uses some higher power transistors, LEDs, and a lipo. The design goal was to be able to mute a TV from around corners. It bears a striking resemblance to your Remote Switch.

    4 replies

    Sounds interesting. The TV-B-Gone that you are using is definitely a more 'high-powered' device though (to get around those corners!). I was going for a more compact design and long battery-life, so the "Magic Button" is just line-of-sight. Feel free to use any of my design though - it is all shared here.

    The thing I like about yours is that it uses the Arduino libraries. Is the USBasp able to program the ATtiny with the LED attached? The USBtinyISP I have does not tolerate anything below 680Ω.

    It looks like these programmers have 1.5k resistors on MOSI and SCK. Having the LED on MISO avoids this and allows it to program.

    That is a clever use of IR for a fixed wireless signal.

    jcantalupo presumably sleeps standing up.

    Wonderful project

    I like big buttons and I can not lie.