A friend wanted to have an iPhone remote trigger for her porch light. I used a relay kit from Sparkfun to handle the 110v household circuit.
Nice! Thanks for sharing your code.
I’m new to electronics but have been a programmer for many years. I’m trying to do something similar (Imp-enabled switch) and my initial attempt seems to toggle the light on and off. I have a simple LED/resistor on a breadboard to dev the circuit using 3v3 to the LED and pin8 set to open drain output.
The issue I’m having is that the LED is powered on when the Imp initiates the firmware. I need the light to be off until I send the signal to power it on from HTTP In input. I’m not clear where I should put my code to set the LEDstate off to begin with.
My guess is you have got the pin set to open drain with a pullup resistor. Can you give more detail on how the LED is wired and exactly what your code says?
basically I have wired it up like the blink-o-matic example. Nothing fancy at this point. I think I have it working now.
Also consider this …
If you happen to not be in sight of the switched device (like a patio light or garage door), you’ll want to also have the imp send back the actual state of the switch. Example, you open a browser at work and turn on the light … is it really on? If the imp sends back the state of the pin to your browser (every 60 seconds or so), you’ll be able to verify if you really turned it on or off.
Especially important for a garage door because the up/down action is a single pulse. One or two external switches (sensors) can verify whether the door is really UP or really DOWN, or stuck somewhere in-between (which is also important to know).
Which reminds me of the refrigerator light paradox. Is the light really off when the door is closed? The imp might also have been a handy thing for Schrodinger and his cat.