Author Archives: admin

Seg 3: Experimental analysis

3.4 Experimental analysis

(1) draw the experimental schematics: According to the design idea, you can draw the experimental schematics, which is shown in Figure 3-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 eight in the Basic Part.


Figure 3-3 experimental principle

(2) circuit connection: By the experimental principle, we firstly connect the circuit shown in Figure 3-4.


Figure 3-4 Experimental connection

(3) wifi network connection: when we power the wifi on the Arduino main board, we can get the wifi signal. But, note that, for the stability of wifi signal, we should power the wifi shield board by the 15V voltage adapter designed in Table 3-1. Then, after a short while, you can search a wifi signal in your compter named as HI_LINK_XXXX (which is said in Section 2) transmitted by wifi module. Here, in my computer, the wifi signal is called as HI_LINK_0021. Then double click the wifi network HI_LINK_0021wifi, and input the password ( the default password is 12345678). It is said that you have connected the wifi networks. Note that, if you use the wifi module at the first time, to ensure the exactness of data configuration, wifi module needs to recovery the default factory settings (press the button RST on the Arduino shield board for 6 seconds, then power off and reboot for the wifi module. Also can see the method in Section 2). 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. Then, if wifi module connects a wifi hot spot, then we can let data send by wifi communication.

Seg 1: Temperature sent to Cloud by using Arduino and wifi

3.1 Problem presention: how to use Arduino and wifi for sending temperature to remote cloud

In this section, we will give a presentation how can we send the measured temperature data to the remote cloud by using Arduino control board 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.

3.2 Hardware and software

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

Table 3-1: the required materials

number

name quantity function note

1

Arduino software 1 platform

2

server 1 Collection data

3

Wifi module 1 Wireless communication

4

Arduino shield board 1 Connection wifi All version

5

USB to serial RS232 1 conversion

6

5V1A voltage adapter 1 voltage

7

antenna 1 Transmit wifi signal optional

8

HTC mobile phone 1 Wifi hot spot

9

client 1 Read data

The hardware materials can be seen in Figrue 3-1.


Figure 3-1 Hardware

Seg 8: Mobile phone software

二. Mobile phone software

In nature, mobile phone software is the same as PC software. In this section, we will debug wifi module by mobile phone software.

  1. Install the mobile phone debug software EasyTCP (have iphone and Android versions, respectively. If you want them, you can contact me by skype: yichone.), in this experiment, we use the Android version EasyTCP.
  2. Open the wifi network at mobile phone, and look for the wifi signal HI-LINK_0021的wifi and double it to connect with the same way as PC version, as shown in Figure 2-12.


    Figrue 2-12 Look for the wifi signal HI-LINK_0021

  3. Open the mobile software EasyTCP→click “CONNECT”→click “+” to add the connection IP address and port number, which is the same as PC software. IP is 192.168.16.254, and port is 8080, which are shown in Figure 2-13. Then click “connect” to let mobile phone connect to the wifi network HI-LINK_0021.


    Figure 2-13 Connect to wifi network by Android mobile phone

  4. At the same time, we should open the serial assistant. In this experiment, we must send the data from mobile phone to PC serial port by wifi network. In the later experiment, we would send the data from mobile phone to server on the cloud. In figure 2-14, data “5″ has been send to PC serial port by wifi network successfully.


    Figure 2-14 Communication between mobile phone and PC serial port by wifi

2.5 Key notes and summaries

1) As for the new wifi board, we can make a preliminary judgment whether a wifi board can work normally by simply observing the display state of the LED light. But, we should note that the insertion direction when wifi board is inserted into a Arduino shield board.

2) when network-serial assistant is used to debug wifi module, it is noted that the wifi module should be recovery to the default factory setting and the software settings.

3) We should choose the wifi signal transmitted from wifi module to debug the wifi module, or we cannot use the wifi module for the wireless communication rightly.

Seg 7: Look for the wifi networks

(2) Look for the wifi networks


Figure 2-8 Look for the wifi network signal

After setting the relevant parameters by the above-mentioned step (1), we can find the wifi signal transmitted from wifi board according to the followings.

  1. After power on the wifi board for about 30 seconds, the three LED lights would be exhibited normally. That is, LED1 is lighting with red all the time, LED2 is light with green all along as well, and LED3 is blinking with green light. The relevant context can be referred as shown in Section 2.3. Then, clicking the network icon, you would find there are many wireless network signals, where there is a named as HI_LINK_XXXX wifi signal, which is the wanted wireless wifi network signal. Therefore, we can double click such wifi signal, then it is needed to input password 12345678, which is the default password. If it is the first connection, it needs us to input the password, but thereafter, we may not input the password. Note that, the later 4 letters “XXXX” in the wifi signal name HI-LINK_XXXX is denoted by the different names, since their names may be different according to the different wifi devices. For example, in our such example, the name of wifi signal is HI-LINK_0021, which is also the same as the name encountered in the mobile phone. After double clicking the HI-LINK_0021 wifi signal and input the password, we can make the computer connect to the wifi module on the Arduino shield board, as shown in Figure 2-8.
  2. According to 1), we can connect the wifi network HI-LINK_0021 transmitted from wifi module. Then, return to the network-serial assistant shown in Figure 2-6, click the “Open” button on the left serial setting, and click the “Connect” on the right wifi setting, which are denoted by opening the serial port COM6 and connecting wifi network HI-LINK_0021, as shown in Figure 2-9 with red label. Note that, if the serial port doesn’t open, or the wifi network doesn’t be connected, the buttons “Open” and “Connect” would not work normally, and thus we cannot change the states of buttons “Open” and “Connect”. In other word, “Open” cannot be changed into “close”, and “Connect” cannot be changed into “disconnect”.


Figure 2-9 open the serial port and connect wifi network

  1. After connecting the serial port and wifi networks by Figure 2-10, we can transmit and receive data between serial port and wifi module, as shown in Figure 2-11. When we send a digital number “1″ at serial port, then we can receive “1″ at wifi network. Similarly, if sending “1″ at wifi networks, we can receive “1″ at serial port. Thus, we have realized the normal communication between serial port and wifi network.

    Figure 2-10 WIFI connection based on Arduino shield board


    Figure 2-11 Communication between serial port and wifi network

Seg 6: Software settings

2.4 Software debug

You can also use computer (PC) and/or mobile phone software to debug the wifi module. After the connection among the wifi board, Arduino shield board, USB to RS232 cable, and power, then we can test the wifi module shown by the following.

一. Computer (PC) version software

(1) software setting

Open the network serial software (which can be download from the website, if cannot find, can be contact me by my skype: yichone). Firstly, we should set simply the software environment, as shown in Figure 2-6, especially for the red label.


Figure 2-6 Simple settings for the PC network serial debug software

Some notes on the settings:

  1. PortNum: can be found at “computer (or my computer)”→right click “property”→click “device manager”→click “COM and LPT”. We can get the PortNum is COM6. So, we choose “COM6″ in the software, as shown in Figure 2-7.


Figure 2-7 query of PortNum

  1. Baud rate (BauR): during the wireless communication, the rate is generally chosen as 115200. It is also the wifi transmission rate 11MHz.
  2. Protocol: during the wireless communication, we should let wifi module as TCP Client mode. In other words, let wifi as client to visit the server.
  3. ServerIP (server IP address): :in the default factory setting, please input the IP address: 192.168.16.254. Note that, in the default factory setting, the IP address is 192.168.16.254. However, if the wifi board has ever been used, the IP address maybe is not this address. So, before using it, we must confirm the default factory setting for the wifi module. The way to default factory setting is introduced at Section 2.3.
  4. ServerPort (server port): the value is 8080.

Seg 5: Get a better view of the LED lights on wifi board

  1. Get a better view of the LED lights

    If you get a better view of the wifi board, there are three LED lights. As the above-mentioned, if the insertion direction is right on the wifi board, the three LED lights would be lightened, as shown in Figure 2-4, where LED1 is the indicator for the power source, if the LED is light with red all the time, it shows that the power source works normally; LED2 is lighting with green, which shows the wifi module works normally; vice versa, the wifi module cannot work normally if LED2 is dark. LED3 is denoted by the state of wireless transmission. If LED3 is shining fast, it shows that the wifi module is transmitting data, and shining slowly shows that the wifi module is idle and has no data to transmit. Moreover, if LED3 is dark, it shows the wifi module close the wireless transmission.

Note that, if the wifi module has ever been used (i.e., it is not a new wifi module). To ensure the configuration is right, the wifi board should recovery the factory default setting. If wifi board is already default setting, you can skip over this step. Firstly, give the wifi board a 5V (350mA) power and wait about 30 seconds. Then press the RST button on the Arduino shield board for about 6s, as shown in Figure 2-5. The wifi board would reboot. After this, the wifi board can return to the default factory setting.


Fgure 2-5 RST button on the Arduino shield board

Seg 4: Hardware connection

2.3 Hardware debug

Generally speaking, a new wifi module is no problem in use. But for ensure to use, we can debug the new wifi hardware from the following.

  1. Hardware connection

    Fistly, wifi module is inserted into the Arduino shield board. Note that the insertion direction. A way for the judgment of direction is by the power. When power on, if the insertion direction is not right, then only one red LED light is lightened for the wifi module, and the remaining LED lights cannot be lightened (in fact, the remaining two LED lights is weakly shinning if you see them detailedly, since there exists interface around the two LED lights). Vice visa, if the insertion direction is right, then LED light is lightened and red at first. After a while, the other two LED lights can be lightened, where one LED light would be shining regularly.


    Figure 2-4 Description of LED lights for wifi module

Seg 3: Arduino shield board

  1. Arduino shield board

    From Figure 2-1, the Arduino shield board has two power provision ways; one is RS232 interface. As show in Figure 2-1, by using the cable USB to RS232, wifi signal can be changed into USB signal to computer by RS232 interface. So, when the wifi module are inserted into the Arduino shield, the power is provided by USB cable. But, since the Arduino and the shield board are powered by USB from computer, it may be not enough for the power source. Therefore, the best way to provide voltage is the use of power adapter. This can promise the enough power. In addition, by utilizing such Arduino shield, the communication ways can be wifi and Bluetooth (ble) for the short wireless communication.

Seg 2: wifi module

  1. Wifi module

    From Figure 2-1, wifi module has two rows of pins. If seen it in detail, there are labels for the two rows pins in wifi module, i.e., p1 and p2, which is denoted by the first row pins and the second ones. Each row of pins has 14 pins. Certainly, different type of wifi module is corresponding to the different labels. For example, wifi module is shown in Figure 2-2 has a mental shell, which facilitates heat dissipation, and its pins are labeled from 1 to 28. Similarly, all of the pins are arranged into two rows, each of which has 14 pins. Its schematic diagram could be seen in Figrue 2-3. When the 28 pins are inserted into the Arduino shield board, wifi signal is changed into serial signal, and/or vice versa. In general, there are two MAC addresses in the wifi module, which are used to look for the Application Point (Ap). The relevant context can be referred to the association in the first lesson part.


    Figure 2-2 wifi module with mental shell


    Figure 2-3 Schematic diagram of wifi module (unite: mm)

    Table 2-1 Definitions of pins in the wifi module

number

function

direction

description

1

VCC

Power In

5V power input

2

GND

GND

Power grand

3

WLAN_LED

O

WIFI start instruction

4

VDD

Power Out

3.3V power output

5

LINK2

O

Net gape 2 connection instruction

6

USB_P

I/O

USB signal +

7

USB_M

I/O

USB signal -

8

STA/GPIO_0

I/O

Status instruction/GPIO_0

9

GPIO_1

I/O

GPIO_1

10

ES/RST

I

Exit the passthrough/recovery factory value

11

TX0P2

A

Net gape 2 TX-P

12

TXON2

A

Net gape 2 TX-N

13

RXIP1

A

Net gape 1 RX-P

14

RXIN1

A

Net gape 1 RX-N

15

RXIN2

A

Net gape 2 RX-P

16

RXIP2

A

Net gape 2 RX-P

17

TXON1

A

Net gape 1 TX-N

18

TXOP1

A

Net gape 1 TX-P

19

RTS_N/GPIO_2

I/O

Net gape 2 RTS

20

UART_RX

I

Serial 1 RX

21

UART_TX

O

Serial 1 TX

22

RXD/GPIO_3

I/O

Serial 2 RX

23

LINK1

I/O

Net gape 1 connection instruction

24

CTS_N/GPIO_4

O

Serial 1 CTS

25

WPS/RST

I

WPS button/recovery factory value

26

TXD/GPIO_5

O

Serial 2 TX

27

VDD_1_8

Power Out

Net gape 1.8V output

28

VCC

Power In

5V input