To connect ESP32 to your computer with Linux Debian 12, you will need to follow these steps:
- USB Cable: You need a USB to micro-USB or USB-C cable, depending on the port type in your ESP32.
- Drivers: Most modern operating systems automatically recognize ESP32, but you may need to install CP210x USB to UART Bridge VCP drivers.
- Connection:
- Connect the USB cable to the ESP32.
- Connect the other end of the cable to a USB port on your computer.
- Checking the connection:
- On Linux, use the command “ls /dev/tty*” in the terminal.
You should see a new serial device.
- On Linux, use the command “ls /dev/tty*” in the terminal.
- Software: For programming ESP32, you can use Arduino IDE or the ESP-IDF platform.
Backup
Making a copy of the factory ESP32 content is a good idea, especially before introducing your own changes. Here’s how you can do it:
1.Install esptool:
If you don’t have it yet, install esptool. You can do this via pip:
|
|
2.Connect the ESP32 to your computer via USB.
How do I know which port to use?
On Linux:
- Open a terminal and type:
ls /dev/tty*
- Connect the ESP32 to your computer
- Type again:
ls /dev/tty*
- Compare the results - the new port that appeared is probably your ESP32
- It will usually be something like
/dev/ttyUSB0
or/dev/ttyACM0
If you’re unsure, you can disconnect and reconnect the ESP32, observing which port disappears and reappears on the list.
3.Perform the backup:
Open a terminal and type:
|
|
Note: Change /dev/ttyUSB0
to the appropriate port for your system.
4.This command will create a flash_contents.bin
file, which will contain a copy of the entire ESP32 flash memory.
A few notes:
- Make sure you have enough disk space (the file will be about 4MB).
- The process may take a few minutes.
- If you encounter connection problems, you may need to repeat the command to perform a backup.
To restore this copy later:
|
|
Remember that this copy contains everything in the flash memory, including the bootloader, partitions, and application.
Install Arduino IDE
To install Arduino IDE on a Linux system, you can use one of two main methods:
1.Installation through the package manager (easier, but may not be the latest version):
Open a terminal and type:
|
|
This method works on Debian/Ubuntu-based systems. For other distributions, the command may differ.
2.Installation from the official Arduino website (latest version):
a) Go to
https://www.arduino.cc/en/software
b) Download the Linux version (64-bit or 32-bit, depending on your system)
c) Extract the downloaded .tar.xz file
d) Open a terminal in the folder where you extracted the files
e) Run the installation script:
|
|
After installation, you can launch Arduino IDE from the application menu or by typing arduino
in the terminal.
Additionally, to use Arduino IDE without root permissions, you need to add your user to the dialout group:
|
|
Also make sure that you can write to the device:
|
|
After executing this command, it will be necessary to restart the system or log out and log back in.
After installing Arduino IDE and connecting ESP32, the next steps are:
-
Adding ESP32 support to Arduino IDE:
- Open Arduino IDE
- Go to File > Preferences
- In the “Additional Boards Manager URLs” field, add:
https://espressif.github.io/arduino-esp32/package_esp32_index.json
- Click OK
See documentation: https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html
-
Installing the ESP32 board:
- Go to Tools > Board > Boards Manager
- Search for “ESP32”
- Install “ESP32 by Espressif Systems”
-
Configuring Arduino IDE:
- Select the appropriate ESP32 model in Tools > Board > esp32 > AI Thinker ESP32-CAM from the Arduino IDE menus.
- Select the correct port in Tools > Port
- Select proper frequency - see crystal freq. Usually 80 or 40 MHz
-
Testing the connection:
- Open an example sketch: File > Examples > WiFi > WiFiScan
- Click the “Upload” button to compile and upload the program
-
Programming:
- Now you can start writing your own programs or modify existing examples
-
Testing application/code
- Open Tools > Serial Monitor
- Set baud to 115200
- Observe the result of the code