Micro Controller unter macOS - Teil 2

Setting up the Arduino IDE and integrating the ESPs and setting up Thonny under macOS

An Apple a day keeps Windows away:-)

Establish Part 2: ESPs

1. A brief preliminary remark

The microcontrollers of Espressif, ESP8266 and ESP32, enjoy great popularity among the Bastlers, they are fast, have plenty of storage space, WLAN and even, depending on the variant, Bluetooth with on board. There are also numerous cheap boards from various manufacturers. They can also be programmed with the Arduino IDE. However, some additional steps are needed for the IDE to talk to the ESPs.

In addition, the version 1.8.13 of the Arduino IDE for MacOS is not quite "Big Sur", which requires some additional steps. Let's get it on!

2. Provision of boards for ESP8266 and ESP32

    First, the Arduino IDE must be told where the files can be retrieved for handling the ESPs. To do this, we call the default settings under /File (engl. "Preferences" and enter the "URLs" administrators:
    For ESP8266, this is:
    https://arduino.esp8266.com/stable/package_esp8266com_index.json
    and for the ESP32:
    https://dl.espressif.com/dl/package_esp32_index.json

    a) Entry of URLs:

    After clicking on the icon on the right next to the line "Additional Board Manager URLs", a small window opens, where the two above mentioned URLs, one in each of their own rows, are entered.

      b) Download the files in the board administrator/board manager

      To do this we call him: /Tools / Board / Boarding Administrator...

      c) Load the files for the ESP8266: enter the esp82 search box and click "Install" (it takes a few seconds to find the desired package)


      d) Loading the files for the ESP32: enter esp32 in the search box and click "Install"

      then close the window.

      3. The first programme with an ESP6266

        Again I use the example program "Blink" from the sample collection.

        As test subjects were available to me:

        All three boards of AZ-Delivery.

        The program "Blink" (all comments removed):

        void setup() {
          pinMode(LED_BUILTIN, OUTPUT);
        }

        void loop() {
          digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on
          delay(200);                        // wait for a second
          digitalWrite(LED_BUILTIN, LOW);    // turn the LED off
          delay(200);                        // wait for a second
        }

        To make the program ESP-compatible, we need to select the appropriate board as well as the right port. Choosing the right board can be a bit of a game of advice, sometimes you don't know which one is in front of you. I chose WeMos D1 R1, which worked with all three of my ESP8266s.

        Tools -> Board: -> ESP8266 Boards (2.7.4) -> WeMos D1 R1


        And the port: tools -> Port -> /dev/ c.usbserial -1420


        The exact name of the port depends, of course, on the hardware.

        Now happily translate the program and load onto the board.

        There was now a serious problemwhich is probably due to the fact that the ESP8266 environment is not yet fully "Big Sur" compatible.

        There was always an error message "pyserial or esptool directories...":


        After some searching in the net I was caught and could solve the problem:

        a) Download the file: https://github.com/espressif/esptool/archive/v3.0.zip
        b) Download the file: https://github.com/pyserial/pyserial/archive/v3.4.zip
        c) Unpack the files in the download folder "esptool-3.0.zip" and "pyserial-3.4.zip"
        d) Rename the folders "esptool-3.0" to "esptool" and "pyserial-3.4" to "pyserial"
        (e) These two folders will now be added to the directory
        ~/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/
        Copy and replace the folders that are located there.

        How on earth do you get into this folder? The folder ~/Library is usually hidden in the Finder. So what to do?
        Very simple: the line

        ~/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/


        Copy to the clipboard and then call the menu item in the Finder: "Go to -> Go to the folder..." and then insert the clipboard into the small window and click "Open".


        After this procedure, the compilation and transmission of all three boards worked and a powerful flash of the built-in LED was used.

        Done!

        4. The first program with an ESP32

          There was a problem here. All three boards in the series "ESP32 D1 R32 Development Board with CH340G and WiFi + Bluetooth (Arduino compatible Internet Development Board)" by AZ-Delivery initially refused to include a program. Two could not connect and the other board reported: "A fatal error occurred: Timed out waiting for packet content". This board could be revived by reducing the "Upload Speed" to 115200 construction.


          The other two were not able to make contact with the Arduino IDE at the lowest upload speed of 460800.

          This was definitely not at MacOS, because I had the same result with the Arduino IDE both under WIN 7 and under LINUX Mint.

          After consulting Gerald Lechner, at least one of the board could be revived.
          The message: »Connecting........_____....._____....._____....._____....._____.....«
          If you connect the pin OO to GND and then press the rest button, the board will be moved manually to Flash mode. One of the two deniers was successful, the other was a futile effort.

          So three boards worked:


          As a board I first chose the "ESP32 Dev Module" from the heading "ESP32 Arduino", the port was called /dev/ c.usbserial -0001. (All required drivers were pre-installed!)

          5. The program

          Here again the tried and tested program "Blink", which however had to be changed a little. Because it is the pin 1 or pin 2 connected to the internal LED and the predefined constant LED BUILTIN is unknown to this module.

          int LED = 1;
          // 1 für ESP32 NodeMCU; 2 für für ESP32 D1 R32

          void setup() {
            pinMode(LED, OUTPUT);
          }

          void loop() {
            digitalWrite(LED, HIGH);
            delay(200);
            digitalWrite(LED, LOW);
            delay(200);
          }


          For the Heltec board I had to hire:

          Board: Heltec WiFi Kit 32

          Port: /dev/ c.usbserial -0001

          The program had to be changed:

          void setup() {
            pinMode(LED_BUILTIN, OUTPUT);
          }

          void loop() {
            digitalWrite(LED_BUILTIN, HIGH);
            delay(200);
            digitalWrite(LED_BUILTIN, LOW);
            delay(200);
          }


          Done! Next time we install Thonny as a development environment for Micro Python.

          Download pdf


          Esp-32Esp-8266For arduinoBasics softwareProjects for beginners

          6 comments

          Marco

          Marco

          Hallo,
          ich nochmal hab den Fehler gefunden.
          Anscheinend gibt es Unterschiede bei den Kabels.
          Habe drei Stück ausprobiert und erst beim dritten wurde der ESP8266 vom Mac erkannt.
          Bei den anderen beiden war nur die Stromversorgung von ESP gegeben.
          Gruß Marco

          Marco

          Marco

          Hallo zusammen,
          der Beitrag ist echt spitze.
          Leider wird bei mir der serielle USB-Port nicht angezeigt sondern nur kabellose Verbindungen.
          Weiß jemand woran das liegt?
          Beste Grüße
          Marco

          Rudolf Reiber

          Rudolf Reiber

          Das Problem von Julia konnte gelöst werden. Es fehlte das neueste esptool an der entsprechenden Stelle. Ob das nun an Big Sur lag oder daran, dass die Arduino IDE nicht korrekt upgedatet wird? Ich weiß es nicht. Auf jeden Fall tut bei Julia nun alles.

          Rudolf Reiber

          Rudolf Reiber

          Hallo Julia,
          kannst Du die Probleme bitte genauer schildern.
          Bei mir ist die ESP32 Umgebung völlig „Big Sur“ kompatibel.
          Viele Grüße
          R. Reiber

          Julia

          Julia

          vielen Dank für diesen Artikel, die Problembehandlung für den ESP 8266 hat gut geklappt,
          aber was ist mit der ESP32 Umgebung, auch sie ist noch nicht völlig »Big Sur« kompatibel,
          beste Grüße von Julia

          Rudolf Reiber

          Rudolf Reiber

          Hinweis: bei dem dritten ESP32 Board, das nicht tat, befand sich ein Lötbatzen zwischen zwei Pins, dem TXT- und RXT-Pin. Das ist bei der Endkontrolle des Boards offensichtlich nicht aufgefallen. Mithin konnte das Board nicht mit der tion mit der ARDUINO-IDE erfolgen. Nach dem Entfernen der Lötbrücke funktionierte auch das dritte Board einwandfrei.

          Leave a comment

          All comments are moderated before being published

          Recommended blog posts

          1. Install ESP32 now from the board manager
          2. Lüftersteuerung Raspberry Pi
          3. Arduino IDE - Programmieren für Einsteiger - Teil 1
          4. ESP32 - das Multitalent
          5. OTA - Over the Air - ESP programming via WLAN