interfacing web server with a robot

advertisement
INTERFACING WEB SERVER WITH
A ROBOT
The ESP8266 is a MICROCONTROLLER from Chinese
manufacturer ESPRESSIF that includes Wi-Fi
capability. It comes with an inbuilt firmware which
supports serial interface and can be controlled using
AT commands.
In short the ESP8266 module is a “serial to wireless
internet” device.
FEATURES:
802.11 b/g/n protocol
Wi-Fi direct (P2P), soft-AP
Integrated TCP/IP protocol stack
Supports antenna diversity
Power down leakage current of < 10uA
WHY ESP8266?
HARDWARE CONNECTIONS
The ESP8266 requires 3.3V power–do
not power it with 5 volts!
The ESP8266 needs to communicate
via serial at 3.3V and does not have 5V
tolerant inputs, so you need level
conversion to communicate with a 5V
microcontroller like most Arduinos use.
When power is applied the red power
light turns on and the blue serial
indicator flickers frequently
BLOCK DIAGRAM
PIN CONFIGURATION
VCC AND GROUND CONNECTIONS
The outer hub of the breadboard is Vcc and the inner hub is
GND
LM 7805 PIN CONFIGURATION
LM 7805 CONNECTIONS
LM 7805 is a 5V voltage regulator which reduces any voltage below 32V to
5V
L293D PIN CONFIGURATION
L293D CONNECTIONS
Place L293D in such a way that the notch is facing towards the
right
Giving 5V to Vss makes the robot move slow when compared to
giving it 8V( in our case we have given 5V)
Pins 1,8,9,16 are connected to Vcc of the breadboard
Pins 4,5,12,13 are connected to GND of the breadboard
ARDUINO ATMEGA 16 PIN
CONFIGURATION
ARDUINO ATMEGA16 CONNECTIONS
Pin 9 of the Arduino is given to Vcc and pin 10 to the GND of the
breadboard
Place the Arduino such that its notch is facing the notch of L293D
INTERFACING L293D WITH ARDUINO
Connect the pins 0 and 1 of the Arduino to the pins 15 and 10 of the L293D
Connect the pins 24 and 25 of Arduino to the pins 2 and 7 of L293D
MOTOR CONNECTIONS
Connect the left motor pins to the pins 11 and 14 of L293D
Connect the right motor pins to the pins 3 and 6 of L293D
IR SENSOR CONNECTIONS
Connect the left, centre and right sensors to pins 26,27and 28 of
the Arduino respectively
LM 35 PIN CONFIGURATION
LM35 is a temperature sensor
Connect the Vcc and GND to the breadboard and output pin to
the 29th pin of the Arduino
The LM35 gives analog output so we have connect it to the analog
pin of the Arduino
CREATING A SERVER USING
ESP8266
STEPS TO CONNECT THE ESP8266 Wi-Fi
MODULE
The Vcc (3.3V) of the ESP8266 is given to Vcc of the
breadboard.(The 8V of the breadboard is reduced to 3.3V by means
of a voltage regulator)
The Tx and Rx pins of the ESP8266 is connected to the Rx and Tx
pins of the Arduino
The GND pin of the ESP8266 is given to the GND of the breadboard
The RESET pin of ESP8266 should be connected to 3.3V
CHPD pin should be given to 3.3V
The ESP8266 can be wired and can be programmed by using the AT
commands. The wiring connections are shown
AT COMMANDS
ESP8266, in it’s default configuration, boots up into serial
modem mode. In this mode you can communicate with it using
a set of AT commands. A set of AT commands used in this
project is explained
 Connect to the Wi-Fi network of the module.
In our case it is AI-THINKER_FBB24A
 The AT command is used to check if the system and Wi-Fi
module are working correctly
 The AT+RST command is used to reset the module
 The AT+GMR command is used to know about the current firmware version

The AT+CIFSR command is used to return the local ip address
(192.168.1.4)
 The AT+CWMODE command is used to enable both client and
server
 the AT+CIPMUX command is used to enable multiple connections
The AT+CIPSERVER command is used to create a server
 The AT+SIPSEND command is used to send messages
 The message is displayed on the webpage
Thus the following AT commands used in programming the ESP8266 Wi-Fi
module can be understood better by a table format. The following AT
commands used for this project are shown.
ALGORITHM
Void setup()
{
initialize input and output pins;
reset ESP8266;
set mode as 3;
enable multiple connections;
enable server;
}
Void loop()
{
wait for GET request;
Check for obstacles;
Do the necessary actions;
Measure temperature using LM35;
send message to the server using AT+SIPSEND command;
}
Add \r \n to the command inside Serial.write in order to send
command to the Wi-Fi module
\r \n denotes carriage return(enter)
For example to send the command “AT” use the command
Serial.write (“AT\r\n”)
Download