Introduction: NodeMCU [Episode 1] Say Hello World But Never Goodbye !!!

About: CEO Bhaiyh Sistemas E-mail: ivan@bhaiyh.com.br Linkedin: https://www.linkedin.com/in/ivanrobertosilva/

Very important! Before you start, realize that something can and will go wrong in your experiments.

I don't want to be pessimistic, but once you know this from the outset, it helps to deal with frustration and avoid an early withdrawal. I'm sure we'll be able to build our example successfully. Believe it! Are you ready to start? Very well! Follow the steps below, where I will present not only the activities and instructions, but points of attention and problems that may happen as well.

Step 1: Forget the Idea That You'll Just Copy the Sample Code and Magically Everything Will Work.

I said it already at the top, but it's always good to reinforce it, just because your mind might want to give up when you feel things are complicated.

Step 2: Do I Need to Know Everything About Electronics, IoT, Robotics, Programming Among Other Specialties to Carry Out My First Project?

Of course not! Just learn / discover a little about each specialty and as the needs arise, you can add them to your journey of study.

Step 3: Let's Get Our Hands Dirty!!! These Are the Requirements:

Hardware Required:

  • 01 - NodeMCU V3 - ESP8266 - CP2102 - Approximate cost ($ 15.00)
  • 01 - Protoboard 400 Points (* Optional) - Approximate cost ($ 5.00)
  • 01 - Diffuse LED 5mm (* Preferential color) - Approximate cost ($ 0.10)
  • 01 - USB cable - Approximate cost ($ 4.00)

Approximate total cost (Components + Shipping & Handling) = $ 30.00

Step 4: Electrical Scheme

This example's electrical scheme is very simple, you may skip the protoboard, but I recommend its use, because after this first project, you will want to do many more, and it is more practical just connect the jumper or components, test, change your mind and everything without the need to weld.

The NodeMCU component can be connected to the protoboard in several ways without changing its behavior. In my example I connected in the last lines because it facilitates the handling of the usb cable in relation to the board.

Let's connect our LED on the D7 (GPIO13) of the NodeMCU, one pole on the D7 and another on the GND.

Attention! Sometimes the LED may not work. If everything is in accordance with the guidelines but the LED does not turn on, try to replace it and try again.

Note: In my first test, I bought 40 LEDs and the first one I used was "burnt". That's right! But before I tried to change the LED I ended up redoing everything a few times.

Step 5: Software Required

Arduino IDE

* There are other IDE's and ways to program and write to NodeMCU.

After installing Arduino, access the menu option (File> Preferences)

In the "Additional URLs of License Plate Managers:" field, please complete with "http://arduino.esp8266.com/stable/package_esp8266com_index.json"

Now in the Arduino IDE menu click (Tools> Card> Card Manager)

Find the "esp8266 by ESP8266 Community" card and click [Install]

Look in the cards' options (Tools> Board>) to "NodeMCU 1.0 (ESP-12E Module)".

Attention! After installing the card it may take a few minutes for the option to be displayed.

Step 6: It's Time to Connect Your ESP8266 Module to Your Computer

Perform the USB drive installation


Attention! There may be some incompatibility with your operating system, check the success of the drive installation.

Step 7: Let's Schedule!

Check the Arduino IDE if the port used is correct (Tools> Port>).

Write the source code as below:

void setup() {

Serial.println("Hello World!");

pinMode(13, OUTPUT); // Initializing the GPIO 13 for the D7 (LED)

}

void loop() {

digitalWrite(13, HIGH); // Turn on LED

delay(5000); // Wait 5 seconds turn on

digitalWrite(13, LOW); // Turn off LED

delay(2000); // Wait 2 seconds turn off

}


Attention! The message "Hello World!" might not be displayed on the Arduino IDE monitor due to processing delay.

Recommended 2 lines of code below at startup:

void setup() {

Serial.begin(115200); // Starts at the same frequency

delay(100); // Wait a while in the execution

Serial.println("Hello World!");

pinMode(13, OUTPUT); // Initializing the GPIO 13 for the D7 (LED)

}

To follow the execution, open the monitor / console through the menu (Sketch> Monitor)
Now you need to "Load" the source code into NodeMCU memory so that it executes by clicking the [Load] button.

Attention! This may take a few seconds / minutes, check the NodeMCU LED flashing while recording is in progress.

Step 8: Check and Evaluate !!!

Make sure your LED light is on for 5 seconds and off for 2 seconds.

It is essential that you do not be disappointed when conducting your first experiments, it is very normal in the technology world that something "unexpected" happens, so research, fix it and move on.

See you all next time !!!