A few weeks ago, I read up on an Arduino project to create a home automation system. Being a electronic hobbyist, I wanted to be aware of the limits of my skill sets before attempting a project such as this.
One of my major pain points was to open up a remote control, and hack in a microprocessor to manage this remote via a software program. This involved soldering very small contact points on electronic circuit boards.
Cost of the components aside, I wanted to be sure that once I started on an automation project, I would be able to complete it without destroying any of the major functional components such as the remote control.
This instructable is a "flight simulator version" of a web-based home automation system that I intend to put together in the next few days to come.
But before I did that, I had to be sure!
Step 1: From the Parts Bin ...
As this is a flight-simulator version, I put this prototype together with the following parts already lying around in my parts bin:
A Basic Stamp 2 Rev. E. Microprocessor Homework Board from www.parallax.com - the full version of my project will either have an Arduino Uno or Nano.
Or, I would re-purpose the Raspberry Pi B from my other instructable to take on additional responsibilities
A remote from an old pedestal fan - the fan is long gone!
A mechanical relay such as the Songle SRD-05VDC-SL-C - the full version of this project will use a solid-state relay
Three male-to-female connectors (Red, Blue and Brown as shown in the pictures) for the control side of the relay
A couple of male-to-female connectors (purple as shown) for the load side of the relay
A 10 - inch section of Blue speaker wire
A soldering iron and solder for obvious reasons
A fresh 9V battery - This is important because you need good amount of juice to trigger a mechanical relay
Step 2: Simple Objective(s)
The objective(s) of this undertaking are very simple:
What the remote does when the buttons are pressed isn't important - meaning, the appliance it controls does not necessarily have to be part of this exercise. Any remote can be used as long as it works and could be hacked (even possibly be destroyed in the process!)
What really matters is whether or not I be able to wire my remote control buttons to a microprocessor and influence the remote via the micro controller to perform some of its functions as one would normally do by pressing the various buttons.
Turning the remote On/Off (the Power button at the very top, right below the LCD screen)
With the remote On, change the speed of the fan that the remote once upon a time controlled (the first button on the left, just below the power button)
Step 3: Taking Apart the Remote
Taking apart the two halves of the remote is most often than not, a painful exercise. I had to pry mine apart and in the process, broke a few tabs on the plastic body. Luckily, the printed circuit board (or PCB) appeared unscathed from the onslaught!
Once the shell was off, all I had to do was undo the 4 tiny screws to dismount the PCB from the body.
The battery connectors soldered to the PCB fit snugly to the plastic body - slip these connectors off the body before dismounting the PCB completely!
Step 4: The Hack...
Luckily, this PCB has a pretty good design with each of the contact points labelled appropriately.
If not, the easiest way to identify the contact points would be to align the PCB with it's key pad and mark the contact points with a permanent marker.
OK. I did not have my hands free when I soldered the speaker wires on to the PCB! So I skipped the "before" picture.
It's important to figure out how the buttons work before proceeding with the hack:
- A typical contact point on the PCB consists of two crescent shaped rings
- Each ring has tangs projecting into the circular space formed by the two crescents
- The tangs have clear spaces between them - very important because these spaces are the ones that make the difference between the "On" and "Off" state of a contact point
- As my crude sketch illustrates, to flip the button to the "On" state, simply short the tangs
- Which is exactly what the key pad does - below the fancy symbols on the key pad are tiny pieces of conductive material that connect the tangs of the two crescents together forming an electrical connection
Therefore, all we would need to hack the remote is take the buttons away and solder a couple of wires to the crescents taking care not to fill any of the empty spaces with conductive solder!
Step 5: Reassemble the Hacked Remote
For this test, I decided to hack two buttons - the Power On/Off, and the Speed cycle.
The contact points are pretty small even for a remote of this size. Therefore, the two crescents are the only locations I could solder the speaker wires on without having the molten solder spill on to the rest of the PCB and cause undesirable shorts!
Once again, another one of my crude sketches makes the point.
To put the remote back, all that was needed to be done was:
- to skip the key pad
- run the wires through the holes where the buttons once were
- screw the PCB back on to the top shell
- close up the remote
- put the batteries back in
Remember to use the key pad as a guide when running the wires out through the remote.
The hack is now ready to be tested!
Step 6: Testing the Hack...
Before proceeding any further, I had to make sure that the hack actually works because that's the only way I can confirm that I did not:
- Get excessive solder on the PCB causing unintended shorts
- Or worse, destroy the PCB by keeping the hot soldering iron in contact with the board for just too long!
But how do I press the buttons?!
Touching the bare ends of the blue wires, and moving them apart is equivalent to pushing the button down on the remote once.
Power On/Off Test:
- When the batteries are loaded, the remote comes on automatically
- Therefore, touching the two Blue wires soldered to the power button should turn off the remote
- Making the wires touch each other again, should make the power come back on
- The LCD will display the current speed briefly, and then power down to display a tiny fan icon
Test 1 - Success!
Speed Button Test:
- From the previous test, the remote should be powered on, and the blue wires must not be in contact
- To increment the speed, short the other pair of Blue wires soldered to the speed button contact point
- This time, shorting the speed button wires each time increments the speed to the next higher value
- Shorting the wire repeatedly, cycles the fan speed between 51 > 52 > 53 > 51
Test 2 - Success!
These tests confirm that the hack was successful with no (harmful) side effects :-)
Next, the wiring.
Step 7: Wiring the Microprocessor Circuit
The wiring for this prototype is super basic.
As shown in the simple schematic, there are two parts to this simplicity:
Control (input) side of the Relay:
As Basic Stamp 2 microprocessor is controls the relay, it should be wired on the control side .
- The digital pin P14 from the BS2 runs to the signal terminal on the relay (the Blue wire)
- The 5V power from the BS2 runs to the (+) ve supply terminal on the realy (the Red wire)
- The Ground pin from the PS2 runs to the (-) ve terminal on the relay (the Brown wire)
Load (output) side of the Relay:
- There's no polarity on the output side therefore, two purple wires have been used for connections
- Wire 1 runs from the (C)ommon terminal which is usually the middle connector on the relay board, to one of the Blue wires of the remote
- Wire 2 runs from the Normally Open (NO) terminal to the other Blue wire
Why the Normally Open (NO) Terminal:
The (NO) terminal is the preferred choice because we don't want the remote to be turned on as soon as the power is supplied to the relay.
Instead, the microprocessor must trigger the relay so that a brief contact is established between (C) and (NO) terminals causing an electrical connection between the two blue wires of the remote.
This brief flow of electric current will cause the remote to power On
- Do not cross wires across two different contact points of the remote!
- Make sure that the relay is wired to the correctly paired set of Blue wires soldered to the contact points
With all the wires in place, I strapped the relay to the back of the remote - this way, I could make the remote stand upright for more convenient testing.
Step 8: The Ultra-simple Code
The code is ultra-simple. The graphic illustrates the Basic Stamp version which can be easily adapted to another microprocessor such as the Arduino.
When the power's supplied to the circuit by closing the 9V battery terminals this program causes the relay to trigger On and Off many number of times.
The HIGH command indicates that an On signal is being sent to the signal terminal (the Brown wire) of the relay
This causes the circuit on the load side to close causing a current to be sent to the Blue wires of the remote
The LOW command does the opposite and triggers the relay to cut Off power to the load side, thus causing the contact between the two Blue wires of the remote to be lost
This is equivalent to the manual test, when I briefly touched the wires on the remote together and moved them apart.
The PAUSE commands indicate the wait in milliseconds, the program has to wait before issuing the HIGH and LOW commands each time
Step 9: Power On/Off Test
This test is as simple as the code that runs it.
With the 9V battery connected, the remote appears switched off
As the program begins execution, the Green LED on the BS2 board (in the background) comes on indicating that the program is running
The relay triggers for the first time causing the remote to power On
After a brief pause of 750 milliseconds, the relay triggers again - this time, the remote powers Off
Step 10: The Speed Button Test
This test requires a few quick changes to the set up:
- Disconnect the 9V battery from the BS2 board
- Disconnect the relay from Blue wires for the Power button
- Rewire the relay to the Blue wires for the Speed button
- Normally a speed function on the remote is used after the remote comes on - for the speed test to work, the remote must already be On
- For this, briefly touch the wires of the Power button to turn on the remote - the LCD must display the current speed
- Reconnect the 9V power back to the BS2 board to begin program execution
- This time, the speed value on the remote will cycle between the 3 speed levels available - 51 > 52 > 53 > 51
We now have a prototype of an automation system that can be used to pretty much run an appliance remotely via a computer program
Step 11: So, What's Next?
As mentioned at the beginning of this IBLE, the idea was to scope out my ability to execute a larger project (such as home automation) before I embark on the real deal. Let's summarize some Pros and Cons of taking this route.
- This definitely is a straight forward solution - Instead of you pressing the buttons, the processor does this for you
- You don't have to mess with how a remote communicates with its target - like how my other IBLE here demonstrates
- The remote becomes a "Zombie version" of its former self
- Soldering tiny terminals on the remote has chances of ruining the remote and rendering it completely unusable
- You may have to wire as many number of relay as the number of buttons you wish to automate - project becomes bulkier and would require more power
So, what am I looking forward to?
First, extend this prototype out to a proper application that would enable me to control at least 3 remote controls
This will require use of several solid-state relays, and a more detailed Arduino or BS2 or GPIO program
Develop a Web-based application that I can deploy to a local web server hosted on one of my Raspberry Pis or a spare Windows box
Finally, I can use my cell phone or tablet to access the local web application to control certain appliances around the house - starting with lights in the living room or garage would be good starting points
Thanks for reading my IBLE!