Blog 2Smart (EN)

4 stages of using the platform to create a new IoT device

The easiest way to add a new IoT device to the 2Smart Cloud platform is to use a step-by-step wizard. However, for experienced vendors and those who do not want to be limited by the wizard, there is the classic way, which has more flexible features. With the example of the Wi-Fi relay, we will show how to use the classic way of adding a new IoT device to the account of the 2Smart Cloud vendor.

If you begin your experience with the platform through this article, we recommend going through the instructions of the wizard which contains important details excluded in the text below.

Prototype preparation and registration on the platform


The preparation of a smart Wi-Fi relay prototype is described in detail in the previous article. We will use the same scheme to talk about the features of the classic way of creating a new IoT device on the 2Smart Cloud platform.

This goes with assuming that you have already registered on the platform itself and tried its functionality in demo mode.

Prototype Wi-Fi relay based on the ESP32 microcontroller

Wi-Fi relay scheme

Preparing firmware


1 - To begin the classic way of creating a new IoT device on the platform, open the "Products" page and click "Add Product".

Note: The same button on the main account page launches the wizard!

Button to create a new product

2 - Select the microcontroller that the smart device is based on. In our example, it is the ESP32. Click “Next”.

Microcontroller selection screen

3 - Once the product settings window opens, you can specify a description of the device, create firmware, and configure the interface of the mobile application. Unlike the wizard, the procedure of these steps can differ.

New product settings screen

4 - Pay attention to the tooltip indicating your progress in creating a new device. With its help, you will see which steps have already been passed and which still have to be completed before the device can be published on the 2Smart Cloud platform.

The tooltip indicating the progress of the device

5 - In the "General" column, enter the name of the device and description then upload an icon and a photo.

  • "Product name" is the name under which the product will be displayed in 2Smart Cloud Market and by which users will search for the device.
  • "Product icon" is a graphic image that will be next to the name in the marketplace.
  • "Description" is a small text about a product that you can see on its card in the marketplace.
  • "Product photo for market" - displayed in the card in the marketplace, accompanying the text description.

You can postpone this step if you wish. Data can be edited at any time. Remember to return to this step before publishing the product.

General information

6 - Proceed with the creation of the firmware. Click the "Add Firmware" button in the "Firmware" column and select one of the available options for your microcontroller.

Firmware creation button

7 - Select the basic firmware. For ESP32 microcontrollers this is ESPHome or Custom. You can read more about the difference between them in the previous article.

After selecting the appropriate firmware base (in our example, ESPHome is used), click "Next".

Base firmware selection screen

Copy the code of the Wi-Fi relay firmware, prepared based on ESPHome, into a new window (detailed comments on the code are in the previous instruction).

# Switchers for relay and wi-fi led indicator
    switch:
      - platform: gpio
        id: l2
        name: relay
        pin:
          number: GPIO4
          inverted: True
      - platform: gpio
        id: Wifiled
        name: ledWifi
        pin:
          number: GPIO2
# Physical button for relay switching
    binary_sensor:
      - platform: gpio
        pin:
          number: GPIO13
          mode: INPUT_PULLUP
          inverted: True
        name: sensor_button
        on_press:
          then:
            - switch.toggle: l2
# Physical button for reset creds for production devices (only for 2Smart Cloud version of EspHome)
      - platform: reset_sensor
        pin:
          number: GPIO15
          mode: INPUT_PULLUP
          inverted: true
        name: Reset button
        filters:
          - delayed_on: 2s
    interval:
      - interval: 10s
        then:
          if:
            condition:
              wifi.connected:
            then:
              - switch.turn_on: Wifiled
            else:
              - switch.turn_off: Wifiled
# Standart sensor for wi-fi signal
    sensor:
      - platform: wifi_signal
        name: "WiFi Signal Sensor"
        update_interval: 10s
# Standart sensors for wi-fi settings
    text_sensor:
      - platform: wifi_info
        ip_address:
          name: ESP IP Address
        ssid:
          name: ESP Connected SSID
        bssid:
          name: ESP Connected BSSID
        mac_address:
          name: ESP Mac Wifi Address

Device firmware setup screen

When the code is set up, click "Save".

8 - After the firmware code was added, two new "Build firmware" buttons appear on the product setup screen for Sandbox and Production firmware.

Links for Sandbox and Production firmware builds

Sandbox is the firmware for testing a prototype device. Production is the final version of the firmware, which is installed on devices for end-users.

For more information on the difference between these two options, see the previous article.

9 - Press the first "Build firmware" button to prepare the Sandbox firmware.

Link to build Sandbox firmware

10 - Enter the parameters of your Wi-Fi network and click "Save".

Please note! Devices based on the ESP32 microcontroller support only Wi-Fi networks with a frequency range of 2.4 GHz!

Screen for adding Wi-Fi network settings

11 - After completing the building process, click the "Download" link.

Link to the complete archive with Sandbox firmware

12 - Inside the downloaded archive, there will be a “readme.md” file describing the process of firmware installation. Flash your device according to the instructions.

Firmware is available for Mac OS, Linux, or Windows devices.

Please note! If the firmware is already written to the microcontroller, don't forget to delete it following the instructions in the “readme.md” file or as described in the documentation.

Contents of the Sandbox firmware archive

The process of installing the firmware on the device

13 - When the firmware has been installed, head back to your account on the 2Smart Cloud platform. The device status will change to "Ready" and the status indicator will turn green. This means that your device was successfully detected by the platform.

In some cases, you might have to disconnect the ready IoT device from the power supply and reconnect it for the system to detect the device.

Ready status indicating that the device has been successfully detected

14 - Pay attention to all points in the "Firmware" column once the device is connected:

  • "Update firmware" - Use the link to make changes to the firmware code. After editing, don't forget to build new versions of Sandbox and Production firmware.
  • "Firmware settings" - The vendor can enter their text of instructions for users instead of the one used in 2Smart Cloud by default.
  • "Pairing support" - The switch in "Firmware settings" window, that responsible for the possibility of adding a device by 2Smart Cloud application users using the standard method. If enabled, the device can be added to the application using the pairing function. If disabled, the user will be able to find the product in the catalog, but not start the pairing.
When might it be necessary to disable the option? The possibility exists for vendors who have prepared special firmware that does not support the standard pairing. In this case, users can be offered instructions on how to connect the device in other ways, for example, through the device's built-in interface.
  • "Connection info" - Technical information for this product with the ability to quickly copy every configuration parameter. More information about all parameters can be found in the documentation of the platform.
  • "Preview State" - Current data of all sensors of the device connected to the test environment of the platform.
  • "Clear device" -  A button that, when clicked, deletes information about the state of the device from the Sandbox environment. This option may be required during the development and debugging phase of the product firmware.
  • "Device status" - The indicator of a test device’s connection with Sandbox firmware and its current status. It allows you to make sure that the device is connected, the current firmware version is installed and functions correctly.

Options in the

Connecting to Sandbox environment and configuring the interface of the mobile application


1 - When the system has detected a device with test firmware, you can configure the mobile app interface to control the device from your smartphone. The "Add layout" button is now active, click it.

Link to create a mobile app interface

2 - The Mobile App Interface Master in the classic version is the same as the one used in the wizard.

Mobile application interface settings screen

You can control the device while editing the application interface. The device instantly responds to the switching of the relay widget on the mobile application emulator screen. And on the contrary, when you press the relay toggle button on the board in the interface of the mobile application emulator, the widget's state will change instantly.

3 - Click "Save" when the application interface settings are complete. You can return to editing at any time. Use the "Edit layout" link.

Link to edit the interface of the mobile app

4 - Now you can test the control of your device from your smartphone. Download the app (iOS | Android), turn on the development mode in the settings, and find your device in the list. Similar to testing the device when adding one with a wizard.

Building the final Production firmware and controlling the device from a smartphone.


Use Production firmware for devices that will be sold to end-users. We recommend leaving one prototype device with test Sandbox firmware for easy testing of new features or changing the interface of the mobile app.

1 - To build the Production firmware, click the appropriate "Build firmware" button.

Link to build Production firmware

2 - Wait until the process is complete and click the "Download" link.

Link to the completed archive with Production firmware

3 - Install the final version of the firmware on the device in the same way as you did with the test version.

Please note! If the firmware is already written to the microcontroller, don't forget to delete it following the instructions in the “readme.md” file or as described in the documentation.

4 - After building the final firmware, the "Publish" button for your product is activated. Click it to place your IoT device in the catalog of the 2Smart Cloud platform.

Button for publishing the finished product

5 - Confirm your wish to publish a new product on the platform.

Product publication confirmation screen

6 - After publication, a "Published" notification will appear and the status of the product will change from "Draft" to "Production".

The product page in the vendor panel with the

7 - When a device has been published, you can add it to the 2Smart Cloud mobile app on your smartphone and start using the device.

Have in mind that the product will appear in the public catalog only after it is approved by the platform administrators. Until then, you can only add the device through the pairing procedure by selecting "Others" in the market.

Connecting your device to the 2Smart Cloud application


Examine your device through the eyes of your customers. Register in the 2Smart Cloud mobile app as a regular user, disabling development mode. Test the product in a real environment. Feel free to read more in the instructions for the wizard.

Widgets for device control in the 2Smart Cloud mobile app

Make use of the additional device control features that 2Smart Cloud users have. Voice commands, a Telegram bot, and phone call control. Take the opportunity to share access to the device’s control with other users. Detailed instructions can be found in the blog on our website.

What's next


In hindsight, the classic way of creating a new device on the 2Smart Cloud platform is more flexible in comparison to the wizard. We recommend it for experienced vendors who have created at least one product and who are already familiar with the functionality of the platform.

Note that you can always go back to an already published product to edit the firmware and interface of the app. For example, if users of your product started complaining about uncomfortable controls or not enough functionality of the application, you can make the necessary changes in just a few minutes. They will be visible to your customers automatically. Just restart the 2Smart Cloud app on your smartphone.

For more information on editing the product, see the tutorial.

You can also work with statistics on the usage of your devices by your users. There is another tutorial on how to do this.

You don't have to be a big manufacturer to join the 2Smart Cloud! The platform is open, including for DIY developers who make devices for themselves, as in our example with the smart relay.

Links:


All articles about IoT device creation and support

  1. Learn your way around the IoT platform –  create your first device and control it from your smartphone without an MCU
  2. How to create a Wi-Fi switch to control via a mobile app and Telegram bot
  3. 4 stages of using the platform to create a new IoT device
  4. How to create an IoT device on a printed circuit board and take it from prototype to finished product
  5. How to write firmware for an IoT device based on an SDK
  6. How to update the firmware and mobile application of ready-made devices within 5 minutes
  7. Collection and analysis of statistics –  a useful tool for product improvement
Made on
Tilda