Arduino Web Server

About: I am a diy fanatic. I love to build electronics and play with computers. Me and my friends build projects together all the time. It is a great hobby and you should get into it too!

Intro: Arduino Web Server

This project uses an Arduino ethernet shield to serve up a webpage to your router. When you connect to that webpage with your computer or mobile device, you can control the LED on the breadboard. Lets get started. (Update: The code and schematic came from Rui Santos at http://randomnerdtutorials.com/arduino-webserver-with-an-arduino-ethernet-shield/ )

Step 1: Parts

For this build you will need:

1x Arduino Uno R3 RadioShack

1x Arduino Ethernet Shield Amazon

1x Breadboard RadioShack

1x LED RadioShack

1x 220ohm Resistor RadioShack

You will also need:

Ethernet Cable Amazon

USB A to USB B Cable Amazon

Arduino IDE Arduino.cc

Hookup Wire

Step 2: Easy Assembly

Connect the ethernet shield to the Arduino by simply lining up the pins and pushing it in. Connect the led + pin to pin 3 on the Arduino. Connect the led - pin to the 220 ohm resistor. Connect the other end of the 220 ohm to the Arduino's GND. Use the image to help.

Step 3: The Code

This is the code for the project. The gateway, ip and subnet need to be changed to match you network. The MAC needs to be specific to the Arduino but do not change the "DE" at the beginning. Make sure no other device is using that MAC. (Update: Modified code to give credit to original creator.)

Step 4: Testing and Trobleshooting

When you connect to the webpage at 192.168.0.178, you should see the same as the image above. If the page doesn't load, push the RESET button on the Arduino and try again. If it still not working, check the gateway, the routers address, the subnet, and the MAC. If it does load, when you click lamp on, the led should come on. If not, check that the LED's longer pin is connect via hookup wire to Arduino pin 2. If anything is still not working, feel free to leave a comment.

Share

Recommendations

  • Make it Glow Contest 2018

    Make it Glow Contest 2018
  • Plastics Contest

    Plastics Contest
  • Optics Contest

    Optics Contest

11 Discussions

0
None
AmmarY4

2 years ago

thanks

0
None
RobDeVoer

2 years ago

Great project, thanks for sharing

0
None
Linesmen

2 years ago

I am not sure what you ment ? Arnt you still in LAN not in WAN?

Can this be all ? I am still Curius! can you Please explain more about It ?

"In the code, change the port 80 to 8081.

When you connect on the browser, enter this:

192.168.0.178.8081 (Arduino IP)Dot(Port)

If you have any issues, please let me know."

If you have any issues, please let me know."

1 reply
0
None
diytransistorLinesmen

Reply 2 years ago

For LAN, keep the configuration that is in the code. If you would like to set it up for WAN, change the code and setup port forwarding as I described in other comments.

0
None
Linesmen

2 years ago

i made It !

Thanks ! it was a intresting and nice tutorial.

I am not to good in english language but i try my best!

IaI

1 reply
0
None
diytransistor

3 years ago

The port forwarding should be setup like this:

Lan IP: 192.168.0.178 or Whatever your Arduino's IP is.

Protocol: TCP/UDP

Ports Forwarded: 8081

Remote Ports: 8081

In the code, change the port 80 to 8081.

When you connect on the browser, enter this:

192.168.0.178.8081 (Arduino IP)Dot(Port)

If you have any issues, please let me know.

1 reply
0
None
diytransistordiytransistor

Reply 2 years ago

This would work anywhere in the world as long as you have internet connectivity.

0
None
thom123

3 years ago

how change code to make that from other internet conection people could connect ? port fowarding already done