Thursday, March 17, 2016

Turning on LEDs on/off using NodeMCU


Code for turning LEDs ON/OFF using Node MCU.

I followed instructions found in this blog:

http://www.cnx-software.com/2015/10/29/getting-started-with-nodemcu-board-powered-by-esp8266-wisoc/





Troubleshooting Upload using luatool when you hit an TransportError


This blog is to show how to resolve an error during uploading code you have written for the NodeMCU device from the Mac and in my case Mac OS Yosemite 10.10.5

The error that showed up when I tried to upload from my laptop:


( Just so that you know : this is where I downloaded the luatool ).

http://www.cnx-software.com/2015/10/29/getting-started-with-nodemcu-board-powered-by-esp8266-wisoc/



The error shown in blog means there is another communication program (in my case it is Cool Term ) running on my laptop, which was used to send commands to the NodeMCU firmware.

So I did "disconnect" this to device on the CoolTerm, and was able to run the upload the lua script from my Mac to device successfully.



Getting IP address of NodeMCU with a simple script, and some validation tips.


First.
go to the Wifi Connections, - Uncheck the "Internet Sharing",
and click on Wifi Options.










Now, reset the device by clicking the 'RST" button.
http://www.cnx-software.com/2015/10/29/getting-started-with-nodemcu-board-powered-by-esp8266-wisoc/



The Router _ESSID is "Network Name" as found in the Configuration panel of the Mac Connections window.



The password would be set in this field.




End Result : 192.168.2.3 is the IP address.




Troubleshooting tips:
is the Network name and the Password set correctly in the code.

wifi.setmode(wifi.STATION)
wifi.sta.config("networkname","password")
print(wifi.sta.getip())

Next.. check that the Internet sharing is set ON.



Validation:
 ping    192.168.2.3



I found that if the Ping to this device does NOT work- then just click on the RST button on the device and it should get started.

Getting the IP address of nodeMCU - using CoolTerm and a simple script.

Here I am trying to view the access points  and also get the IP address assigned to the device using some basic Lua scripts.





https://smartarduino.gitbooks.io/development-of-nodemcu/content/subsection_42_wifi_mode.html


Viewing the Wifi Access Points around my NodeMCU.

The Node MCU has a wifi built into - so that it can connect to the Internet, and also communicate to other devices like a Laptop, Smartphone etc.

This below is my first attempt to connect the wifi module (Node MCU ) to the view the Access Points around it

Following is from this blog
https://smartarduino.gitbooks.io/development-of-nodemcu/content/subsection_34_wifi_test.html









Flashing the NodeMCU - first time. - Simple steps and challenges I faced.

Flashing the NodeMCU development kit.


Since I was not getting a good response after I connected the NodeMCU to my  Mac ( 10.10.5 ) Yosemite using CoolTerm. http://freeware.the-meiers.org/

https://github.com/nodemcu/nodemcu-devkit/wiki/Getting-Started-on-OSX


I decided to try flashing the NodeMCU to get it back to life.


Note  : when using the CoolTerm -I am assuming that the right driver is installed SL USB to UART. ( follow link below)

Important : You cannot change the Port  to USB to UART from any other if the CoolTerm is connected.

You have to first disconnect it and then go to Options and then select the right driver.






Flashing the NodeMCU : Command.



After flashing which took a minute( I could see a blue light blinking on the device )

I started CoolTerm and when I connected I saw the message that Cannot Open init.lua with some garbage characters as shown above.


So, I disconnected again ( by clicking on Disconnect ) button on CoolTerm, and hit the RST.
Connected back and I got some valid characters.

The parameters were


At this point - it is a blank firmware.

So - I had to read the init.lua by following instructions as listed here.
http://www.electrodragon.com/w/ESP8266_NodeMCU_Dev_Board





Tuesday, March 15, 2016

Resolving Port Missing on Arduino IDE when connecting Node MCU

This blog is to show how to resolve the missing Port when you plug in NodeMCU to the Arduino IDE.

I noticed that the Port( /dev/cu.SLAB)  was not there when I started the Arduino IDE and connected the NodeMCU.

Typically- you would expect to see a port for communication from Arduino IDE to the NodeMCU


But in my Mac 10.10.5 Yosemite -I had to follow the below steps to get this fixed.
Below are the details.



To solve this.

Installed the CP2102 driver, and follow instructions listed in this blog.

https://github.com/nodemcu/nodemcu-devkit-v1.0/issues/2



On my mac - I did not find this folder, so I installed the driver by double clicking on the left navigation panel listing the mounted package when I downloaded the






After this - I had to restart my Mac Laptop - and started Arduino IDE.
With this I was able to see the port on the ide. This resolves the communication issue from my Mac to the NodeMCU device.



Monday, March 14, 2016

Resolving ESP8266Wifi.h not found error when compiling Code for NodeMCU

This blog - shows how to resolve an error that is usually found at the beginning session of trying to compile ESP8266 code on the Arduino.

At this point -I'd imagine that you have connected one of the USB cable to the NodeMCU and other end to your laptop ( In my case a Mac OS)

If you tried to compile and Upload a sample code something like

#include <ESP8266WiFi.h>

constchar*ssid ="Name";
constchar*password ="Password";

;
//
WiFiServerserver(80);

voidsetup() {
 
Serial.begin(115200);
 
delay(10);
...

and got an error that the ESP8266WiFi.h - was not found , then follow instructions as shown in this link:

https://github.com/ekstrand/ESP8266wifi




In my case - I had to copy, and unzip master.zip it in Users/shashikiran/Documents/Arduino/librariesfolder
and then compile the code.
Without which I was getting the "ESP8266WiFi.h not found in this Arduino workbench window.



Fw: test email

T

Testing - 2nd time.