1.1 Problem presentation: how to use Arduino and wifi for sending temperature to the remote cloud server
In this section, we will give a presentation how can we send the sensed temperature data to the remote cloud server by using Arduino control board (Cduino) and WiFi module. Then, by login into the distributed clients, you can check the temperature around your lovers at any countries in the remote Atlantic side. Certainly, if using many types of sensors, you can check and read many other required information.
31.2 Hardware and software
The required materials in this experiment are shown in Table 1-1.
Table 1-1: the required materials
|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|
|HTC mobile phone||1||Wifi hot spot|
|Breadboard and line||several||connection|
The hardware materials can be seen in Figrue 1-1. All of these modules can be found at www.smartarduino.com, where, the wifi module is updated the new one. Arduino kit can be found at
Figure 1-1 Hardware
1.3 Work principle
The work principle for this experiment can be seen in Figure 1-2.
Figure 1-2 working principle
1.4 Experimental analysis
(1) draw the experimental schematics: According to the design idea, you can draw the experimental schematics, which is shown in Figure 1-3, and this principle of LM35 is the same as Section 8 from the Basic Part. To readers’ convenience, this figure is given here again. Compared with this experiment, it is short of Arduino shield board and wifi board. But the principle of collecting temperature by LM35 is the same as Section 8 in the Basic Part.
Figure 1-3 Experimental principle
(2) circuit connection: By the experimental principle, we firstly connect the circuit shown in Figure 1-4, where, the WiFi module has been updated into the new one, and a omni antenna is add for the better WiFi signal.
Figure 1-4 Experimental connection
(3) wifi network connection: when we power the wifi on the Arduino main board, we can get the wifi signal. But, for the stability of wifi signal, we should power the wifi shield board by the dedicated voltage adapter shown in Table 1-1. Note that, the wifi module could not be inserted in a wrong direction. If right, then the three led lights will be light (one red and other two is green); if wrong, just ONLY one red led is light. Or, you can connect it by Fig. 1-4.
If the inserted wifi module is right, after a short while, you can search a wifi signal in your compter named as Serial-WiFi transmitted by wifi module. Then double click the wifi network serial-wifi, and input the password ( the default password is 12345678) shown in Figure 1-5. In general, it is not necessary to input the password. Then, the serial-wifi network is connected.
Figure 1-5 Serial-WiFi connection
Note that, if you use the wifi module at the first time, to ensure the exactness of data configuration, wifi module needs to recover to the default factory settings (press the button RST on the Cduino shield board for 6 seconds, then power off and reboot for the wifi module, as shown in Figure 1-6. Also can see the method in Section 2).
Figure 1-6 Reset wifi module to the factory default setting.
This step is similar to open the wifi in our phone to surf the internet. It shows that the wifi module can transmit the wifi signal. Therefore, if wifi module connects a wifi hot spot, then we can let data send by wifi communication.
(4) set up wifi hot spot: Since there is no other wifi hot spot in our such experimental environment, then we use OUR HTC mobile phone to set up a wifi hot spot (wifi router is suitable). After this, temperature data can be sent by wifi to the cloud server. At first, open the “WLAN hot spot” in the mobile phone. At the same time, remember to open 3G network signal (very important), which can make temperature data collected by LM35 send to server in the remote cloud. In this experiment, the WLAN hot spot name in my HTC phone is set as “SmartArduino” for the mobile SSID, and password is “12345678″, as shown in Figure 1-7. You can also use the default name and password. However, for the input convenience, you had better to modify the default name and password.
Figure 1-7 wifi hot spot by HTC phone
(5) network configuration: This step is very important. If right, then you can do a successful experiment. When the computer finds and connects the wifi network Serial-WiFi from the wifi module successfully, you can input the website “192.168.16.254″ in the browser, and input the user name and password (both are “admin”) to configure the web data, which is shown in Figure 1-8.
Figure 1-8 Login into the wifi configure system.
After login into the wifi configure system, we can set the wifi module some parameters. The detailed parameters and information is shown in Figure 1-9.
Figure 1-9 Serial-WiFi network configurations
After set, then click apply, then my HTC phone will find a connection, which is shown in Figure 1-7. When configure the network data parameters, please specially note that the marked by red rectangle, and others can be default settings. Some notes are given as follows.
At this time, wifi module can be viewed as a collection and transmission unite, which can send the collected temperature data to the server on the remote distributed cloud.
SSID and Password are the same as the SSID and Password from the mobile phone (or wifi router).
Remote ServerDomian/IP: It is pointed to the server IP address where the temperature data are stored at. In our such experiment, the IP address is 22.214.171.124, which is corresponding to the IoT system (www.IoT.fm). Anyone can use this server to do their own experiment.
Locale/Remote Port: the server port number, here is 80.
After configure, click “Apply”. At this time, if you check your phone, there is a “1 user connects” in the bottom of the “WLAN hot spot”, as shown in Figure 1-7. This implies that, the wifi module on the Arduino board has been connected the mobile hot spot. That is, the wifi module has been connected the internet. Then the sensed temperature data by LM35 can be sent to the cloud server.
(6) Arduino code
|//the sensed temperature data by LM35 is sent to the remote server 126.96.36.199 (www.IoT.fm)|
void upload_sensor(float vol)
// send the HTTP PUT request:
//here, uid=demo, and the key is encrypted by “Get API Key” on the IoT system
Serial.println(“Host: api.iot.fm”); //the remote server
Then you can download the above code to the Arduino control board. Note that, there is a switch. You should let the switch on the outside (O) when downloading the Arduino code. This is because the serial connection may affect the data download, which is shown in Figure 1-10.
Figure 1-10 Switch on the Cduino base board
At the same time, you can track the data transmission on the monitor at the Arduino soft-platform, which is shown in Figure 1-11 marked by the red label. The temperature is 26.39, and this data has been transmitted to the remote server cloud by wifi networks.
Figure 1-11 Data display on the Arduino serial monitor
(7) data connection at the end: if you finished the above six steps successfully, congratulations, you are successful. The temperature sensed by sensor LM35 has been successfully sent to the server on the internet by wifi module. The related temperature data can be exhibited in Figrue 1-12, which is obtained by click “Data List” in the IoT system. Note that, when you want to checkt the new sensed data from Arduino, you must refresh the IoT system to get the new sensed data.
Figure 1-12 Data List at server
1.5 Key notes and summaries
(1) Before configuring network parameters, to ensure the successful configuration, please recovery the wifi module to the default factory settings.
(2) Please ensure the exactness of data configuration, especially the settings about mobile phone and server IP address.