Sharing wifi to UNO + Ethernet

I know this question has been asked couple times, but I couldn't find any topics which goes really into the specifics.

Scenario: I have a wifi router, a notebook with wifi connection and an arduino uno with an ethernet shield. The plan is to connect the uno to the notebook with an enet cable and share the wifi with the uno so for example I can ping the UNO from my smartphone connected to the same wifi.

  • Wifi router IP: 192.168.0.1
  • Notebook IP: 192.168.0.3

I have right clicked the wifi adatapter in my network settings and checked the "allow other users to connect thru this computer's internet connection". I have assigned a static IP address to the notebook's ethernet adapter (192.168.1.200) and if I used the following lines in my code:

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };   //physical mac address
byte ip[] = { 192, 168, 1, 100 };                      // ip in lan 
byte gateway[] = { 192, 168, 1, 200 };                   // internet access via router
byte subnet[] = { 255, 255, 255, 0 };                  //subnet mask
EthernetServer server(80);                             //server port     

void setup() {
  Serial.begin(9600);
  Ethernet.begin(mac, ip, gateway, subnet);
  server.begin();
  Serial.print("server is at ");
  Serial.println(Ethernet.localIP());
}

then I was able to ping the UNO. The problem though is that I was only able to do this from the notebook and not from the phone, which means I really created a small subnet for the arduino, and it accessible from the notebook only. It doesnt really go "beyond" the notebook.

I have tried to use 192.168.0.100 and 192.168.0.200 but that didn't work either.

So please enlight me how should I configure my notebook and UNO to be able to ping the uno from my phone. There are no IP conflicts in my network, I know this for sure from the router.

If you read thru all these and willing to help: please be specific, dont be vague.

Thanks a lot!

UPDATE: I have edited a code because it showed a wrong IP, not comprehensive with the text. That was just a typo, I have ran the code I have described in my problem desciption.

This is incorrect. Insure the gateway is the IP of the notebook.

// change this
  Ethernet.begin(mac, ip, gateway, subnet);
// to this
  Ethernet.begin(mac, ip, gateway, gateway, subnet);

The update I have added to my post fixed that. I always used the IP of my notebook as the gateway. I have tripplechecked and it still the same. The full code I use actually runs an http server, so once I call the IP of the UNO from my PC it displays a small HTML page.

That HTML page is not accessible from anywere else on the same wifi.

As I wrote I tried using 192.168.0.100 and 192.168.0.200 as well without and differences. On the IP settings of the notebook enet I tried using the IP of both my wifi card and my router, but no progress.

If I type the IP of my UNO to my phone it gets back as "This site can't be reached"

If the wifi is your connection to the internet, then you will not be able to reach the Arduino from the wifi. The wifi gateway is not set to use the laptop, and the laptop's localnet is probably not routed in your router.

Your laptop (as I recall) will masquerade the Arduino's IP as its wifi IP.

Alright... l will assume that it is true and there is no way to connect to the arduino from the same wifi. Which sounds pretty odd, but... well, I am not a network guy.

What kind of a settings should I use in my arudino code if I want my arduino to be able to connect to blynk?

I was able to connect it to blynk if I have connected the arduino directly to the router. The problem is that I can not do that and programming via USB at the same time because the router is pretty far from my workstation. (moving the laptop to the router is not an option. It would be super-inconvenient to work there).

thanks.

Get a router that has both wifi and ethernet. Connect the Arduino to the ethernet. Then all devices should be able to communicate with the Arduino.

SurferTim:
Get a router that has both wifi and ethernet. Connect the Arduino to the ethernet. Then all devices should be able to communicate with the Arduino.

Istvanb:
I was able to connect it to blynk if I have connected the arduino directly to the router. The problem is that I can not do that and programming via USB at the same time because the router is pretty far from my workstation. (moving the laptop to the router is not an option. It would be super-inconvenient to work there).

"You can't alwYs get what you want..' - Mick Jagger

“Very true, thanks for trolling my question with irrelevant answers!” - wife of Mick Jagger

The relevant answer is route the Arduino localnet through the notebook.

SurferTim:
The relevant answer is route the Arduino localnet through the notebook.

Awesome! So you have finally read my question! Because it was about how to do it.