Arduino environment construction for ESP8266 development

Arduino environment construction for ESP8266 development

1. Introduction to Arduino

  Arduino is a convenient, flexible, and easy-to-use open source electronic prototyping platform. Contains hardware (various models of Arduino boards) and software (ArduinoIDE). Developed by a European development team in winter 2005. Its members include Massimo Banzi, David Cuartielles, Tom Igoe, Gianluca Martino, David Mellis and Nicholas Zambetti, among others.
  It is built on the open source code simple I/O interface version, and has a Processing/Wiring development environment similar to Java and C languages. It mainly includes two parts: the hardware part is the Arduino circuit board that can be used for circuit connection; the other is the Arduino IDE, the program development environment in your computer. You only need to write the program code in the IDE, and after uploading the program to the Arduino circuit board, the program will tell the Arduino circuit board what to do.
  Arduino can perceive the environment through a variety of sensors, and feedback and affect the environment by controlling lights, motors and other devices. The microcontroller on the board can write programs through the Arduino programming language, compile them into binary files, and burn them into the microcontroller. The programming of Arduino is realized through Arduino programming language (based on Wiring) and Arduino development environment (based on Processing). Arduino-based projects can include only Arduino, or Arduino and other software running on the PC, and communicate between them (such as Flash, Processing, MaxMSP) to achieve.

2. Arduino IDE software installation

  1. Download the corresponding installation package, double-click to run, and then follow the prompts to click the next step.
insert image description here
  2. Build the NODE MCU environment: open the arduino software, click on the menu bar file, preferences, additional development board manager URL: (for loading the esp8266 library)http://arduino.esp8266.com/stable/package_esp8266com_index.json
insert image description here
  3. Add the NODE MCU development board.
insert image description here
  4. Search for the esp8266 library and install it.
insert image description here  5. After the installation is complete, restart the software. If there is NodeMCU in the development board, the installation is successful.
insert image description here

3. Introduction to ESP8266

  ESP8266 series wireless module is a cost-effective WIFI SOC module, supports standard IEEE802.11b/g/n protocol, and has a complete built-in TCP/IP protocol stack. Users can use this series of modules to add network functionality to existing equipment, or to build a stand-alone network controller.

3.1 Features of ESP8266

  • Support STA, AP, STA+AP action modes;
  • Very small 802.11b/g/n WiFi SOC module
  • Built-in 10-bit high-precision ADC uses low-power 32-bit CPU, which doubles as an application processor
  • Support USART, GPIO, IIC, PWM, ADC, SPI and other interface clock frequency up to 160MHz
  • Support smart config, AirKiss one-key network Support multiple sleep modes, deep sleep current as low as 20uA
  • Embedded LWIP protocol stack
  • Support SDK secondary development
  • Universal AT commands can be used quickly Support serial local upgrade and remote firmware upgrade (FOTA)

4.nodeMCU

  NodeMCU is an IoT hardware development board. It is actually a Wi-Fi module plus some accessories. It uses Lua scripting language programming. The platform is based on the eLua open source project, and the bottom layer uses ESP8266 sdk 0.9.5 version. The platform uses many open source projects, such as lua-cjson, spiffs. NodeMCU includes firmware that can run on the esp8266Wi-FiSoC chip, and hardware based on the ESP-12 module.

5. ESP8266 development board

  ESP-12K is a Wi-Fi module developed by Anxinke Technology. The module core processor ESP32-S2 is a highly integrated low-power Wi-Fi system-on-chip (SoC), designed for the Internet of Things (IoT) , mobile devices, wearable electronic devices, smart home and other applications. ESP32-S2 has industry-leading low power consumption performance and radio frequency performance, supports IEEE802.11b/g/n protocol, integrates Wi-Fi MAC, Wi-Fi radio frequency and baseband, radio frequency switch, radio frequency Balun, power amplifier, low noise Amplifier etc.

  The ESP32-S2 chip is equipped with an Xtensa® 32-bit LX7 single-core processor with an operating frequency of up to 240 MHz. The chip supports secondary development without using other microcontrollers or processors. The chip has built-in 320 KB SRAM and 128 KB ROM, and can be connected with external flash and RAM through SPI/QSPI/OSPI and other interfaces. ESP32-S2 supports a variety of low-power working states, which can meet the power consumption requirements of various application scenarios. The chip's unique fine clock gating function, dynamic voltage clock frequency adjustment function, and RF output power adjustment function can achieve the best balance between communication distance, communication rate and power consumption.

  ESP32-S2 provides rich peripheral interfaces, including SPI, I2S, UART, I2C, LED PWM, LCD interface, Camera interface, ADC, DAC, touch sensor, temperature sensor and up to 43 GPIOs. It supports external expansion of PSRAM on the chip, and ESP-12K modules can be equipped with PSRAM as an option. In addition, it also includes a full-speed USB On-The-Go (OTG) interface, which can support the use of USB communication.

5.1 Features

  • ​Complete 802.11b/g/n Wi-Fi SoC module with data rates up to 150Mbps
  • Built-in ESP32-S2 chip, Xtensa® single-core 32-bit LX7 microprocessor, supports clock frequency up to 240 MHz, has 128KB ROM, 320KB SRAM, 16KB RTC SRAM
  • Support UART/GPIO/ADC/PWM/SPI/I2C/LCD/I2S/Camera/IR/USB/DAC interface, support touch sensor, temperature sensor, pulse counter
  • Packaged in SMD-42
  • 集成 Wi-Fi MAC/ BB/RF/PA/LNA
  • Support multiple sleep modes, deep sleep current is less than 10uA
  • Serial rate up to 4Mbps
  • Embedded Lwip protocol stack
  • Support STA/AP/STA+AP working mode
  • Support Android, IOS Smart Config (APP) / AirKiss (WeChat) one-click network configuration
  • Support serial port local upgrade and remote firmware upgrade (FOTA)
  • General AT commands can be used quickly
  • Support secondary development, integrated Windows, Linux development environment
    insert image description here
    insert image description here

6. ESP8266 development board test

  We choose to use the arduino development platform here, and the arduino platform has an ESP8266 development board module, which is easy to operate.
  Open the arduino software, select the development board model (see step 5 of arduino IDE installation), and select the development board. The ESP8266 software package comes with a test sample project. Next, we can use the test project as an example to test whether our hardware and software are built successfully.

  1. Select the file in the menu, find the example, the project in the basic example.
insert image description here

/*
  Blink

  Turns an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
  it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
  the correct LED pin independent of which board is used.
  If you want to know what pin the on-board LED is connected to on your Arduino
  model, check the Technical Specs of your board at:
  https://www.arduino.cc/en/Main/Products

  modified 8 May 2014
  by Scott Fitzgerald
  modified 2 Sep 2016
  by Arturo Guadalupi
  modified 8 Sep 2016
  by Colby Newman

  This example code is in the public domain.

  http://www.arduino.cc/en/Tutorial/Blink
*/
// the setup function runs once when you press reset or power the board当您按下复位键或给电路板通电时,设置功能运行一次
int led=LED_BUILTIN;//ESP-12上的LED指示灯
int led2=16;//GPIO16(D0)//NDDEMCU上LED,可以直接写16,或者写D0
/*硬件初始化*/
void setup() {
    
    
  // initialize digital pin LED_BUILTIN as an output.初始化LED为输出模式
  pinMode(led, OUTPUT);//引脚模式配置为输出模式
  pinMode(led2, OUTPUT);
}

// the loop function runs over and over again forever主循环,和while(1)一样
void loop() {
    
    
  digitalWrite(led, HIGH);   // 引脚输出高电平
  digitalWrite(led2, HIGH);
  delay(1000);                   // wait for a second
   digitalWrite(led, LOW);   // 引脚输出低电平
   digitalWrite(led2, LOW);
  delay(1000);                       // wait for a second
}

  7. Connect the development board to the computer and select the port number.
insert image description here
  8. Compile the code and download the sample program
insert image description here  .
insert image description here

Guess you like

Origin blog.csdn.net/weixin_44453694/article/details/125070906