The 2Smart Cloud IoT platform allows you to create any smart device. All the necessary tools for this are available: services for creating firmware and mobile applications, checking the health of the device, tools for updating the functionality of the device and mobile application, analytics tools, and statistics collection. The platform is open to large manufacturers and DIY users. Using the example of a simple product – a Wi-Fi relay – we tell you how to create your smart device based on the 2Smart Cloud IoT platform in just one hour.
The instructions describe the easiest way to create a new IoT device – using a step-by-step assistant. Connecting the device to the platform without a wizard, with access to all tools at once, is described in the next post.
Our example shows an assembling smart relay controlled via the mobile app. We will connect an ordinary table lamp through a relay, making it smart. The light will be controlled from a smartphone using the 2Smart Cloud app and voice commands, a phone call, or the Telegram bot.
What we used to assemble this device:
|IoT platform ESP-WROOM-32 DevKit v1 – 1 pc.
(or any other platform variation with or without ESP32 microcontroller on Dev Board)
|Mini-relay (Zelo-module)||1 pc.|
|Resistors (220 Ohms)||1 pc.|
|5 mm LED||1 pc.|
|Tactile push buttons with caps||2 pcs.|
|Connection cable set||1 pc.|
The scheme of the device is quite simple. You can find its images instantly in a Google search. As a result, the device runs without any interruptions.
Here’s what the Wi-FI relay prototype looks like:
A brief description of the scheme:
To prepare the assembled device for operation, register on the 2Smart Cloud IoT platform. The service will help create firmware for a smart relay and a mobile application for the control and provide cloud infrastructure for further operation and support of the device.
In this tutorial, we will demonstrate how to create a device based on ESPHome firmware in a short time. After selecting, click “Next”.
# 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
Firmware code comments:
Attention! If the firmware is already written to the microcontroller, remove it by following the instructions in the ‘readme.md’ file or as described in the documentation.
After the system detects the device with the test firmware, you can configure the interface of the mobile application to control the device from a smartphone.
For the smart relay in our example, two widgets are enough: the relay on/off button and the Wi-Fi signal level sensor.To change the order of the widgets in the list, use drag-and-drop. To add a new tab to the application, click the “Add Tab” link in the top right of the Emulator screen.
The library of widgets on the platform is quite diverse, and most of them are universal and suitable for different devices. The library is simple to grasp, and you can safely choose any widget. In their respective settings, it will be clear with which sensors of your device it can be used.
Please note that you can control the device from a mobile application, its emulator in the developer’s account, and physical buttons on the relay board. Changes in the state of the sensors are instantly displayed in the application interface on the smartphone and its emulator in the computer browser.
You can make changes to the application interface in the developer panel. These include: editing the device’s name and icon, adding new widgets, and changing the order of existing ones. All the changes will be visible to customers after they restart the application on the smartphone.
The firmware that was used before is intended only for testing the prototype. Its peculiarity is that the code contains technical data not needed on the end user’s device. First of all, these are your home or work Wi-Fi network credentials.
The production firmware is the version that is installed on devices for sale. Its code no longer contains the additional parameters needed to test the prototype. The device is connected to the platform using a standard pairing from the end-user’s account.
To truly put your product to the test, imagine you are the person buying the device. Add a device from the catalog using the recommended steps:
That’s it! All that’s left is to power an ordinary table lamp through a smart relay, and it will respond to commands from the mobile appl cation. Keep the safety precautions in mind when connecting the power.
As demonstrated, adding a new IoT device to the 2Smart Cloud platform does not take much of your time. We tried to make the interface as user-friendly as possible and simplify the platform as much as possible for our user’s pleasure.
Creating a new IoT device is just the beginning of working with the 2Smart Cloud platform. The following blog articles will tell you how to modify the firmware of devices, edit the interface of a mobile application and analyze product usage statistics.
You don’t have to be a major manufacturer to join the 2Smart Cloud! The platform is open, among other things, to DIY developers who produce small batches of devices, just like our smart relay example.