It’s been over a month since I received my spark core. Since then, I have been playing with examples and tutorials around here while keeping a lookout for an ideal project to start with. Recently, I came across these RF remote controlled outlet switches. I paid $20 for 5 outlets and 1 remote which I figured is a good deal. Now, I am planning to hack the remote and hook it up to core. This way I can control 5 devices over the internet for only 60 bucks!
The idea is simple and dirty. Spark is gonna simulate the button pressing on the remote. I understand this is not the best way to hack a remote but I don’t have a logic analyzer handy to monitor the signal being sent to the RF transmitter. It would have been nice to be able to reverse engineer the remote and let the core send the signal to transmitter instead. It would have allowed me to add more outlets in future without any hardware change. However, I figured the quick and easy fix is good for now since I don’t have many devices to control over the internet anyway. Also, I am growing impatient. It’s time I could turn on the window fans at home before leaving work so as to come to a much cooler house .
Now having justified the hacking method, lets get to the task at hand. The remote has 10 buttons for 5 outlets. On and Off are separate push buttons (normally open). All I have to do is short the corresponding switch electrically to simulate the button press. I figured optocouplers would be perfect here. Spark would issue a high on one side and on the other side the transistor turning-on will short the pushbutton. Isolating the two sides is probably a good idea. I ordered these optocouplers from sharp(?) at amazon because they got delivered very fast and free. The datasheet is not too accurate. I did some tests to find out that 2.0 V at 10 mA forward current is needed to turn-on the transistor on the other side. It felt this should be a good operating point well within core’s abilities. I did some tests with core and things worked out fine. Nice and simple so far.
I am planning to charlieplex the inputs to the optocouplers. This way I will be using only 4 pins for 10 optocouplers and saving plenty for future extensions. Over the weekend, I will finalize the schematic and send the board for fabrication. I haven’t thought much about the firmware and web side of things as I imagine it to be fairly simple. Functionally all I need is a web interface with buttons for each outlets. In the firmware, I will have a spark function taking the outlet number and state as inputs. I will have all the pins tri-stated in the setup. In the function, first the two corresponding pins will be set to OUTPUT and LOW and then one of them will be set to HIGH for 100 ms. I will set them to INPUT and return.
I understand there is a similar project already done with spark and shared in the community. Unfortunately, a lot of my design was already done before I found this resource. It’s a helpful read, nonetheless. Thanks @Carsten4207
This is my first project with spark and I hope to add more functionality and hardware as my understanding evolves. I will share pictures, schematics and code as soon as everything is ready. My idea here is to share the project while it’s still in preliminary stage so that I can iterate the design with other member’s input. Please let me know your thoughts/concerns about design, feasibility and additional features that I can incorporate at this time.
Thanks in advance.