Toit has everything you’ll need to build an IoT application, including firmware, cloud connectivity, a web-based console, and even a new programming language with Python-like syntax but considerably quicker execution speeds. But more importantly, Toit provides container-based development for the ESP32, allowing applications to be installed and updated independently from one another, as well as from the underlying firmware. This article highlights some of the key characteristics of this feature-rich platform that assist IoT developers in swiftly and easily developing their applications.
Innovative and Effective Multitasking on a $2 ESP32 MCU
Toit pushes a $2 ESP32 MCU to its boundaries in order to perform genuine multitasking. Toit allows you to deploy numerous applications on the same device in a much lighter and agile approach by dividing the firmware and apps code. As a result, you can freely and safely experiment with your code without risking bricking your device.
On the devices, your applications run in a separate environment from the system and from each other, making it possible to run numerous applications simultaneously. As a result, even if one of the applications goes down, the system will continue to function normally. The worst that can happen if a flaw gets into your code is that it crashes that one program. Working with Toit allows users to simply repair the bug and re-deploy the app over the air in seconds.
Connectivity Options in Toit
Connectivity works out of the box with Toit. You can directly connect to the built-in Wi-Fi of the ESP32. In addition, NB-IoT or LTE-M cellular modems are used by many users to connect to the cloud. In fact, there’s no need to connect the device to the PC via USB wire and wait for it to flash the code. After having installed Toit on a device, all communications between device and cloud happens over the air, whether your device is on your desk or located on the other side of the planet.
Unlike typical IoT systems, which combine all functionality into a single large piece of code, Toit configuration for connectivity is separated from application code. Intelligent scheduling of activities is made easy by Toit’s orchestration engine, which means that it is possible to schedule a configuration change or an update in just a few clicks, even for devices currently offline.
Toit applications are 40 to 100KB in size, and an update simply transmits patches to the previously installed version, so a Toit app update can be as minimal as 20KB. Being so, updates happen in seconds, and thus the chance of losing connectivity is quite low.
Even if the cellular connection is lost during the update, Toit will automatically resume the transfer once the connection is restored. Furthermore, the updates resume from the most recent data received, rather than from the beginning.
Toit applications focus solely on producing data and preserving it on the device, as Toit’s connectivity is separated from its application code. So, each time a device connects to the internet, the data is uploaded to the cloud. Hence, even on sluggish and unreliable internet connections, this makes a Toit device incredibly robust, accessible, and power-efficient.
Programming Made Easier with Toit
If you’ve ever attempted writing code for a microcontroller, you know how frustrating it can be. You program in C, and changing a single line of code takes minutes to re-deploy. The issue is that when it comes to microcontrollers, writing in low-level programming can be tedious. High-level languages, on the other hand, such as MicroPython, make it simple to write code but at the expense of execution speed.
Toit went above and beyond in creating a programming language exclusively for the Internet of Things. It is a modern object-oriented language, it provides you with a contemporary, memory-safe language. It integrates a cutting-edge editor with syntax highlighting, goto definitions, and auto completions. Within the Toit virtual machine, your code executes as one or more applications. Because your code runs in a sandboxed environment, the worst that can happen as a result of a defect is that your application crashes.
Through the GPIO pins on the ESP32, you can control any peripheral your plugin. The I2C, SPI, I2S, and UART protocols are all available for use. In addition, Toit’s package manager provides drivers for a variety of regularly used peripherals such as sensors and motors, and if you don’t have one, their engineering team is available to assist you in writing one.
Easy to use APIs and Secure Communication
You don’t have to feel obligated to use their console and they don’t want their command-line tools to make you feel restricted. “You are in full control of your devices and everything you can do with the Toit platform, you can do through our API. It is easy to integrate our platform into your products and turn your device fleet fully programmable”, says Toit. Toit’s gRPC-based APIs give users the liberty to achieve whatever they want with the platform.
IoT is all about data and Toit’s APIs are built to provide you complete programmatic control over your devices and to make ingesting acquired data into your own backend as simple as possible.
Using contemporary public-key encryption, all communication between the device and the cloud is encrypted end-to-end. Each device has its own cryptographically secure identification, allowing you to pinpoint the source of all collected data.
To Write And Deploy Applications, Use The Visual Studio Code Extension
Toit introduced a Visual Studio Code extension that does much more than merely highlighting the code with the introduction of a new programming language. In the built-in terminal, users may run code snippets, deploy programs, and monitor the output. The extension also displays a list of devices and apps that are currently operating in the sidebar. This Visual Studio Code extension speeds up development. We loved the fact that we could execute the software directly on the device, just as we would a computer program. There is no need to worry about picking a port, flashing, or any other issues that can arise while dealing with C++ programs. Overall, this VS code extension provides all of the fundamental functions of the web-based interface, as well as additional app deployment options.
Getting Started with Toit
To flash the firmware, first-time users will require an ESP32 board and a USB cable. Users can now start creating even without installing anything on their PCs, thanks to the support for flashing from the browser via Web serial. The provisioning of your device will just take a few minutes, and you’ll be up and running in no time. You can try out anything on the device once it has been provisioned, as long as it is connected to the internet as all the communications between the devices and cloud will happen over the air.
The console includes a built-in code editor that allows you to write, run, and monitor code on your device using timestamps. This is a terrific approach to try something new and enhance your software quickly. After your program is up and running, you can install it as a long-running application on your device. The app’s output, if any, will be logged and may be viewed in the console’s LOGS section. Toit’s excellent multitasking abilities convert an ESP32 into a whole computer. You can now easily commence your journey with Toit by referring to their quick-start guide.
For more information, kindly visit Toit’s official website.