2020年12月11日 星期五

Installing the ESP32 Board in Arduino IDE (Windows)

Installing the ESP32 Board in Arduino IDE (Windows) 

源自於 https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/

There’s an add-on for the Arduino IDE that allows you to program the ESP32 using the Arduino IDE and its programming language. In this tutorial we’ll show you how to install the ESP32 board in Arduino IDE whether you’re using Windows.

If you have any problems during the installation procedure, take a look at the ESP32 Troubleshooting Guide.

If you like the ESP32, enroll in our course: Learn ESP32 with Arduino IDE.

Prerequisites: Arduino IDE Installed

Before starting this installation procedure, make sure you have the latest version of the Arduino IDE installed in your computer. If you don’t, uninstall it and install it again. Otherwise, it may not work.

Having the latest Arduino IDE software installed from arduino.cc/en/Main/Software, continue with this tutorial.

Do you need an ESP32 board? You can buy it here.

Installing ESP32 Add-on in Arduino IDE

To install the ESP32 board in your Arduino IDE, follow these next instructions:

  1. In your Arduino IDE, go to FilePreferences

  2. Installing ESP32 Add-on in Arduino IDE Windows, Mac OS X, Linux open preferences
  3. Enter 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:

    Installing ESP32 Add-on in Arduino IDE Windows, Mac OS X, Linux enter URLs

    Note: if you already have the ESP8266 boards URL, you can separate the URLs with a comma as follows:

    https://dl.espressif.com/dl/package_esp32_index.json, http://arduino.esp8266.com/stable/package_esp8266com_index.json
  4. Open the Boards Manager. Go to Tools > Board > Boards Manager…

    Installing ESP32 Add-on in Arduino IDE Windows, Mac OS X, Linux open boards manager
  5. Search for ESP32 and press install button for the “ESP32 by Espressif Systems“:

    ESP32 Add-on in Arduino IDE Windows, Mac OS X, Linux Installed
  6. That’s it. It should be installed after a few seconds.

    ESP32 Board add-on in Arduino IDE installed

Testing the Installation

Plug the ESP32 board to your computer. With your Arduino IDE open, follow these steps:

1. Select your Board in Tools > Board menu (in my case it’s the DOIT ESP32 DEVKIT V1)

Arduino IDE select the ESP32 board in Tools menu

2. Select the Port (if you don’t see the COM Port in your Arduino IDE, you need to install the CP210x USB to UART Bridge VCP Drivers):

Arduino IDE select the ESP32 Port in Tools menu

3. Open the following example under File > Examples > WiFi (ESP32) > WiFiScan

Arduino IDE open WiFiScan example for ESP32

4. A new sketch opens in your Arduino IDE:

Arduino IDE uploading WiFiScan example to ESP32


5. Press the Upload button in the Arduino IDE. Wait a few seconds while the code compiles and uploads to your board.

Arduino IDE upload WiFiScan sketch to ESP32

6. If everything went as expected, you should see a “Done uploading.” message.

Arduino IDE done uploading ESP32 WiFiScan sketch

7. Open the Arduino IDE Serial Monitor at a baud rate of 115200:

Open Arduino IDE Serial Monitor at baud rate 115200

8. Press the ESP32 on-board Enable button and you should see the networks available near your ESP32:

ESP32 Testing Add-on installation in Windows PC, Max OS X, and Linux computer

Troubleshooting

If you try to upload a new sketch to your ESP32 and you get this error message “A fatal error occurred: Failed to connect to ESP32: Timed out… Connecting…“. It means that your ESP32 is not in flashing/uploading mode.

Having the right board name and COM por selected, follow these steps:

  • Hold-down the “BOOT” button in your ESP32 board
Solved A fatal error occurred: Failed to connect to ESP32: Timed out… Connecting…
  • Press the “Upload” button in the Arduino IDE to upload your sketch:
Arduino IDE uploading new sketch to ESP32
  • After you see the  “Connecting….” message in your Arduino IDE, release the finger from the “BOOT” button:
Arduino IDE done uploading ESP32 WiFiScan sketch
  • After that, you should see the “Done uploading” message

That’s it. Your ESP32 should have the new sketch running. Press the “ENABLE” button to restart the ESP32 and run the new uploaded sketch.

You’ll also have to repeat that button sequence every time you want to upload a new sketch. But if you want to solve this issue once for all without the need to press the BOOT button, follow the suggestions in the next guide:

If you experience any problems or issues with your ESP32, take a look at our in-depth ESP32 Troubleshooting Guide.

Wrapping Up

This is a quick guide that illustrates how to prepare your Arduino IDE for the ESP32 on a Windows PC, Mac OS X, or Linux computer. If you encounter any issues during the installation procedure, take a look at the ESP32 troubleshooting guide.

Now, you can start building your own IoT projects with the ESP32!








沒有留言:

張貼留言

Messaging API作為替代方案

  LINE超好用功能要沒了!LINE Notify明年3月底終止服務,有什麼替代方案? LINE Notify將於2025年3月31日結束服務,官方建議改用Messaging API作為替代方案。 //CHANNEL_ACCESS_TOKEN = 'Messaging ...