Live data from Hacker News

Turn a light bulb on with every new user or download

rigoneri.com

21–30 of 42 posts

Re: Turn a light bulb on with every new user or download

#21
post #11

BIG FAT WARNING: If you're going to relay your Raspberry Pi / Arduino to mains electricity, be very, very careful! Mains electricity can KILL. Make sure you learn about safe shielding, connecting and grounding practices. Above all, be extremely cautious! I can't stress this enough. EDIT: For more information: http://tubelab.com/Safety.htm

Indeed. For your own good, don't do this: http://palace-dci.sourceforge.net/images/electronics.jpg

Amazingly, I never had a single incident with that parallel port->breadboard+transistors+relays->lights setup from my high school days.

Re: Turn a light bulb on with every new user or download

#23
post #13

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. You can get a small remote power switch for $100 or so.

Belkin WeMo is only $49 and programmable via IFTTT. Edit: $45 on Amazon at present.

We've had success with a WeMo and this project: https://github.com/issackelly/wemo which lets you control the WeMo switch from within your local network. A quick python script to query the database for new users followed by calls to on() and off() works great.

Re: Turn a light bulb on with every new user or download

#24
I built something similar recently to flash a light every time someone buys something on Creative Market (video here https://vine.co/v/bTnnTVmH5eD). 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.

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.

Re: Turn a light bulb on with every new user or download

#25
post #11

BIG FAT WARNING: If you're going to relay your Raspberry Pi / Arduino to mains electricity, be very, very careful! Mains electricity can KILL. Make sure you learn about safe shielding, connecting and grounding practices. Above all, be extremely cautious! I can't stress this enough. EDIT: For more information: http://tubelab.com/Safety.htm

Others have mentioned the Belkin WeMo, which seems to be the best solution for anyone who doesn't want to mess with circuits (though I have no experience with, so can't comment). Does anyone know if it is available in a 220v format?

But if you do mess around with RasPis or Arduinos for that, I can't stress how useful the PowerSwitchTail is http://www.powerswitchtail.com/Pages/default.aspx - you give it a low power signal, and it switches a high power one. They have a 220v version as well.

Re: Turn a light bulb on with every new user or download

#26
post #11

BIG FAT WARNING: If you're going to relay your Raspberry Pi / Arduino to mains electricity, be very, very careful! Mains electricity can KILL. Make sure you learn about safe shielding, connecting and grounding practices. Above all, be extremely cautious! I can't stress this enough. EDIT: For more information: http://tubelab.com/Safety.htm

Pro tip: avoid hardware, stick to software. Just kidding.

Re: Turn a light bulb on with every new user or download

#27
post #25
post #11

BIG FAT WARNING: If you're going to relay your Raspberry Pi / Arduino to mains electricity, be very, very careful! Mains electricity can KILL. Make sure you learn about safe shielding, connecting and grounding practices. Above all, be extremely cautious! I can't stress this enough. EDIT: For more information: http://tubelab.com/Safety.htm

Others have mentioned the Belkin WeMo, which seems to be the best solution for anyone who doesn't want to mess with circuits (though I have no experience with, so can't comment). Does anyone know if it is available in a 220v format? But if you do mess around with RasPis or Arduinos for that, I can't stress how useful the PowerSwitchTail is http://www.powerswitchtail.com/Pages/default.aspx - you give it a low power si…

It's sold in New Zealand where I am, and we are on 240v.

Re: Turn a light bulb on with every new user or download

#29
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.

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:

tail -f "" | grep --line-buffered "" | sed -ue "s/^.*$/\x07/"

I also needed to set the terminal bell to be a "click" instead of a "bell" for this to sound acceptable during moderate traffic.

Re: Turn a light bulb on with every new user or download

#30
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.

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).

Anyway, this is a neat project and I wish you good luck OP!

Post reply on HN