Getting Started with ESP32: Program ESP32 using Arduino IDE to Blink an LED

Getting Started with ESP32: Program ESP32 using Arduino IDE to Blink an LED

ESP32 is the successor of the popular ESP8266 Wi-Fi module, with many advanced features such as a dual-core 32-bit CPU with built-in Wi-Fi and dual-mode Bluetooth with a sufficient amount of 30 I/O pins. It is capable of functioning reliably in industrial environments, with operating temperature ranging from –40°C to +125°C. It has a wide variety of peripherals available like capacitive touch, ADCs, DACs, UART, SPI, I2C, etc. In addition to that, it also has a built-in hall effect sensor and a built-in temperature sensor.

 

ESP32 can be programmed directly from the Arduino IDE which makes it easy to work for the large community of Arduino developers. Here in this ESP32 getting started tutorial, we will configure ESP32 in Arduino IDE and program it to Blink an LED. So, let’s get started with the ESP32 development board.

 

Materials Required

  • ESP32 Module
  • USB cable
  • Arduino IDE

 

ESP32 Specifications and Pinout

Before we actually get started with ESP32 programming, let's first check the specifications of ESP32. As mentioned earlier, it has a dual-core processor which means it has two processors. The ESP32 will run on breakout boards and modules from 160MHz up to 240MHz which is a very good speed for anything that requires a microcontroller with connectivity options.

ESP32 Pinout

As you can see, the processor used in ESP32 is ESP-WROOM-32 which is a 32bit microprocessor. The below picture shows the schematics diagram of ESP32:

ESP32 Schematic Diagram

 

Any basic ESP32 circuit design can be divided into eight major sections:

  • Power Supply
  • Power-on sequence and system reset
  • Flash
  • Crystal Oscillator
  • RF
  • ADC
  • External Capacitors
  • UART

 

It has a couple of buttons and LEDs which are explained below:

  • Micro USB Port: This port is used to connect ESP32 to our computer for programming by using a USB cable.

 

  • Boot Button: Boot button is used to upload the program from Arduino IDE into ESP32 after clicking on the upload icon on the Arduino IDE. Please make sure that don’t press the EN button with the Boot button otherwise ESP enters into firmware uploading mode.

 

  • EN Button: The EN button is used to reset the ESP module.

 

  • Power-On LED: It is used to indicate the power supply, glows red when powered.

 

  • I/O Pins: The ESP32 has more pins than ESP8266, With the ESP32 you can decide which pins are UART, SPI, or I2C. You just need to set on the code, this becomes possible due to the ESP32 chip multiplexing feature. If you don’t set them on the code the pins will be used as default.

ESP8266 Pinout

For more details about pin description, you can refer ESP32 datasheet.

USB-UART Bridge: The USB to UART Bridge Controller is a fully integrated USB to UART controller that provides USB connectivity to devices with a UART interface.

 

Preparing ESP32 in Arduino IDE

Step 1: First you need to download and install Arduino IDE software which you can download from https://www.arduino.cc/en/Main/Software for free. If you have already installed Arduino IDE on your PC, then make sure that it is the latest version of IDE as the older version doesn’t include the ESP32 board. 

 

Step 2: After installing, open IDE and go to Files -> Preferences and open preference window and see the “Additional Boards Manager URL’s” as:

Preparing ESP32 in Arduino IDE

 

Step 3: This box may be empty or contain some other URL if you have used it previously for ESP8266. You just have to paste the below URL into this box if the box contains already another URL, then paste it by separating another URL using comma(,).

https://dl.espressif.com/dl/package_esp32_index.json

 

Step 4: After pasting the given URL my window looks like this as I already used ESP82666, Now press OK and the window will disappear.

Setting Preference for Interfacing ESP32 with Arduino

 

Step 5: Now go to Tools-> Board-> Board Manager and search for ESP32 and press install, it will take some time to install, make sure that you have an internet connection; after installing, your window looks like this:

Install ESP32 Library in ArduinoIDE

After this, close the window of board manager and your Arduino IDE is ready to program ESP32.

 

Programming ESP32 With Arduino IDE

Now you are ready to program your ESP32 using Arduino IDE according to your requirements. Following are the steps required to program the ESP32 with Arduino IDE. Here we will upload an LED binky program in ESP32 using Arduino IDE.

 

Step 1: First of all, connect your ESP32 to your computer using a micro-USB cable, make sure that Red LED goes high after connecting it with the PC.

 

Step 2: Now you have to select your board; so go to Tools-> Boards and select “ESP32 Dev Module”.

Programming ESP32 With ArduinoIDE

 

Step 3: Now open device manager and check to which com port ESP32 is connected. Here, my ESP is connected to port6.

Connecting ESP32 with PC

 

Step 4: Open Arduino IDE again and paste the given LED blink program:

int LED_BUILTIN = 2;
void setup() {
pinMode (LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}

 

In ESP32, the internal LED is connected to pin no. 2; so I define that pin of ESP as high or low. This code makes LED blink every 1 second, you can change the interval by changing the delay.

 

Step 5: To upload the code in ESP32, click on the upload button.

Uploading Code into Arduino UNO

After uploading the code, you will see a window like this and finds “Done uploading” if everything you did earlier was correct.

ESP32 LED Blinking Code

Now see your ESP module and you will find that a LED of your module is blinking at an interval of 1 second. You can also connect LED externally with ESP32 in that case you have to just change that PIN to which you are connecting the LED.

 

Working of ESP32 LED Blinking Project

After going through the above steps properly, you can blink LED using ESP32, so here I am showing you some pictures to demonstrate how it is working:

ESP32 LED Blinking Project

This is how we can successfully blink LED using ESP32 with Arduino IDE. Complete code is given below. You can also connect the external LED with some GPIO pin of ESP32, just change the pin no. in the code.

I hope you liked the article and learned something new, if you have any questions regarding this project, please comment below.

Code

int LED_BUILTIN = 2;

void setup() {

pinMode (LED_BUILTIN, OUTPUT);

}

void loop() {

digitalWrite(LED_BUILTIN, HIGH);

delay(1000);

digitalWrite(LED_BUILTIN, LOW);

delay(1000);

}

5 Comments

超人気質屋

★最高等級時計大量入荷!
▽◆▽世界の一流ブランド品N級の専門ショップ★
注文特恵中-新作入荷!-価格比較.送料無料!
◆主要取扱商品 バッグ、財布、腕時計、ベルト!
◆全国送料一律無料
◆オークション、楽天オークション、売店、卸売りと小売りの第一選択のブランドの店。
■信用第一、良い品質、低価格は 私達の勝ち残りの切り札です。
◆ 当社の商品は絶対の自信が御座います。
おすすめ人気ブランド腕時計, 最高等級時計大量入荷!
◆N品質シリアル付きも有り 付属品完備!
☆★☆━━━━━━━━━━━━━━━━━━━☆★☆
以上 宜しくお願い致します。
(^0^)

日本的な人気と信頼を得ています。
安心、安全にお届けします
価格、品質、自信のある商品を取り揃えておりますので、
当店の主要な経営のブランド:ヴィトン シャネル ロレックスなど.
当店は主に経営する商品:かばん.バッグ .財布 .キーケース. .腕時計など.
日本には無い商品,日本では高価な商品,弊社のない商品,取引先を代理して製造会社を連絡することができる.
弊社長年の豊富な経験と実績があり.輸入手続も一切は弊社におまかせできます.ご希望の商品を責任を持ってお届けします.
当店の商品は特恵を与える。興味あれば、是非ご覧下さい
財布、腕時計、バッグ一品市場

この度は、ご丁寧な説明をしていただきまして有難うございました。
説明をしていただいた通り綺麗な商品で購入して大変良かったと思います。
ネットでブランド品を購入するのは心配しましたが返品可能のシステムやお電話の対応の良さで安心して購入出来ました事を感謝しています。
大切に使用して行きたいと思います。
この度は有難うございました。
【最短当日発送】遅くとも1~2営業で出荷可能、全国一律送料無料。販売価格はフリーダイヤルにてご相談させてください♪ルイヴィトン ハンドバッグ モノグラム チェリー スピーディ25 M95009 新品 レディース さくらんぼ ミニボストン ルイ・ヴィトン ルイビトン ルイ ヴィトン ビトン ブランド 男性 女性 母の日 父の日 ギフト 誕生日プレゼント ルイ・ヴィトン
シミや汚れの少ない商品が購入出来てとても嬉しいです。
ネット購入は不安もありましたが夢市場プレミアムさんは届いてから返品可能だと電話で聞いて安心して購入出来ました。
届いた商品もネットの画像や説明で聞いていた通りで納得出来るとても良い品物でした。
新品ではヌメ皮のシミが多い商品なので今回の購入、良い買い物が出来て感謝しています。
手書きの一筆とても嬉しかったです!信頼できるお店です。

エルメス バーキン サイズ
2022年春夏新作商品
同等品質提供した格安で完璧な品質のをご承諾します
品質を重視、納期も厳守、信用第一は当社の方針です
高品質の追求 超N品を良心価格で提供
絶対に満足して頂ける品のみ皆様にお届け致します.
ご注文を期待しています!

Add new comment

The content of this field is kept private and will not be shown publicly.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.