loading
Picture of Web Controlled Arduino LED

This instructable shows you how to build a Web-enabled tri-color LED based on an Arduino and the WIZnet Ethernet shield, controllable from any Web browser .

Check the live demo at http://try.yaler.net/~arduino/led

Because the LED is exposed through a simple RESTful web service running on the Arduino color changes can also be triggered by Pachube or other platforms offering Web hooks. Welcome to the Web of Things ! The LED can of course be replaced by a motor or a high voltage switching relay to enable more interesting browser controlled applications, e.g. for home automation.

Publishing your Arduino through the Yaler relay server makes the Arduino accessible from everywhere even if it is hidden behind a firewall or a NAT and does not have a public IP address. A single Yaler relay server instance can host many Arduinos (and any other device with a TCP Socket library, e.g. a Sheevaplug or an Android phone) and is available at https://yaler.net/ (Disclosure: I'm a founder of Yaler)

Material

  • Tri color LED [Adafruit | SparkFun]
  • Arduino Duemilanove ATmega 328 [Adafruit | SparkFun]
  • Arduino WIZnet Ethernet Shield [Adafruit | SparkFun]
  • Resistors [1 x 150 Ohm, 2 x 82 Ohm for the Adafruit LED or
    1 x 180 Ohm, 2 x 100 Ohm for the SparkFun LED]
  • RJ45 cable

Tools

  • Soldering iron
  • Helping hands
  • A / B USB cable

Infrastructure

  • Internet access with DHCP, no public IP address needed for Arduino
  • (Optional: PC or Cloud Server with a public IP address, to run Yaler)

Step 1: Soldering resistors and wire to the tri-color LED

Picture of Soldering resistors and wire to the tri-color LED
4343262388_316a9ca0b3.jpg
4343264024_3c639d1739.jpg
4343264348_48439f5d37.jpg

(Note: All images show the Adafruit LED with the corresponding resistors and wire color)

  • Shorten all except for the longest leg of the LED
  • Solder the resistors to the LED legs as shown below
  • Shorten the remaining long leg
  • If you use the Adafruit LED, solder the red wire to it [as shown below]
  • If you use the SparkFun LED, solder the black wire to it
 
1-40 of 66Next »
mhachem1 month ago

I know this was posted very long ago but I'm trying it and I need some help. I connected everything as said and I pasted the code into the arduino sketch. I put the mac address of my arduino and its connected directly to my router through ethernet. When I uploaded the sketch and ran the serial monitor, it seems that it keeps timing out while everything is connected perfectly because it worked on the example code. This is what it says :

setup

connected

timeout

connected

timeout

Can someone please help me because I really want it to work! Thank you

tamberg (author)  mhachem1 month ago

Hi mhachem, the output looks fine. Did you try to access the URL? (Please reply to tamberg@yaler.net) Kind regards, Thomas

mhachem tamberg1 month ago

Hey Thomas, Thank you for replying!

I tried accessing the URL and it just shows me a blank page.

Everything is connected correctly because your example sketch worked the way it's supposed to. I really don't know what I could be doing wrong that is causing it to time out.

Please help =[

tamberg (author)  mhachem1 month ago

Sent you an email reply. Kind regards, Thomas

I am trying a project and ran into NAT'd IP shutting me down. So, I like the idea of the yaler.org relay. what is an email address where I can reach someone about the service? The prices quoted are yearly? Is the 1GB of data for the maker plan yearly as well?

Thanks

tamberg (author)  brian.fox.5055236 months ago
For info, please see https://yaler.net/ or contact tamberg@yaler.net

hi I was wondering if this tutorial is doable with an uno or leonardo board ?

tamberg (author)  nedhallett210 months ago

Yes, those should work as well.

KobusK10 months ago

Hi, I notice nedhallett2 already asked but got no reply. I would like to know if this would work with the Arduino Uno R3 ?

tamberg (author)  KobusK10 months ago
Yes, it would. Cheers, Thomas

Works great!! best internet controled arduino tutorial I have seen thus far.

tamberg (author)  egwillfriedel1 year ago
Thanks!
Milen1 year ago
Hi, I am trying to reproduce the project using ARDUINO MEGA. I have created an yaler account and I am able to see the webpage with the 3 colored buttons. The problem is that nothing happens pressing the buttons. I added the following lines inside the code:

if (yalerState == YALER_UPGRADED) {
      //Serial.println("upgraded");
      receiveRequest(client);
      if (state == DONE) {
        if (isPut) {
        Serial.print("    led0="); 
        Serial.print(led[0]);
        Serial.print("    led1="); 
        Serial.print(led[1]);
        Serial.print("    led2="); 
        Serial.println(led[2]);       
         
          setColor(led[0], led[1], led[2]);
          sendPutResponse(client);
        } else {
          sendGetResponse(client);
        }
      }
    } else {
      //Serial.println("timeout");
    }

 I want to see what data is send to the PWM channels. The result from the Serial monitor is:

    led0=0    led1=0    led2=0
    led0=0    led1=0    led2=0
    led0=0    led1=0    led2=0
    led0=0    led1=0    led2=0
    led0=0    led1=0    led2=0
    led0=0    led1=0    led2=0
    led0=0    led1=0    led2=0
    led0=0    led1=0    led2=0
    led0=0    led1=0    led2=0


 That means - pressing the buttons does not effect the values for the LED intensity. Please suggest where the problem could be...
tamberg (author)  Milen1 year ago
Hi, the parsing of the incoming HTTP request in this example is not very robust. There might be a broken offset or something similar in receiveRequest. Unfortunately I don't have an Arduino at hand to test anything before mid January. Regards, Thomas
btan31 year ago
Hi,

I made changes to the code and everything. Now I'm trying to access the website but I can't. I tried http://46.137.106.125/{Relay Domain}/led and http://try.yaler.net/{Relay Domain}/led. Both of the lead to server error page. Am I missing something here?
tamberg (author)  btan31 year ago
Hi,

the server error page is likely HTTP Status 504 (Gateway Timeout). This is Yaler's response if no device is available at the given Relay Domain.

Reasons might vary from typos to memory overflow. Can you add some Serial output to your Arduino program to see if the program is running and if it get's the request from your browser?

Kind regards,
Thomas
btan3 tamberg1 year ago
Hi,

Thanks for the reply. I uncommented all serial print commands in the code. It prints setup on the serial monitor which means it goes through void setup but nothing after that and I can't access the website. Am I using the correct web address here? I'm using arduino nano with ethernet shield btw if that makes any difference.

Thank you.
tamberg (author)  btan31 year ago
If the shield works fine with other examples, maybe the Nano runs out of memory?
btan32 years ago
Hi,

When you say "you should now be able to access the Arduino Web LED at http://{Yaler IP}/{Relay Domain}/led", what is the Yaler IP?
tamberg (author)  btan32 years ago
Hi, if you use the hosted ervice the IP in the source code is fine.

Kind regards,
Thomas
bajonjon2 years ago
hello sir,.can you upload the complete code???
tamberg (author)  bajonjon2 years ago
Just sent you a message. Regards, Thomas
renexdon2 years ago
Hi tamberg, firstly congratz for this very useful post. I'm quite new with Arduino and Web of the Things staff, I'd like to implement the java apps directly on my google app engine account, I use Eclipse for that purpose, any suggestion? ReneX
tamberg (author)  renexdon2 years ago
He renexdon, Sounds great. Your Java App could call the Arduino via HTTP. Regards, Thomas
Are you planning to get your demo working again? I enjoy playing with it, it is my homepage
tamberg (author)  Michael_Bell2 years ago
Glad you like it. Sometimes it's stuck and needs a reset. Will do that ASAP.
jaypozo3 years ago
Great project, but it doesn't seem to work for me. Everything compiles and I can connect to the Arduino and see the colour select page, but when I click one of the boxes, it doesn't change on the Arduino. Any ideas? I get this output when I hit the page:

n/led/ HTTP/1.1

And this when I click on the RED box:


n/led/led/ff0000 HTTP/1.1
Host: try.yaler.net

It looks like the "isPut" variable never gets set to "true" and so the pins never get set.
tamberg (author)  jaypozo2 years ago
jaypozo, the code didn't work anymore due to a change on the relay. Please download the updated version from this Instructable. Regards, tamberg
tamberg (author)  jaypozo3 years ago
Hi, from the output it seems the path is shorter than the code expects. Which URL are you using to access your Arduino? Kind regards, tamberg
jaypozo tamberg3 years ago
This is the URL I'm using: http://try.yaler.net/gsiot-2fds-hkan/led/
tamberg (author)  jaypozo3 years ago
Ok. Does it work if you use http://try.yaler.net/gsiot-2fds-hkan/led instead (without the final slash)?

Regards,
tamberg
tamberg (author) 2 years ago
Just updated the ZIP downloads to reflect the new relay IP address and fix a parsing error.
crackHacker3 years ago
ok i can get it to compile and everything but my network keeps showing it as expired on the lease.
tamberg (author)  crackHacker3 years ago
Hi, according to this thread http://code.google.com/p/arduino/issues/detail?id=716 calling maintain() might help. Cheers, tamberg
whanif3 years ago
I had a problem, when compiling the "HelloTriColorLedYalerService.pde" sketch, the result return with errors and the main error is "cannot declare parameter 'c' to be of abstract type 'client'" can i know why ? I've add the EthernetDHCP into libraries but still produce that error. TQ
tamberg (author)  whanif3 years ago
Whanif, thanks for trying the code. Which Arduino model and Arduino IDE version did you use? And which version of the libraries? It's been some time since I wrote this code. Cheers, tamberg
whanif tamberg3 years ago
Thank you for the reply, I'm now using Arduino Uno Revision 2 and the IDE is version 1.0, for the libraries, it is Version 1.0b4. Thanks in advance...
tamberg (author)  whanif3 years ago
Ok. I don't have an Arduino Uno R2, but I can try to recompile the code with the new IDE and libraries this weekend. Sorry for the delay...
whanif tamberg3 years ago
Ok, thank you for your help...
tamberg (author)  whanif3 years ago
Looks like the Arduino libraries changed significantly with v1.0, as far as Ethernet is concerned. Upgrading the code might take some time. As a quick fix you can try to use Arduino 0018 (if that works with the Uno).
1-40 of 66Next »