How to setup and program ESP8266 in Arduino?

HOW TO SETUP AND PROGRAM ESP8266 MODULES IN ARDUINO (BEGINNER)

Hi. In this tutorial I will show you how to easily setup and program ESP8266 modules in Arduino environment. In this tutorial I will use NodeMCU V2 or V3 model.
I designed this tutorial in three parts. First we will install Arduino environment and latest ESP core. In the second part we will compile and program. And in the third part we will see how install a new library and see its examples.

SETUP
Well, let’s start. First we download Arduino software from arduino.cc. Find the program under the software section. Then you install it. When it is installed, let’s find the latest core for our ESP8266 modules. In browser enter “github.com/esp8266/Arduino/releases“. Find the latest version at the top and copy link of asset ending with .json. This is pre-release version. Instead you can get a latest stable release at the same link address, but just cut the “releases” text and scroll down and search for the json link to copy. I always use pre-releases and check for new ones every so often.
Now we open Arduino. Go to File, Preferences. In the “additional boards manager URL” paste the link we have just copied to clipboard. Click OK, Go to Tools, Board, Boards manager. Select updatable. Select ESP, click UPDATE. Wait a few moments and click Close. That’s it. You are prepared to program ESP8266 modules.

COMPILING
When you have the program on your hard drive, just find it. .INO files will have a little Arduino icon in front. Double click it. It will run Arduino environment.
If you have previously used other type of Arduino board, you will have to change the board. Go to Tools again, then select your board. In my case NodeMCU 1.0.
When you plug your board into USB port, it will appear under “Tools”, “Port”. Select it. When closing the Arduino program, it will remember your last setting.

There is a nice option to verify if your code compiles. Press CTRL+R or click TICK icon. To program press CTRL+U or RIGHT ARROW icon. You can see shortcuts under “Sketch menu”.

LIBRARIES
If you want to install a new library. You just have to go into “Sketch” menu, then “Include Library”. Here we see two options. One is “Add ZIP library”, where you can import your ZIP library packages you have downloaded from internet. The other option is “Manage libraries”. Let’s click it. Here are listed all your libraries. You do not have to check this manager from time to time, as Arduino checks for new versions by itself and asks you if you want an update. In our case we use ESP8266 core. This core uses ArduinoJson and some other libraries. If you update them, than you will maybe not be able to compile your ESP programs anymore. These library change structure and calls, so the core cannot use them anymore. Solution is to check the current version before the update. If new library does not work, just downgrade it back.
In the manager you can also search for new libraries to install. Let’s say we want to install a relay library. Under “all” just type “relay”. It will list all available libraries. Let’s select “First built – Relay”. Click install. Click close. Under the menu “File”, “Examples”, we can search and open enclosed examples and compile them.

That’s it. Simple as that. I have to inform you, when programming the NodeMCU, you just press “upload”, as the USB connection can pull GPIO0 low by asserting DTR and reset your board by asserting RTS. But if you use ESP-01 you will need to enable flashing yourself by pulling GPIO0 low or pressing a “flash” key, while powering up or resetting the module. Happy programming!
Don’t forget to hit LIKE for this video if you find it educational, COMMENT below if you have any thoughts and questions, SHARE video with your friends and consider SUBSCRIBING to my channel. Be sure to press the bell next to subscribe button to be informed when I publish new videos. See you next time!

ABOUT
How to setup and use ESP8266 in Arduino. ESP32 chips have a different setup. Organized in three parts: 1.Install Arduino environment + latest ESP core, 2.compile and program, 3.install a new library and see its examples. A beginner tutorial.

LINK to hx711 1kg load cell: http://s.click.aliexpress.com/e/JemeiQr
LINK to ESP8266 NodeMCU: http://s.click.aliexpress.com/e/ZnmmaQ7
LINK to ESP32 DOIT devkit: http://s.click.aliexpress.com/e/6yJQNj2

———————————————————————————————————————
Do you like my work?
1. Hit LIKE.
2. Hit SUBSCRIBE! Did you consider subscribing to my YouTube channel and being updated when new videos are published?
3. COMMENT below.
4. SHARE.
5. Support my work on Patreon: https://www.patreon.com/GreenEyedExplorer
6. You can also donate directly to me via: http://paypal.me/rokrodic
7. Buying through my affiliate links makes you no additional cost, but gives me a small headstart in getting new things for my explorations.

———————————————————————————————————————
LINKS:
GreenEyedExplorer homepage: http://www.rodic.si
GreenEyedExplorer Thingiverse: https://goo.gl/jdyHbF
GreenEyedExplorer GitHub: https://goo.gl/XtjB3h

Songs in the background: Topher Mohr and Alex Elena – Where I am From, Silent Partner – True Love, Vibe Tracks – Undeniable, YouTube Audio Library.

Leave a Reply