IoT Developer Prototyping Kit

The ESP32 is a cool little device, and the ESP32-WROVER can be purchased in bulk for as low as $3. As hardware becomes faster, more powerful, and cheaper, C/C++ is no longer the only choice for embedded systems programming. After following the initial setup instructions below, everything can be done in the web browser from editing Lua code to controlling the servo via WebSockets, and loading a trusted TLS certificate from Let’s Encrypt.

FreeRTOS and lwIP

The ESP32 and the free ESP-IDF development environment is a great starting point for anyone interested in running the Barracuda App Server on FreeRTOS. The development environment, which can be downloaded from GitHub, includes a ready to use FreeRTOS setup and the lwIP TCP/IP stack.

The following video gives a quick introduction on how to compile and use the included Barracuda App Server example. The servo control example, shown in the video below, is based on the design pattern explained in the article Modern Approach to Embedding a Web Server in a Device.



Prerequisite

All you need is an ESP32 with pSRAM such as ESP32-WROVER and the free ESP-IDF development environment. The following is a set of compressed installation instructions for this environment. Consult the official ESP IDF documentation if you feel you need more information.

We recommend using the Linux ESP-IDF version and if you are on Windows, just install the "Windows Subsystem for Linux". It's super easy to install and use. Just open the Windows 10 Store and search for Ubuntu. See this tutorial if you feel you need more information.

Open the Ubuntu shell after installation and make sure to enable copy and paste so you can copy the commands below and paste the commands into the shell using Ctrl-Shift-V.

The following set of commands work on standard Linux and the Windows Linux subsystem. Copy the commands below and paste the commands into the Ubuntu shell:

1: Update system:

sudo apt-get update

2: Upgrade system:

sudo apt-get -y upgrade

3: Install required tools:

sudo apt-get -y install git wget flex bison gperf python python-pip python-setuptools python-serial python-click python-cryptography python-future python-pyparsing python-pyelftools cmake ninja-build ccache libffi-dev libssl-dev

4: Install ESP-IDF:

We can install the ESP-IDF as soon as the above set of commands completes. Copy and paste the following commands:

cd mkdir esp cd esp git clone --recursive https://github.com/espressif/esp-idf.git cd esp-idf ./install.sh cd .. source esp-idf/export.sh

The last command above sets up the path to the ESP IDF tools such as the compiler. You must run this command each time you open a new Ubuntu (Bash) shell.

Download and Compile the Barracuda App Server Example

You should now be in the ~/esp directory if you followed the above commands and the environment should be ready for compiling the Barracuda App Server example.

Using git, clone the Barracuda App Server ESP32 Github repository as follows:

git clone https://github.com/RealTimeLogic/LspAppMgr-ESP32.git LspAppMgr cd LspAppMgr

Windows tip: If you are using Windows and not accustomed to the Windows Subsystem for Linux or prefer to edit files using standard Windows tool, you may instead clone LspAppMgr-ESP32 in, for example, c:\develop. You may run the following commands from the Windows Subsystem for Linux if you have the directory c:\develop :

pushd /mnt/c/develop git clone https://github.com/RealTimeLogic/LspAppMgr-ESP32.git LspAppMgr popd ln -s /mnt/c/develop/LspAppMgr LspAppMgr cd LspAppMgr

The next step is to configure the build and set your own Wi-Fi credentails. Enter the following command to start the configuration tool.

make menuconfig

Using the configuration tool, navigate to "Example Connection Configuration" and set your Wi-Fi credentials. Save the configuration data and exit the configuration tool.

You are now ready to build the example. Simply type the following to compile the example:

idf.py build

You may flash (upload) the code to the ESP32 as soon as you have compiled the code; however, you may first have to install Silicon lab's USB to UART drivers if you are using Windows. The drivers are needed when flashing the ESP32.

Attach the ESP32 to your computer using USB and upload the example as follows:

Linux:

idf.py flash monitor

Windows Linux sub system:

idf.py -p /dev/ttyS4 -b 115200 flash monitor

The above command is for COM4. See the Windows Device Manager for the port assigned to your ESP32. We had problems with the default baud rate, which is 460800. The above command sets the baud rate to 115200.

The example should start and connect to your Wi-Fi as soon as the code is uploaded. Consult the Github repository's README.md file for what to do next.