Skip to the content.

Installing Prerequisites and Setup

Lab Objectives

This lab will ensure you have all the resources and software needed to complete the lab installed. You should follow the instructions for your OS and complete all sections of the setup before moving forward with the Lab.

ESP8266 Development

To be able to complete the workshop you need install the required software to your laptop or workstation.

WiFi Connectivity

The ESP8266 can connect to a 2.4GHz network supporting 802.11 b/g/n. The ESP8266 will not work with 5GHz frequencies (802.11 ac).

As there is no ability to launch a browser on the ESP8266, so you cannot work with WiFi networks needing a browser to be able to enter credentials, which is a mechanism often used in public spaces, such as hotels.

The workshop does not support advanced authentication, such as using LDAP or certificates to authenticate to the network. You should have a network that uses an access token/password, such as WPA/WPA2 - this is what most home WiFi access points provide.

Many corporate networks are difficult to connect IoT devices to, as they can be tightly secured, often requiring certificates to be installed.

If a suitable network is not available then smart Phone hotspots can be used to provide connectivity. The workshop does not require large amounts of data for the ESP8266, so is suitable for using a phone hotspot.

There are no incoming ports needed for the workshop, but the ESP8266 needs to be able to connect via MQTT protocol over TCP to ports 1883 and 8883. The workshop also need web access over TCP ports 80 and 443. The final port that is needed is for Network Time Protocol (NTP), which uses an outbound UDP connection on port 123.

Purchasing the required Hardware

You need the following hardware to work through the workshop:

The workshop instructions uses the DHT11 temperature and humidity sensor. This can be replaced with the DHT22 sensor, which has the same pinout, but offers a more accurate sensor. DHT11 is accurate within 2C, whilst the DHT22 is accurate to within 0.5C.

Installing the Required Software

The following instructions have been tested against Linux (Ubuntu 18.04LTS and Fedora 27), MacOS (High Sierra) and Windows 10. If you are using a different OS then you may need to adapt the instructions to match your installed OS.

You may need admin access to your workstation to be able to install the software and drivers.

Step 1 - Install Drivers

If you are using the kit given to you in the B31TF laboratory, then the boards you will be using are branded LoLin and use the CH340 USB to serial chip.

You may need a driver for your OS to be able to communicate with the USB to serial CH340G chip used in the ESP8266 modules. Do not plugin the device until you have installed the driver on Windows and Mac. The drivers can be downloaded from :

macOS

Link: http://www.wch.cn/download/CH341SER_MAC_ZIP.html

This is the manufacturers web site, in Chinese, for the USB driver chip on the LoLin NodeNCU board. Use Google Chrome to translate, or just click the download link to access the macOS driver.

After installing go to ‘System Preferences -> Security and Privacy’ to allow the driver to be loaded.

Alternatively if you use homebrew you can install the driver using command:

bash
brew cask install homebrew/cask-drivers/wch-ch34x-usb-serial-driver

If you have your own ESP8266 module then it may not use the CH340G USB to serial chip. Another very popular chip is the CP2102, which is used in Amica branded boards. The drivers for this chip can be found here.

If you are a Mac user and use homebrew then the driver can be installed using command:

bash
brew cask install homebrew/cask-drivers/silicon-labs-vcp-driver

Windows / Linux

Link: https://github.com/nodemcu/nodemcu-devkit/tree/master/Drivers

Select the appropriate one for your OS, download it, unzip it and install it.


IMPORTANT

Linux should not need a driver installing, as it should already be installed.


If you have your own ESP8266 module then it may not use the CH340G USB to serial chip. Another very popular chip is the CP2102, which is used in Amica branded boards. The drivers for this chip can be found here.

All

When the driver is installed and the NodeMCU module is connected you can test if the driver is working:

Step 2 - Install the Arduino IDE

The workshop will use the Arduino IDE to create applications for the ESP8266 module. You need to have an up to date version of the Arduino IDE, available from here. Select the version for your OS then download and install it.

Linux

Your linux distro may have Arduino available in the software package manager catalog, if not you can manually install it:


IMPORTANT

You will need to change the version number in the command above if you downloaded a version newer than 1.8.7.


macOS

Simply drag Arduino app into Applications folder after unzipping.

Windows

Simply run the downloaded installer application.

Step 3 - Install the ESP8266 Plugin for Arduino IDE

Out of the box the Arduino IDE does not support ESP8266 development. You need to add a plugin to add support. Launch the Arduino IDE then open up the preferences panel for the Arduino IDE:

Paste in the URL for the ESP plugin to the Additional Board Managers URLs field: http://arduino.esp8266.com/stable/package_esp8266com_index.json

Select ‘OK’ to close the preferences dialog.

Select Tools -> Board: -> Board Manager… from the menu, then enter ESP in the search box. This should reveal an item esp8266 by ESP8266 community. Click inside the esp8266 box then press install to install the latest plugin. Once installed close the board manager.

Step 4 - Install the Filesystem Upload Tool for ESP8266

The ESP8266 has flash memory that can hold a filesystem. There is a plugin for Arduino that allows you to generate a populated filesystem and upload it to the ESP8266 board. The plugin can be downloaded from here. You need to create a tools directory within the sketch directory then extract the content there.

tools directory


IMPORTANT

You can find the sketch directory location from the preferences panel of the Arduino IDE.


The default location of the sketch directory is:

Step 5 - SSL utility to work with certificates

During the workshop you will be generating your own self-signed certificates, so need the OpenSSL tooling installed. Follow the instructions for your OS below:

Linux

OpenSSL is installed as part of the OS for most distros, so should have nothing to do here. If it is not installed then most distros have an OpenSSL package which can be installed using the distro package installer tool.

macOS

OpenSSL is installed as part of the OS, so nothing to do here.

Windows

There are 2 options for installing OpenSSL on Windows. You can install a binary distribution to run on Windows or you can enable the Windows Subsystem for Linux, which provides a Linux environment within Windows:


IMPORTANT

The first method will not provide the xxd binary, but you don’t need it for this workshop. If you get an error saying MSVCR120.dll is missing, then you can download the Visual Studio 2013 redistibutable package here.


Click to return to the Part 1 homepage.