Search This Blog

Wednesday, September 16, 2015

nodeMCU Amica ESP-12E, Wi-Fi module overview!


 Amica ESP-12E

Wi-Fi Module – ESP-12E module similar to ESP-12 module but with 6 extra GPIOs.USB – micro USB port for power, programming and debuggingHeaders – 2x 2.54mm 15-pin header with access to GPIOs, SPI, UART, ADC, and power pinsMisc – Reset and Flash buttonsPower – 5V via micro USB portDimensions – 49 x 24.5 x 13mm


Starting up the module

  • Install the CP2102 USB-TTL driver
  • Open serial Terminal (ex: coolTerm on OSX) & use 9600 Baud Rate
  • Test with module and initiate communication! Try the following commands:
wifi.setmode(wifi.STATION)
wifi.sta.config("SSID","password")
wifi.swifi.sta.getip())
--192.168.18.110
  • You can also toggle or/and read GPIO status:
pin = 1
gpio.mode(pin,gpio.OUTPUT)
gpio.write(pin,gpio.HIGH)
gpio.mode(pin,gpio.INPUT)
print(gpio.read(pin))

Blink example:
pin = 1
gpio.mode(pin,gpio.OUTPUT)

while 1 do
gpio.write(pin,gpio.HIGH)
tmr.delay(1000000) -- 1 second
gpio.mode(pin,gpio.LOW)
tmr.delay(1000000) -- 1 second
end

To get the board automatically run a script right after boot is complete, you can edit init.lua as follows:
file.open("init.lua","wine(print("hello world"))
file.close()

Flash NodeMCU firmware

Download the firmware from Github, as well as nodemcu-flasher to flash the firmware to the node. 


Startup init.lua

  • After Flashing, the board does not have any LUA files inside, at bootup, the module will try to run init.lua by default.

Using Arduino IDE

- Install Arduino IDE 1.6.5
Install the ESP8266 Board Package by entering:  http://arduino.esp8266.com/stable/package_esp8266com_index.json
into Additional Board Manager URLs field in the Arduino v1.6.4+ preferences.



Use the Board manager to install the ESP8266 package.
After reboot, select your module from the Tools->Board 
- Write Arduino code :-)
---------------------------------------------------------------------------------------------------------------------------------