Ok so so far, I have my newly acquired E'net shield running as a web server, connected via a drop cable to the ADSL modem. I gave it an IP addy in the 10.0.0.x range since the router is 10.0.0.2 and it assigns our laptops similar numbers. So, laptops in the house can browse to the Arduino web server which then responds with the temperature from an LM35, all via the adsl modem.
That was easy....
Now then... how do I make my Arduino web server visible on the other side of the modem?. So far I guess I have an intranet, but I wonder if it's possible to make it out onto the www? Then I could check the house temperature by browsing from my bb.
I have a feeling this would be a whole new ball game?
Now then... how do I make my Arduino web server visible on the other side of the modem?. So far I guess I have an intranet, but I wonder if it's possible to make it out onto the www?
No, but you can make the router visible (actually, it already is) and then have it do port-forwarding, to send data that should go to the Arduino actually go to the Arduino.
you need to configure port forwarding on your router. Just google it, there are tons of instructions for it, there might even be one specifically for your router model.
Here is my webserver.
I use (modified) TinyWebserver library and wrote an html5/javascript program using jquery heavily for a mobile web interface to my arduino based aquarium controller. I access it via my smart phone. This is how it looks (everything is served out of the arduino, no external service used)
Very slick doughboy, well done.
I have two questions though, how did you interface the webcam to the Arduino and did you use DynDNS or do you have a static IP from your ISP?
(or are you acessing it via wifi on your local network)
the webcam video feed is from a foscam ip camera, but integrated into the web page.
if you buy a foscam, you get a dns service from foscam that works similar to dyndns, so thats what I use. I do not have a static ip per se, but my dynamic ip has been the same for the last 10 years. As long as you do not disconnect your modem (cable or dsl) too long, you will most likely get the same dynamic ip address from your isp.
So, I need to get Mr Gooogle to help me. I still have the box my modem came in, and there's a CD in there which afair, has a full manual, not just the "getting started" I pull out from time to time.
Edit: Yep the manual has a section on Port Forwarding, and Portforward has a section on my device, so here goes.
It was the whole name thing that I was wondering about, so seems covered by the dyndns thing.
If you expose your server code to the internet, insure your server code is bulletproof. Mine was under attack almost immediately after exposing it to the net. The public ip is port forwarded through my router to the Arduino at 192.168.2.2.
Here is the post with my test. http://forum.arduino.cc/index.php?topic=197103.0
The server code is still up, but modified from the original format. It now uses index.htm file as the default. It does not have fancy pages on it yet, just enough to test all the web browser functions. http://68.99.58.119
Do not leave any functions exposed that could be used to break your security. Exposing a control like your garage door opener to the internet without any type of security could be bad.
Thanks Tim.... mine isn't working yet. I "think" I've port-forwarded correctly, but when I type in my external ip (as declared on my modem's internal page) I get unavailable. When I follow your test link it works, btw: that's what I was expecting mine to do.
I was just going to ask you to post the sketch, but I see you did that already in the Playground: on my way there now to have a look.
Are you certain your ISP allows port 80 connections from the internet? Unless you have a commercial account with a static ip, many ISPs, including mine, block port 80 requests, along with other major service ports.
I have a commercial account, so it works fine here.
Do you get your router webfig login page if you try your public ip from your localnet?
You lost me there, i'm afraid! Oh wait, i see what you mean.... no, that's the addy I put in to try access the Arduino, but it fails.
What I did notice is that if I tried the router's public ip addy from my laptop, I got the Arduino. But when I tried from a 3G connection it failed. I put that down to my laptop being wireless to the router, and even though I asked for the public address, I never left the house so to speak. (Of course, I can access the Arduino via its local address from my laptop, since it also has a local address on the lan side)
Try it from a neighbor or friend's connection. If it works from your localnet, and doesn't from the internet, chances are it is your ISP blocking port 80. The test would be to change your server port in the Arduino and port forward it. Many ISPs do not block 8080-8088. Change your server to that port, like 8080, then in your browser: http://xx.xx.xx.xx:8080
They don't want you hosting a public website on a residential account. You can almost always get around some blocks. The 8080 to 8088 ports are usually used for web proxy and bittorrent stuff, so the ISP's let that through.
edit: Since we are on this subject, let me remind you that hosting a public website with a residential account is probably in violation of your user agreement with your ISP. If they find out, you may have big problems.
I tried port 8080 and it still didn't work so I gave up
But then I though wth, and tried 8085 arbitrarily and whoopy-do it worked. I can now see the temperature in my dining room here. (It might not work for you since that's not a static addy and might change; also might have unplugged the whole thing by the time you try it.)
Thanks SurferTim for all that help; Karma++ on me!
Next I need to understand security: this only has a temp sensor running but I know zilch about this stuff so i hope it won't allow hackers into our home. It's not going to be on much, this was a pure "fun" test and I won't tempt fate by leaving it up.
I don't know about that port. You could take a chance and ask your ISP about it.
You can see how someone like me, except with bad intentions, could mess things up for you. Maybe turn up your thermostat to 90 degrees? Down to 55? Open your garage?
If you just want to monitor everything, you are safe with the code you have. Who really cares except you and me what your room temperature is right now. Just don't allow adjustments to any of that without implementing some type of security.
edit: And don't display info that could expose a weakness in your security, like "I'm not home and I know that because all the lights are off. But the door is open and the security system is disabled".