Embedded Web Server Tutorials

The Ultimate Guide to Embedded Web Server Technology

A collection of Embedded Web Server tutorials that covers everything from tiny event driven microcontroller solutions to larger embedded systems including VxWorks, QNX, and Embedded Linux systems.

Embedded Web Server

Do NOT Use an Embedded Web Server

Before embedding a web server in your product, think about what you are trying to achieve. Embedding a web server may not be the best solution when using a small microcontroller. To understand why, see the following whitepaper:

When Not to Use an Embedded Web Server in a Device

Embedding a Web Server in a Microcontroller

If you are planning on using a small microcontroller such as a Cortex M3 or similar with limited internal memory and no option for using external memory, consider following the design pattern in the tutorial Embedding a Web Server in a Microcontroller.

Another great option for existing microcontroller solutions is to offload all IoT/web/networking to an ESP32 running the Barracuda App Server. The two processors can easily communicate using for example SPI or UART. An ESP32 is super low cost and can easily be added to existing solutions. The ESP32 supports both wired and wireless Internet communication. Download Barracuda App Server for ESP32 and get started today.

Device Management via IoT/Cloud or Embedded Web Server?

IoT and Embedded Web Server technologies both have their plusses and minuses. Reaping the benefits of both solutions and eliminating the negatives is possible. The article Device Management via IoT or Embedded Web Server explains how this is possible.

Embedded Web Server vs. Embedded Application Server

If you have ever Googled "embedded web server" or "embedded web server tutorials", you have likely come across many tutorials on how to create a lightweight web server on, for example, Linux to serve static HTML files. Being able to serve static web pages is one of the most fundamental parts of any embedded web server; however, for device management to be practical, we need to look beyond just serving static web pages. In particular, embedded web servers generally must be able to let the web functionality affect the device operation -- the remote browser has to be able to "talk" to the embedded system.

An embeddable application server is a more formalized way of saying an embedded web server that lets you easily build HTML based interactive device management applications. To get a better understanding of the differences between an embedded web server and an embedded application server, see the What is an Embedded Application Server, a primer for embedded developers tutorial for details.

Develop the server side web application using C, C++, or by using a high level language?

Embedded WebSockets Server

For an embedded developer, the first thing that may be considered is that the server side part of the embedded web application must be designed in C code. Although this is very common, it may not be the best solution for many embedded systems. Web applications are very text heavy, and it is time consuming and error prone to develop server side web applications in C code. A better solution may be to use an application server that supports a fast and compact scripting language suitable for embedded systems. For efficient scripting in an embedded environment, there’s a scripting language called Lua and it is especially designed to operate on small (embedded) platforms. It is specifically defined as an extensible language and is implemented as a C library that gets compiled and linked with your application/firmware. For more information, check out the Using Lua for Web Application Development article.

Embedded programming using Lua and C code

Embedded programming for non C coders

Do you have any team members that are not hard core C/C++ developer? If so, check out the Barracuda App Server article Embedded programming using Lua and C code. You can download and run the same tutorials on your own FreeRTOS/lwIP powered ESP32.

New to Lua?

Get a quick introduction to Lua by following our Online Interactive Lua Tutorials

The Future: Single Page Application (SPA)

Traditional web applications have been processed exclusively on the server side. With the uprising of JavaScript on the client side and many of the new client side JavaScript frameworks, many choose to push some or all of the Human Machine Interface (HMI) processing to the client side -- i.e. to the browser. Check out the following tutorial if you are interested in learning more about SPA design techniques for device management.

Modern Approach to Embedded Web Server Design

Using Modern Web Frameworks such as AngularJS, ReactJS, and Vue.js

Look no further if you are you planning on using the latest in web development. The following article explains this in detail:

Using ReactJS, Angular, and Vue.js with any web server

What about CGI?

You may be looking for a CGI enabled server if you are old school. In addition to being passé, CGI has several drawbacks such as several security issues, being slow, and time consuming development in embedded devices. Older websites were originally implemented using the Common Gateway Interface (CGI). In truth, CGI is only an interface. It is generally cumbersome to manage and requires a full-up OS like Linux that can load external programs, meaning that deep embedded monolithic systems cannot use CGI. Basic embedded web servers typically specify only function hooks; you must write the functions. With CGI on standard web servers, Perl scripting is very common, but most embedded environments do not support Perl, meaning you have to revert to C to get things done. All of this makes CGI an unattractive option. See the following whitepaper for more information on why we do not recommend CGI for new design.

Barracuda App Server vs CGI, including CGI security issues

The elephant in the room for embedded web server security

Hacking your embedded web server

With easy to use hacking tools available on Github, anyone can hack your embedded web server enabled product. Follow along the hack any embedded web server tutorial to learn how shockingly easy it is to hack your devices.

Barracuda App Server and Mako Server Tutorials

The following is a list of hands-on tutorials for the Mako Server, which is a Barracuda Application Server (BAS) derivative product designed for high level operating systems. Mako Server and BAS provide the same programmer API, thus the following Mako Server tutorials also apply to the Barracuda App Server. Clicking any of the links below takes you to the Mako Server web site.

Kickstart your embedded device management design with a ready to use dashboard template, including ready to use authentication, menu generation, and REST/AJAX and WebSockets examples:

Server Generated Dashboard App

IoT Tutorials and Web of Things

IoT and embedded web technologies are merging. Learn how to take advantage of both by using a common code base. Our IoT Tutorials explain this in detail.

Posted in Whitepapers