ESP32 programming, Arduino - install requirements

Diese Seite gibt es auch in Deutsch

I have not had much to do with Arduino or microcontrollers, apart from updating and operating my 3D printer. Microcontrollers, for example the ESP32, offer a cheap alternative to the Raspberry Pi for certain purposes, such as collecting data or certain control or monitoring tasks : WLAN and Bluetooth included . After entering new territory for me here, I wanted to share my experience from a beginner's point of view. Background of my efforts was a concrete use case.

I had set myself the goal to record the water flow of my water-to-water heat pump. For measuring the flow I use an ultrasonic flowmeter TUF-2000B, this works so far and shows the actual flow and offers RS485 as interface, see: Commissioning Ultrasonic Flowmeter Flowmeter TUF-2000M. To display and record the flow rates of the TUF-2000B in Home-Assistant, I need a way to read out the serial interface RS485 and transmit the data via WLAN to Home-Assistant. For receiving the data in Home-Assistant I need something like MQTT, which I will describe in a separate article.

Equipment

For the use case, i.e. the recording of data from a RS485 interface, I got the following hardware and have it available:

But my first intermediate goal for now is just to be able to address the ESP32 via the existing USB port and to upload an example: Both should be possible via the Arduino IDE.

Arduino IDE from the MS-Store

Not needed for a long time, but from updating the 3D printer I remember that the Arduino IDE is available in the Windows Microsoft Store:

After starting the IDE, the board hardware can be selected under Tools, Boards.

ESP32 is missing from the boards

Unlike the 3D printer, I can't find the ESP32 among the available boards:

After a brief search, additional source URLs, for previously unknown boards, can be added under Preferences:

After a short excursion with other URLs and the board version 2.02 -> see ESP32 2.0.2, it worked with version 1.06 and the URL: "https://dl.espressif.com/dl/package_esp32_index.json" then worked:

After specifying the URL, the hardware can be installed and selected in the Boards Manager:

Connect ESP32 via USB

The ESP32 can simply be connected to the computer with a USB cable, which also triggers the typical USB noise when connecting new devices, but the ESP32 does not appear in the Arduino IDE.

As COM port only port: COM1 is available

At this point we are still missing a driver: docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/establish-serial-connection.html -> www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers

Install CP210x Universal Windows Driver

After downloading and unzipping the driver, it can be easily integrated by "right-clicking" and "Install":

After this action an additional COM port, in my case COM3 appears under the ports:

After selecting COM3 we have a connection to our ESP32:

Once all preparations for programming an ESP32 are done, the examples available in the Arduino IDE can be adapted and uploaded to the ESP32:

The upload of the WiFiClient and a simple web server (HelloServer) follows in a separate article ...

positive Bewertung({{pro_count}})
Rate Post:
{{percentage}} % positive
negative Bewertung({{con_count}})

THANK YOU for your review!

Publication: 2022-11-04 from Bernhard 🔔


Top articles in this section


ESP32 MQTT - Send data
To be able to receive data from an ESP32, I have prepared an MQTT broker as a Docker container. The container can be integrated into Home-Assistant and thus forward the data from the ESP32 to Home-Assistant via MQTT. On the part of ESP32, I tested sending with the following sketch and later integrated the relevant parts into another sketch.

ESP32 WiFi example
In preparation for uploading sketches to a microcontroller, I installed the ESP32 board infromations and a USB to UART Bridge driver, see: Preparations for Programming an ESP32.

ESP32 Flowmeter - RS485 Modbus
As described in the first article of this series, my first goal was to read out a TUF-2000M Ultrasonic Flow Meter via an ESP32. For this purpose I found an example for an ESP8266 on the internet: Reading a TUF-2000M Ultrasonic Flow Meter with an Arduino or ESP8266 and https://forum.arduino.cc/t/comunicacion-rs485/698786/2. I described the setup of the TUF-2000M in the following article: Field Report: Ultrasonic Flow Meter TUF-2000M. To be able to read the TUF-2000M via RS485, it must first be c...

Questions / Comments