Is NodeMCU an Arduino

Setup of the Arduino IDE with the NodeMCU / ESP8266 board

In our workshops and coding evenings with the NodeMCU board and the Arduino IDE, we have recently gained a lot of experience, which I would like to summarize here in the blog post.

So far we have come across two different NodeMCU boards, which also have significantly different sizes. The larger board is delivered with a CH340 chip for the USB interface. The smaller board comes with a Silicon Labs CP210x chip. Depending on which board you have, you have to install the appropriate driver, of course.

The driver for the CP210x can easily be found on the Silicon Labs website. Since the manufacturer's website for the CH340 chip is unfortunately in Chinese, others have already written corresponding installation instructions that are only linked to here. If you install the correct driver, a new COM interface will appear in the device manager after connecting the board via USB cable. A corresponding device can then be found in the list under Mac OS and Linux.

Once this step has been completed, you can now download the Arudino IDE without any problems. The Arudino IDE is unfortunately not configured for the NodeMCU by default, so you have to install an additional board manager. This is done in three steps. First you have to enter an additional board administrator URL in the settings. For the NodeMCU it is as follows (please copy to the clipboard):

http://arduino.esp8266.com/stable/package_esp8266com_index.json

Then you also have to download the corresponding board. To do this, go to “Tools”> “Board…” and select the top position “Board administrator…” from the list. There you can enter “nodemcu” in the search field and a “esp8266 by ESP8266 Community” board should appear. Just click on “Install” and the board information will be downloaded.

The last step is to select the appropriate board in the selection list and set the appropriate port. Both are done again in the “Tools” menu, then select the “Board…” item and select the “NodeMCU 1.0…” entry. Then select the correct COM port again in the “Tools” menu under “Port ...”.

Then nothing should stand in the way of the first sketch, so that you can quickly open an example sketch under “File”> “Examples”, for example for the blinking of an LED, and click on the “Upload” button (arrow to the right) can upload the program to the NodeMCU. The small board already has an LED soldered to digital pin D0 “on-board” so that it can be used for flashing. With the larger board you have to put together a small LED circuit yourself.

Here are two more tips for configuring and using the Arduino IDE

1. Increase font size

So that everyone can follow the program code well on the monitor in teams of 2 or 3, it is worth increasing the font size in the settings. You should just experiment a bit here. For me, font size 16 is optimal. This means that the program code can still be read perfectly from a distance of 1m.

2. Maximum upload speed

When working with the NodeMCU, we noticed that the program code on the board is uploaded much slower compared to e.g. an Arduino Nano. I don't know whether the compiled code is larger or not, but after we experimented a little with the speed of the serial interface, the upload went much faster. It is also worth exploring the maximum here instead of having to endure an upload of 20-30 seconds each time.

3. Use preconfigured constants for the pins

If the board manager is installed, the names of the digital and analog pins of the NodeMCU are available as constants. That means you can use D0 for the first digital pin and A0 for the analog pin directly in the code. Since the pin designations in the many example codes use the direct value such as 13 or 10 and the assignment is different with the NodeMCU, it is worthwhile to briefly adapt the program code and use the constants.

Here is an example of the Arduino IDE in font size 16 and using D0 as a constant

To use the full potential of the NodeMCU, the board should be connected to a WiFi network. I explain how to do this in a separate blog post.

blog comments powered by Disqus