Setup

Arduino IDE

Installing ESP32 Add-on in Arduino IDE To add ESP32 Board in your Arduino IDE, follow these instructions :

  1. Open your Arduino IDE, go to File>Preferences

  2. Put https://dl.espressif.com/dl/package_esp32_index.json into the “Additional Board Manager URLs” field as shown in the figure below. Then, click the “OK” button

Note: if you already have another boards (i.e ESP8266 boards URL), you can separate the URLs with a comma like this:

https://dl.espressif.com/dl/package_esp32_index.json, http://arduino.esp8266.com/stable/package_esp8266com_index.json

  1. Then go to the Boards Manager. Go to Tools > Board > Boards Manager
  2. Go to the search bar and type ESP32 then install ESP32 by Espressif Systems
  3. install

ESP-IDF

https://www.electronics-lab.com/deep-dive-on-controlling-led-with-esp32-c3-devkitm-1-development-board-using-esp-idf/

ESP32 Products

ESP32-C3-DevKitM-1 (ESP32-C3-MINI-1)

ESP32-C3-DevKitM-1 is an entry-level development board based on ESP32-C3-MINI-1, a module named for its small size. This board integrates complete Wi-Fi and Bluetooth LE functions.

EN-pinout

中文-管脚

ESP32-C3-DevKitC-02 (ESP32-C3-WROOM-02)

ESP32-C3-DevKitC-02 is an entry-level development board based on ESP32-C3-WROOM-02, a general-purpose module with 4 MB SPI flash. This board integrates complete Wi-Fi and Bluetooth LE functions.

pinout

ESP32 With Integrated OLED (WEMOS/Lolin) https://www.instructables.com/ESP32-With-Integrated-OLED-WEMOSLolin-Getting-Star/

Power Options

如何给ESP32供电 To power your ESP32 dev kit, you have three options:

Attention: be very, very careful to only use one of those options at the same time.

For example, do not power your ESP32 dev kit via the 5V pin using a 10V input while at the same time you have the module connected to your computer via USB. This will surely damage your module, and perhaps even your computer.

With this, you should have a good understanding of what the ESP32 is, and you must be eager to get hands-on with it. I totally understand :-). Let’s proceed with the next lesson, where I’ll show you how to set up the ESP32-Arduino Core on the Arduino IDE.

Example

“addressable” RGB LED,

ESP32-C3 Blink Test with Arduino IDE and DumbDisplay https://www.youtube.com/watch?v=BAnvHOs5Fks

Guide for WS2812B Addressable RGB LED Strip with Arduino https://randomnerdtutorials.com/guide-for-ws2812b-addressable-rgb-led-strip-with-arduino/

https://www.electronics-lab.com/deep-dive-on-controlling-led-with-esp32-c3-devkitm-1-development-board-using-esp-idf/

https://espressif-docs.readthedocs-hosted.com/projects/arduino-esp32/en/latest/api/ledc.html

esp32 12v solenoid lock

清单:

https://www.circuito.io/app?components=9442,360217,842876

https://www.youtube.com/watch?v=kGkyvVwwuL8

https://esp32io.com/tutorials/esp32-solenoid-lock

https://creativepradeepthehomeofelectronics.blogspot.com/2021/07/smart-wifi-controlled-door-lock-system.html

https://esp32io.com/tutorials/esp32-door-lock-system-using-password

https://www.hackster.io/robocircuits/iot-door-lock-project-0601f5

//CreativePradeep//
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>


BlynkTimer timer;


int toggleState_1 = 1;
int pushButton1State = HIGH;


int toggleState_2 = 1;
int pushButton2State = HIGH;


int wifiFlag = 0;


#define AUTH "AUTH TOKEN"                 // You should get Auth Token in the Blynk App.  
#define WIFI_SSID "WIFI NAME"             //Enter Wifi Name
#define WIFI_PASS "WIFI PASSWORD"         //Enter wifi Password


#define RELAY_PIN_1      26   //D26
#define RELAY_PIN_2      27   //D27
#define WIFI_LED         25   //D25


#define PUSH_BUTTON_1    32   //D32
#define PUSH_BUTTON_2    33   //D33


#define VPIN_BUTTON_1    V1 
#define VPIN_BUTTON_2    V2


void relayOnOff(int relay){


    switch(relay){
      case 1: 
             if(toggleState_1 == 0){
              digitalWrite(RELAY_PIN_1, HIGH); // turn on relay 1
              toggleState_1 = 1;
              }
             else{
              digitalWrite(RELAY_PIN_1, LOW); // turn off relay 1
              toggleState_1 = 0;
              }
             delay(200);
      break;
      case 2: 
             if(toggleState_2 == 0){
              digitalWrite(RELAY_PIN_2, HIGH); // turn on relay 2
              toggleState_2 = 1;
              }
             else{
              digitalWrite(RELAY_PIN_2, LOW); // turn off relay 2
              toggleState_2 = 0;
              }
             delay(200);
      break;
      default : break;      
      } 
}


BLYNK_CONNECTED() {
  // Request the latest state from the server
  Blynk.syncVirtual(VPIN_BUTTON_1);
  Blynk.syncVirtual(VPIN_BUTTON_2);
}


// When App button is pushed - switch the state


BLYNK_WRITE(VPIN_BUTTON_1) {
  toggleState_1 = param.asInt();
  digitalWrite(RELAY_PIN_1, toggleState_1);
}


BLYNK_WRITE(VPIN_BUTTON_2) {
  toggleState_2 = param.asInt();
  digitalWrite(RELAY_PIN_2, toggleState_2);
}


void with_internet(){
  if (digitalRead(PUSH_BUTTON_1) == LOW) {
      relayOnOff(1);
      // Update Button Widget
      Blynk.virtualWrite(VPIN_BUTTON_1, toggleState_1);
    }
  if (digitalRead(PUSH_BUTTON_2) == LOW) {
      relayOnOff(2);
      // Update Button Widget
      Blynk.virtualWrite(VPIN_BUTTON_2, toggleState_2);
    }
}
void without_internet(){
  if (digitalRead(PUSH_BUTTON_1) == LOW) {
      relayOnOff(1);
    }
  if (digitalRead(PUSH_BUTTON_2) == LOW) {
      relayOnOff(2);
    }
}


void checkBlynkStatus() { // called every 3 seconds by SimpleTimer


  bool isconnected = Blynk.connected();
  if (isconnected == false) {
    wifiFlag = 1;
    digitalWrite(WIFI_LED, LOW);
  }
  if (isconnected == true) {
    wifiFlag = 0;
    digitalWrite(WIFI_LED, HIGH);
  }
}


void setup()
{
  Serial.begin(9600);


  pinMode(RELAY_PIN_1, OUTPUT);
  pinMode(PUSH_BUTTON_1, INPUT_PULLUP);
  digitalWrite(RELAY_PIN_1, toggleState_1);


  pinMode(RELAY_PIN_2, OUTPUT);
  pinMode(PUSH_BUTTON_2, INPUT_PULLUP);
  digitalWrite(RELAY_PIN_2, toggleState_2);


  pinMode(WIFI_LED, OUTPUT);


  WiFi.begin(WIFI_SSID, WIFI_PASS);
  timer.setInterval(3000L, checkBlynkStatus); // check if Blynk server is connected every 3 seconds
  Blynk.config(AUTH);
}


void loop()
{  
  if (WiFi.status() != WL_CONNECTED)
  {
    Serial.println("Not Connected");
  }
  else
  {
    Serial.println(" Connected");
    Blynk.run();
  }


  timer.run(); // Initiates SimpleTimer
  if (wifiFlag == 0)
    with_internet();
  else
    without_internet();
}

ESP32 Mini Smart Farm

https://www.elec-cafe.com/esp32-mini-smart-farm-micropython/

ESP32 遥控器

https://www.youtube.com/watch?v=SVlm7QU5Nkk https://www.seeedstudio.com/blog/2023/04/13/ble-wifi-remote-using-seeed-studio-xiao-esp32c3/

https://www.e-tinkers.com/2019/11/build-an-esp32-web-server-and-ir-remote/

https://oshwhub.com/satun/c3mini-yao-kong-qi_copy https://www.youtube.com/watch?v=SVlm7QU5Nkk https://www.hackster.io/techstudycell/esp32-bluetooth-home-automation-with-ir-remote-control-relay-10d4e8?f=1 https://www.youtube.com/watch?v=dODmsoAu0D4

troubleshooting

?# class WiFiClientSecure’ has no member named ‘setInsecure’

upgrade to latest:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
board_build.partitions = no_ota.csv
lib_deps = h2zero/NimBLE-Arduino@^1.3.1
	   AugustESP32

=> upgrade to latest

[env:esp32dev]
platform = https://github.com/platformio/platform-espressif32.git
board = esp32dev
framework = arduino
platform_packages =
    framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#master
monitor_speed = 115200
board_build.partitions = no_ota.csv
lib_deps = h2zero/NimBLE-Arduino@^1.3.1
    AugustESP32

这段文字是ESP32-C3的资料。 基础资料包括(原理图尺寸图等):http://124.222.62.86/yd-data/YD-ESP32-C3/ 如果查看引脚功能图可以参考链接如下: https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32c3/_images/esp32-c3-devkitm-1-v1-pinout.jpg 如果计划使用官方的idf-C语言编程详细资料链接(例程就是的API参考): https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/get-started/index.html 如果计划使用Ardiuno编程资料链接: https://docs.espressif.com/projects/arduino-esp32/en/latest/getting_started.html#about-arduino-esp32 如果计划使用micropython语言编程资料链接如下: https://docs.micropython.org/en/latest/esp32/quickref.html 如需要安装核心板的硬件usb转串口驱动: https://www.wch.cn/products/CH340.html?from=list micropython的ESP32-C3固件注意有两个固件:https://micropython.org/download/