Remote control web page for arduino and ethernet card

Hello arduino friends.I create a project for control Air Condition (A/C) from web browser local or from anywhere in the world.For example you can start your home A/C from your office or opposite, before returning from a trip for set up the ideal temperature...I decode my remote control IR signals and create IR library signals.I use an IR led for transmit signal connected at digital pin and a temperature sensor connected at analog pin.You can add and humidity sensor,PIR sensors,Laser sensors,Light sensors (LDR)...Another way is an universal remote control connected with arduino from digital output via transistor as switch with on/off button or other buttons.Also you can add mosfets and relays for other devices without IR signals for example electric infrared heating panels.The user interface is a simple html page inside SD card for show a virtual remote control for A/C.You can send me suggestions and ideas for improvement of the website graphics (virtual remote control image) and extension of the code for controlling other devices.Thanks.

Hi, i am using Arduino mega & Ethernet shield to do same program as yours, but it doesn't work ever turn on the LED via webpage. could you please advise any skill?

You have configured the modem before at port 80?
Also you must check the html code for errors.
After give http://192.168.1.15 if your modem work at 192.168.1.1 but if your modem work at 192.168.2.1 modify my sketch and give 192.168.2.15
You can change it with 192.168.X.YY YY = 1....255 X=same modem setup IP.
If work locally you can expand it to global with DynDns account (or similar, DynDns is not free anymore) or with static IP from your internet provider.
Check this in my code....Thanks.

Power7net, i was looking for a simple example of interaction between a web page and an arduino example utilizing the SD card on the Ethernet Shield. This is perfect! Thank you.

Where I can find the PulsesIR_Toyotomi library?

Hi, when I m compiling program getting error
'PulsesIR_Toyotomi' does not name a type
'pulsesIR_Toyotomi' was not declared in this scope
can you please advise

Hi my friend I want to connect my arduino from wan but reading your code I don't see how you connect with dyndns to access to host name replacing the dinamic ip of router... I can control my and update my public ip with no ip and arduino but now I want control and read data for the arduino from external computer connect to internet...

manuel_zazu:
Hi my friend I want to connect my arduino from wan but reading your code I don't see how you connect with dyndns to access to host name replacing the dinamic ip of router... I can control my and update my public ip with no ip and arduino but now I want control and read data for the arduino from external computer connect to internet...

You would use a url like below to access your index.htm page, then the rest of the urls in your page can reference the initial download url.

http://mypage.no-ip.com/index.htm

Several of the issues which have come up in the above are addressed in the pages I've been creating and refining for some time now at...

Besides the "how to" stuff there, there is complte downloadable sourcecode. The Arduserver3 code is the one to "go for", probably.

===
Getting everything working can be "a little" daunting.

The following starts with some BASIC basics... skim them, if you don't need them. There's more, later.

Start with a "simple" set up: An LED to stand for whatever you want to turn on and off over the web. Control it with a subroutine called TurnItOnOff. For now, in your loop() routine, read a push button. Button down, LED on. Up, off.

You probably, eventually, want to be able to see the temperature in the controlled space. Connect a temperature sensor, and read it with a subroutine called ReadTture which returns the temperature in a form you have the software skills to cope with. I often use an integer-type datum filled with tenths of degrees centigrade. In other words, if the temperarture were 23.8 deg C, I'd be working with 238. If negative temperatures are going to be involved, just "slide" the scale down 1000 degrees, making 23.8 C 1238 in my scheme. (-15.0 deg C would be 850)

Now, without messing much with your subroutines, just by adding a few bits to the loop() code, you should be able to get your growing system to report the current tture, even if only in my weird scale, to the serial monitor whenever you press the button. (Not met the serial monitor? Go meet it! Very useful for debugging. Therefore, leave pins D0 and D1 out of YOUR designs, so that they remain available for the serial monitor. Intro at...


Time to tackle using your ethernet module.

First: IP addresses...

There are two sorts (at least).

"Local", and
"Outside world".

In a simple home, you may well have a wire from outside carrying "the internet" into your house.
It will connect to a modem/router (Called "router" from here). That router will have an "outside world" internet address, assigned to you by your ISP. (And it can change from day to day.)

It would look something like 152.54.201.153

IF I knew your outside world IP address, I could put it into my browser, and "the system" would send a request from me to you, asking, do you have a web server connected to the outside world? If you do, please send whatever it is set up to send."

We'll come back to all of that.

Your router is in two parts. One faces the outside world, passes "stuff" back and forth with outsiders. The other part faces inwards, to you and whatever you've attached to the router. That part of the router takes stuff from the attached devices, and sends stuff to them.

And it also sometimes passes stuff from "outside" to "inside", or vice versa, OR passes stuff BETWEEN devices on the "inside", assuming you have more than one.... which you will do if you have a "normal" internet terminal (e.g. a PC with a browswer... e.g. the thing you are reading this on!)

All of the "stuff" "inside" is your Local Area Network, your LAN.

Each device on the LAN has a unique-to-your-LAN "IP address", too. And they usually start with...

192.168.0.

My PC might be on 192.168.0.5, and my Arduino web server on 192.168.0.250

Those are their LAN addresses. Both can be "seen" in the outside world... but they are "seen", from outside, as being "at" the "outside world" IP address my ISP has assigned (today) to my router.

If my router's "outside" IP address happens, today, to be 152.54.201.153, then if you point your browswer at that, the message will arrive at my router, and then be passed so ONE of the devices on the LAN.

If you JUST use 152.54.201.153, your browser will add ":80" to that, to tell my router what sort of reqest for service is arriving. And I've told my router which of my devices to use for requests for those services.

If you use 152.54.201.153:81, your browser will send it out unchanged, and my router will send the request to a different device on my LAN... the one I've designated to service those requests.

** BUT I've gotten ahead of myself!....

=========
START with the REALLY SIMPLE stuff I set out at the top.

THEN work on getting your Arduino to work as a Web Server JUST on your LAN....

Start by telling your router to set aside some of the local IP addresses (192.168.0....) to be UNUSED by the DCHP service that it almost certainly provides.

Lets' say you've told your router "Don't use 192.168.0.220-192.168.0.254 for your DCHP purposes" (That's as good a range as any other to reserve).

THEN tell your Arduino to "put" itself on your LAN at 192.168.0.220. (And start careful notes of what you have put where! There's no reason to give your big stuff (laptop and so on) "static IP addresses" (That's what we're doing with the Arduino) (A LOCAL static address. a Static "outside" address is very expensive, and, for us hobbyists, not needed)...

There can't be more than one device on the LAN with the same local IP address. "The system" will take care of things like your laptop's connection (and smartphones, tablets, etc) AS LONG AS you have reserverd some addresses, as described above for .220-.254. And you only assign static (local) addresses within that range.

So. Do all the above. Tweak the web server demo code you are trying to use in your Arduino, so that it will "attach" to the LAN at the right IP address. (If you notice the "port" thing too, use ":80" for now. Be careful not to end up with two colons. You may only need to put "80" into the software.

Ah. "Web server demo code you are trying to use". I would suggest the one that comes with the standard Arduino software development environment. At 12/14, on my setup, that would be "WebServer" in Examples/Ethernet. It will, once all is taken care of, tell you the voltage on one of the analog inputs.

Once that's done, you should be able to sit at a computer on the LAN, fire up a web browser (e.g. Firefox) and put the local IP address into the browser's address bar, and get some kind of answer from the Arduino. (Address bar: Where you SHOULD put the "www." things we use to access "stuff" "on the web". NOT the Google search window, which so many people use all the time, even though that is going 'round the houses, if you know the www thingie. Sigh.)

*** BY STARTING LIKE THIS, we are leaving a whole bunch of problems out of the picture... for now. I'll put the rest in a "Part 2" post.

Here's the second half of what I started above...

Apart from reserving some local IP addresses for your use, you won't (yet) have to mess with settings in your router.

You won't (yet) have to mess with getting a DDNS service working.

You won't (yet) have (some) of the anti-malware software problems you may get later.

Once you have that working, try tweaking whatever web server example you used as a starting point so that it will tell you the temperature of an attached temperature sensor. For not, DON'T START trying the much more complicated business of getting the Arduino to accept "do this" commands down the internet.

Bookmark this page. Just getting that much working could easily fill the rest of today. When you have that working, come back for....

PART TWO.

So. You have a web server working on your LAN. Good. LOTS accomplished. The rest is very "do-able", too... but if you followed my advice, you weren't distracted by some of todays issues while trying to get yesterday's dealt with.

Now we're going...

First: to make your Arduino web server visible to anyone on the interent
Second: to make it accept commands, e.g. turn the LED on or off.


Making your Arduino visible.

You'll need to get a DDNS service running. The details are in my Arduserver.com pages, but here's the essence:

There are people out there who will, either for free, or for very modest fees, do something for you.

What they will do is get a URL (www-thingie, e.g. "www.google.com") registered for your internet-wide exclusive use. Let's say you've been given MyHome2014c04.org

They will then listen for messages from you. Those messages will say "My current numeric "outside" IP address is...." (Let's say that it is 152.54.201.153 at the moment)

And if your address has changed, the nice people at the DDNS service will tell the necessary people "If anyone wants MyHome2014c03.org's server, they need to go to 152.54.201.153"

Once that's done (once set up it all happens automatically), anyone putting MyHome2014c03.org into their browser is sent to 152.54.201.153. Fantastic!

(Your system... probably something in your router... will have to send the "My current address..." message either periodically, or whenever it changes, if you have a "clever" updater which "watches" for changes.)

That's it in a nutshell. More help at Arduserver.com, or a connected page.

You should now be able to "see" your Arduino server from anywhere. And you can test that from your own LAN if you put MyHome2014c03.org into your browswer. "Looking" for your server that way will make your system go "out" onto the internet, even though the internet will send the request "back" to the device which COULD have been accessed more directly.


ONWARD....

Last, and certainly not least... Buttons on your webpage.

It is quite easy to put a button on a webpage. That's just a little tricky HTML. I found getting clicks of those buttons ACTED UPON "a bit" of "a challenge"... but I got there in the end.

Before you can do anything with buttons, you need AT LEAST to be able to "see" the web server over your LAN. At that point, you could have tried adding the buttons, to act, OVER THE LAN... but getting your (read only) webserver visible across the whole internet seemed more do-able, and more fun, that's why I suggested doing that first.

Adding the buttons has no implications for anything which has gone before this.

I'm not going to give even a condensed "how to add buttons" here... it's all at Arduserver.com

====
Hmmm... still reading! Thank you! But I'd be REALLY grateful if you would "Like" or "Goggle Plus" some of the referenced pages. The above, and those pages have been a lot of work. Sometimes I wonder if it is of any use to anyone. If it isn't, there's no point in me doing these things.