Setting up the Arduino IDE and integration of the ESPs as well as the establishment of Thonny under MacOS
An Apple the day keeps Windows away :-)
Part 1 - Set up Arduino
1. A short preliminary remark
Even users of Apple's Mac computers feel the need to deal with microcontrollers. There is much literature, also you will find a large number of contributions in the network. However, the predominant number of this information refers to the use of the controllers under Windows computers. The Macians are probably in the call to liitle or nothing with micro controllers and only deal with graphics. While this may apply on average, it is not true for all "Maccerer". This and, of course, the relatively low dissemination of Macs is probably the reason for the rather pantomal treatment of this platform in this topic.
This contribution will help beginners to dig into this beautiful area.
2. Helpful software
This entry was written under MacOS »Big Sur« (version 11.2.2), the currently newest operating system.
First of all, I would like to give a brief overview of helpful software. Of course, the enumeration is not complete, but the preference of the author is due.
a) »terminal«To call various shells to interact with the computer by means of console commands.
b) »preview"The often underestimated PDF reader from MacOS with simple ways to edit PDFs and pictures, is enough for home use.
c) »Safari«, The supplied browser
d) »Text", A simple text editor, included
Software from »outside«
a) »iTERM2", A very powerful terminal software, available for free at:
b) »BBEdit«Very powerful text editor, chargeable ($ 50), also available in the AppStore, only available in English
c) »CotEditor", Simple text editor, free in the AppStore
d) »Firefox«, »Google Chrome«, »Opera«, »Vivaldi«, »Microsoft Edge"All browsers, according to personal taste, selectable
3. Installation of the Arduino IDE
Prerequisite for programming the Arduino or ESP modules is at least one development environment. Two of them are known to me, on the one hand the Arduino IDE and the other the "Visual Code Studio" of Microsoft. For the beginner, I think the "Arduino IDE" is ideally suited, but not so powerful, but less complicated to incorporate.
The Arduino IDE is available for free on the Arduino website:
Here are the versions for Windows, Linux and MacOS, at the time of creating this text version 1.8.13. After clicking on the line »Mac OS X« and answering the question whether we only load or give a small donation, the software is loaded and lands in the folder »Downloads«, where it will be unpacked.
From there we draw the program in the »programs« folder.
Now the program "Arduino" is started. First, we must answer the one-time security query because the program does not come from the AppStore. After all, the developers seem to be registered with Apple.
Now comes the »Arduino« window:
The red error messages in the below window can be ignored because no board is yet connected.
An installation of drivers for connecting the boards was not necessary for me.
The following boards:
- »Arduino Mega® 2560 Rev3« by Arduino
- »Mega 2560 R3 Board with Atmega2560« by AZ-Delivery
- »Atmega328 development board« by Vellemann
- »Microcontroller Board with Atmega328P, Atmega16U2, compatible with Arduino UNO® R3« from AZ-Delivery
- »Nano V3.0 with Atmega328 CH340« from AZ-Delivery
worked without further driver installation.
At the first start, a folder "Arduino" is created in the user folder. All projects are stored in these folders.
If further libraries are loaded, they automatically come to a folder »Libraries«, which is located in the "Arduino" folder.
The UNIX path to these folders is:
~ / Documents / Arduino or ~ / Documents / Arduino / Libraries
»~« Is the abbreviation for »/ users / users«. ("User" is of course the name of the respective user. (The sign "~« is obtained with "Option-N".)
4. Setting up the IDE
IDE means "Integrated Development Environment" and is a collection of programs that allow easy software development to enable.
The Arduino IDE can be adapted to a certain extent. Let's take a look at that. The program is started and then the menu item »Arduino -> Preferences ...« is called.
The »Preferences« window:
- Setting the language
- Text size, for the elderly, 18 points is recommend. ;-)
- Setting option: »None«, »Standard«, »more« or »All«. Select for the beginning »Standard«.
- If the hook is set here, you can use the program texts in an external editor, e.g. CotEditor or BBEDIT write. This has advantages because these editors are much more powerful than the Arduino editor, but on the other hand, it has the disadvantage that you have opened two windows and that the syntax accentuation, as in the Arduino IDE, is not available. Try out and decide what you like better.
5. The first program
For the first steps, I use the microcontroller board with ATMega328p, ATMega16u2, compatible with Arduino UNO R3, which is connected to the Mac with a USB cable. Then it starts:a) start Arduino program
b) The IDE provides a variety of sample programs called "Sketches" here. One of them, "blink," we will bring to life.
Nomen Est Omen, the program lets the built-in LED light on pin 13 in seconds.
c) We open the sketch »Blink«
The sketch "Blink"
d) and select the type of connected board
e) Setting the ports
The name for the port depends on the USB controller chip of the board used, but always starts with »/dev/cu.usbserial-«.
f) now translate and play on the board
If you click on the button with the hook, the program is only translated. So you can determine if a syntax error is present, logical errors are not found so of course. :-(
Clicking on the button with the right arrow translates the program into a version that can run the microcontroller and transfers the program code to the chip of the board
In red font, the success message is down in the window.
g) After a short time, the LED should blink cheerfully.
h) A note about the boards compatible with the Arduino Nano:
There are boards that are provided with the "old bootloader", others have the new bootloader. The board »Nano V3.0 with Atmega328 CH340« from AZ-Delivery comes with the old bootloader. Therefore, in the Arduino IDE, another setting must be made, because the right bootloader must be selected extra:
If you want to play the new bootloader on the board, you will find a good instructions here:
For me, the capacitor of 10μF was needed between GND and RST so that the flash operation worked.
Next time we integrate the micro controllers from Espressif into the Arduino IDE.