Author Options:

control 4 outputs over the internet with arduino? Answered

I would like to control 4 LED lights in my house over the internet with arduino uno, ethernet shield and my android phone. All they need to be is on/off outputs. I really could use allot of help. I am new to using the arduino over the internet.


start small, teach yourself to turn the leds on/off automatically, then via serial or button, then get the default webserver sketch for the ethernet shield working, then mix the two together :)

Ok, I played with the uno and mega and setup a sketch to run 52 outputs on the mega and flash leds in sequence and random and running 2 separate groups. Day before yesterday I received the ethernet sheild and played with it. I loaded a sketch to control an led output, on/off. Then I expanded it to 8 outputs and it works great on the INTRANET. Now I looked for a sketch to start with on using it on the INTERNET, not the intranet so I can control it from my phone when I am away from the house. It seems every one I found kept coming up with numerous compling errors. Do you know of a sketch I can use to start with working over the internet?

do you have an external ip available or are you behind a single ip on a home router?

Im going to assume the later, in which case you need to look into port forwarding for your router model.

And potentially a dynamic dns (plenty of free ones out there) if your external ip changes

having a website is different than having an external ip address.

Your best bet is to look into either relaying data back and forth between your website and the ethernet shield (via port forwarding)

or just using port forwarding directly

let me know if you have any questions about this

I have 2 internet cameras that have port forwarding but when I installed them they did it automatically. So I am not sure how to do it. I do need a little help.

it depends on your router. Look for your router's model number online to find a tutorial on port fowarding, or a manual.

it is a netgear 7550. I think I have port forwarding all set. Now what do I do to connect over the internet.

depending on the port you forwarded it to, you'd connect like http://youripaddress:portyouforwarded

fort forwarding works by taking all data going to X port, and forwarding it to an internal ip on your network on Y port

ok I tried that but it can not find it. Lets say my arduino is and I port forward it to 49994. so on my Razor Maxx android I type, right?


ok so heres port forwarding in a nutshell.

Lets pretend your arduino is on port 80 (http is usually port 80)
then you make a rule in your router to forward port 49994 to port 80 for ip

Then go to your external ip address (find your external ip at http://www.whatismyip.com/) :49994

If your router doesnt let you have an external port and internal port... then its blindly forwarding the port to the same port internally.

So in that case... you can modify the arduino code to run on port 49994.

You still need to access it via http://yourexternalip:port

Let me know if any of this didnt make sense

Great, I understand fully now. I was getting my external ip mixed up with the ip's from the router. Thank you very much for staying with me on this. I have learned allot and will put it to good use in my experimenting. Now I am not afraid to port forward. Now I need a static ip. Any ideas on getting around this?

you can either get one from your isp (some internet providers will let you have one) or what most people do is get a dynamic dns. http://dyn.com/dns/ :)

I got it. You want to use your wan ip address then it works.

I have a project I want to build and I need 24 pwm outputs. I will be using a arduino mega and it says 14 of the digital pins can be used as pwm outputs. Can I just pick them or are there specific ones I should use.

search for pwm on the arduino mega page, it tells you which is which

OK I have been. I am waiting on the ethernet shield to arrive today and play with it next.

Use teleduino - it's dead simple.



checking out arduino.cc the arduino forums, and searching arduino webserver will get you a LONG way. It's really not hard but I don't want to learn to do it just to teach you how to do it. It's been done, a hundred times over.

(Don't get me wrong - just saying, retyping it here is not worth either of our time when searching would easily find the projects).