BIG FAT WARNING: If you're going to relay your Raspberry Pi / Arduino to mains electricity, be very, very careful!<p>Mains electricity can KILL. Make sure you learn about safe shielding, connecting and grounding practices.<p>Above all, be extremely cautious!<p>I can't stress this enough.<p>EDIT: For more information: <a href="http://tubelab.com/Safety.htm" rel="nofollow">http://tubelab.com/Safety.htm</a>
This falls - as others have already commented - in the 'knows just enough to be dangerous' category.<p>Please use LEDs, don't even bother messing around with opto-isolators and so on unless you have experience with both mains electricity and designing safe circuitry.
This seems like a really great use for raspberry pi. I recently finished a project involving a pi + a relay to activate a door buzzer, written in javascript. It was surprisingly simple and straightforward.<p>Besides turning on lights, the cool thing about relays is that most things involving physical push-buttons can be taken apart and easily wired up to a relay.
Working with mains power is stupid. Don't do it if you can avoid it, especially if you don't know what you are doing.<p>You can get a small remote power switch for $100 or so.
This is when I feel envy toward engineers who can program hardware. I'm so involved with Ruby and HTTP and CSS etc. that I have negligible knowledge about Arduino, Raspberry Pi, and Beaglebone.<p>I don't even know where to start and whether it will be a fruitful exercise (i.e. will I be able to devote sufficient time to it to actually learn something worthwhile).<p>Anyway, this is a neat project and I wish you good luck OP!
I built something similar recently to flash a light every time someone buys something on Creative Market (video here <a href="https://vine.co/v/bTnnTVmH5eD" rel="nofollow">https://vine.co/v/bTnnTVmH5eD</a>). I know nothing about mains electricity, so I pulled together an Arduino and a LED with a bit of socket work to get a green light flashing. Once someone completes a sale, a piece of Javascript is requested from a Node.js HTTP server I setup. The server then pings the computer with the Arduino plugged into it over UDP and the client sends a serial response to the Ardunio, flashing the light. It's pretty simple, but it was fun to get all the components together and learn more about hardware development. Since a flash of the LED is requested on every sale and the UDP responds pretty quickly, it acts as a great thermometer during high sales peaks.<p>I'm now in the process of abstracting the entire thing into a self-contained box that communicates over wifi and uses mains electricity. Hopefully I don't kill myself.
Cool project!<p>Maybe iterate it to use LEDs instead of incandescents.<p>For hardware hacking- you have 3 types of hardware that can make life easy- but there are tradeoffs:<p>1) Arduino
2) Raspberry PI
3) Beaglebone<p>Arduino is great when you want low power, but it isn't an awesome internet platform.<p>Raspberry Pi is great when you're going to leverage a full blown PC Monitor, but using it for hardware hacking requires a bit of elbow grease<p>The Beaglebone is great for when you are doing something internety & hardware hacky, but without a full blown pc monitor.<p>I would have done your project with a beaglebone, fwiw. I'd also have used LEDs instead of incandescents. But this is a great project! Nice work!
Nice one!
When I did something similar, I found the clicking sound of the relay more satisfying, than a lightbulb, so I eventually completely removed the lightbulb.<p>At the time I used MacMini, which was a tiny bit expensive for this very purpose (also not everyone in the office likes a blinking light 24/7) then eventually I came up with the following oneliner:<p>tail -f "<access_log>" | grep --line-buffered "<whatev>" | sed -ue "s/^.*$/\x07/"<p>I also needed to set the terminal bell to be a "click" instead of a "bell" for this to sound acceptable during
moderate traffic.
Hook up a USB Flashing Police light to failed CI builds<p><a href="http://www.amazon.com/Rhode-Island-Novelty-Police-Beacon/dp/B0011CZV5A/ref=cm_cr_pr_sims_t" rel="nofollow">http://www.amazon.com/Rhode-Island-Novelty-Police-Beacon/dp/...</a>