So this time I thought it would be cool to introduce you to the trendy NodeMCU development board which is basically based on the ESP8266, and how to start playing with it using the Arduino IDE. With built in WiFi and more capabilities, it is indeed the perfect fit for your IoT solution at a low budget.
The NodeMCU is an open-source firmware and development kit that helps you to prototype your IOT product within a few Lua script lines.
The name NodeMCU refers to two separate components:
- The NodeMCU firmware which provides a Lua development and execution environment which can run on any ESP8266 module with a minimum of 512Kb Flash Memory.
- The NodeMCU Inc manufactured development kits. These are low-cost breadboard-friendly modules aimed at providing a simple to configure and set up, hardware platform for developing ESP8266-based Lua IoT applications.
How to setup your Arduino IDE for NodeMCU programming?
To setup your Arduino IDE, go to File → Preferences and enter the following URL under 'Additional Boards Manager URLs':
http://arduino.esp8266.com/stable/package_esp8266com_index.json
Then go to Tools → Board → Board Manager and somewhere in the list you will find ESP8266 by ESP8266 Community. Install it. Once you are done installing, you are ready to start programming.
Your First Program (BLINK)
What you need:
- Arduino IDE
- NodeMCU Development Board
- LED
Connections: Connect the positive end of the LED to node D7 on the NodeMCU boards and the negative end to the Ground node. Note that D7 is mapped to Pin 13 on the arduino.
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}