# ArduinoUno-ESP8266-2WD **Repository Path**: thermalogic/arduino-uno-esp8266-2wd ## Basic Information - **Project Name**: ArduinoUno-ESP8266-2WD - **Description**: 基于Arduino UNO和ESP8266的WIFI控制2WD小车 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2024-07-31 - **Last Updated**: 2025-11-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # The WIFI Controlled Car Using Arduino UNO and ESP8266(LCD1602A,BMP280) * WIFI control:forward, backward, left and right turn, acceleration and deceleration * Ultrasound obstacle avoidance * Temperature and Pressure * Display:distance of obstacle,temperature and pressure ![](img/2wd_wifi_lcd1602a_bmp280_atk-esp8266_edge_web.jpg) ## Components * Arduino UNO R3 x1 * Arduino UNO ProtoShield x1 * ATK-ESP8266 x1 * FT232 x1 * Motor Drive:L298N x1 * Ultrasonic Sensor:HC-SR04 x1 * HC-SR04 bracket(yellow) x1 * BMP280 Pressure Sensor x1 * LCD1602A I2C x1 * Mini Breadboard: SYB-170 X1 * 2WD Robot Car Chassis Kit (1 universal wheels, 2 TT Tires, 2 TT motors, and 1 chassis) x1 * Power: 800mAh 7.4V Lithium battery ## Code * Arduino UNO: [CAR_WIFI_UNO_LCD1602A_BMP280](./code/CAR_WIFI_UNO_LCD602A_BMP280/) * Arduino UNO ann ESP8266-01S communicate with software serial:**component_softserial.h** * ESP8266-01S WIFI: [CAR_WIFI_ESP8266](./code/CAR_WIFI_ESP8266/) **Modular design**: the codes of each component as a header file, make it easy to add or subtract component and adjust functionality ## Software ### Install the ESP8266 Arduino core * https://github.com/esp8266/Arduino Copy this URL: * https://arduino.esp8266.com/stable/package_esp8266com_index.json and paste it in `Files -> Preferance-> Additional Boards Manager URLs` Then go there: `Tools > Board > Boards Manager`, Look up `ESP8266` and then install the most recent version. After installation, you can go into the `Tools > Board` and select that ESP8266 Module ![](img/ESP8266_Arduino.jpg) #### Arduino UNO packages * [SoftwareSerial](https://docs.arduino.cc/learn/built-in-libraries/software-serial/) * [ArduinoJson](https://arduinojson.org/) #### ESP8266 packages * [ESP8266WiFi](https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/readme.html) * [ESPWebServer](https://github.com/esp8266/ESPWebServer) * [ArduinoJson](https://arduinojson.org/) ## Layout ### Arduino UNO R3 ![](img/Arduino-UNO-R3.jpg) ### Ultrasonic Sensor: HC-SR04 ![](./img/hc-sr04.jpg) ```c // Ultrasonic - Arduino #define TRIG_PIN 13 // Trigger #define ECHO_PIN 12 // Echo ``` |HC-SR04 | Arduino Uno | |-------------|---------------| | VCC | +5V | | Trigger | Pin 13 green | | Echo | pin 12 blue | | GND | GND | ### Motor Driver: L298N ![](img/L298N.jpg) #### TT Motors | L298N | TT Motor | |--------------|---------------------| | OUT4 | Left Motor `+` | | OUT3 | Left Motor `-` | | OUT2 | Right Motor `+` | | OUT1 | Right Motor `-` | ![2WD Robot Car Chassis Kit](img/2WD-RobotCar-Chassis-Kit.jpg) #### Arduino UNO and Power ```c #define RightBack 9 // Motor balck - LS298N IN1-> Arduino Pin9 #define RightForward 8 // Motor red + LS298N IN2 -> Arduino Pin8 #define LeftForward 5 // Motor black - LS298N IN3 -> Arduino Pin5 #define LeftBack 4 // Motor Red + LS298N IN4 -> Arduino Pin4 #define leftPWM 10 #define rightPWM 6 ``` | L298N | Arduino/Power | |--------------|------------------| | ENA | Pin 6 orange | | IN1 | Pin 9 green | | IN2 | Pin 8 blue | | IN3 | Pin 5 yellow | | IN4 | Pin 4 blue | | ENB | Pin 10 orange | | VCC | Lithium Battery `+` | | GND | Lithium Battery `-` and Arduino GND | | +5V | Vin | ## Breadboard BMP280和ATK-ESP8266安装于SYB-170面包板上 Arduino A4、A5连接到面包板,然后,连接BMP280和LCD1602A I2C模块的SDA、SCL * SDA -> A4 * SCL -> A5 ![](img/syb-170-layout.jpg) ### BMP280 ![](img/BMP280-Sensor-Parts.jpg) ### LCD1602A I2C https://arduino.nxez.com/2020/10/08/arduino-drives-lcd1602-screen-through-i2c.html * LiquidCrystal:https://www.arduino.cc/reference/en/libraries/liquidcrystal/ LCD1602A I2C Address: 0x27 ```c #include #include LiquidCrystal_I2C lcd(0x27,16,2); ``` ![](img/LCD1602A-I2C.jpg) ## The WIFI of ATK-ESP8266 and Software Serial ### ATK-ESP8266 ![](img/ATK-ESP8266.jpg) ### Upload to ESP8266 Compile the programme,then upload to ESP8266 with FT232(USB to TTL) * ATK-ESP8266:ESP-12E module ![](img/FT232.jpg) | FT232 | ATK-ESP8266 | |---------|--------------| | RXD | TX | | TXD | RX | | VCC | VCC | | GND | GND and IO0(pull-down: USRT Download) | Connect the GND of FT232 to the two pins of ESP8266 using a breadboard ### Arduino UNO ann ATK-ESP8266 Communicate with Software serial ```c #define SS_RX_PIN 3 // -> ESP8266 TX #define SS_TX_PIN 11 // -> ESP8266 RX ``` * The layout of Arduino UNO and ESP8266 |ATK-ESP8266 | Arduino | |-------------|------------------| | VCC3.3 | +3.3V orange | | RX | Pin 11(soft serial TX) yellow | | TX | Pin 3 (soft serial RX) blue | | GND | GND | ### Visiting the hotspot of ESP8266 * WIFI Hotspot : ```c const char *ssid = "ESP8266-WIFI"; const char *password = "12345678"; IPAddress ip(192, 168, 1, 1); ``` * Visit : http://192.168.1.1