The ESP32 board and the ESP8266 board are among the most important programmable boards in the world of electronics, because the board offers many advantages over the Arduino Uno board, including that it provides Bluetooth and WIFI, which enables it to send data wirelessly and connect to the Internet without the need to connect any module to the board.
In this tutorial, we will learn how to program the ESP32 board and ESP8266 board using the Arduino IDE. We will upload a simple code to turn on and off the LED lamp on both boards for fixed periods of time.
First, we will program the ESP32 board. open the Arduino IDE program and click on the File tap at the top of the screen and then click on preferences.
Then a window will appear to you as you see now. Go to the rectangle at the bottom of the window, which is next to the phrase Additional boards manager URLs, click on it and copy the following link into that rectangle:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
Then press the OK button:
Now click on the Tools tap at the top of the screen, then click on Board and choose from the list that will appear Boards Manager:
A search box will appear on the left of the screen, type the word ESP32 in it as you see now :
Several options will appear, choose ESP32, and press the INSTALL button :
Then wait a few minutes, and the phrase PlatformESP32:ESP32@installed will appear at the bottom of the black screen, indicating that the board has been successfully added to the Arduino IDE.
Finally, click on the Tools tap at the top of the screen, then click on Board and choose from the list that will appear ESP32, and from the list that will appear choose the board or version that you want to program. In our case, we will choose ESP32 Dev Module:
Then connect the Arduino ESP32 board to the computer and click on the Tools tap at the top of the screen, then click on Port and choose from the list that will show the COM port to which the ESP32 Dev Module boardis connected. This COM port number varies depending on the USB port to which the board is connected on the computer. For me, I connected the ESP32 board to the COM9 port, so I will choose this port:
You can now upload any programming code you want to theESP32 board. We will upload a simple programming code to turn on and off the LED lamp on the ESP32 board for fixed periods of time.
When the program starts uploading the code, press the BOOT button on the ESP32 board continuously until the code upload is completed successfully.
After uploading the code, you will find that the lamp on the board flashes for fixed periods of time as shown in the image below.
Now we will learn how to program the ESP8266 board. Go to the Arduino Ide program and click on the File tap at the top of the screen and then click on preferences:
Then a window will appear to you as you see now. Go to the rectangle at the bottom of the window, which is next to the phrase Additional boards manager URLs, click on it and copy the following link into that rectangle:
http://arduino.esp8266.com/stable/package_esp8266com_index.json
Then press the OK button:
Then click on the Tools tap at the top of the screen, then click on Board and choose from the list that will appear Boards Manager.
Then a search box will appear on the left of the screen, type the word ESP8266 in it :
Then you will see several options, choose the ESP8266, and press the INSTALL button :
Then wait a few minutes, and the phrase PlatformESP8266:ESP8266@installed will appear at the bottom of the black screen, indicating that the board has been successfully added to the Arduino IDE.
Finally, click on the Tools tap at the top of the screen, then click on Board and choose from the list that will appear ESP8266, and from the list that will appear choose the board or version that you want to program. In our case, we will choose ESP8266 Generic Module:
Now connect the ESP8266 board to the computer and click on the Tools tap at the top of the screen, then click on Port and choose from the list that will show the COM port to which the ESP8266 board is connected. This COM port number varies depending on the USB port to which the board is connected on the computer. For me, I Connected the ESP8266 board to the COM8 port, so I will choose this port:
You can now upload any code you want to the ESP8266 board. We will upload the same simple code that we uploaded before, to turn on and off the LED lamp on the ESP8266 board for fixed periods of time. Download that code from the sources section at the end of the lesson, and upload the code. On the board.
When the program starts uploading the code, press the flash button on the ESP8266 board continuously until the code upload is completed successfully.
After uploading the code, you will find that the lamp on the board flashes for fixed periods of time as you see in the image below :