Page 357 - ARM Based Microcontroller Projects Using MBED
P. 357
14.4 PROJECT 2—ANDROID—NUCLEO BOARD COMMUNICATION USING THE ESP-01 343
Character array Buffer stores the data received from the mobile phone. Several if-else
statements are used to determine the action to be taken depending on the received data (com-
mand). Notice that in this project the mobile device is the Server and the Wi-Fi expansion
board is the Client.
14.3.11 Testing the Program
The program can easily be tested with a mobile phone. You should install a TCP Server
apps on your Android mobile phone before starting the test. There are many freely available
TCP apps in the Play Store. The one installed and used in this project is called the Simple TCP
Socket Tester by Armando J.G. Parra (sabiocharro@gmail.com) as shown in Fig. 14.11.
The steps to test the program are as follows:
• Plug the Wi-Fi expansion board on top of your Nucleo-F411RE development board.
• Compile and download the program to your development board.
• Start the Simple TCP Socket Tester apps on your mobile phone and set the Port number to
5000, and click START SERVER so that the device starts to listen for incoming TCP
connections.
• Press the Reset button on the development board and wait until a connection is made to the
mobile device (you should see the notice: Local IP: 192.168.1.178—Clients connected: 1 at
the top of the screen, where 192.168.1.178 is the IP address of the mobile device). Now,
activate relay 1 by sending the command ON1 and click the SEND button as shown in
Fig. 14.12. Relay 1 should now be activated on the relay board and at the same time the red
LED corresponding to relay 1 should turn ON.
14.3.12 Suggestions for Additional Work
Modify the project so that the relays are controlled from a PC instead of a mobile phone.
14.4 PROJECT 2—ANDROID—NUCLEO BOARD COMMUNICATION
USING THE ESP-01
14.4.1 Description
In this project we shall be using the tiny ESP-01 board to provide Wi-Fi capability to our
development board. ESP-01 is the cheap alternative to the Nucleo Wi-Fi expansion board.
Fig. 14.13 shows the ESP-01 module. This module has a few I/O ports and can either be used
on its own as a standalone processor with Wi-Fi capability, or it can be used with a host
processor to provide Wi-Fi capability to the host. In this project ESP-01 is used to provide
Wi-Fi capability to our Nucleo-F411RE development board.
As in the previous project, a 4-channel relay board is connected to the development board
and the relays are controlled by the commands sent by an Android mobile phone over the
Wi-Fi link using the UDP protocol.