webserver not working

hi,
i have a temperature sensor connected to my ethernetshield and the shield to an arduino uno.

When i change the code of the webserver example a bit so i can read in degrees centigrade it works, but only when i connect straight to my computer and i need to change the ip of my pc to be in the same range.

When i connect to my router and then to my pc i can't connect any more.

How can i solve this ?

temperatuur.ino (2.73 KB)

yyy898:
i have a temperature sensor connected to my ethernetshield and the shield to an arduino uno.

When i change the code of the webserver example a bit so i can read in degrees centigrade it works, but only when i connect straight to my computer and i need to change the ip of my pc to be in the same range.

When i connect to my router and then to my pc i can't connect any more.

Connecting an Arduino webserver to your PC instead of to your router sounds wrong.
So that seems to be a LAN problem, no Arduino problem.

A typical home network configuration is:

  • router connected to internet service provider (router "WAN" port)
  • each station (PC, Arduino network shield) is connected to the router (router "LAN" ports)

If your router has not enough LAN ports, you need an additional "home LAN switch" to multiply the number of LAN ports in your network.

Find out your IP configuration. When you are on Windows 7, open a command interpreter window (execute "cmd.exe") and run the command ("ipconfig"). The values for IPv4 address, default gateway and subnet mask will give you some informations about the configuration you may use with your Arduino.

If for example:
IPv4 address: 192.168.2.200
subnet mask: 255.255.255.0
default gateway: 192.168.2.1

Then you just select an IP address if 192.168.2.x where 'x' is replaced by a number in the range 2..254 which is NOT already in use by some other device in your network.

ok, changed the ip of arduino to 192.168.0.177, and i changed the port to 8080 (just in case 80 is blocked for some reason)

arduino is wired to a lan port,
but i still can't connect wireless or thru an other lan port

yyy898:
ok, changed the ip of arduino to 192.168.0.177, and i changed the port to 8080 (just in case 80 is blocked for some reason)

As your LAN network seems to be operating at 192.168.0.x addresses, IP 192.168.0.177 should be fine for your Arduino webserver. I cannot see any problem.

If you have any problems, please check:

  1. Do you have an "Ethernet Shield with Wiznet W5100", or is your hardware different?

  2. What is the output when pinging the IP address with ICMP echo requests?
    ping 192.168.0.177

How much experience do you have with networking? Are you familiar with the assignment of IP addresses, netmasks and gateways?

You must assign an IP to the Arduino that is within the netmask range of the localnet your PC is on. Use an IP that is outside the IP range of the localnet DHCP server.

jurs:
As your LAN network seems to be operating at 192.168.0.x addresses, IP 192.168.0.177 should be fine for your Arduino webserver. I cannot see any problem.

If you have any problems, please check:

  1. Do you have an "Ethernet Shield with Wiznet W5100", or is your hardware different?

  2. What is the output when pinging the IP address with ICMP echo requests?
    ping 192.168.0.177

when i ping i get: destination host unreachable

yyy898:
when i ping i get: destination host unreachable

Very strange.
Which type of board are you using? Is it an UNO?

Is your Arduino Ethernet Shield able to obtain a dynamic IP address from your router by changing the Ethernet initialization to:

//  Ethernet.begin(mac, ip);  // fixed IP address (commented out)
  Ethernet.begin(mac);  // try to obtain dynamic IP address from the router instead

What IP address does the serial monitor then print in the line "server is at ..."?

then it just doesn't output an ip.

I am using an aduino UNO indeed

When i connect to my router and then to my pc i can't connect any more.

Can you explain in more detail what and how are connecting the arduino?

yyy898:
then it just doesn't output an ip.

I am using an aduino UNO indeed

Please check mechanical connections between UNO and Ethernet shield.

Especially when combining "compatible" no-name boards with each other, the following problems may arise with the 6-pin ISP connection between both boards:

  1. male headers too short
    ==> possibly short circuit between UNO-USB and soldering side of Ethernet shield

  2. male headers too long
    ==> possibly the 6-pin ISP header connection will not fit correctly

Please check mechanical stacking of the shield and take special care that:

  • no short circuit between UNO USB and soldering side of shield can occur and
  • that the 6-pin ISP header between UNO and shield create a firm connection

all the connections are good because when i connect directly to my pc everything works fine, it only stop's working when i put a router in between

What brand and model router are you using? I have seen reports that TP-Link routers have problem with the ethernet shield.

D-link

Hello,
Is there a solution yet?

Same problem here. Ip, Subnet, Mac all in range, but there is no local connection. D-link DL524 router and TP-Link WR840N router too (both are not working). I have another TP-Link router, the same UNO is working fine there.