Getting Started With ESP32 on a Mac
by shahizat in Circuits > Electronics
20859 Views, 3 Favorites, 0 Comments
Getting Started With ESP32 on a Mac
About ESP32
ESP32 is a low cost and low power system on a chip microcontroller with integrated Wi-Fi & dual-mode Bluetooth. ESP32 is created and developed by Espressif Systems, a Shanghai-based Chinese company, and is manufactured by TSMC using their 40nm process.
Task
ESP32 Development Board will be used to blink an embedded LED infinitely.
Supplies
- ESP32 Module
- Arduino IDE
- Programming cable (micro USB cable)
- Breadboard (optional)
How to Connect Your ESP32 to a MacBook
- Install the driver in order to communicate UART through USB.
- Go to Preferences/Security & Privacy and allow the driver to run, and restart the Mac.
- Connect your Micro USB to your ESP32 Board.
- Run $ ls /dev/cu.* and you should now see /dev/cu.SLAB_USBtoUART.
Before starting the next step, make sure you have the latest version of the Arduino IDE installed in your computer. It can be found by the following link.
Installing ESP32 Add-on in Arduino IDE
- In your Arduino IDE, go to File> Preferences
- Enter https://dl.espressif.com/dl/package_esp32_index.j... into the “Additional Board Manager URLs” field. Then, click the “OK” button.
- Go to Tools > Board > Boards Manage.
- Search for ESP32 and press install button for the “ESP32 by Espressif Systems“.
- Close a window
Writing Code for Arduino
Plug the ESP32 board to your computer. Open Arduino IDE, follow these steps:
- Select your Board in Tools > Board menu (in my case it’s the ESP32 DevModule)
- Select the Port /dev/cu.SLAB_USBtoUART.
- Write down the following code
/*
* ESP32 LED Blink Example */ #define LED 2 void setup() { // Set pin mode pinMode(LED,OUTPUT); } void loop() { delay(500); // 500ms digitalWrite(LED,HIGH); // Turn on LED delay(500); // 500ms digitalWrite(LED,LOW); // Turn off LED }
Blinking a Built-in LED on ESP32
Press the Upload button in the Arduino IDE. Wait a few seconds while the code compiles and uploads to your board. After uploading program you will find on board BLUE LED will start Blinking.