Your First NodeMCU/Lua Script Flash on ESP8266!!!

Let’s get our feet wet with NodeMCU/Lua and sees what happens !!- #arduSerie 20

J3
Jungletronics
3 min readOct 14, 2016

--

Investigating Options Available

I’m just experiencing the ESP8266 few options offered for my home automation project.
This firmware is much commented on the net, so I decided to test it at my own risk.

Here we’re Go!!!

Step 00 — Prepare The Software!!!

Download the NodeMCU-flasher from https://github.com/nodemcu/nodemcu-flasher/tree/master/Win64/Release
Extract and execute it!!!

Cool!!!

Now get the firmware from
https://github.com/nodemcu/nodemcu-firmware/releases.

Step 01 -Prepare The Hardware!!!

Let's go ahead!!!

The necessary hardware:

3 x 10kΩ Resistors
1 x 1 kΩ Resistor
1 x 330Ω Resistor
1 x 47 uF Electrolitic Capacitor
1 x 5 mm LED
1 x ESP8266 Board (ESP01)
1 x Arduino UNO
1 x Breadboard 400 holes or bigger
Some Wire Jump (please, notice the by-pass black wire)
A bit of pacience:)

Here is the schematic:

To flash a new firmware to ESP8266 you need to boot the ESP8266 in the upload mode and write new firmware, NodeMCU.

Let's started by just connect GPIO0 to GND for upload mode and start flashing.

All hardware configurations are the same as my previous video. Watch it if you have any questions !!

Step 02 — Flash To ESP8266!!!

A great working tool for hobbyist play with esp8266 is ESPlorer.
ESPlorer? Integrated Development Environment (IDE) for ESP8266 developers. The essential multi-platforms tools for any ESP8266 developer from Lua tool author’s, including an LUA for NodeMCU and MicroPython. Also, AT commands are supported. Required JAVA (SE version 7 and above) installed.

Step 03 — Run It!!!

ESPlorer lets you run scripts, upload files, run snippets and do a bunch of other useful things with your ESP8266.

Run the application and copy this code.
We will turn on/off the light of the LED on the breadboard!

Here is the code:

lighton=0
pin=4
gpio.mode(pin,gpio.OUTPUT) -- Assign GPIO to Output
tmr.alarm(1,500,1,function()
if lighton==0 then
lighton=1
gpio.write(pin,gpio.HIGH) -- Assign GPIO On
else
lighton=0
gpio.write(pin,gpio.LOW) -- Assign GPIO off
end
end)

Simple right? just to become familiar with NodeMCU and Lua.

Click on the ‘Send To ESP’ button on Hurray!!! Led flashing!!!

Here is the video:

BTW, What is Lua?

Lua is a powerful, efficient, lightweight, embeddable scripting language.
It supports procedural programming, object-oriented programming,
functional programming, data-driven programming, and data description.

Where does Lua come from?

Lua is designed, implemented, and maintained by a team at PUC-Rio,
the Pontifical Catholic University of Rio de Janeiro in Brazil.

Lua is powerful (but simple)!!!

Lua is small!!!

Lua is free!!!

There you go!!!

Till the next episode of #arduSerie!!!

Bye o/

Credits & References:

The book Programming in Lua The first edition is freely available online

A Look at the Design of Lua by vimeo.com

A Look at the Design of Lua by cacm.acm.org

Lua is featured in the latest issue of Communications of ACM magazine by PUC-RIO

NodeMCU: Connect Things EASY by nodemcu.com

Lua by lua.org

ESPlorer by esp.ru

NodeMCU by Github

14core: Running Lua by 14core

Espressif by espressif.com

4 reasons I abandoned NodeMCU/Lua for ESP8266

Download All Project Archives

Related Posts

Arduino Headless Setup & ESP8266 (WIFI cheap chip!) — Rather Stunning MCU!!! — #arduSerie 16

Flashing The Official ESPRESSIF Firmware in ESP8266 !!! — Easy ESP8266 Flashing!!! — #arduSerie 17

Get Started Using AT Commands w/ ESP8266 — Multiple Connection as TCP Server — #arduSerie 19

Your First NodeMCU/Lua Script Flash on ESP8266!!! — Let’s get our feet wet with NodeMCU/Lua and sees what happens !!- #arduSerie 20

  • Edited @ jan2019 — Grammar corrections w/ Grammarly — Send me a comment, please:)
  • Edited @ Dez2020 — BOM and some text corrections, reference added :)

--

--

J3
Jungletronics

Hi, Guys o/ I am J3! I am just a hobby-dev, playing around with Python, Django, Ruby, Rails, Lego, Arduino, Raspy, PIC, AI… Welcome! Join us!