Traditional IoT firmware is compiled, linked, and deployed on a microcontroller and has been the same for decades. Here, even if the program has a single bug, the system’s chances of a complete collapse are pretty high. This ruins the entire functionality of your device, rendering your device useless. The Toit platform completely restructures the IoT development process and aims to fix the above problem. This new platform serves as an end-to-end IoT software platform and also as a new programming language. “We turn firmware development into software development, enabling every software developer to become a successful IoT software developer.” is what the Toit team says.
Toit was founded in 2018 by a team of developers that built the V8 for Chrome at Google. They launched Toitware, the general-purpose firmware for IoT devices that replace the traditional development process. Toit platform is targeted to be used in the very popular ESP-32 MCUs, due to their IoT capabilities. The $2 MCU is pushed to its limit to perform true multitasking, which is nearly impossible with traditional MCU programming. “Toit provides powerful API endpoints such that your data can flow from your devices into your own IoT cloud system.” says the Toit team.
What’s so different in the Toit platform?
One of the most exceptional feature of the Toit IoT platform is its multitasking capabilities. By splitting the firmware and software sections, Toit allows you to deploy multiple applications on the same device. Here, even if one of the applications crashes the others would still continue running as if nothing happened. This allows you to easily update the buggy application without affecting the flow of other applications and you’re good to go. While running multiple applications that too on the same device, the chances of a security breach might pose a problem. Toit takes care of this by providing a robust and safe environment where each application gets its own isolated memory areas.
If you’re familiar with the current process of implementing IoT solutions, then you know the trouble one has to take just for running a simple application. You need to compile the code, ensure that you don’t make syntax errors in the low-level programs, and then flash via USB connectors. One might say that you could use a high-level language like MicroPython but it comes with significantly slower execution speeds. Toit took the best of both these worlds and created a new programming language for IoT: Toit. It is an object-oriented language with a simple and easy-to-use syntax similar to Python. Toit offers the perks of high-level languages while being 20 times faster than MicroPython.
A look into the features of Toit programming language
Unlike other programming languages used for embedded systems, Toit is a language that was developed solely for IoT. So, it is a dedicated language for IoT that allows for better power management which is important for battery-based systems. Toit features an automatic memory management system which helps to avoid crashes. The new language also comes with a garbage collector, aiding the memory management system. Features like these are not available in traditional programming languages and might be a challenge implementing those using languages like C.
“With Toit, we wanted to create a high-level language that would avoid the limitations of the existing languages used in IoT development. On top of this, the Toit language had to be intuitive to learn and safe to use.” says the Toit team. The syntax of Toit is modern, simple and quite similar to Python. So, a Python developer can easily learn this new language within a few hours and deploy their first application within 15 minutes. Toit is an indentation based language just like Python and has no braces or semicolons. The files are saved with ‘.toit’ extensions and have a VS code language extension for a richer developing experience. So once you start developing with the Toit platform, there’s no coming back.
Manage your IoT applications with the Toit console
Toit also provides a web-based console which makes it easier to manage devices and applications. The Toit console is user-friendly and features a simple and straightforward GUI. You can monitor the health of your device, check the device storage used and look into the log history. The console also serves as a good platform for starting up with the Toit platform. Each device has its own Code tab where you can develop your program and run it on your device right away. By default, the code snippet will run for a maximum of two minutes only. So, if you need to run it for a very long time, you will have to deploy it as an application.
For communicating between multiple devices, Toit provides a convenient publishing/subscribe or PubSub pattern which is exactly like MQTT protocol. They define the topics using two conventions: device and cloud. Inter-device topics communicate with the ‘device:’ prefix. Similarly, external devices communicate with ‘cloud:’ as prefix. They also provide APIs with examples so you can access the data even though a machine is running Python, Java or Golang. Other than that, the console allows you to serially monitor the device by connecting it through a USB port. The web-serial feature is currently in the beta phase and supports only Chrome and Windows edge browsers. Additionally, the console displays a number of metrics like PubSub and data logging rates in the form of graphs.
Concluding remarks on the Toit platform
The famous proverb, “Necessity is the mother of invention” describes Toit in the best way. The world of IoT needed a change to make it easier to write IoT software and to fulfil the promise of building smart devices through IoT. Toit platform’s vision is to bring standardization across IoT development process and might become a game-changer very soon. As of now, this young platform is missing a few things which include lack of support for Bluetooth/BLE and Wi-Fi for user programs. They have libraries for a few of the sensors like the bme280 temperature sensor and icm20948 IMU sensor. If your preferred sensor is not on the list, then Toit encourages you to write your own driver for it. So, you won’t get that huge community support right now, instead, you can connect with the developers directly on the Toit’s Slack workspace.
Finally, talking about the pricing, Toit does not have a subscription or provisioning fee. They provide a 100MB per month free data transfer through their platform and after that, you need to pay $0.10 per MB. You can learn more about the Toit platform on its website.
Toit’s official website is the source of all the information and images.