Real-time Web Control for Light Decorations (no Server Side Coding)

Introduction: Real-time Web Control for Light Decorations (no Server Side Coding)

Arduino Ethernet is an awesome device. This is how to operate your festive seasonal lights from wherever you want:
-by a simple click on your web-page (a few lines of HTML, no javascript, or any other coding is required);
-by entering a simple "http://..." line into any browser on any device like a phone, a computer, or a tablet
-from any other internet enabled device such as another Arduino Ethernet.

Step 1: Gathering Details and Preparation

The solution utilises a cloud-based real time web publishing tool  that allows you to publish any data with about 0.1 second latency.
First you will need:

Arduino Ethernet (which is in fact is Arduino + Ethernet Shield)
-   NPN transistor, like BC548
- 5.6 kOhm resistor
- wires
- ethernet cable
-power adaptor for Arduino
- Free account on (when registered you will get your publishing and web keys which you will put into Arduino code and in http code on your website)
- seasonal lights themselves (I used what I had, small 100mA chain of leds) - you may need to add an additional resistor for different "led architecture", or even use a relay to power some major decoration )) - up to you.
As a holder for LEDs I used something that was called "Tree" in a  shop. I thought it would look cool. 

Step 2: Soldering It All Together

You can use a board or just solder the wires together like I did.
Then pack it all in a project box. I placed the transistor outside to cool it down a bit and to prevent the box from overheating.

Step 3: Register on

Register an account on
After registration you will get a publishing key and a web key.  You will need them for the next steps.

Step 4: Upload the Arduino Code

Upload the Arduino code (you need to upgrade your IDE to the latest version 1.0)
Do not forget to Input Mac address of your board into the code
Also substitute the phrase "ENTER_YOUR_WEB_KEY_HERE" by your actual WEB_KEY from your account.

The code

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = {  0x??, 0x??, 0x??, 0x??, 0x??, 0x?? };
char serverName[] = "";

EthernetClient client;
const int ledPin =  8;

void setup() {
  pinMode(ledPin, OUTPUT);

  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");

void loop()
  char statusrec;
  char prevstatus;
  boolean iscon=false;
        for (int i = 0; i < 10; i++){
          boolean clcon=client.connect(serverName, 80);
          if (clcon) {
          } else {
            Serial.println("  connection failed");
    if (iscon){   
        client.print("GET /index/tag?tag=alarm&web_key=ENTER_YOUR_WEB_KEY_HEREHTTP/1.1\nHost:\nUser-Agent: Arduino For Teh Win!\nAccept: text/html\nConnection: close\n");
for (int cc=1; cc<10000; cc++){
  if (client.available()) {
    char c =;
     if (c=='$') {
     c =;
     if (c=='$') {
          c =;
              if(c=='1') {digitalWrite(ledPin, HIGH);}
              if(c=='0') {digitalWrite(ledPin, LOW);}
  if (!client.connected()) {cc=10000;}

------------------- unnecessary information ---------
The code below is actually inquiring by GET requests and parses responses into commands. So when you send a request to with your key, it sends the command to arduino.
You can substitute the word "alarm" in "tag=alarm" in the GET request by any other - just remember to do the same later on your web page in your http requests.

Step 5: Control Your LEDs

Create the following html page:
(DO NOT FORGET to substitute "ENTER_YOUR_WEB_KEY_HERE" and "ENTER_YOUR_PUBLISHING_KEY_HERE" with a real WEB and PUBLISHING KEYs from your home page)


<!DOCTYPE html>
        <script id="partcl_client_script" web_key="ENTER_YOUR_WEB_KEY_HERE" publish_key="ENTER_YOR_PUBLISHING_KEY_HERE" src=""></script>
<p><button onclick="partcl.publish('alarm','$$0')">off</button> <button onclick="partcl.publish('alarm','$$1')">on</button></p>

Please be aware that the publishing key will be visible to anyone who examines souse of your pages. If you are concerned about this,  it is better to open a separate partcl account for this project to make this publish key different from the keys in your other projects.
Also, in, navigate to "My sites" on the right menu and disable Partcl on new sites. Keep the tick on your site though )
Or you can keep the page private if you want.

Alternatively, instead of creating the page, you may open any web browser on any device and enter the following:
(to turn the LED on):$$1
(to turn it off):$$0

I will be happy to guide you through a process to control your lights from a Wordpress blog or from another Arduino Ethernet.


Make It Glow Challenge

Participated in the
Make It Glow Challenge

The Mad Science Fair

Participated in the
The Mad Science Fair

Be the First to Share


    • Pocket-Sized Speed Challenge

      Pocket-Sized Speed Challenge
    • Super-Size Speed Challenge

      Super-Size Speed Challenge
    • Audio Challenge 2020

      Audio Challenge 2020

    2 Discussions


    7 years ago on Step 5

    I can not get this project to work!

    When I debugg the Arduino code I found that the if statment below never get true becouse 'c' never contains the character '$'.

    c = ();
    if (c == '$') {
    c = ();

    If I log what 'c' contains I will get some html code.

    What is wrong?
    Have partcl changed anything since you made this tutorial?