Chapter Two:A Brief TCP Communication between Arduino and Remote Server


2.1 Problem presentation: How to transmit the sensed temperature by LM35 to the remote server by TCP protocol based on Arduino platform.


In this chapter, based on the Arduino UNO R3 development board, we will realize the function that the sensed temperature data can be sent to the remote server by using wifi module. Furthermore, we can control the data to send or not. Similarly, by using this TCP communication protocol, you can control the network-based electronic devices at anywhere through your phone or other network communication ways (e.g., wifi).


2.2 Hardware

The required materials in this experiment are shown in Table 2-1.

Table 1-1: the required materials

number name quantity function note


Arduino software 1 platform


server 1 manager data


WiFi module 1 Wireless communication


Arduino shield board 1 Connection wifi All version


USB to serial RS232 1 conversion


5V/1A voltage adapter 1 voltage


Antenna 1 Transmit wifi signal optional


Samsung mobile phone 1 Wifi hot spot


LM35 1 Collect Temperature


Breadboard and line several connection


Cduino 1 Development board

The hardware materials can be seen in Figrue 2-1. All of these modules can be found at, where, the wifi module is updated the new one. The Arduino kit can be found at SmartArduino


Figure 2-1 Hardware


2.3 WiFi module parameters setting


For readers’ convenience, we will repeat the wifi module parameters setting by the following steps:

  1. Connect wifi module: find the signal transmitted by the wifi module in your PC, and double it to connect this wifi network;
  2. Login into the wifi local server: input the URL:, and input the default name (admin) and password (admin).

    Figure 2-2 login into wifi local server


  3. Parameters setting: You can set the corresponding parameters shown in Fig. 2-3. Note that, in our such experiment, we use phone as a wifi router (i.e., hot spot). Its name and password is SmartArduino and 12345678, respectively. The remote server is our IoT system ( Its IP is, and the TCP port is 9501. Certainly, you will change the parameters if you choose other communication ways and the remote server.

Figure 2-3 wifi module parameters setting

Warm prompt: to make sure the parameters setting right, you had better reset the wifi module to recover the default factory setting, as shown in Fig. 2-4.

Figure 2-4: reset wifi module

2.4 Experiment

After the above setting, you can download the Arduino code to the Cduino development board. The Arduino code can be download from the github (


Then, open the serial monitor, we have the following result, as seen in Fig. 2-5. It is shown that, the sensor arduino is waiting for the command from the server.

Figure 2-5: experimental result by serial monitor

So, if we send a command “begin” to the sensor arduino, seen in Fig. 2-6.

Figure 2-6: send a command “begin” from the remote server.

and Arduino board also receives the command, then we will see that, the sensed data has been tested by serial monior, shown in Fig. 2-7.

Figure 2-7: the sensed data by using serial monitor.

At the same time, we can also see the sensed data at the remote server. Open the “Data Display”, and select the sensor “arduino” at the pie graph. We see the sensed temperature data by LM35, which is shown by the pulse in Fig. 2-8.

Figure 2-8: the sensed temperature data from Data Display.

In addition, we can use the “Data List” to see the concrete data value, as shown in Fig. 2-9. For example, at the time: 2014-05-22 08:07:15, the sensor “arduino” receives the temperature data “27.37″.

Figure 2-9: the concrete temperature data from “Data List”

If we send a command “end”, the remote server doesn’t receive the sensed temperature data, which can be seen Figs. 2-10, 11.

Figure 2-10: send a command “end” at the remote server.

Figure 2-11: the sensed data disappears after send an “end” command


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>