Beginner's Guide to Embedded Systems and Secure IoT Communication
Learn embedded system programming by using a free tool that includes several IoT projects focusing on security and establishing trusted communication.
Join the DZone community and get the full member experience.Join For Free
If you are new to embedded programming or if you are new to the complex world of setting up secure IoT devices requiring X.509 certificate and PKI management, then the SharkSSL IDE for ESP32 is a great starting point. With this IDE, even a "Noob" can be up and running with the first RTOS-powered IoT device in 30 minutes.
In addition to many C code examples, the SharkSSL IDE also includes a project that lets developers with no C code experience program the ESP32 using a high level programming language called Lua.
In a nutshell, the ESP32 provides a free development environment. Ready to run low-cost ESP32s can be purchased online.
Typically, embedded programming is notoriously known to be difficult to get started with since you need a deep understanding of hardware and device driver design, and require expensive equipment such as a JTAG probe and an IDE compatible with the JTAG probe. If this sounds all Greek to you, don't worry. You do not need to learn any of this when using the ESP32. With the ESP32, the compiled code (the firmware) is uploaded from your computer to the ESP32 by using a USB cable. The ESP32 uses the FreeRTOS Real Time Operating system and all examples included in the SharkSSL IDE use FreeRTOS.
The following video shows how the ESP32 can be used for controlling both a servo and LEDs. The SharkSSL ESP32 IDE includes several projects, and the following video shows how to use the included Barracuda App Server, which enables programming the ESP32 using Lua.
Why Use the SharkSSL ESP32 IDE?
Although the ESP32 command line development environment is free, it may be complex for a beginner to set up. Also, everything needs to be done via the command line, which takes time to learn. The SharkSSL ESP32 IDE provides a GUI front end to the command line environment and packages everything into one unit that is super easy to install.
Some examples, such as the AWS IoT Core MQTT example, require PKI configuration. The SharkSSL IDE simplifies this configuration by enabling a drag and drop configuration option, which automatically modifies the C code with your AWS certificates. After the drag and drop configuration, a simple button click compiles and uploads the AWS IoT Core MQTT firmware to the ESP32, which then immediately connects to your AWS IoT Core instance.
Why use the SharkSSL TLS Stack?
SharkSSL is a TLS stack for embedded systems that includes many IoT protocols such as MQTT and WebSockets. The TLS stack also includes many examples that show how to set up a complete Public Key Infrastructure (PKI). Many developers new to IoT initially struggle with security and PKI. The ready to run examples can be used "as is"; however, if you are new to PKI, check out the article A Gentle Introduction to Asymmetric Encryption and SSL Certificates.
Many hardcore embedded developers perform all of the software development directly on the device, but this setup typically requires an expensive development environment and a JTAG probe. Since all device drivers for the ESP32 come ready to use, a developer need only focus on the higher levels. The higher levels can easily be developed on your host computer such as on Windows using Visual Studio or on Linux using gcc. All IoT examples that come with SharkSSL can easily be compiled for your host operating system using your favorite host IDE. This development pattern not only makes your development easier, but also much faster. When you are done with testing and debugging the high-level code, simply integrate the code into one of the examples in the SharkSSL IDE, compile the code, and upload it to the ESP32.
You can download the SharkSSL Source Code from GitHub and compile the same examples for your host computer.
How to Choose a Suitable ESP32
You can use any ESP32, but we recommend using the ESP32 WROVER version which has more memory and lets you run the Barracuda App Server for ESP32 that in turn lets you use the Lua programming language -- not just C code. The C Code examples do not need the WROVER and can run on any ESP32.
Get Started With The SharkSSL ESP32 IDE
Published at DZone with permission of Wilfred Nilsen, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.