We are, to begin with going to see getting Started Internet of Thing(IoT) Using NodeMcu for your IoT project. There are many IoT modules accessible within the market and it is very simple to induce misplaced with all the choices available.
This module is the foremost popular one because it is truly little and as it cost $6. However, the number of open GPIO pins (input/output pins) is very constrained. It is also difficult to plug it into a standard breadboard. If you select this module, you won’t be able to do the projects using analog sensors, as the analog input isn’t available.
You’ll discover more data almost this module at https://nurdspace.nl/images/e/e0/ESP8 266_Specifications_English.pdf
The NodeMCU ESP8266 development board comes with the ESP-12E module containing ESP8266 chip having Tensilica Xtensa 32-bit LX106 RISC microprocessor. This microprocessor underpins RTOS and works at 80MHz to 160 MHz movable clock recurrence.
ESP8266 has 128 KB Ram and 4MB of Flash memory to store information and programs. Its tall preparing power with in-built Wi-Fi / Bluetooth and Profound Rest Working highlights make it perfect internet of Thing NodeMcu projects. NodeMCU can be fueled utilizing a Miniaturized scale USB jack and VIN Pin (Outside Supply Pin). It underpins UART, SPI, and I2C interface. The NodeMCU Development Board can be easily modified with Arduino IDE since it is easy to use.
NodeMCU ESP8266 Specifications & Features
Microcontroller: Tensilica 32-bit RISC CPU Xtensa LX106
Operating Voltage: 3.3V
Input Voltage: 7-12V
Digital I/O Pins (DIO): 16
Analog Input Pins (ADC): 1
Flash Memory: 4 MB
SRAM: 64 KB
Clock Speed: 80 MHz
USB-TTL based on CP2102 is included onboard, Enabling Plug n Play
Small Sized module to fit smartly inside your Internet of Thing NodeMcu projects
Nodemcu GPIO API:
This GPIO(General Reason Input/Output) permits us to get to pins of ESP8266, all the pins of ESP8266 gotten to utilizing the command GPIO, all the get to is based on the I/O index number on the NoddMCU dev units, not the inside GPIO pin, for the case, the pin ‘D7’ on the NodeMCU dev kit is mapped to the internal GPIO pin 13, in the event that you need to turn ‘High’ or ‘Low’ that particular pin you would like to call the pin number ‘7’ no the internal GPIO of the Pin. After you are programming with generic ESP8266 this confusion will arise which pin should be called amid programming, on the off chance that you’ reutilizing NodeMCU dev kit, it has come prepared for working with Lua translator which can easily program by looking the pin names related on the Lua board. If you’re utilizing non-specific ESP8266 gadgets or any other merchant sheets it would be ideal if you allude to the table underneath to know which IO list is related to the inside GPIO of ESP8266.
D0 or GPIO16 can be used only as a read and write pin, no other options like PWM/I2C are supported by this pin.
This command will initialize the GPIO mode and also used for setting the input/output direction of the pin
Syntax : gpio.mode(pin, mode)
Pin: select any of the available gpio pins
Mode: set the selected pin mode to input or output.
Example: gpio.mode(7, gpio.OUTPUT)
This command will read the Pin value, whether the Pin is in High state or Low state will be returned when utilizing this command.
This command will make the Pin to go High or Low, we utilize this command to set a Pin to go High or Low, in the event that you need to turn on and off a Driven this command can be utilized in such situations.
Syntax : adc.read(channel)
There is only one channel available with esp devices so always choose 0, may in future devices we can expect more ADC with ESP chips. This will return the sampled value in
Example : val = adc.read(0)
This function allows to open any file in the system for editing or creating a new file, this function access to all the existing files in the system if we want to create any new file using this function can only be done, for creating a new file, we need to open a file in write mode. All the file.open() function must be closed with the file. close function.
Filename, the file to be opened. There are different modes available to work on the files.
“r”: read mode (default mode in the file access)
“w”: write mode
“a”: append mode ( adding data to existing file)
“r+”: update mode. All previous data are preserved
“w+”: update mode, all previous data is erased
“a+”: append update mode, previous data is preserved, writing is only allowed at the end of the file.
pwm.setup() This function allows setting a pin to PWM mode, only 6 pins can be set to PWM mode at the most case.
Syntax: pwm.setup(pin, clock, duty)
Pins from 1 to 12 can be chosen for PWM
Clock frequency should be set between 1- 1000, PWM frequency.
Duty cycle should be between 0-1023, max is 1023(10bit)
Example: pwm.setup(1, 100, 512) this example set the ‘D1’ pin as pwm output and frequency is 100 hz and duty cycle is 512.
This function pause the output of the PWM waveform.
This function allows to set the duty cycle for a pin.
Syntax: pwm.setduty(pin, duty)
pwm.setup(2, 500, 512)
pwm.setup(3, 500, 512)
function led(r, g, b)
led(512, 0, 0) — set led to red
led(0, 0, 512) — set led to blue.
That book helped me create this tutorial
Visit to get more tutorials on IoT project
619 total views, 3 views today