Platform vendors using the ESP32 microcontroller in their projects have two firmware development tools available: ESPHome and the 2Smart Cloud Software Development Kit (SDK). We will talk about the pros and cons of these tools and demonstrate with a simple example how to work with each of them.
Simplicity – is a key advantage of the ESPHome suite of libraries and tools. To develop firmware on this basis, you don’t even need to know the principles of programming. The main drawback is the limited functionality of the firmware.
It is developed by the 2Smart Cloud SDK team and supports all useful mechanisms and full device integration with the platform. The functionality of the firmware created on this basis is much wider than in the case of ESPHome. In addition, SDK development is a priority for the team, so all new platform functions will, first of all, appear in this database. This means that vendors who have chosen the firmware version on the SDK will be able to quickly use the innovations of 2Smart Cloud in their products.
Vendors can use the SDK-based code samples posted on the 2Smart Cloud GitHub as templates for the firmware of their devices, changing and modifying the code in any way.
The basic principle of creating firmware using the SDK is that the code has already been written to integrate the device with the platform, it is enough for a vendor to describe the logic of their product.
The comparative table below shows what functionality is available when using each of the options:
Which of the options for the firmware base for the ESP32 microcontroller to choose depends on the vendor’s needs and its resources. In many cases, the best option is a combination of the two – due to its simplicity, ESPHome is perfect for quick connection and initial testing of a device concept, and SDK-based firmware can be written for subsequent iterations of the prototype and the final version of the product.
Below it will be shown how to develop the firmware in each of the two ways. As an example, a simple device will be used – an LED (blinker) connected to the ESP32, which can be controlled from a mobile application and using additional methods available in 2Smart Cloud.
There are two ways to create a new product in 2Smart Cloud – with or without a step-by-step assistant. Read more about the differences between the two methods on the platform’s blog. In this example, we will use the option without a step-by-step wizard. The wizard-based alternative method is basically no different.
As a result, we received a workable IoT device that can be linked to the 2Smart Cloud mobile application and controlled from a smartphone. However, due to the limitations of ESPHome, the vendor and users will meet the following difficulties:
The 2Smart Cloud Developer Kit solves these problems, which is why most vendors recommend using it when building the firmware of the finished product, even if the prototype has been tested with ESPHome-based firmware.
This is how the development of the firmware for the same device – blinker – looks like on SDK base:
In fact, having written the code, you can move on to creating a new product on the platform. Don’t close the source editor – the firmware still needs some work.
Each of the reviewed ESP32 firmware development tools – ESPHome and SDK – have their pros and cons. The best option when prototyping is often to take advantage of both bases. ESPHome allows you to quickly validate a device’s concept, while SDK-based firmware provides the most flexible options for fine-tuning its functionality and simplifies the maintenance process.
We are planning to develop both tools on 2Smart Cloud. ESPHome will add features that are missing today, and the SDK will receive new basic abstractions to quickly solve common problems.