Coding Chase - Projects
Sunday, 12 July 2015
IoT Projects - ESP8266
The ESP8266-01 Wifi Module is a really cheap component which is programmable and includes two GPIO pins (although it seems you can use the TX/RX pins as GPIO as well and even expand available GPIOs by soldering a few extra pins to the chip legs).
There is quite a community around this module, there are several variants of it - and so far I've been quite impressed by the wifi range on this, as well as the size and features.
First off, there's the official espressif SDK and github resources:
http://espressif.com/new-sdk-release/
https://github.com/esp8266
https://github.com/esp8266/at-command-set
... and then there's NodeMCU:
http://nodemcu.com/index_en.html
https://github.com/nodemcu/nodemcu-firmware
http://www.nodemcu.com/docs/
NodeMCU relies on a Lua interpreter for the applicational part, which makes it easier to code but on the other hand, may require more tweaking with regards to memory usage.
There are however some valuable tricks going with NodeMCU, which was the method I ended up going with on my experiments:
1) lua scripts can be compiled to bytecode files .lua > .lc
2) the NodeMCU firmware build can be customized to include only the modules you'll be needing:
http://frightanic.com/nodemcu-custom-build/
For my solution, I ended up choosing the dev-0.96 github branch and only 7 modules:
node / file / GPIO / WiFi / timer / UART / MQTT
Using the float version rather than integer also seemed to do more for me in terms of system stability.
As for the lua scripts inside the unit, I've managed to secure a couple of interesting features already:
1) MQTT broker reconnect after either wifi or broker outage/recovery
2) ESP settings for wifi and MQTT to be updated over the air (by sending config update messages over MQTT to the wifi module, updating its configuration and rebooting it)
It's equally possible to change timer durations or GPIO operation parameters over MQTT if required - and of course, receive data from the wifi module regarding its status!
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment