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.


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 cd esp-idf ./ cd .. source esp-idf/

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 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 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: 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: flash monitor

Windows Linux sub system: -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 file for what to do next.

Why Lua and not Python?

Python may be the king of the desktop, but Lua rocks in embedded systems. Python's main focus is to be a generic and easy to use command line scripting language, while Lua is designed to be a C Library with its main focus on being easy to integrate into a larger program. Lua is found in many games such as World of Warcraft. Lua has traditionally been selected when speed and size matters. Developers generally find Lua to be much faster and less resource hungry than Python. A developer that knows Python will find it easy to learn Lua since both languages are similar.

Why Use Lua in Embedded Systems?

The C/C++ programming languages dominate embedded systems programming, but developers often run into issues such as buffer overflows, memory leaks, and other memory corruption errors. With Lua you avoid these problems, particularly in larger projects where many computer programmers with varying skills are involved.

Lua abstracts out the details for the underlying microcontroller hardware. Instead of worrying about the bits and the bytes, a developer simply accesses methods of a peripheral object to control the hardware. Hardware control is done via a so called Lua binding. The abstraction of the hardware layer allows developers to focus on the application specifics rather than on the workings of the low-lying hardware.

Learn Lua in 15 Minutes: