๐Ÿ’พ
EC
  • Introduction
  • EC Course
    • Syllabus
    • Preparation for EC
    • Tutorial
      • Tutorial: arduino-stm32
        • Tutorial: arduino-stm32 Installation
        • Tutorial: arduino-stm32 Part1
        • Tutorial: arduino-stm32 Part2
      • Tutorial: MDK uVision
        • Tutorial: Installing MDK uVision
        • Tutorial: Create a Project with uVision
        • Tutorial: Adding library header in uVision
        • Tutorial: Re-using Project Configuration
        • Debugging in uVision
      • Tutorial: PlatformIO in CLion
      • Tutorial: PlatformIO in VSCode
      • Tutorial: Repository Management
      • Tutorial: Managing library header files
      • Tutorial: PinName Configuration
      • Tutorial: Bitwise Macro
      • Tutorial: Custom initialization
      • Tutorial: Documentation
      • Tutorial: Creating Application API
      • Tutorial: 7-Segment Display
      • Tutorial: DC motor driver connection
      • Tutorial: USART with TeraTerm
      • Tutorial: Finite State Machine programming
      • Tutorial: Bluetooth
      • Tutorial: Zigbee with Nucleo board
    • LAB
      • LAB Report Template
      • LAB: Smart mini-fan with STM32-duino
      • LAB: Portable Fan with mbed
      • LAB: GPIO Digital InOut
      • LAB: GPIO Digital InOut 7-segment
      • LAB: EXTI & SysTick
      • LAB: Timer & PWM
      • LAB: Stepper Motor
      • LAB: Input Capture - Ultrasonic
      • LAB: USART - LED, Bluetooth
      • LAB: ADC - IR reflective sensor
      • LAB: Line Tracing RC Car
    • Sample code
      • Code Templates
    • Hardware
      • Nucleo-F411RE
      • LAB Hardware
        • Electronic Chips
        • HUINS Embedded Kit
    • Projects
      • Line Tracing Car Project
      • Design Project
        • Past Projects
      • Project Grading Criteria
    • Study Resource for MCU
      • Hexa-Decimal Table
      • Bitwise Op for Register
      • System Clock
      • Timer
      • USART
      • ADC
  • STM32 M4 Programming
    • Documentation
      • C++ API Docs
    • Firmware Library
      • PinName Configuration
      • GPIO Digital
      • RCC
      • EXTI_SysTick
      • TIMER
      • USART
    • Troubleshooting
    • mbed for STM32
      • Tutorial: mbed-Part 1
      • Tutorial: mbed - Part 2
      • Tutorial: mbed - Part 3
      • Using mbed API on uVision
    • mbed OS
  • Other Programming
    • Arduino
    • Socket Programming
      • Window Socket Programming
      • Arduino WiFi
    • Cube-MX
    • Github
    • Markdown
      • Example: API documentation
    • MATLAB
  • C Programming
    • C-Programming Lessons
      • Installing Visual Studio Community
        • Visual Studio Community 2022
      • Installing VS Code(Mac/Linux)
      • Creating Header Lib
      • Pointer
      • Array
      • 2D Array
      • Structure
      • Dynamic Alloc
      • Bitwise Operation
  • Numerical Programming
    • Syllabus
    • Preparation for NP
    • Math Review
    • Tutorial
      • TA Session Video
      • Tutorial: NP Library Header Files
      • Tutorial - Sine Taylor
      • Tutorial: Passing a Function, Function callback
      • Tutorial: Nonlinear solver
      • Tutorial: Differentiation
      • Tutorial: Integration
      • Tutorial: Matrix Structure
      • Tutorial: Eigenvalue problem
      • Tutorial: ODE-IVP
      • Tutorial: Curve Fitting
      • Tutorial: Create Github Repos of NP lib
      • Tutorial: Version Control in Github
      • Tutorial: Documentation with Markdown
      • Exercise: Version Control and Documentation
    • Example: MATLAB
    • Example: NP Library
    • Assignment
      • Assignment Factorial and Power
      • Assignment: Version Control and Documentation
    • Problem Bank
Powered by GitBook
On this page
  • Add WiFi(ESP8266) to Arduino UNO
  • Arduino sketch code
  • Reference

Was this helpful?

  1. Other Programming
  2. Socket Programming

Arduino WiFi

PreviousWindow Socket ProgrammingNextCube-MX

Last updated 2 years ago

Was this helpful?

Add WiFi(ESP8266) to Arduino UNO

If ESP-01 Adapter is used, Connect VCC=5V.

If ESP9266 module is used, Connect VCC=3.3V

Arduino sketch code

#include <SoftwareSerial.h>

SoftwareSerial ESPserial(2, 3); // RX | TX

void setup()

{

//Serial.begin(115200); // communication with the host computer
Serial.begin(9600); // communication with the host computer

//while (!Serial) { ; }

// Start the software serial for communication with the ESP8266

ESPserial.begin(115200);
//ESPserial.begin(9600); // communication with the host computer

Serial.println("");

Serial.println("Remember to to set Both NL & CR in the serial monitor.");

Serial.println("Ready");

Serial.println("");

}

void loop()

{

// listen for communication from the ESP8266 and then write it to the serial monitor

if ( ESPserial.available() ) { 
  //Serial.println("received"); 
  Serial.write( ESPserial.read() ); }

// listen for user input and send it to the ESP8266

if ( Serial.available() ) { 
  //Serial.println("read");
  ESPserial.write( Serial.read() ); }

}

First use UNO-PC Serial Baud 9600, UNO-ESP Serial Baud 115200

In Serial Monitor (Baud 9600) : Type

AT                          // should get OK response
AT+UART_DEF=9600,8,1,0,0    // to change UNO-ESP baudrate to 9600*

Now, we have changed ESP8266 Serial to 9600.

Modify the Arduino Sketch to ESPserial.begin(115200); and upload again.

AT+CWMODE?                  // Current Connection Mode
AT+CWMODE=1                 // Change Connection Mode to Mode=1 (Station mode)
AT+CWLAP                    // Show List of Avaiable WiFi
AT+CWJAP="SSID","๋น„๋ฐ€๋ฒˆํ˜ธ" // Connect with SSID and Password
AT+CIFSR                    // Check IP and MAC

ESP8266 ์™€์ดํŒŒ์ด ๋ชจ๋“ˆ์€ ๋„คํŠธ์›Œํฌ ์—ฐ๊ฒฐ์— ๋Œ€ํ•ด 3๊ฐ€์ง€ ๋ชจ๋“œ๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

  1. Station mode: ESP8266 ๋ชจ๋“ˆ์ด client๋กœ wifi ๊ธฐ๋Šฅ๋งŒ ํ•จ (๋ณธ ์˜ˆ์ œ์—์„œ ๋ชจ๋“œ 1 ์‚ฌ์šฉ)

  2. AP mode: ESP8266 ๋ชจ๋“ˆ์ด Access Point๊ฐ€ ๋จ

  3. AP + Station mode: AP์™€ client ๋‘˜ ๋‹ค ๋จ

    \

Reference

\

์•„๋‘์ด๋…ธ(Arduino) ์ธํ„ฐ๋„ท ์—ฐ๊ฒฐํ•˜๊ธฐ: ESP-01(ESP8266) ์™€์ดํŒŒ์ด ๋ชจ๋“ˆ(Wifi module) ์–ด๋Œ‘ํ„ฐ ๋ฐฐ์„ 
์•„๋‘์ด๋…ธ(Arduino) ์ธํ„ฐ๋„ท ํ•˜๊ธฐ - Wifi (ESP-01: ESP8266)์—ฐ๊ฒฐํ•˜๋Š” ๋ฐฉ๋ฒ•IT-G-House
STM32F411 ํ™•์žฅ๋ณด๋“œ ESP8266 TCP ํ†ต์‹  ์‹œํ—˜ ์ถ”๊ฐ€๋„ค์ด๋ฒ„ ๋ธ”๋กœ๊ทธ | Baram
Logo
Esp8266 WebServer using STM32 HAL ยป ControllersTechControllersTech
Library 52- Ethernet peripheral on STM32F4xx - STM32F4 DiscoverySTM32F4 Discovery
Arduino - WiFi
Logo
Add WiFi to Arduino UNOInstructables
GitHub - imjeffparedes/iot-esp8266-arduino-interface: โ€‹Learn how to communicate with ESP8266 Wifi Module using Arduino UNO.GitHub
Logo
Logo
Logo
Logo