Skip to main content

Introducing ESP RainMaker

·5 mins·
RainMaker Announcements Esp32
Table of Contents

Today we announced ESP RainMaker. This is another step forward for Espressif to enable makers to build connected devices and access them through phone apps, 3rd party services or voice assistants, quickly, without having to manage the infrastructure.

The ESP RainMaker is a collection of device-agent SDK, a transparent cloud application and iOS/ Android phone apps. This lets developers write the firmware and instantaneously interact with it through the phone-apps, or through other services.

Developer Workflow
#

We are excited about this launch as it gives more power to firmware developers. And I want to talk about this a bit.

As a firmware developer working with RainMaker this is how the workflow looks like:

  • You build applications using the goodness of Espressif’s ESP-IDF open-source SDK and the RainMaker Agent.
  • You choose to expose any parameters of your device in the application’s firmware that you wish to control externally.
  • The RainMaker agent syncs these attributes with the RainMaker cloud. The RainMaker cloud transparently makes the device parameters available to the phone applications and other services. This does not require you to write any code in the cloud. The cloud application is built with AWS Serverless services.
  • The RainMaker phone applications then redraw themselves to present the parameters of the devices to the user. Reading or changing these attributes is as easy as toggling a button on the phone.
  • The availability of a Python client library lets you access the same parameters through a command-line or through python programs, that you could then link with any other services.

And all of this, without any configuration of the cloud interfaces, or phone apps. All you can continue to focus on is the device firmware.

Examples
#

Let’s quickly look at some examples that will make things clearer.

GPIO
#

The simplest example is GPIOs. Let’s say you wish to expose some GPIO controls from your device. Your RainMaker code for this will look like:

/* Create a device and add the relevant parameters to it */
esp_rmaker_create_device("ESP32-S2-Saola-1", NULL, gpio_callback, NULL);

esp_rmaker_device_add_param("ESP32-S2-Saola-1", "Red",
                            esp_rmaker_bool(false), PROP_FLAG_READ | PROP_FLAG_WRITE);
esp_rmaker_param_add_ui_type("ESP32-S2-Saola-1", "Red", ESP_RMAKER_UI_TOGGLE);

esp_rmaker_device_add_param("ESP32-S2-Saola-1", "Green",
                            esp_rmaker_bool(false), PROP_FLAG_READ | PROP_FLAG_WRITE);
esp_rmaker_param_add_ui_type("ESP32-S2-Saola-1", "Green", ESP_RMAKER_UI_TOGGLE);

esp_rmaker_device_add_param("ESP32-S2-Saola-1", "Blue",
                            esp_rmaker_bool(false), PROP_FLAG_READ | PROP_FLAG_WRITE);
esp_rmaker_param_add_ui_type("ESP32-S2-Saola-1", "Blue", ESP_RMAKER_UI_TOGGLE);

Basically,

  • esp_rmaker_create_device: You define a name for a device and a callback (in this case* gpio_callback*) that will handle the requests when the parameter is modified externally.
  • esp_rmaker_device_add_param: You add parameters (or attributes) of the device that you wish to expose. Here we add 3 GPIOs (Red, Green, Blue). We mention that this parameter is of type bool. We can create parameters of other data types as well.
  • esp_rmaker_param_add_ui_type: Each parameter also includes a UI type that the phone application should use for displaying that parameter. In this case we mention that a UI type “toggle” element should be used.

Correspondingly the phone apps will show the following while accessing the device:

Light
#

You can also use other parameter types, for example let’s look at the light example.

/* Create a device and add the relevant parameters to it */
esp_rmaker_create_lightbulb_device("Light", common_callback, NULL, DEFAULT_POWER);

esp_rmaker_device_add_brightness_param("Light", "brightness", DEFAULT_BRIGHTNESS);
esp_rmaker_device_add_hue_param("Light", "hue", DEFAULT_HUE);
esp_rmaker_device_add_saturation_param("Light", "saturation", DEFAULT_SATURATION);

In the GPIOs example earlier, we had used a “raw” datatype as bool. The RainMaker agent also provides some pre-defined higher level datatypes (standard types). This example uses these higher level APIs for creating the parameters. Note that we could also have written this code using the raw datatype instead, but this is a short-hand utility API.

A list of these standard types is available here: https://rainmaker.espressif.com/docs/standard-types.html. It also has the corresponding Standard Types C API that is used in the code above. We will continue to update this list of standard types as we go along.

The phone apps then redraw themselves to match what is written in the firmware:

Bridges
#

You can also easily export multiple “logical devices” within the same ESP32 node. This makes it convenient in cases where your ESP32 acts as a bridge and allows the RainMaker phone apps to interact with these bridged devices.

More Examples
#

You can find many other samples in the esp-rainmaker/examples/ directory of the ESP RainMaker project.

Specifications
#

While we make this infrastructure available, we want to be as transparent as possible about the architecture and the data exchange that flows through the ESP RainMaker infrastructure.

Feel free to reach out to us if you have any feedback, requests or suggestions for ESP RainMaker.

Get started using the ESP RainMaker
#

Support for ESP-RainMaker is currently enabled for ESP32-S2 SoCs. If you have an ESP32-S2 based development board with you, you can get started with using ESP RainMaker from here: https://rainmaker.espressif.com/docs/get-started.html

You can also head over to the ESP RainMaker GitHub repository.

We are excited about releasing this, and we hope you find it helpful. We really look forward to what you will do!

Related

ESP32 Device Provisioning: Configuring Custom Data
·3 mins
API Esp32 Jumpstart IoT
One of the common requirements I have seen is, during the initial device provisioning, configuring some device specific custom data on the device.
HomeKit on Espressif’s ESP32
·5 mins
Internet Of Things Esp32
IoT is not one thing, it means different things to different people. So also, there are so many ways of building connected products.
ESP32: TLS (Transport Layer Security) And IoT Devices
·5 mins
Security IoT Esp32 Technology
TLS is the security component in the familiar *https protocol, *that we rely on for security on the Internet.