Vous êtes sur la page 1sur 26

alselectro

All about Microcontrollers,Tips on Pc,Android phone,Electronics

Hey there! Thanks for dropping by alselectro! Take a look around and grab the RSS feed to stay
updated. See you around!

 8051
 ARDUINO
o ETHERNET SHIELD
 BlueTooth/WIFI
 CCTV
 Electronics
 ESP8266
 Friendly ARM Mini2440
 GPS
 GSM
 GSM,GPS
 LPC 2148
 MicroControllers
o AVR Microcontrollers
 PIC MicroController
o PIC16F877A – MPLABX with XC8
 Port Forwarding
 QUADCOPTER
 Raspberry PI
 Robotics
 STM32 ARM CORTEX M3
 Ubuntu Linux
 Uncategorized
 Windows
 XBEE Radios

Ethernet Shield–Connecting with Laptop instead of


direct Router
Filed under: ARDUINO, ETHERNET SHIELD — 5 Comments
May 1, 2017

In the previous post we’ve seen how to connect the Arduino ETHERNET SHIELD to a Router
directly & upload LM35 data to Thingspeak.
What if you do not have physical access to your Router & your Laptop is connected over WIFI
to the Router. Or you cannot run a RJ45 cable from Router to Ethernet shield.

The procedure we follow is similar to the one we did for connecting Raspberry PI to Laptop.

Link here

First step is to enable SHARING of your existing internet.In my case , Laptop is connected to
Router

over WIFI.

Open Control Panel –> Network & Internet –> Network & Sharing Center

Click on the existing internet connection

On the next screen click PROPERTIES & then SHARING


Tick mark to ENABLE SHARING of Internet connection

Now plug in the USB cable to Arduino & then connect the RJ45 Straight cable from shield to the
RJ45

Port of LAPTOP.
As soon as you connect the RJ45 cable you can see an UNIDENTIFIED NETWORK
Click on that new Network , select PROPERTIES.

On the next screen double click on Internet Protocol version 4 (TCP/IPV4)


You can see an IP address like 192.168.137.1.

Note that this is the new Gateway IP of the new network formed by Ethernet shield.If you do not
see any IP , just select the “ Use the following IP “ & feed in manually the IP.

Now RUN –> CMD > IPCONFIG /ALL

to verify the IP.

Under Ethernet adapter the Gateway IP of new network is displayed.

Note that this is the GATEWAY IP & Ethernet shield will be allotted IP in this range .
Let us try some built in example codes.

Under Examples –> Ethernet –> select DhcpAddressPrinter

This will print the IP allotted to the Shield.


Upload the code & open up the Serial monitor.

The IP allotted to the shield here is 192.168.137.30 which is in range of new Gateway .
Next example is WEBSERVER
Open the WEBSERVER code .

You need to change the IP Address as 192.168.137.xxx

Here change it to 192.168.137.177 where the SERVER will be started. Note the usage of comma
instead of dot between each byte.
Upload the code & open the serial monitor to verify that SERVER is started.
You can use your Browser as CLIENT.

Type in the IP 192.168.137.177 to access the server.

On the Serial monitor “Client connected “ information will apper.

On the browser you can see the values of ANALOG Pins of Arduino.

As nothing is connected to the Analog pins , you get random values.


Next example is the TELNETCLIENT

Open the code.

Here Ethernet shield is used as CLIENT & you need to change the IP of client in range with the
new Gateway 192.168.137.177

Next is the IP of the SERVER . This may be another PC or Android phone connected to the
same Network .

Here the SERVER is started on PC with IP 192.168.0.103

Note that this IP is in the range of Gateway of Router 192.168.0.xxx


Scroll down further & note the PORT number on which the SERVER will LISTEN.

Here it is 10002.

Upload the code on to Arduino.


To test the setup , you need to start a SERVER on another PC on the same network with IP
192.168.0.103

For this we use HERCULES software. DOWNLOAD HERE

Click on TCP Server tab on Hercules , feed in the port number 10002 & click LISTEN.

The server is started on PC with IP 192.168.0.103 , so , no need to enter the IP


Now open the Serial Monitor of Arduino where SHIELD is declared as CLIENT.

You can see the “Connected..” feed back from the Server.

Type in some characters on Arduino side , as well as Hercules side to verify 2 way
communication.
Instead of PC & HERCULES you can use your Android mobile ( to be connected over WIFI to
the same Network).

On your mobile install TCP TOOLS


Open TCP SERVER

The IP of Android device is shown with default port 8080.Click on LISTEN

In the TELNET CLIENT code you need to change the SERVER IP t from 1,1,1,1

to 192.168.0.102 & then change the port of server to 8080 & then upload to Arduino
Once code is uploaded open the Serial monitor.

On mobile you see the IP of CLIENT connected


Test 2 way communication by typing in characters.
Next we shall test the code which sends LM35 Data to THINGSPEAK SERVER.

You can check my previous post for details

Upload the same code without any change in IP.

IT WORKS FOR BOTH RANGE OF ipS 192.168.0.xxx & 192.168.137.xxx


Open the Serial Monitor to see the data being uploaded to THINGSPEAK.
WATCH THIS VIDEO :

Share this:

 Twitter
 Facebook

Related

Arduino Ethernet Shield–LED ON/OFF from webpageIn "ARDUINO"

Ethernet Shield for Arduino – a walkthroughIn "ARDUINO"


ETHERNET SHIELD Arduino–Upload LM35 Data to THINGSPEAKIn "ARDUINO"

Tags: ETHERNET SHIELD


Comments RSS feed

5 Comments:

Pawan

May 2, 2017 at 11:26 am

wonderful work sir …

Reply

SyedTauqeer

March 27, 2018 at 3:00 pm

I am facing a problem that my new network is not showing. it appears for 2 sec and
disappears again. Please tell me what possible error might be.

Reply

nemuke denzo router

August 5, 2018 at 4:55 pm

good effort. don’t stop sharing & keep updating.

Reply


Rob

October 7, 2018 at 1:24 pm

Great help here! Thanks for the well laid out procedure.

Reply

Taki Ripeu Bosoka

January 13, 2019 at 2:03 am

Ethernet WebServer Example

Ethernet shield was not found. Sorry, can’t run without hardware.

whats the problem?

Reply

Leave a Reply

« ETHERNET SHIELD Arduino–Upload LM35 Data to THINGSPEAK


Arduino PRO MINI – How to upload code »

 Blog Stats
o 1,951,324 hits
 Follow Blog via Email

Enter your email address to follow this blog and receive notifications of new posts by
email.

 Recent Posts
 NEXTION HMI Display With Arduino–Getting Started
 STM32 F103 Bluepill ( Arduino core) – USB upload
 STM32F103 Bluepill–Getting Started with Arduino core
 RASPBERRY PI – All About controlling Relay Boards for Home Automation
 Raspberry PI B , B+ – How to enable UART & interface with GSM
 How to connect Raspberry PI to LAPTOP – DIRECT NETWORK LINK Method
 USBASP – How to install driver on Windows 8 /10
 Sim808 GPS GSM Module – Sending Gps Location SMS
 GPS Tutorial–Sending GPS Coordinates over GSM
 ESP8266 WEMOS D1 With I2C Serial LCD
 WiFi ESP8266 Development Board WEMOS D1
 GSM controlled RELAY with Arduino
 LPC2148 – Getting started with 32 bit ARM7 uC
 NodeMCU Arduino core 2. LED On/Off from WebBrowser
 NODEMCU–Getting Started with Arduino Core 1. GPIO pins & Network Access
 AVR– SELF LEARNING – TIMER1 INTERRUPTS
 AVR–SELF LEARNING – TIMER 0 INTERRUPTS
 AVR SELF LEARNING – EXTERNAL INTERRUPTS
 AVR SELF LEARNING KIT–Interfacing 16 x 2 LCD in 8 bit Mode
 AVR–SELF LEARNING KIT–Getting Started

 Archives

Archives

 Address

Saravana Electronics,
10,Edayar Street,
Coimbatore,
India

Vous aimerez peut-être aussi