Picture of Web Controlled Valentine
With this mix of software and hardware, you can light up a heart-adorned night light from anywhere with internet access. So whether you remember at work, in a cafe, at home, or on your (web enabled) cell phone, you can tell your valentine that you're still remembering.

(that, or you can annoy your sweetheart by rapidly pulsing the light throughout the day, until she manually turns it off)

I finally wrote my own serial communications program, with the new code, the delay is gone.

Step 1: Gathering Materials

Picture of Gathering Materials
relay comp1.jpg
relay comp 2.jpg
There are several ways of controlling an outlet from a PC, but since I had one lying around anyway, I based the project on an Arduino NG i/o board. ($32 from Sparkfun) All other parts were either scavenged, picked up locally at Radio Shack or bought at a grocery store; therefore, there are some messy hacks involved.

Don't let the use of the Arduino dissuade you from attempting this, or a similar problem. The Arduino is extremely straightforward and inexpensive.

Arduino NG - USB Prototyping Board
9vdc 350ma power adapter
USB male A-male B cable
computer power cord (or other suitable grounded cord)
three prong outlet, cover, and box
PC Relay - 12vdc coil rating rs part #275-248
Reed Relay - 5vdc coil rating rs part #275-232
diode (i used rs part #276-1620, but I had it lying around)
Heart-adorned night light
Arduino IDE from http://www.arduino.cc
Xampp from http://www.apachefriends.org/en/xampp-windows.html
ComSender - my serial communications program, php code, and Arduino code. (attached)
Hi - this is pretty great, but when I run the php on apache I see the web page with
"Notice: Undefined variable: submitted in C:\xampp\htdocs\index.php on line 51
Outlet State is Unknown "
and if I click a button
"Fatal error: Class 'COM' not found in C:\xampp\htdocs\index.php on line 27"

It *looks* like everything is defined? I'm unfamiliar with PHP but the arduino seems to be setup alright.

Problem is that in new version of php COM class is not used.

You have to include php_com_dotnet.dll which you already have in

XAMPP\php\ext folder into apache php.ini file

Go to Xampp config screen, then hit config for Apache server and choose PHP(php.ini) file and edit it.

Scroll until you find ; Dynamic Extensions ; and add



kaby5 years ago
can you tell me what part of the xampp server your using cause i can only get ftp and apache working
gschoppe (author)  kaby5 years ago
Apache+php (which is what xampp contains) is all you need.
kaby5 years ago
I really wanna do this project but I got 2 questions...... What is the php code and what code do I have to upload to my arduino......thanx
gschoppe (author)  kaby5 years ago
the php code, along with the exe file and the ocx file, reside on the computer the arduino is connected to... they take care of turning web requests into serial communication to the arduino... the arduino code (the.pde file) is what goes on the arduino to read the serial transmissions from the computer and operate the relay accordingly... all the files are in the zip file attached to the first step (the arduino code is in the arduino subfolder)
kaby gschoppe5 years ago
Wow......thank u so much........you cleared up everything so fast, keep up the good work!!!!
rk245 years ago
can you post a method that give us to control more leds? or more outputs?

please...I've tried but.... didn't work form me....

works fine with 1 output..

great instructable....

please make the same idea with 8 or more outputs!!!!! T_T
That's a great Instructable!!! I understand all the hardware construction parts but do you know if I could do it with a basic stamp 2 module? because I have one lying around....
gschoppe (author)  andrewsweet46 years ago
you definitely could, but since I haven't used that board for several years, I'm not sure what the code would look like.
Miffy206 years ago
This is amazing and I really want to give this a try but I'm having trouble finding some of the supplies you used at a good price. Are there any alternatives?
dolulob7 years ago
Hi, Funny thing... I kinda made the same thing... But its a USB powered white PLexyglas cube, with LEDs inside. The cube is constantly fading colors Then the 2 ppl have a program running on their PC, when either one is thinking about the other the fading stops and the cube turns red (you can change the color in the settings) I use ICQ to send the message through the internet, that way I dont have to bother about a server or anything... I will eventually post an Instructable here, when I can find some time. Mike
aloishis898 years ago
This is really cool. I have been wanting to mess around with controlling electronics over the internet. is there anywhere i should look that can give me the basics? I sorta understand what is happening, but i cant find a site that explains it out.
photozz8 years ago
If you want to save the price of the USB board, you could just use the LPT port to drive the reed relay.


If your looking to make a portable ethernet connected setup, I would check around for Nano ITX boards.


I have a few of the EPIA boards laying around. you can power them from a regular 12V wall supply, and they have built in Ethernet. Many still have pin headers for LPT connections.
gschoppe (author)  photozz8 years ago
I kinda like the idea of using parallel, but most newer computers don't include it and most usb adapters can't be easily fiddled with (as I learned making a snes multitap/usb adapter)... I went with the Arduino for several reasons: 1) uses TTL to communicate, so any stand alone Ethernet controller can talk to it. 2) my arduino is usb and can easily become serial (with a max2322 and some caps) so use with both older and newer pcs is facilitated 3) Cheapest dev board I know of that has its powers 4) ethernet arduino is forthcoming 5) I already had one :) if i was going for a stand-alone setup, I'd use a less pricy/overly complicated solution than a nano itx pc... come on, ~$400 for an outlet control? i can do better. using an old thinkpad 365 (i think), a max2322 chip, three 1microfarad caps, and this setup, I've got a stand alone unit for ~$150, and thats without trying to be efficient or dedicated (BTW: just make a serial to ttl-adapter, connect it to the arduino, and run everything normally). if I used a serial arduino to start with and bought a gutted laptop (no need for cd, harddrive(use a cf card with an adapter), internal display, ect), it'd be even cheaper. with a bit of eBay magic, it could be a cool $100. anywho, for my future plans an arduino fit nicely, and its a great piece of kit to have around (used for a usb morse key, universal computer controlled remote, winamp control, ect)
noahw8 years ago
This is some awesome Valentine's Day technology. Now that you have a computer controlled power outlet you can make all kinds of remotely operated gifts and machines. Nice idea and instructable!
erfonz noahw8 years ago
You could make sure your christmas lights were off, space heater wasn't running while your out, but most importantly... annoy/freak the bejeezes out of anybody!
gschoppe (author)  noahw8 years ago
gschoppe (author) 8 years ago
the eventual goal is to rig it with an Ethernet or Bluetooth Arduino, if and when I get one, and use them for full home automation... btw, this cost apr. $40 to do this, and I can add outlets for ~$10 a piece. X10 wants 99 for just the usb controller