Intro to IoT using ESP8266, MQTT & NodeRed

Prerequisites Note: Known-good versions of the prequisites are available is the git repository for this workshop. All Download the Paho MQTT client from http://www.eclipse.org/paho/clients/tool/ Download or clone a copy of the workshop repository to your home directory, from https://github.com/InfernoEmbedded/esp-workshop If you have a firewall enabled, allow traffic on port 1883 (MQTT) Install NodeJS 4 (not 3 or 5), saved in esp-workshop/windows_x64 - https://nodejs.org/en/download/package-manager/ Install NodeRed from http://nodered.org/docs/getting-started/installation.html Flash the board with NodeMCU firmware (only required is your board does not already have the NodeMCU firmware installed) Download and extract the latest ESP8266 NONOS SDK from https://espressif.com/en/support/download/sdks-demos Build the firmware using the Cloud build service https://nodemcu-build.com, Include: ADC bit DHT enduser_setup file GPIO HTTP MQTT net node 1Wire PWM timer UART WiFi Flash the firmware, this example uses the firmware included in the repository, but you may want your own (see above) instead: esptool.py –port /dev/ttyUSB0 write_flash -fm dio -fs 32m 0x00000 ~/esp-workshop/nodemcu-master-15-modules-2016-07-22-03-05-09-float.bin 0x7c000 ~/esp-workshop/sdk/ESP8266_NONOS_SDK/bin/esp_init_data_default.bin ...

September 28, 2016 · 14 min · Alastair D'Silva

Installing Eclipse

Eclipse Install Download and extract the latest version of Eclipse Classic for your platform from http://www.eclipse.org. Install a recent AVR Toolchain. Windows & OSX users should use Inferno Embedded AVR Tools, as should Linux users if their distro does not include GCC-4.8. Install Doxygen Running Eclipse for the first time Download and extract workspace.7z from the bottom of this page. This will give you an Eclipse workspace that is preconfigured with extensive syntax highlighting. Launch Eclipse, and select your new workspace Extract the eclipse-updatesites.7z archive from the bottom of this page We will now be installing the following Eclipse plugins: AnyEdit Tools - cleans up whitespace on save Eclox - provides Doxygen parsing MultiClipboard - provides support for multiple clipboard EGit - manage Git repositories within Eclipse Click on “Help”, “Install New Software” Click on “Available Software Sites”, “Import”, then select the eclipse-updatesites.xml you extracted earlier Exit and restart Eclipse Click on “Help”, “Install New Software” Select the “Anyedit” update site, “Eclipse-3.5-3.7 Plugins”, and install “AnyEditTools”. Restart when prompted Click on “Help”, “Install New Software” Select the “AVR Eclipse” update site, then “AVR Eclipse Plugin”. Restart when prompted Click on “Window”, “Preferences”, “AVR’, “Paths” and configure your AVR toolchain. If you are using Inferno Embedded AVR Tools, you should set up the following custom paths (examples are for a 64 bit Windows install): Click on “Help”, “Install New Software” Select the “Eclox” update site, then Eclox”. Restart when prompted Click on “Help”, “Install New Software” Select the “Multi Clipboard” update site, then Multi Clipboard. Restart when prompted Importing Flame In Eclipse, select File, Import, Git, Projects from Git, Clone URI, then enter as the uri: https://github.com/InfernoEmbedded/flame.git Select “master” as the repository to clone Eclipse will spend a while cloning the repository andindexing all the code, then you are ready to compile Select all the projects in Project Explorer (or just the projects you care about), right click and select “Build Configurations”, “Set Active”, “ATmega328P_20MHz” (for the MHVBoard), or whatever is suitable for your target platform Building Flame Right click on “flame” in “Project Explorer”, then select “Build Configurations”, “Set Active”, and choose the build configuration you need. MHVBoard R2/R7 users should choose ATmega328p-20MHz Right click on “mhvlib” and select “Build Project” The same procedure can be used to build any of the tutorial projects Uploading to the Microcontroller Build your project (see above) Right click on the project in “Project Explorer”, select “Properties”, “AVR”, “AVRDude” and select a programmer configuration from the Programmer tab (not the configuration selection on top, which allows you to have multiple configs, we use this to support different microcontrollers) You can create a new programmer configuration by selecting “New”, and filling out the details from the table below. The supplied workspace already has a few common programmers setups added If you are using an MHVBoard (or other bootloader that needs an explicit reset), reset your device Right click on the project in “Project Explorer”, select “AVR”, “Upload Project to Target Device” Name Programmer Speed Port MHVBoard R2/R7 usbasp blank blank Optiboot, Arduino Mini w/ ATmega328 stk500 115,200 Arduino Uno, Arduino Ethernet Arduino 115,200 <your serial port> Arduino Duemilanove w/ ATmega328, Arduino Nano w/ ATmega328, Arduino Mega, Arduino Fio, Lilypad Arduino w/ ATmega328, Arduino Pro/Pro Mini w/ ATmega328 Arduino 57,600 Arduino Duemilanove w/ ATmega168, Diecimila, Arduino Nano w/ ATmega168, Arduino Mini w/ ATmega168, Arduino BT, Lilypad Arduino w/ ATmega168, Arduino Pro/Pro Mini w/ ATmega168, Arduino NG Arduino 19,200 Arduino Mega 2560/ Mega ADK stk500v2 115,200 Updating Flame To fetch the latest version of Flame from the git repository, issue a “git pull” in the flame directory Useful Information Keyboard shortcuts can be configured in Windows, Preferences, General, Keys Syntax highlighting can be configured in Windows, Preferences, C/C++, Editor, Syntax Coloring Downloads workspace.7z (667.8 KB) eclipse-updatesites.7z (0.5 KB)

December 26, 2013 · 3 min · Alastair D'Silva