We are proud to partner with Toit, a cloud-managed container platform for IoT devices. We look forward to delivering an opportunity to develop robust end-to-end solutions to our customers and community.

With the Toit, it is now possible to continuously update the code on ESP32 microcontrollers remotely, and securely publish data to Qubitro with the most effortless setup ever offered.

Both companies are focused on improving the developer experience by removing the technical challenges, and we are very excited to bring a complete experience to our customers and community with Toit.
- Beray Bentesen, CEO
The combination of Qubitro and Toit just might be the easiest and most productive way to generate data from your ESP32-based devices, ship it securely to the cloud, and learn from it through Qubitro's convenient analytics and APIs.
- Kasper Verdich Lund, Co-founder & CEO

The Toit language and VM containers are deployed to are a great choice for those using the ESP32, and would like to use a productive high-level language unlike C or C++, but require more performance than MicroPython.

See it in action

Toit offers both their remote management cloud platform and open-source local tool Jaguar. Both can be used to quickly and easily upload the below Toit examples with the ability to flash the Toit firmware over USB. Our first example is a minimal sketch showing how little code is required to connect to Qubitro and then publish a single message for ingestion.

Upon installation of the Toit tools and registration with the Toit cloud platform, it is possible to update devices remotely and have them run permanently using a YAML application definition file.

The official Toit documentation has details on setting tooling up, configuring an application, deploying an application, and how to use the Toit language. You can even give Toit a try without downloading anything by using their browser-based upload tool and code editor.

💯
Toit hosts a package manager with the Qubitro package, which reduces the amount of code required to submit data directly to Qubitro. Other packages for sensors and connectivity are available on libs.toit.io
import qubitro

main:
  client ::= qubitro.connect
      --id="PASTE_DEVICE_ID"
      --token="PASTE_DEVICE_TOKEN"
  client.publish { "Temperature": random 1000 }
  print "Data published to Qubitro!"
qubitro_publish.toit

The following example takes measurements from a BME680 WisBlock sensor found in the starter pack, used to post to Qubitro once every ten seconds. Our hardware partner RAKwireless has an ESP32 core module which allows for a turnkey modular hardware solution. In combination with Qubitro and Toit, you can go from nothing to a complete custom solution in less than 10-20 minutes.

import qubitro
import bme680
import i2c
import gpio

main:
    led_pin := gpio.Pin 12 --output
    led_pin.set 1
    bus := i2c.Bus
        --sda=gpio.Pin 4
        --scl=gpio.Pin 5
    sdevice := bus.device bme680.I2C_ADDRESS
    sensor := bme680.Driver sdevice
    
    client ::= qubitro.connect
        --id="DEVICE_ID"
        --token="DEVICE_TOKEN"

    led_pin.set 0

    while true:
        led_pin.set 1
        client.publish{"temp": "$(%.1f sensor.read_temperature)", "hum": "$(%.1f sensor.read_humidity)", "pressure": "$(%.1f sensor.read_pressure / 100)", "gas":"$(%.3f sensor.read_gas / 1000)"}
        print "Published message to Qubitro!"
        led_pin.set 0
        sleep --ms=10000
    
    led_pin.close
qubitro_bme680.toit

For a more low-power example, the following snippet posts once every 10 minutes and put the ESP32 into a deep sleep. To run regularly, make sure to include the proper application configuration file!

import qubitro
import bme680
import i2c
import gpio
import esp32

main:
    led_pin := gpio.Pin 12 --output
    led_pin.set 1
    bus := i2c.Bus
        --sda=gpio.Pin 4
        --scl=gpio.Pin 5
    sdevice := bus.device bme680.I2C_ADDRESS
    sensor := bme680.Driver sdevice
    
    client ::= qubitro.connect
        --id="DEVICE_ID"
        --token="DEVICE_TOKEN"

    led_pin.set 0

    led_pin.set 1
    client.publish{"temp": "$(%.1f sensor.read_temperature)", "hum": "$(%.1f sensor.read_humidity)", "pressure": "$(%.1f sensor.read_pressure / 100)", "gas":"$(%.3f sensor.read_gas / 1000)"}
    print "Published message to Qubitro!"
    led_pin.set 0
    led_pin.close

	esp32.deep_sleep (Duration --s=600)

As soon as the device starts publishing data, it will become visible within the Qubitro portal as long as valid JSON is submitted. Published data can use published metrics to customize charts and dashboards to help you monitor and manage the device.

Qubitro device data table
Qubitro device data analytics

To integrate applications with the available data from your Toit devices, the Qubitro API can be queried with the following example:

curl --request GET \
     --url 'https://api.qubitro.com/v1/projects/PASTE_PROJECT_ID/devices/PASTE_DEVICE_ID/data?keys=PASTE_ENTITY_NAME&period=90&limit=10' \
     --header 'Accept: application/json' \
     --header 'Authorization: Bearer PASTE_TOKEN'
{
  "response": [
    {
      "temp": 25,
      "time": "2021-12-21T18:45:14.560401"
    },
    {
      "temp": 25,
      "time": "2021-12-21T17:45:07.085844"
    },
    {
      "temp": 25,
      "time": "2021-12-21T16:44:59.64154"
    },
    {
      "temp": 25,
      "time": "2021-12-21T15:44:52.151324"
    },
    {
      "temp": 26,
      "time": "2021-12-21T14:44:44.667748"
    }
   ]
}

Examples and Documentation

Toit Connector - Qubitro Platform Documentation
Connect ESP32 based boards with Toit Package based on Toit language

Sounds interesting? Then don't forget to register Qubitro and Toit; both platforms are free to sign-up and develop your custom solutions.

Toit - IoT software platform for the ESP32
GitHub - toitlang/jaguar: Use live reloading over WiFI to turbo-charge developing for your ESP32.
Use live reloading over WiFI to turbo-charge developing for your ESP32. - GitHub - toitlang/jaguar: Use live reloading over WiFI to turbo-charge developing for your ESP32.
GitHub - kasperl/toit-qubitro: Qubitro connector for the ESP32 based on the Toit language.
Qubitro connector for the ESP32 based on the Toit language. - GitHub - kasperl/toit-qubitro: Qubitro connector for the ESP32 based on the Toit language.

Join the conversation

Great! Next, complete checkout for full access to Qubitro.
Welcome back! You've successfully signed in.
You've successfully subscribed to Qubitro.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.