SlideShare a Scribd company logo
Controlling and observing a robotic car with a
smartphone through NodeMCU
Course name Embedded System
Student name Nafiz Md Imtiaz Uddin
ID number : 2520190011
Task number Final Exam project
App name: ESPcar
This project file is included:
i. One PPT file (This ppt)
ii. Code (ino format)
iii. One proteus file
iv. apk and aia file
v. One clip folder (speaking)
Aim of task
The NodeMCU board communicates to the
MIT app cloud through WiFi when the WIFI-
controlled automobile is turned on. The data
will be communicated to the NodeMCU board
through the cloud when hit the Commands
(Forward, Backward, Left, Right) buttons on
the interface built in the MIT app. The gear
motors then rotate in accordance with those
values. This is done with the L298N motor
driver board. The speed of these motors may
also be changed via the MIT app's slider.
What is NodeMCU?
• NodeMCU is an open source IoT platform with a cheap cost. It came with
firmware that ran on Espressif Systems' ESP8266 Wi-Fi SoC and
hardware that was based on the ESP-12 module at first. Later, the ESP32
32-bit MCU was introduced to the mix.
• Development kit: The Development Kit based on ESP8266, integrates
GPIO, PWM, IIC, 1-Wire and ADC all in one board. Power our
development in the fastest way combined with NodeMCU Firmware!
• Because NodeMCU is an open source platform, its hardware design is
available for anybody to edit, alter, or construct. The ESP8266 Wi-Fi
enabled chip is used in the NodeMCU Dev Kit/board. The ESP8266 is a
low-cost WIFI chip with TCP/IP protocol designed by Espressif Systems.
Refer to the ESP8266 WIFI Module for further information about the
ESP8266. Version 2 (V2) of the NodeMCU Dev Kit is available, namely
NodeMCU Development Board v1.0 (Version2), which is typically black in
color.
What is NodeMCU? –About pin
• The Node MCU has a storage capacity of 4MB and a memory
capacity of 128KB. For device communication, it features
numerous GPIO (General Purpose Input Output) pins. For analog
input, it only has one Analogue pin.
• What is an ESP?
✓ The architecture of the ESP82662.
✓ A microcontroller is an ESP8266 or ESP-12E
✓ Wi-Fi solution with low power consumption and high integration
✓ At least seven external components
✓ Wide range of temperatures: -40°C to +125°C
✓ ESP8285 — integrated 8-Mbit flash
What is NodeMCU? –specification
• Because there are many different types of ESP8266 on the market, our ESP8266 board may
differ somewhat from the one shown below:
• The processor, memory, and WIFI unit are all placed in the ESP8266-12 block in the picture
above. The remaining components guarantee connectivity with external sensors, a USB port,
and a voltage regulator, among other things.
What is NodeMCU? – Functional diagram
• Take a look at the functional diagram of an ESP8266-12 if we're interested
in computer architecture:
What is NodeMCU? –About SRAM, CPU, ROM
➢SRAM is a kind of memory (Static Random Access Memory)
• Familiarize with the ESP8266-12 architecture.
• Can we find the following on the functional diagram:
➢The computer's processor (Central Processing Unit)
• The ESP8266 has a 32-bit CPU that can only handle 16-bit
instructions. It's Harvard architecture, which essentially implies that
instruction and data memory are kept separate.
• The ESP8266 features a Read-Only Memory (ROM) on board that
contains some library code as well as a first-stage boot loader. The
rest of the code must be kept on a serial flash memory external to
the computer (provides only serial access to the data - rather than
addressing individual bytes, the user reads or writes large
contiguous groups of bytes in the address space serially).
What is NodeMCU?
-ESP8266 module circuit diagram
What is NodeMCU? –ESP pinout
• The amount of flash memory accessible on our ESP8266 may differ
depending on the model.
• The ESP8266 features a set of GPIO pins (General Purpose
Input/output pins) that we may use to "control" external sensors, just
like any other microcontroller.
• Although our ESP8266 has 17 GPIO pins, only 11 of them may be
used (among 17 pins, 6 are used for communication with the on-
board flash memory chip). There's also an analog input (to convert a
voltage level into a digital value that can be stored and processed in
the ESP8266).It also features WIFI communication, which allows to
connect our ESP8266 to your WIFI network, connect to the internet,
run a web server, and link our smartphone to it, among other things.
• Another benefit of the ESP8266 is that it can be programmed in the
same way as any other microcontroller, particularly an Arduino.
ESP Pinout
Introduction
The origins of robotic development may be traced back to few
fundamental concepts. It reduces human work and may be used
in a variety of domains, including military, surveillance, and
industrial pick and place. Humanoid robots are the most recent
humanoid robots produced in the modern world. Wireless
technology is also being used to construct robotic automobiles.
Bluetooth, WI-FI, and Zigbee Communication are examples of
wireless technologies used in robotics. In addition, there are a
plethora of android applications available in the Play Store for
controlling a robot automobile. MIT Tool Inventor is a popular
drag-and-drop app that was utilized in this project. It contains
several features like buttons, gauges, sliders, and plotting
capabilities. We can link a larger number of Robotic Cars to
control them using Wi-Fi technology, which is particularly handy
for surveillance applications. Indoor localization technologies are
now being developed, so we can deploy this sort of Wi-Fi-
controlled Robotic Car as well.
In my project, the device that can connect to Wi-Fi and the
mobile application that controls the NodeMCU will construct an
access point.
In my case, the L298N
would have to enter the
device via a motor, which
would be connected to
NodeMCU.
Instruments of this project
1. NodeMCU (ESP-12E) x 1 + USB data cable,
2. L298N motor driver x 1,
3. Gear motor x 4,
4. Robot wheel x 4,
5. Battery holder (2 pics 3.7V battery),
6. Jumper wires,
7. Breadboard x 1,
8. Chassis board x 2,
9. Screws + Screw driver,
10. Others.
All of instrument picture (mainly)
Others chassis
board and screws
Work of the instrument [01]
1. NodeMCU ESP-12E: The ESP-12E has an 802.11b/g/n HT40 Wi-Fi transceiver,
allowing it to connect to a Wi-Fi network and communicate with the Internet, as
well as create its own network for other devices to connect to. This expands the
capabilities of the ESP8266 NodeMCU.
2. L298N motor driver: The L298N is a dual H-Bridge motor driver that allows for
simultaneous speed and direction control of two DC motors. The module can
power DC motors with voltages ranging from 5 to 35V and peak currents of up to
2A.
3. Gear motor: DC motors come in a variety of shapes and sizes. It features little
plastic gears and is rather simple to use. Small robots and toys will benefit from
this motor.
4. Robot wheel: It is usually made of plastic material. It will be attached to the gear
motor so that it can rotate. As a result, the function of the gear motor is clearly
understood.
Work of the instrument [02]
5. Battery holder: A battery holder is a container or chamber designed to accommodate a
battery. The holder must also establish electrical contact with the battery terminals when
using dry cells. Cables are frequently linked to the battery terminals for wet cells, as in
autos or emergency lighting equipment.
6. Li-ion battery: Lithium ions can be stored in the anode and cathode. Lithium ions flow
between these electrodes through the electrolyte, storing and releasing energy. The battery
receives current from the charger. The electrolyte transports lithium ions from the cathode
to the anode. In my project, I used 3.7V battery.
7. Jumper wires: Electrical lines having connection pins on both ends are known as jumper
wires. They link two locations in a circuit without the need of solder. Jumper wires can be
used to change a circuit or diagnose faults with it.
8. Breadboard: Through-hole electronic components are compatible with breadboards.
Long metal leads are meant to be inserted through holes in a printed circuit board (PCB)
covered with a thin copper covering, allowing the components' leads to be soldered to the
board.
Work of the instrument [03]
9. USB data cable: The cable is mainly used for uploading the code
(ESP8266) from Arduino IDE. The only thing we'll need is a Micro-B
USB cable. The USB port on the ESP32 Thing may be used to both
power and program the device.
10. Chassis board: The board is body frame of this car. It mainly used
for the projection purpose. Also, between the two boards we can work
with different components and attach with screws if necessary.
11. Screw Driver: A screwdriver is an instrument for turning screws. It
comprises of a metal rod that fits into the top of the screw and has a flat
or cross-shaped end.
MicrosoftVISIO software
Flowchart
Circuit diagram
ENA -> D5
IN1 -> D8
IN2 -> D7
IN3 -> D4
IN4 -> D3
ENB -> D6
Arduino code –screenshot of ARDUINO IDE
Arduino code
//Nafiz Md Imtiaz Uddin
//ID: 2520190011 - CST2019 [江西理工大学]
/*
Micro-USB: NodeMCU can be powered through the USB port
3.3V: Regulated 3.3V can be supplied to this pin to power the board
GND: Ground pins
Vin: External Power Supply
*/
#define ENA 14
#define ENB 12
#define IN_1 15
#define IN_2 13
#define IN_3 2
#define IN_4 0
#include <ESP8266WiFi.h>
//This library provides ESP8266 specific Wi-Fi routines
#include <WiFiClient.h>
//Library for Arduino Wifi shield
#include <ESP8266WebServer.h>
//simple web-server. Supports only one simultaneous client,
//know s how to handle GET and POST
String injunction; // store the command
int robot_car = 900; // 400 - 1023.[Speed of car]
int SpeedCoefficient = 3;
const char* ssid = "NodeMCU Nafiz"; //Wifi name
const char* password = "Nafiz_2022"; //Enter Password
ESP8266WebServer server(80);
Arduino code
void setup() {
pinMode(ENA, OUTPUT);
pinMode(ENB, OUTPUT);
pinMode(IN_1, OUTPUT);
pinMode(IN_2, OUTPUT);
pinMode(IN_3, OUTPUT);
pinMode(IN_4, OUTPUT);
Serial.begin(115200); //Sets the data rate in bits per second (baud) for serial
//data transmission. For USB baudrate is fixed on 115200 bps
// Now we connecting wifi system
WiFi.mode(WIFI_AP);
WiFi.softAP(ssid, password);
IPAddress myIP = WiFi.softAPIP();
Serial.print("IP address is ");
Serial.println(myIP);
// Now we start the WEB-server
server.on ( "/", HTTP_handleRoot ); //
server.onNotFound ( HTTP_handleRoot ); //if not found wifi
server.begin();//Tells the server to begin listening for incoming connections
}
//Forward funtion
void Forward_func(){
digitalWrite(IN_1, LOW);
digitalWrite(IN_2, HIGH);
analogWrite(ENA, robot_car);
digitalWrite(IN_3, LOW);
digitalWrite(IN_4, HIGH);
analogWrite(ENB, robot_car);
}
Arduino code
//Backward funtion
void back_func(){
digitalWrite(IN_1, HIGH);
digitalWrite(IN_2, LOW);
analogWrite(ENA, robot_car);
digitalWrite(IN_3, HIGH);
digitalWrite(IN_4, LOW);
analogWrite(ENB, robot_car);}
////Right button funtion
void right_func(){
digitalWrite(IN_1, HIGH);
digitalWrite(IN_2, LOW);
analogWrite(ENA, robot_car);
digitalWrite(IN_3, LOW);
digitalWrite(IN_4, HIGH);
analogWrite(ENB, robot_car); }
////Left button funtion
void left_func(){
digitalWrite(IN_1, LOW);
digitalWrite(IN_2, HIGH);
analogWrite(ENA, robot_car);
digitalWrite(IN_3, HIGH);
digitalWrite(IN_4, LOW);
analogWrite(ENB, robot_car);
}
void Forward_funcRight(){
digitalWrite(IN_1, LOW);
digitalWrite(IN_2, HIGH);
analogWrite(ENA, robot_car/SpeedCoefficient);
digitalWrite(IN_3, LOW);
digitalWrite(IN_4, HIGH);
analogWrite(ENB, robot_car); }
Arduino code
void Forward_funcLeft(){
digitalWrite(IN_1, LOW);
digitalWrite(IN_2, HIGH);
analogWrite(ENA, robot_car);
digitalWrite(IN_3, LOW);
digitalWrite(IN_4, HIGH);
analogWrite(ENB, robot_car/SpeedCoefficient);
}
void back_funcRight(){
digitalWrite(IN_1, HIGH);
digitalWrite(IN_2, LOW);
analogWrite(ENA, robot_car/SpeedCoefficient);
digitalWrite(IN_3, HIGH);
digitalWrite(IN_4, LOW);
analogWrite(ENB, robot_car);
}
void back_funcLeft(){
digitalWrite(IN_1, HIGH);
digitalWrite(IN_2, LOW);
analogWrite(ENA, robot_car);
digitalWrite(IN_3, HIGH);
digitalWrite(IN_4, LOW);
analogWrite(ENB, robot_car/SpeedCoefficient);
}
void stopCar(){
digitalWrite(IN_1, LOW);
digitalWrite(IN_2, LOW);
analogWrite(ENA, robot_car);
digitalWrite(IN_3, LOW);
digitalWrite(IN_4, LOW);
analogWrite(ENB, robot_car);
}
Arduino code
void loop() {
server.handleClient();
injunction = server.arg("State");
if (injunction == "F") Forward_func();
else if (injunction == "B") back_func();
else if (injunction == "L") left_func();
else if (injunction == "R") right_func();
else if (injunction == "I") Forward_funcRight();
else if (injunction == "G") Forward_funcLeft();
else if (injunction == "J") back_funcRight();
else if (injunction == "H") back_funcLeft();
else if (injunction == "0") robot_car = 500;
else if (injunction == "1") robot_car = 490;
else if (injunction == "2") robot_car = 640;
else if (injunction == "3") robot_car = 610;
else if (injunction == "4") robot_car = 780;
else if (injunction == "5") robot_car = 790;
else if (injunction == "6") robot_car = 820;
else if (injunction == "7") robot_car = 990;
else if (injunction == "8") robot_car = 860;
else if (injunction == "9") robot_car = 1021;
else if (injunction == "S") stopCar();
}
void HTTP_handleRoot(void) {
if( server.hasArg("State") ){
Serial.println(server.arg("State"));
}
server.send ( 200, "index/html", "" );
delay(1);
Upload code in NodeMCU-ESP12E
The App overview
( the final designed map image or Final app picture) - ESPcar
• Button * 5 (Image * 5)
• Label * 3
• HorizontalArrangement * 1
• TableArrangement * 1
• Slider * 1
• Web * 1
MIT app user interface and block code
MIT app inventor processing
Run the project
Simulation in proteus
Simulation in proteus
• In proteus NodeMCU, we cannot run directly, because I think that there is
no functional type module system. Also, the NodeMCU of proteus is not
much used by others. But if we use the PIC type module in proteus, we can
run the ESP type system perfectly. But the problem is that my project is
only based on NodeMCU. But if we use another simulation, maybe we can do
something.
• And the hex file, if we get from the Arduino part, we can implement the
proteus. Here are used 3 libraries based on the NodeMCU system:
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
Which fully supports the NodeMCU of the Arduino IDE.
Simulation in proteus
Screenshots of other attachments
References
❑ Prof. Dr. Ata Jahangir, Course: Embedded System-Lecture-36. Project Notice_NodeMCU (江西理工大学)-2022
❑ https://en.wikipedia.org/wiki/NodeMCU
❑ https://www.nodemcu.com/index_en.html#fr_5475f7667976d8501100000f
❑ https://snscourseware.org/snsctnew/files/1584985731.pdf
❑ http://www.manelsoft.com/projects/nodemcu_introduction.aspx
❑ https://annefou.github.io/IoT_introduction/02-ESP8266/index.html
❑ https://www.researchgate.net/figure/ESP8266-module-circuit-diagram_fig3_328749402
❑ https://www.easybom.com/blog/a/esp8266-nodemcu-pinout-diagram-datasheet
❑ http://ai2.appinventor.mit.edu/
❑ https://www.iconfinder.com/
❑ https://www.arduino.cc/
Nafiz Md Imtiaz Uddin
2520190011@mail.jxust.edu.cn
江西理工大学
计算机科学与技术 (19计算机班)
Computer Science and Technology(2019-2023)
Jiangxi University of Science and Technology

More Related Content

NodeMCU || Controlling and observing a robotic car with a smartphone through NodeMCU

  • 1. Controlling and observing a robotic car with a smartphone through NodeMCU Course name Embedded System Student name Nafiz Md Imtiaz Uddin ID number : 2520190011 Task number Final Exam project App name: ESPcar This project file is included: i. One PPT file (This ppt) ii. Code (ino format) iii. One proteus file iv. apk and aia file v. One clip folder (speaking)
  • 2. Aim of task The NodeMCU board communicates to the MIT app cloud through WiFi when the WIFI- controlled automobile is turned on. The data will be communicated to the NodeMCU board through the cloud when hit the Commands (Forward, Backward, Left, Right) buttons on the interface built in the MIT app. The gear motors then rotate in accordance with those values. This is done with the L298N motor driver board. The speed of these motors may also be changed via the MIT app's slider.
  • 3. What is NodeMCU? • NodeMCU is an open source IoT platform with a cheap cost. It came with firmware that ran on Espressif Systems' ESP8266 Wi-Fi SoC and hardware that was based on the ESP-12 module at first. Later, the ESP32 32-bit MCU was introduced to the mix. • Development kit: The Development Kit based on ESP8266, integrates GPIO, PWM, IIC, 1-Wire and ADC all in one board. Power our development in the fastest way combined with NodeMCU Firmware! • Because NodeMCU is an open source platform, its hardware design is available for anybody to edit, alter, or construct. The ESP8266 Wi-Fi enabled chip is used in the NodeMCU Dev Kit/board. The ESP8266 is a low-cost WIFI chip with TCP/IP protocol designed by Espressif Systems. Refer to the ESP8266 WIFI Module for further information about the ESP8266. Version 2 (V2) of the NodeMCU Dev Kit is available, namely NodeMCU Development Board v1.0 (Version2), which is typically black in color.
  • 4. What is NodeMCU? –About pin • The Node MCU has a storage capacity of 4MB and a memory capacity of 128KB. For device communication, it features numerous GPIO (General Purpose Input Output) pins. For analog input, it only has one Analogue pin. • What is an ESP? ✓ The architecture of the ESP82662. ✓ A microcontroller is an ESP8266 or ESP-12E ✓ Wi-Fi solution with low power consumption and high integration ✓ At least seven external components ✓ Wide range of temperatures: -40°C to +125°C ✓ ESP8285 — integrated 8-Mbit flash
  • 5. What is NodeMCU? –specification • Because there are many different types of ESP8266 on the market, our ESP8266 board may differ somewhat from the one shown below: • The processor, memory, and WIFI unit are all placed in the ESP8266-12 block in the picture above. The remaining components guarantee connectivity with external sensors, a USB port, and a voltage regulator, among other things.
  • 6. What is NodeMCU? – Functional diagram • Take a look at the functional diagram of an ESP8266-12 if we're interested in computer architecture:
  • 7. What is NodeMCU? –About SRAM, CPU, ROM ➢SRAM is a kind of memory (Static Random Access Memory) • Familiarize with the ESP8266-12 architecture. • Can we find the following on the functional diagram: ➢The computer's processor (Central Processing Unit) • The ESP8266 has a 32-bit CPU that can only handle 16-bit instructions. It's Harvard architecture, which essentially implies that instruction and data memory are kept separate. • The ESP8266 features a Read-Only Memory (ROM) on board that contains some library code as well as a first-stage boot loader. The rest of the code must be kept on a serial flash memory external to the computer (provides only serial access to the data - rather than addressing individual bytes, the user reads or writes large contiguous groups of bytes in the address space serially).
  • 8. What is NodeMCU? -ESP8266 module circuit diagram
  • 9. What is NodeMCU? –ESP pinout • The amount of flash memory accessible on our ESP8266 may differ depending on the model. • The ESP8266 features a set of GPIO pins (General Purpose Input/output pins) that we may use to "control" external sensors, just like any other microcontroller. • Although our ESP8266 has 17 GPIO pins, only 11 of them may be used (among 17 pins, 6 are used for communication with the on- board flash memory chip). There's also an analog input (to convert a voltage level into a digital value that can be stored and processed in the ESP8266).It also features WIFI communication, which allows to connect our ESP8266 to your WIFI network, connect to the internet, run a web server, and link our smartphone to it, among other things. • Another benefit of the ESP8266 is that it can be programmed in the same way as any other microcontroller, particularly an Arduino. ESP Pinout
  • 10. Introduction The origins of robotic development may be traced back to few fundamental concepts. It reduces human work and may be used in a variety of domains, including military, surveillance, and industrial pick and place. Humanoid robots are the most recent humanoid robots produced in the modern world. Wireless technology is also being used to construct robotic automobiles. Bluetooth, WI-FI, and Zigbee Communication are examples of wireless technologies used in robotics. In addition, there are a plethora of android applications available in the Play Store for controlling a robot automobile. MIT Tool Inventor is a popular drag-and-drop app that was utilized in this project. It contains several features like buttons, gauges, sliders, and plotting capabilities. We can link a larger number of Robotic Cars to control them using Wi-Fi technology, which is particularly handy for surveillance applications. Indoor localization technologies are now being developed, so we can deploy this sort of Wi-Fi- controlled Robotic Car as well. In my project, the device that can connect to Wi-Fi and the mobile application that controls the NodeMCU will construct an access point. In my case, the L298N would have to enter the device via a motor, which would be connected to NodeMCU.
  • 11. Instruments of this project 1. NodeMCU (ESP-12E) x 1 + USB data cable, 2. L298N motor driver x 1, 3. Gear motor x 4, 4. Robot wheel x 4, 5. Battery holder (2 pics 3.7V battery), 6. Jumper wires, 7. Breadboard x 1, 8. Chassis board x 2, 9. Screws + Screw driver, 10. Others.
  • 12. All of instrument picture (mainly) Others chassis board and screws
  • 13. Work of the instrument [01] 1. NodeMCU ESP-12E: The ESP-12E has an 802.11b/g/n HT40 Wi-Fi transceiver, allowing it to connect to a Wi-Fi network and communicate with the Internet, as well as create its own network for other devices to connect to. This expands the capabilities of the ESP8266 NodeMCU. 2. L298N motor driver: The L298N is a dual H-Bridge motor driver that allows for simultaneous speed and direction control of two DC motors. The module can power DC motors with voltages ranging from 5 to 35V and peak currents of up to 2A. 3. Gear motor: DC motors come in a variety of shapes and sizes. It features little plastic gears and is rather simple to use. Small robots and toys will benefit from this motor. 4. Robot wheel: It is usually made of plastic material. It will be attached to the gear motor so that it can rotate. As a result, the function of the gear motor is clearly understood.
  • 14. Work of the instrument [02] 5. Battery holder: A battery holder is a container or chamber designed to accommodate a battery. The holder must also establish electrical contact with the battery terminals when using dry cells. Cables are frequently linked to the battery terminals for wet cells, as in autos or emergency lighting equipment. 6. Li-ion battery: Lithium ions can be stored in the anode and cathode. Lithium ions flow between these electrodes through the electrolyte, storing and releasing energy. The battery receives current from the charger. The electrolyte transports lithium ions from the cathode to the anode. In my project, I used 3.7V battery. 7. Jumper wires: Electrical lines having connection pins on both ends are known as jumper wires. They link two locations in a circuit without the need of solder. Jumper wires can be used to change a circuit or diagnose faults with it. 8. Breadboard: Through-hole electronic components are compatible with breadboards. Long metal leads are meant to be inserted through holes in a printed circuit board (PCB) covered with a thin copper covering, allowing the components' leads to be soldered to the board.
  • 15. Work of the instrument [03] 9. USB data cable: The cable is mainly used for uploading the code (ESP8266) from Arduino IDE. The only thing we'll need is a Micro-B USB cable. The USB port on the ESP32 Thing may be used to both power and program the device. 10. Chassis board: The board is body frame of this car. It mainly used for the projection purpose. Also, between the two boards we can work with different components and attach with screws if necessary. 11. Screw Driver: A screwdriver is an instrument for turning screws. It comprises of a metal rod that fits into the top of the screw and has a flat or cross-shaped end.
  • 17. Circuit diagram ENA -> D5 IN1 -> D8 IN2 -> D7 IN3 -> D4 IN4 -> D3 ENB -> D6
  • 18. Arduino code –screenshot of ARDUINO IDE
  • 19. Arduino code //Nafiz Md Imtiaz Uddin //ID: 2520190011 - CST2019 [江西理工大学] /* Micro-USB: NodeMCU can be powered through the USB port 3.3V: Regulated 3.3V can be supplied to this pin to power the board GND: Ground pins Vin: External Power Supply */ #define ENA 14 #define ENB 12 #define IN_1 15 #define IN_2 13 #define IN_3 2 #define IN_4 0 #include <ESP8266WiFi.h> //This library provides ESP8266 specific Wi-Fi routines #include <WiFiClient.h> //Library for Arduino Wifi shield #include <ESP8266WebServer.h> //simple web-server. Supports only one simultaneous client, //know s how to handle GET and POST String injunction; // store the command int robot_car = 900; // 400 - 1023.[Speed of car] int SpeedCoefficient = 3; const char* ssid = "NodeMCU Nafiz"; //Wifi name const char* password = "Nafiz_2022"; //Enter Password ESP8266WebServer server(80);
  • 20. Arduino code void setup() { pinMode(ENA, OUTPUT); pinMode(ENB, OUTPUT); pinMode(IN_1, OUTPUT); pinMode(IN_2, OUTPUT); pinMode(IN_3, OUTPUT); pinMode(IN_4, OUTPUT); Serial.begin(115200); //Sets the data rate in bits per second (baud) for serial //data transmission. For USB baudrate is fixed on 115200 bps // Now we connecting wifi system WiFi.mode(WIFI_AP); WiFi.softAP(ssid, password); IPAddress myIP = WiFi.softAPIP(); Serial.print("IP address is "); Serial.println(myIP); // Now we start the WEB-server server.on ( "/", HTTP_handleRoot ); // server.onNotFound ( HTTP_handleRoot ); //if not found wifi server.begin();//Tells the server to begin listening for incoming connections } //Forward funtion void Forward_func(){ digitalWrite(IN_1, LOW); digitalWrite(IN_2, HIGH); analogWrite(ENA, robot_car); digitalWrite(IN_3, LOW); digitalWrite(IN_4, HIGH); analogWrite(ENB, robot_car); }
  • 21. Arduino code //Backward funtion void back_func(){ digitalWrite(IN_1, HIGH); digitalWrite(IN_2, LOW); analogWrite(ENA, robot_car); digitalWrite(IN_3, HIGH); digitalWrite(IN_4, LOW); analogWrite(ENB, robot_car);} ////Right button funtion void right_func(){ digitalWrite(IN_1, HIGH); digitalWrite(IN_2, LOW); analogWrite(ENA, robot_car); digitalWrite(IN_3, LOW); digitalWrite(IN_4, HIGH); analogWrite(ENB, robot_car); } ////Left button funtion void left_func(){ digitalWrite(IN_1, LOW); digitalWrite(IN_2, HIGH); analogWrite(ENA, robot_car); digitalWrite(IN_3, HIGH); digitalWrite(IN_4, LOW); analogWrite(ENB, robot_car); } void Forward_funcRight(){ digitalWrite(IN_1, LOW); digitalWrite(IN_2, HIGH); analogWrite(ENA, robot_car/SpeedCoefficient); digitalWrite(IN_3, LOW); digitalWrite(IN_4, HIGH); analogWrite(ENB, robot_car); }
  • 22. Arduino code void Forward_funcLeft(){ digitalWrite(IN_1, LOW); digitalWrite(IN_2, HIGH); analogWrite(ENA, robot_car); digitalWrite(IN_3, LOW); digitalWrite(IN_4, HIGH); analogWrite(ENB, robot_car/SpeedCoefficient); } void back_funcRight(){ digitalWrite(IN_1, HIGH); digitalWrite(IN_2, LOW); analogWrite(ENA, robot_car/SpeedCoefficient); digitalWrite(IN_3, HIGH); digitalWrite(IN_4, LOW); analogWrite(ENB, robot_car); } void back_funcLeft(){ digitalWrite(IN_1, HIGH); digitalWrite(IN_2, LOW); analogWrite(ENA, robot_car); digitalWrite(IN_3, HIGH); digitalWrite(IN_4, LOW); analogWrite(ENB, robot_car/SpeedCoefficient); } void stopCar(){ digitalWrite(IN_1, LOW); digitalWrite(IN_2, LOW); analogWrite(ENA, robot_car); digitalWrite(IN_3, LOW); digitalWrite(IN_4, LOW); analogWrite(ENB, robot_car); }
  • 23. Arduino code void loop() { server.handleClient(); injunction = server.arg("State"); if (injunction == "F") Forward_func(); else if (injunction == "B") back_func(); else if (injunction == "L") left_func(); else if (injunction == "R") right_func(); else if (injunction == "I") Forward_funcRight(); else if (injunction == "G") Forward_funcLeft(); else if (injunction == "J") back_funcRight(); else if (injunction == "H") back_funcLeft(); else if (injunction == "0") robot_car = 500; else if (injunction == "1") robot_car = 490; else if (injunction == "2") robot_car = 640; else if (injunction == "3") robot_car = 610; else if (injunction == "4") robot_car = 780; else if (injunction == "5") robot_car = 790; else if (injunction == "6") robot_car = 820; else if (injunction == "7") robot_car = 990; else if (injunction == "8") robot_car = 860; else if (injunction == "9") robot_car = 1021; else if (injunction == "S") stopCar(); } void HTTP_handleRoot(void) { if( server.hasArg("State") ){ Serial.println(server.arg("State")); } server.send ( 200, "index/html", "" ); delay(1);
  • 24. Upload code in NodeMCU-ESP12E
  • 25. The App overview ( the final designed map image or Final app picture) - ESPcar • Button * 5 (Image * 5) • Label * 3 • HorizontalArrangement * 1 • TableArrangement * 1 • Slider * 1 • Web * 1
  • 26. MIT app user interface and block code
  • 27. MIT app inventor processing
  • 30. Simulation in proteus • In proteus NodeMCU, we cannot run directly, because I think that there is no functional type module system. Also, the NodeMCU of proteus is not much used by others. But if we use the PIC type module in proteus, we can run the ESP type system perfectly. But the problem is that my project is only based on NodeMCU. But if we use another simulation, maybe we can do something. • And the hex file, if we get from the Arduino part, we can implement the proteus. Here are used 3 libraries based on the NodeMCU system: #include <ESP8266WiFi.h> #include <WiFiClient.h> #include <ESP8266WebServer.h> Which fully supports the NodeMCU of the Arduino IDE.
  • 32. Screenshots of other attachments
  • 33. References ❑ Prof. Dr. Ata Jahangir, Course: Embedded System-Lecture-36. Project Notice_NodeMCU (江西理工大学)-2022 ❑ https://en.wikipedia.org/wiki/NodeMCU ❑ https://www.nodemcu.com/index_en.html#fr_5475f7667976d8501100000f ❑ https://snscourseware.org/snsctnew/files/1584985731.pdf ❑ http://www.manelsoft.com/projects/nodemcu_introduction.aspx ❑ https://annefou.github.io/IoT_introduction/02-ESP8266/index.html ❑ https://www.researchgate.net/figure/ESP8266-module-circuit-diagram_fig3_328749402 ❑ https://www.easybom.com/blog/a/esp8266-nodemcu-pinout-diagram-datasheet ❑ http://ai2.appinventor.mit.edu/ ❑ https://www.iconfinder.com/ ❑ https://www.arduino.cc/
  • 34. Nafiz Md Imtiaz Uddin 2520190011@mail.jxust.edu.cn 江西理工大学 计算机科学与技术 (19计算机班) Computer Science and Technology(2019-2023) Jiangxi University of Science and Technology