0% found this document useful (0 votes)
89 views

Development of Wi-Fi Communication Module For Atmega Microcontroller Based Mobile Robot For Cooperative Autonomous Navigation

Uploaded by

David Mustaine
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views

Development of Wi-Fi Communication Module For Atmega Microcontroller Based Mobile Robot For Cooperative Autonomous Navigation

Uploaded by

David Mustaine
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

2017 IEEE Calcutta Conference (CALCON)

Development of Wi-Fi Communication Module for


ATmega Microcontroller Based Mobile Robot for
Cooperative Autonomous Navigation
Aritra Bhuiya Aditya Mukherjee Ranjit Kumar Barai
Computer Science Engineering Dept. Electronics & Telecom. Engineering Dept. Electrical Engineering Dept.
KIIT University KIIT University Jadavpur University
Patia, Bhubaneswar, Odisha-751024, Patia, Bhubaneswar, Odisha-751024, Kolkata-700032
India India India
[email protected] [email protected] [email protected]

Abstract- Effective formation and coverage control of mobile module has been developed that can be gainfully utilized for
robots require a reliable and powerful wireless communication formation control and coverage control of mobile robots. IC
infrastructure for exchanging information among themselves. ESP8266 [18] is required to establish the aforementioned
Standard Transmission Control Protocol/Internet Protocol communication and connect to an access point. Transmitting
(TCP/IP) based Wi-Fi networking is a popular wireless
and receiving data is convenient through ESP8266 because of
communication method which allows rapid development of high
bandwidth communication interface for multi-robot systems. A its pre-installed firmware that supports AT commands. A
large number of educational and experimental mobile robots have connection is established autonomously between mobile robots
been developed with ATmega microcontrollers for their ease of with Atmel ATmega 2560 microcontroller [17]. The
programming. However, there is no off the shelf Wi-Fi microcontroller has been programmed using AVR Studio [19].
communication module available which can directly interface A library has been developed in ANSI C using GNC GCC
with the standard ATmega microcontrollers. This paper gives a compiler. The desired AT commands are sent through the
detailed technical account of how a versatile Wi-Fi communication library. The set of AT commands required to establish a
module can be developed for standard ATmega microcontrollers wireless communication have been listed. After initializing a
so that it can be utilized for establishing a powerful
communication channel between the ESP8266, data is
communication among a group of mobile robots. The circuit
development and power supply issues have been elaborated. The transmitted and received between the mobile robots wirelessly.
effectiveness of the communication module developed has been Since the mobile robots are now able to communicate with each
established by successful experimentation of ATmega other, this method has been implemented in certain swarm
microcontroller based autonomous mobile robots for cooperative robotics algorithm towards formation control. A compatibility
navigation. between AVR (microcontroller) and ESP8266 (Wi-Fi module)
has been established through this work. To the best of the
Keywords- Wi-Fi, ESP8266, serial communication, UART, RS knowledge of the authors, achieving this compatibility between
232, AT commands, Atmel AVR, Atmel ATmega 2560, TCP, AVR software (microcontroller) and AT firmware in ESP8266
WMR, mobile robots.
(Wi-Fi module) has never been addressed in the literature. The
I. INTRODUCTION
developed module have been utilized for the cooperative
autonomous navigation of wheeled mobile robots FIREBIRD-
Effective navigation and control of a group of mobile
V. The schematic diagram for the developed Wi-Fi
robot swarm [1], [2], [3] requires an efficient and user-friendly
communication module based cooperative autonomous
wireless communication network [4], [6], [8], [9], [10], [12],
navigation has been illustrated in Fig. 1.
[13], [14], [15], [16]. Standard Transmission Control
Protocol/Internet Protocol (TCP/IP) based Wi-Fi networking
has emerged as a popular wireless communication method
which allows rapid development of high bandwidth
communication interface for multi-robot systems. An intensive
review in this regard have been presented in [5], [7], [11].
Although Wi-Fi communication is quite common and
popular in recent years yet certain robots running on
microcontrollers like ATmega2560 has no native library to
connect and send/ receive data via Wi-Fi. In the present work,
this problem has been solved and a Wi-Fi communication Fig 1. Communication channel between two Mobile Robots

978-1-5386-3745-6/17/$31.00 ©2017 IEEE 168


2017 IEEE Calcutta Conference (CALCON)

modules to the mobile robots. The ATmega of the mobile


The rest of the paper has been organized as follows. The robots has the necessary pinouts RXD(pin1), TXD(pin2),
circuit construction method has been described in Section II. +5V(pin24), and GND(pin25). The 5V supply needs to be
The conditions to be established before sending and receiving stepped down to 3.3V as the optimal voltage for proper
data have been described in Section III. Two way functioning of the ESP8266 is 3.3V. Supplying 5V to power the
communication has been described in Section IV. Experimental ESP8266 may it. For this purpose, a USB-TTL device can be
validation for cooperative autonomous navigation empllying used which provides an inbuilt 3.3V VCC output. Another
the developed Wi-Fi communication modules for FIREBIRD- major advantage of using USB-TTL is that the exchange of
V robots has been presented in Section V. Section VI concludes command between the ESP8266 and the microcontroller can be
the paper. debugged easily using a RS232 terminal program such as
µ3XWW\¶. This was made possible as the RXD-TXD wiring
II.CIRCUIT CONSTRUCTION BETWEEN ROBOT AND ESP8266 between the ESP8266 and the microcontroller was further
forwarded to the USB-77/¶6 5;'-TXD. Hence the
Embedded Wi-Fi modules that incorporate a firmware commands and codes being transferred can be viewed or sent
and provide a simple means of wirelessly communicating and explicitly using a RS-232 terminal once the USB-TTL is
enabling any device have become widely available since 2007. connected to the Computer. This method is preferable because
One such embedded Wi-Fi module is the ESP8266. The module using a printed PCB of the device increases the reliability on
needs a 3.3 V power supply to function properly. The power the circuitry. Further all voltage fluctuation and electrical
supply can be either provided from the mobile robot or through noises were diminished. The USB-TTL has a USB male port
the USB port of the computer. Once ESPs are active, AT on one side and pinouts of +5V, 3.3V, RXD, TXD and GND
commands are used to initialize the ESPs and control them. The on the other side. The USB-TTL needs power which is to be
ESP can perform certain operations like resetting itself , setting supplied from the robot¶s 5V output when it is not connected to
a static IP, connecting to desired access point, or even starting the USB port of the computer. To solve this problem an USB
a local server using AT Commands. AT commands are female was connected across the 5V and GND of the robot¶s
generally sent through an RS-232 terminal like PUTTY or pinouts as shown in Fig 2. An USB female port is connected
TERMITE using an USB-TTL device from a computer. But to with the 5V VCC and ground of the mobile robot. The USB
enable a communication between robots, these AT Commands TTL is then plugged in the USB female port. The 3.3V pin-out
must be sent from the robots themselves which is demonstrated of the USB TTL is connected to the VCC pin of the
later. A dedicated library in C has been developed for the ESP8266.The GND pin-out of the USB TTL is connected to the
proposed work. The programmer can directly send the AT GND pin of the ESP8266.The RXD pin-out of mobile robots is
Commands to the ESP using Serial Communication or can use connected to the TXD pin of the ESP8266. The TXD pin-out of
the aforementioned library for simplicity. This library can be the mobile robots is connected to the RXD pin of the ESP8266.
included as a header to the program that is written into the The RXD pin-out of the USB TTL is connected to the TXD pin
microcontroller ( Atmel ATmega 2560). Atmel AVR Studio of the ESP8266. The TXD pin-out of the USB TTL is shorted
software was used to program the ATmega 2560 of the mobile to the RXD pin of the ESP8266.
robots. On programming with/without the aforementioned
library, the AT commands were sent serially and autonomously
using UART protocol to the ESP8266. The data between the
two ports can be forwarded and viewed in the RS232 terminal
for debugging. The ESP8266 modules need to be connected to
the same Wi-Fi network in order to communicate with each
other. The ESP8266 can send and receive data only after a
server has been created. In the scope of this paper, a local server
is created within the ESP using the concepts of peer-peer
communication. The esp acting as a server may become a client
when necessary. The server esp communicates through one or
more than one of its 5 channels with one or more client esp
wirelessly. The data received is then parsed and displayed or
processed accordingly as programmed.
To construct the most effective electronic circuit certain
objectives must be fulfilled. The major objective is constructing
Fig 2. Overall circuit connection
a circuit of minimal complexity and making cost to obtain the
desired result. The main intention is to connect the Wi-Fi Use of a common ground in the circuit is recommended
if a different power source is used for powering the ESP.

169
2017 IEEE Calcutta Conference (CALCON)

III. CONDITIONS TO BE ESTABLISHED BEFORE SENDING AND


RECEIVING DATA

The ESP8266 can act independently of the microcontroller


used. The microcontroller only sends data through AT
commands to the ESP8266 which gets processed by the AT
Processor in the ESP. After the processor processes the AT
commands it carries on the task independently. In this case, it
transmits the data to another ESP via a TCP/UDP connection. Fig. 3(a). Fixing the baud rate of ESP and setting the mode
TCP uses sequence number to maintain orderly transmission so Fig. 3(b). List of all available access point
there will be no data packets lost as TCP will arrange for
retransmission if it determines that data has been lost. It
operates in full-duplex mode of communication and connects
with a three-way handshake. A TCP data packet contains
several field like source, acknowledge, sequence no. and data
offset among others all of which are useful for data transfer
(fig4b). Each TCP header contains data in order of 32- bit
words. Once data is received, the ESP8266 generates an
interrupt signal and sends it to the microcontroller. The
microcontroller can then process the data.
Fig. 3(c). Connecting to an access point
The ATmega microcontroller communicates with the
Fig. 3(d) Setting a static IP.
ESP serially. The necessary steps for setting up the Wi-Fi
module ESP8266 for 2-way communication are given below:
IV. ESTABLISHING TWO-WAY CONNECTION BETWEEN TWO
Step 1: The first step is to set up a viable access point. A
ESPS OVER A WI-FI NETWORK AND SENDING AND RECEIVING
separate access point is used. The Access point used was
DATA.
300Mbps Universal Wi-Fi Range Extender TL-WA850RE
The first thing to be checked before any communication
from TP-Link which runs on 220V and 802.11B, 802.11G,
is the ESP response. This is done to ensure all connections are
802.11n wireless mode. This is done so that a large number of
working perfectly. The response can be check by simply
Wi-Fi devices can be connected together. The Wi-Fi is
sending AT serially. An ATOK response indicates perfectly
protected using the standard WPA2 encryption for security.
working connection.
Step 2: As the ESP8266 communicate independently with each
other, the ESPs are connected to the Wi-Fi using AT commands
sent from either the robots or via USB TTL. Once all the ESPs
are connected to the Wi-Fi access point, they remain connected
till they are powered off. When the ESPs are powered on again,
they reconnect to the same Wi-Fi access point provided the
BSSID and WPA2 encrypted password of the access point
remains the same( Fig 3(b) and Fig 3(c).)
Step 3: A static IP of the ESP8266 must be set. If a static
IP is not set, a unique dynamic IP is allocated to each ESP every Fig. 4(a) Allowing device to be used as an Access Point,
time they connect to the access point. Use of static IP over Fig. 4(b) TCP packet format.
dynamic IP is recommended as it provides each robot or ESP
an unique ID that does not change with time (Fig. 3(d)). Allowing multiple connections, starts a server respectively.
Step 4: The ESP communicates serially and hence work 1) Creating a TCP connection between two ESPS over a Wi-
on a selected Baud Rate. Although the default baud rate Fi network:- It is assumed here that both the ESPs are
depends on the AT firmware used, it is generally preset at connected to the same Wi-Fi network. The first thing to be
115200. A suitable baud rate should be set to the ESP using done is to set the ESPS to accept multiple connections. This is
AT commands if the programmer wishes to communicate with done by sending the AT commands: AT+CIPMUX=1(Fig.4a)
the ESP from the AVR microcontroller at a different BAUD A peer-to-peer server is needed before a connection can
RATE. Fig 3(a) illustrates the Baud rate selection. be established. One of the ESPS were chosen as a server.
Step 1-4 once executed need not be repeated again AT+CIPSERVER=1,80 is sent serially. Where 80 is the port
provided the ESP firmware, BSSID and password of the access number and 1 is the channel number. This sets up one of the
point is not altered.

170
2017 IEEE Calcutta Conference (CALCON)

ESP as a server. The other ESP is now the client ESP that needs
to establish a connection with the server ESP.
AT+CIPSTART=2,”TCP”,”ip-address”,portno.As given in
Fig 5. The example shows use of a TCP connection. A TCP
connection is recommended as it provides a reliable means of
Fig. 6(b) Sending message from Client to Server.
communication. Here 2, represents the channel no. the client
Fig. 6(c) Server receiving message.
ESP has used to establish a connection with the server.
The server ESP has however used its channel 0 to
receive the incoming connection. It should be noted that
V. EXPERIMENTAL VALIDATION WITH FIREBIRD-V
channel 0 of the server ESP is the same as channel 2 of the
ROBOTS PERFORMING COOPERATIVE NAVIGATION
client ESP. (Fig. 5)
WITH THE WI-FI MODULE

The developed Wi-Fi communication modules have been


installed on FIREBIRD-V wheeled mobile robots. Two
FIREBIRD robots have been taken and they were allowed to
navigate themselves autonomously in close cooperation. The
high level navigation commands are exchanged between the
Fig 5. Establishing a TCP Connection. ³OHDGHU´ URERW DQG ³IROORZHU´ URbots through the Wi-Fi
2)Sending a message communication modules. The pictures taken during the
Either ESPs can send a message to each other using the experimentation, as shown in Fig 7, depict the various internal
AT Commands:- states of the navigating robots. During the entire experimental
AT+CIPSEND=channel, number of characters. study, the leader and follower robots successfully navigated
>message Fig. 6(a), Fig.6(c)) themselves by exchanging the obstacle avoidance commands
3)Receiving a message: Either of the ESP8266 receives a through the Wi-Fi communication module.
message automatically. It generates an interrupt to the AVR The Co-operative navigation algorithm is as follows:
upon receiving a message. When the interrupt is processed, the Step 1. The leader robot and follower robot both connects
message is fetched from the ESP serially. The message is to the same wifi network autonomously. This is made
encoded in the form of:-+IPD,0,20: message(Fig 6(b), Fig.6(d)) possible through the Library developed or sending the AT
The actual message is parsed by the ATmega 2560 commands explicitly through Serial Communication from
microcontroller. the robots to the ESP.
4)Closing a connection: An existing connection is closed using Step 2. The leader robot creates a local server within itself
the AT command: AT+CIPCLOSE=channel no. waiting for the follower client to connect to it. The follower
These AT commands are listed in Table 1. robot tries to connect to the leader robot using its static IP
TABLE I via a TCP connection. On a successful connection between
ESTABLISHING TWO WAY COMMUNICATION USING AT the robots, the follower robot acknowledges the connection
COMMANDS to the leader via an encoded message and starts moving
ESP8266 (SERVER) ESP8266(CLIENT) forward.
AT+CWMODE=3 AT+CWMODE=3 Step 3. The leader robot upon receiving the
AT+CIPMUX=1 AT+CIPMUX=1
acknowledgement starts moving forward. When the leader
AT+CIPSERVER=1,80 [note the STAIP of the ESP8266(SERVER)]
AT+CIFSR senses an obstruction via its IR sensor, it stops immediately
$7&,367$57 ´7&3´´STAIP>´ and sends an encoded message to the follower wirelessly .
0, CONNECT is displayed 2, CONNECT is displayed The encoded message is received by the follower and is
AT+CIPSEND=0,20 +IPD:2,MESSAGE
<SEND 20 CHARACTERS. > Message is displayed after a IPD reply decoded. The decoded message tells it to stop moving. It
+IPD:0,MESSAGE AT+CIPSEND=2,10 stops moving and Waits for further instruction from the
<SEND 10 CHARACTERS. > leader.
AT+CIPCLOSE=2
Step 4. When the obstruction is removed from the front of
the leader, it senses the absence of obstruction and starts
moving forward. At the same time it instructs the follower
to start moving wirelessly via an encoded message.
Step 5. The follower robot receives the encoded message,
decodes it and then starts moving forward.

Fig. 6(a) Transfer of message between Server & Client

171
2017 IEEE Calcutta Conference (CALCON)

[2] Wenguo Liu, Alan FT Winfield, "Open-hardware e-puck Linux extension


board for experimental swarm robotics research," Microprocessors and
Microsystems, vol. 35, no. 1, pp. 60-67, February 2011.
[3] Madhav D Patil, Tamer Abukhalil, "Design and Implementation of
Heterogeneous Robot Swarm," in Proc. ASEE 2014 Zone I Conf., April
3-5, 2014, University of Bridgeport, Bridgpeort, CT, USA, 2014.
[4] A.F.T. Winfield, O.E. Holland, "The application of wireless local area
network technology to the control of mobile robots," Microprocessors and
Microsystems, vol 23, pp.597±607, 2000.
[5] Ji Hyoung Ryu, Muhammad Irfan, and Aamir Reyaz, "A Review on
Sensor Network Issues and Robotics," Journal of Sensors, Volume 2015,
pp.1-15, 2015.
[6] Gianni A. Di Caro, Frederick Ducatelle, and Luca M. Gambardella,
"Wireless communications for distributed navigation in robot swarms,"
M. Giacobini et al. (Eds), Workshops on Applications of Evolutionary
Computation (EvoWorkshops 2009): Applications of Evolutionary
Computing, pp. 21±30, 2009.
[7] Hui Liu, Houshang Darabi, Pat Banerjee, and Jing Liu, "Survey of
Wireless Indoor Positioning Techniques and Systems," IEEE Trans.
Systems, Man, And Cybernetics²Part C: Applications And Reviews,
Vol. 37, No. 6, Pp.1067-1080, November 2007.
[8] Sabine Hauert, Severin Leven, Jean-Christophe Zufferey, Dario Floreano,
"Communication-EDVHG 6ZDUPLQJ IRU )O\LQJ 5RERWV´ LQ 3URF
Workshop on Network Science and Systems Issues in Multi-Robot
Autonomy, IEEE International Conference on Robotics and Automation,
Fig.7 Real time images taken during experimentation. 2010.
Operations as performed being displayed in LCD display. [9] Technology Robotix Society, IIT Kharagpur, "Giant Swarms of Wi-Fi
Robots," https://www.robotix.in/blog/giant-swarms-of-wi-fi-robots/
[10] Darren Quick, "Aerial swarming robots to create communications
networks for disaster relief," http://newatlas.com/smavnet-robot-
VI. CONCLUSION swarm/16499/, September 28, 2010.
[11] Robotics beta, "Cons and pros of wireless technologies for rescue robot,"
https://robotics.stackexchange.com/questions/2357/cons-and-pros-of-
The power consumption issues of ESP8266 are very minor. The wireless-technologies-for-rescue-robot.
power down leakage current of <10Ua and+19.5dBm output [12] Frederick Ducatelle, Gianni A. Di Caro, Carlo Pinciroli, Francesco
power in 802.11b mode. Mondada and Luca Gambardella, "Communication assisted navigation in
A ESP8266 can ping our TP-link access point at a distance of robotic swarms: self-organization and cooperation," In Proc. IEEE/RSJ
Int. Conf. Intelligent Robots and Systems, September 25-30, 2011, San
350 metre with the PCB antenna. There is slight latency of Francisco, CA, USA, pp.4981-4988.
transmission TCP gives a delay of 200ms for each packet of [13] Ming Li, Min Chen, Kejie Lu, Shiwen Mao, Hua Zhu, B. Prabhakaran,
data to send (which can be overridden using forced data "Robot Swarm Communication Networks: Architectures, Protocols, and
Applications," in Proc. Third International Conference on
delivery system) TCP packets are very complex and Communications and Networking in China, 2008. ChinaCom 2008.
incorporate several mechanisms to ensure connection state, [14] Carlos E. Galvan T., Issac Galvan-Tejada, Ernesto Ivan Sandoval, Ramon
reliability, and flow control of data packets. The developed Brena, "Wifi bluetooth based combined positioning algorithm,"
communication module is quite fast and effective for International Meeting of Electrical Engineering Research ENIINVIE
2012, Procedia Engineering, vol 35, pp. 101 ± 108, 2012.
exchanging navigation commands in real-time. Since the robot [15] Carlos E. Galvan-Tejada, Jose C. Carrasco-Jim ´ enez ´ , Ramon F. Brena,
runs by UART protocol of communication, I2C and SPI "Bluetooth-WiFi based combined positioning algorithm,implementation
communication methods have not been considered. There is no and experimental evaluation," The 2013 Iberoamerican Conference on
Electronics Engineering and Computer Science, Procedia Technology
data loss or noise in this communication. A swarm robot vol.7, pp. 37 ± 45, 2013.
network can be easily maneuvered with this method. Any robot [16] Namjun Park, Sukhoon Jung, Dongsoo Han, "An adaptive hybrid flter for
can become a server and use five of its channel to further practical WiFi-based positioning systems," ICT Express, vol. 1, pp. 82±
85, 2015.
connect to 5 other client robots. The library is simple and easy
[17] ATmega640/1280/1281/2560/2561 datasheet.
to use and is compatible with any modern microcontroller that http://www.atmel.com/Images/Atmel-2549-8-bit-AVR-Microcontroller-
uses AVR programmer. It is easy to understand as it is written ATmega640-1280-1281-2560-2561_datasheet.pdf
in C language. Encoder values, GPS coordinates, commands [18] ESP8266 datasheet.
http://download.arduino.org/products/UNOWIFI/0A-ESP8266-
can be sent for formation control operations. Datasheet-EN-v4.3.pdf
[19] Atmel studio 7.0 user guide.
REFERENCES http://ww1.microchip.com/downloads/en/devicedoc/atmel-42167-atmel-
[1] F. Mondada, L.M. Gambardella, D. Floreano, S. Nolfi, J.-L. Deneuborg, studio_user%20guide.pdfJ. Clerk Maxwell, A Treatise on Electricity
M. Dorigo, "The cooperation of SWARM-BOTS: Physical Interactions and Magnetism, 3rd ed., vol. 2. Oxford: Clarendon, 1892, pp.68-73.
LQ&ROOHFWLYH5RERWLFV´,(((5RERWLFV $XWRPDWLRQ0DJD]LQHYRO
no. 2, pp. 21-28, June 2005.

172

You might also like