Your Arduino IDE environment is where you will be working with your code and uploading that code onto your ESP32. Note that you are not limited to only using the Arduino IDE environment for doing this, so if you are familiar with other environments, feel free to use them. For the purposes of this book, we will be working with this IDE.
Arduino IDE environment
The Arduino integrated development environment (IDE) is a powerful, user-friendly software platform designed for programming and interacting with Arduino microcontroller boards. The IDE makes it easy for beginners to get started with microcontroller programming while also offering advanced features for experienced developers. In this section, we will guide you through the process of setting it up on your computer, enabling you to bring projects described in this book and beyond to life:
Download the Arduino IDE environment at https://www.arduino.cc/en/software. Go through the installation process and accept the defaults, ensuring that you know where the program will be installed.
Open your newly installed Arduino IDE. By default, we will not be able to find ESP32 as a supported board unless we specify it within our preferences. Go to File | Preferences. On the window that is opened, you should see a space for additional boards manager URLs. Enter the URL https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json. Click OK.
Go to Tools | Board | Boards Manager and enter esp32 into the search bar. Click Install on the latest ESP32 version that pops up:
Figure 1.4 – Accessing Boards Manager on the Arduino IDE
After installation, navigate to Tools | Board | esp32 and select NodeMCU-32S.
We then need to install the driver for the ESP32. To check which type you are using, navigate to Device Manager on your device by searching it up on the Windows Start menu and expanding the Ports (COM & LPT) dropdown. Take note of the COM port that is being used; we will also need to set our Arduino accordingly to that later. If the same type is used, which will require the CP210x driver, you will be able to download it at https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers?tab=downloads.
On the Arduino IDE, navigate to Tools | Port and select the COM port that is being used.
Attach your ESP32 to your laptop using a mini USB.
Click File | New Sketch in the top-left corner of the program.
You will see the following code in your environment:
void setup() { // put your setup code here, to run once:}
void loop() {// put your main code here, to run repeatedly:}
To see whether your IDE is working correctly, click on Verify, which is the button in the top-left corner of the screen.
To see whether your device is configured correctly, click on Upload, which is the second button from the left. While the upload is, hold down the Boot button, which is the button in the bottom right.
Check your IDE’s terminal to see whether the code has been uploaded successfully.
With this, your Arduino IDE should be set up and ready to be used. We can now proceed to try it out with our inaugural Hello World exercise.