<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by thingsboard on Medium]]></title>
        <description><![CDATA[Stories by thingsboard on Medium]]></description>
        <link>https://medium.com/@thingsboard?source=rss-ea30efccae4c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*NzW--doQD_zfQSN7v_dang.png</url>
            <title>Stories by thingsboard on Medium</title>
            <link>https://medium.com/@thingsboard?source=rss-ea30efccae4c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 21:17:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@thingsboard/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[ESP32 OTA using ThingsBoard]]></title>
            <link>https://medium.com/@thingsboard/esp32-ota-using-thingsboard-4eb570677ec3?source=rss-ea30efccae4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/4eb570677ec3</guid>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[esp32]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[ota]]></category>
            <category><![CDATA[arduino]]></category>
            <dc:creator><![CDATA[thingsboard]]></dc:creator>
            <pubDate>Thu, 28 Feb 2019 15:18:53 GMT</pubDate>
            <atom:updated>2019-02-28T15:21:18.610Z</atom:updated>
            <content:encoded><![CDATA[<p>I want to show how to send over-the-air(OTA) firmware updates to ESP32 powered devices from the user-friendly dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tV05OqRXMB1GKhup.gif" /></figure><p>The scenario is simple:</p><ul><li>I want to see all registered devices on the dashboard</li><li>current device connection status(online/offline)</li><li>running firmware version</li><li>trigger firmware upgrade for the selected device (with a link to a new firmware)</li></ul><p>I’ll use the ThingsBoard IoT platform for managing my devices. It is free for both personal and commercial usage and you can deploy it anywhere (more info here — <a href="https://thingsboard.io/docs/getting-started-guides/what-is-thingsboard/">what-is-thingsboard</a>).</p><p>You can use this article as a step-by-step guide for configuring both ESP32 and ThingsBoard platform.</p><h3>What will you need</h3><ul><li>Installed and configured <a href="https://github.com/espressif/esp-idf">ESP-IDF</a>, the official development framework for ESP32 chip.<br>Refer to <a href="https://docs.espressif.com/projects/esp-idf/en/latest/get-started/">ESP-IDF Get Started</a> document to set up the software environment.<br>Before continuing, please make sure that you can successfully build and flash some example from ESP-IDF, for instance, <a href="https://github.com/espressif/esp-idf/tree/master/examples/get-started/hello_world">Hello World</a>.<br>For the sample ESP-IDF version <strong><em>v3.3-beta1–328-gabea9e4c0</em></strong> was used.<br>In case of any build errors see <a href="https://docs.espressif.com/projects/esp-idf/en/latest/versions.html#esp-idf-versions">ESP-IDF Versions</a> document to update the version of the installed EPS-IDF.</li><li>Any development board with ESP32-PICO-D4 chip.<br>For this sample, we were using <a href="https://docs.espressif.com/projects/esp-idf/en/latest/get-started/get-started-pico-kit.html#overview">ESP32-PICO-KIT mini development board</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hl5cR5jJs-ug97X9.png" /><figcaption>ESP32-PICO-KIT mini development board</figcaption></figure><ul><li>An account in ThingsBoard platform. You can use your own instance or <a href="https://cloud.thingsboard.io/">ThingsBoard PE Cloud</a></li></ul><h3>ThingsBoard configuration</h3><p>1. Create a new device, name it as <em>ESP32</em> and set its type as <em>ESP32_OTA</em>.<br>The specified device type will be used later in the rule chains and in the dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*C_VpcihqoaDlmbFd.png" /><figcaption>Create a test device</figcaption></figure><p>2. Add the new rule chain that will update the device’s server attribute <em>fwStateIsSynced</em>.<br>The attribute type is boolean and it will be used to show on the dashboard is firmware synced or not.<br>Download, import <a href="https://thingsboard.io/docs/samples/esp32/resources/check_is_esp32_firmware_synced.json">Check is ESP32 firmware synced</a> rule chain into ThingsBoard and save it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qSGNJ5xx5_UMWCXo.gif" /></figure><p>The rule chain has 3 nodes:</p><ul><li><em>Add attributes to metadata</em> — adds client attribute <em>currentFwVer</em> and server attribute <em>lastTargetFwVer</em> to metadata</li><li><em>Update server attribute ‘fwStateIsSynced’</em> — compares for the equality attributes <em>currentFwVer</em> and <em>lastTargetFwVer</em> and assign the comparison result to <em>fwStateIsSynced</em> attribute</li><li><em>Save ‘fwStateIsSynced’ attribute</em> — saves the updated attribute <em>fwStateIsSynced</em></li></ul><p>3. Add the imported rule chain <em>Check is ESP32 firmware synced</em> to <em>Root Rule Chain</em>. Open <em>Root Rule Chain</em>, drag and drop from nodes list <em>rule chain</em> node and select <em>Check is ESP32 firmware synced </em>from a dropdown list.<br>Two links should be created for the new node:</p><ul><li>From <em>Message Type Switch</em> with link type <em>Attributes Updated</em></li><li>From <em>Save Attributes</em> with link type <em>Success</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PIAgiOIpYB1roKCd.gif" /><figcaption>Connect Root Rule Chain with the new chain</figcaption></figure><p>Such rule configuration allows to compare received firmware version after it was updated in the next cases:</p><ul><li><em>After flashing ESP32 by a new firmware through OTA.</em><br>The new value of the firmware version is sent by ESP32 after restarting (as client attribute <em>currentFwVer</em>) and pass through <em>Post attributes</em> link in the rule chain.</li><li><em>After the user saves the new OTA configuration in the widget.</em><br>The new value of firmware version passes through <em>Attributes Updated</em> link in the rule chain as server attribute <em>lastTargetFwVer</em>.</li></ul><p>4. Download and import <a href="https://thingsboard.io/docs/samples/esp32/resources/ota_widgets.json">OTA widgets</a> bundle to Widgets Library to allow specifying of firmware URL and version and send OTA configuration to ESP32.</p><p>5. Download and import <a href="https://thingsboard.io/docs/samples/esp32/resources/ota_for_esp32.json">OTA for ESP32</a> dashboard to Dashboards Group. The dashboard has the alias <em>ESP32_OTA_alias</em> for the devices with type <em>ESP32_OTA</em>. It allows showing on the dashboard a list of ESP32 with OTA support and the current firmware state (synced or not synced) for every device in the list. User can change and update OTA config of any ESP32 form the list by clicking ‘Select OTA configuration’ control in the last column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FfUzMFLmHd9jK8OG.png" /><figcaption>Registered ESP32 devices</figcaption></figure><p>Because of only one device with type <em>EPS32_OTA</em> was created, the table contains only one row. If a new device with type <em>ESP32_OTA</em> is added, then it will appear in the dashboard’s entity table automatically.</p><h3>Configure and flash firmware for ESP32 factory partition</h3><p>1. Clone the sample’s sources from <a href="https://github.com/thingsboard/esp32-ota">ESP32 OTA</a> ThingsBoard repository.</p><p>2. Go to the directory with the cloned project and configure MQTT broker address, Wi-Fi credentials, etc. <br>Open the terminal and execute the next command:</p><pre><strong>make menuconfig</strong></pre><p>In the opened menu select <em>ThingsBoard OTA configuration</em> sub-menu and enter the valid parameters to the fields:</p><ul><li><em>WiFi SSID</em> — login of your WiFi access point</li><li><em>WiFi Password</em> — password of your WiFi access point</li><li><em>MQTT broker URL</em> — ThingsBoard MQTT endpoint</li><li><em>MQTT broker port</em> — ThingsBoard MQTT port</li><li><em>MQTT access token</em> — device’s access token in ThingsBoard</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/0*zcjI4aFzPZLrbPGE.png" /><figcaption>Device connection parameters</figcaption></figure><p>Save the configuration and select <em>Exit</em> to return to the main menu.</p><p>3. Select <em>Serial flasher config</em> sub-menu and change <em>Default serial port</em>, <em>Default baud rate</em> and <em>Flash Size</em> parameters:</p><ul><li><em>Default serial port</em> — serial port name according to your OS (COM-type for Windows, /dev/cu/ for MacOS or /dev/tty/ for Linux)</li><li><em>Default baud rate</em> — 921600 baud (by default <em>111500 baud</em>)</li><li><em>Flash Size</em> — 4 MB (by default <em>1 MB</em>)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/0*SkADjh6L2GICt-IL.png" /><figcaption>Serial flasher config</figcaption></figure><p>Save the configuration and select <em>Exit</em> to return to the main menu.</p><p>4. Select <em>Partition table</em> sub-menu and change <em>Partition table</em> parameter:</p><ul><li><em>Partition table</em> — Factory app, two OTA definitions (by default <em>Single factory app, no OTA</em>)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/0*KM7Eb9eZj3nZVtJB.png" /><figcaption>Partition Table</figcaption></figure><p>Save the configuration and select <em>Exit</em> twice to exit from <em>menuconfig</em> utility.</p><p>5. Any web server that supports HTTPS and returns the image files can be used for OTA. For this sample we will use the GitHub repository to download the images by ESP32 for OTA update. <a href="https://raw.githubusercontent.com/thingsboard/esp32-ota/master/server_certs/ca_cert.pem"><em>ca_cert.pem</em></a> file contains GitHub public certificate already.</p><p><strong>OPTIONAL</strong><br>If you are going to use some another server for the firmware images delivering, then the content of <a href="https://raw.githubusercontent.com/thingsboard/esp32-ota/master/server_certs/ca_cert.pem"><em>ca_cert.pem</em></a> file should be replaced.<br>To get public SSL certificate of a server, execute the next command (preliminary replace <em>raw.githubusercontent.com</em> by the desired server address)</p><pre><strong>openssl s_client -showcerts -connect raw.githubusercontent.com:443</strong></pre><p>Copy a certificate content from the output to <a href="https://raw.githubusercontent.com/thingsboard/esp32-ota/master/server_certs/ca_cert.pem"><em>ca_cert.pem</em></a> and save the file.</p><p>6. Now the project is configured and ready for compilation and flashing. Before the first flashing, it is necessary to erase ESP32 flash memory.<br>Go to the <a href="https://github.com/thingsboard/esp32-ota">root sample directory</a> and execute the next command</p><pre><strong>make erase_flash</strong></pre><p>Execute the next command to build sources, flash ESP32 and get the firmware output:</p><pre><strong>make flash monitor</strong></pre><p>If compilation and flashing were successful and ESP32 connected to ThingsBoard, the next log messages are printed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/0*_tjTWUYOXgz8pGgt.png" /><figcaption>Successful flashing log</figcaption></figure><p>Let’s look at a log message format, for example <em>I (5219) tb_ota: Connected to WI-FI, IP address: 192.168.2.45</em></p><ul><li><em>I</em> — info log type, can be W (warning), E (error) or D (debug)</li><li><em>(5219)</em> — time in milliseconds after the scheduler on APP CPU started</li><li><em>tb_ota:</em> — tag to identify a component that produced the log message</li><li><em>Connected to …</em> — the log message itself</li></ul><p>The application’s flow is the next:</p><ol><li>The firmware is flashing to the <em>factory</em> partition. In the future, the images received during OTA process will be written to partition <em>ota_0</em> or <em>ota_1</em> alternately.<br>See more details in <a href="https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/system/ota.html">Over The Air Updates (OTA)</a> ESP32 API reference.</li><li>The application checks does the flash memory contain the Wi-Fi credentials. Because the compiled image was flashed to the <em>factory</em> partition and the flash memory was erased, the Wi-Fi credential entered in <em>menuconfig</em> are persisted to the flash memory and will be used further.</li><li>The application is trying to connect to the provided Wi-Fi access point.</li><li>After the connection to Wi-Fi access point was established, the application checks does the flash memory contain MQTT URL, port and ThingsBoard access token.<br>Because the application was flashed to the <em>factory</em> partition and the flash memory was erased, MQTT client parameters (URL, port and access token) entered in <em>menuconfig</em> are persisted to the flash memory and will be used further.</li><li>The application is trying to connect to ThingsBoard over MQTT.</li><li>After the connection was established, the application fetching shared attributes <em>targetFwUrl</em> and <em>targetFwVer</em> from ThingsBoard.<br>It allows to cover the case when EPS32 was powered off or lose the connection with ThingsBoard but the shared attributes were updated that time. OTA started only if the shared attributes values aren’t empty and <em>targetFwVer</em> isn’t equal to the hardcoded application’s firmware version.<br>Because any shared attributes were not created in ThingsBoard yet (they will be created through the widget later), for now, OTA procedure is skipped.</li><li>The application started to execute a custom task (for example send some telemetry or attributes data to ThingsBoard) and waits for the update of the shared attributes <em>targetFwUrl</em> and <em>targetFwVer</em> to perform OTA.</li></ol><h3>Performing OTA from ThingsBoard</h3><p>Go to the <em>OTA for ESP32</em> dashboard and press <em>Select OTA configuration</em> for the device. In the opened dashboard enter the next parameters in <em>OTA control</em> widget:</p><ul><li><em>Target firmware version</em> — expected firmware version which is hardcoded in the new firmware image, <em>v1.2</em></li><li><em>Firmware server URL</em> — link to the new firmware image, <a href="https://raw.githubusercontent.com/thingsboard/esp32-ota/master/firmware/example-v1.2.bin"><em>https://raw.githubusercontent.com/thingsboard/esp32-ota/master/firmware/example-v1.2.bin</em></a></li></ul><p>Press <em>Start OTA</em> button to create and send the shared attributes to EPS32.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8wg09wRq_5NdIVR-.gif" /></figure><p>The sample’s <a href="https://github.com/thingsboard/esp32-ota/tree/master/firmware/">firmware</a> directory contains two images with the next differences:</p><ul><li><a href="https://raw.githubusercontent.com/thingsboard/esp32-ota/master/firmware/example-v1.1.bin">example-v1.1.bin</a> — value of <em>FIRMWARE_VERSION</em> in <a href="https://github.com/thingsboard/esp32-ota/blob/master/main/main.h">main.h</a> equals to <em>v1.1</em>.<br><em>counter</em> variable in <a href="https://github.com/thingsboard/esp32-ota/blob/master/main/main.c">main_application_task</a> has value <em>1</em>.</li><li><a href="https://raw.githubusercontent.com/thingsboard/esp32-ota/master/firmware/example-v1.2.bin">example-v1.2.bin</a> — value of <em>FIRMWARE_VERSION</em> in <a href="https://github.com/thingsboard/esp32-ota/blob/master/main/main.h">main.h</a> equals to <em>v1.2</em>.<br><em>counter</em> variable in <a href="https://github.com/thingsboard/esp32-ota/blob/master/main/main.c">main_application_task</a> has value <em>2</em>.</li></ul><p>After the firmware version and URL were updated on the <em>OTA control</em> widget, ThingsBoard sends a MQTT message with the shared attributes to <em>v1/devices/me/attributes</em> MQTT topic.<br>Because of the ESP32 is subscribed to this MQTT topic, as soon as the update message is received it is parsed and the firmware versions are compared.<br>If the value of <em>FIRMWARE_VERSION</em> defined in <a href="https://github.com/thingsboard/esp32-ota/blob/master/main/main.h">main.h</a> isn’t equal to the firmware version received from ThingsBoard, OTA update process will be started and <em>monitor</em> utility outputs the next logs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/0*9S9Zo87HUOds4wC_.png" /></figure><p>The application’s flow is the next:</p><ul><li>shows the received URL and firmware version</li><li>shows the warning that firmware versions are different and the difference between them</li><li>if a server’s certificate is valid and an image was downloaded successfully from the provided URL then OTA process starts (<em>Starting OTA…</em> message is printed)</li><li>during OTA process all other tasks could be executed with some delays.<br>For example, the application sends a telemetry data (in this sample it is the current value of <em>counter</em> variable) to ThingsBoard with a not determined period.<br>If OTA process was finished successfully, ESP32 will be rebooted and after the start, the next logs will be shown:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/0*VN2uO6QWxdr0VIcV.png" /></figure><p>Let’s review the logs differences in comparison when the firmware was flashed to <em>factory</em> partition:</p><ul><li>running partition now is <em>ota_0</em>, not <em>factory</em></li><li>Wi-Fi credentials were loaded from the flash memory, the credentials entered in <em>menuconfig</em> utility weren’t used</li><li>MQTT access token for ThingsBoard also was loaded from the flash memory</li><li>after the shared attributes were fetched, the new OTA process isn’t started because firmware versions are equal</li><li>the application is waiting for the next update of the shared attributes and a newly downloaded image will be written to <em>ota_1</em> partition this time.</li></ul><p>Now, just for testing, you can update <em>OTA control</em> widget with next values:</p><ul><li><em>Target firmware version</em> — v1.1</li><li><em>Firmware server URL</em> — <a href="https://raw.githubusercontent.com/thingsboard/esp32-ota/master/firmware/example-v1.1.bin">https://raw.githubusercontent.com/thingsboard/esp32-ota/master/firmware/example-v1.1.bin</a></li></ul><p>After this OTA update <em>counter</em> periodically changes its value to 0 or to 1, in the same manner as and after flashing the image to <em>factory</em> partition. But the difference this time is that the image was flashed to <em>ota_1</em> partition.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4eb570677ec3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing the Thingsboard Open Source IoT Gateway]]></title>
            <link>https://medium.com/@thingsboard/introducing-the-thingsboard-open-source-iot-gateway-76c6597426fa?source=rss-ea30efccae4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/76c6597426fa</guid>
            <category><![CDATA[dashboard]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[iot-platform]]></category>
            <category><![CDATA[mqtt]]></category>
            <category><![CDATA[internet-of-things]]></category>
            <dc:creator><![CDATA[thingsboard]]></dc:creator>
            <pubDate>Wed, 14 Feb 2018 09:21:09 GMT</pubDate>
            <atom:updated>2018-02-14T09:21:09.080Z</atom:updated>
            <content:encoded><![CDATA[<p>There are numerous IoT protocols and data formats. Some of them are more popular, like MQTT and JSON, and some are quite rare. Many IoT platforms provide support for the most popular protocols and data formats out-of-the-box, but it is hard to support all of them in a single solution. With the growth of the Thingsboard open-source community, we have started receiving requests about supporting IIoT protocols, like OPC-UA and some specific data formats.</p><p>We have decided to implement this functionality as a separate open-source project that will allow us to bridge the platform API to literally any device. The data flow diagram is attached, and we will describe it in detail below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1TDtFtVWks5LwIal.png" /></figure><p>The IoT Gateway is built on top of Java, but is different from similar projects that leverage OSGi technology. The idea is distantly similar to a microservices architecture. After all, there are other programming languages (C, C++, Python, Javascript, Go, etc.) that may be more suitable for application development for target IoT devices, especially when we are talking about language APIs and existing libraries to work with serial ports, GPIOs, I2C, and new modules and sensors that are released every day.</p><p>The Gateway provides simple integration APIs and encapsulates common Thingsboard-related tasks: device provisioning, local data persistence and delivery, message converters/adapters, and more. As an application developer, you are able to choose Python, Go, C/C++, and other languages and connect to Thingsboard Gateway through external MQTT broker or OPC-UA server. Devices that support other protocols may be connected to gateway by implementing custom extensions.</p><p>Thingsboard IoT Gateway provides following features:</p><ul><li>OPC-UA extension to collect data from devices that are connected to OPC-UA servers.</li><li>MQTT extension to collect data that is published to external MQTT brokers.</li><li>Persistence of collected data to guarantee data delivery in case of network and hardware failures.</li><li>Automatic reconnecting to Thingsboard clusters.</li><li>Simple yet powerful mapping of incoming data and messages in a unified format.</li></ul><p>The initial Gateway release goal is to bring Thingsboard data collection feature to OPC-UA- and MQTT-enabled devices. The Gateway project is currently in the active development stage, and you should expect major feature releases in next two months. Our next goal is to bridge all other Thingsboard features and allow you to configure and manage IoT devices through the gateway using Thingsboard widgets and dashboards.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*kNxjv4JQXpeNNSay24yoqQ.png" /><figcaption>Data visualization with Thingsboard IoT Platform</figcaption></figure><p>Links:</p><p><a href="https://thingsboard.io/docs/iot-gateway/">IoT Gateway documentation</a></p><p><a href="https://thingsboard.io/">Thingsboard IoT Platform</a></p><p><a href="https://demo.thingsboard.io/dashboards/3a1026e0-83f6-11e7-b56d-c7f326cba909?publicId=322a2330-7c36-11e7-835d-c7f326cba909">Live Demo Dashboard</a></p><p><em>Originally published at </em><a href="https://dzone.com/articles/introducing-thingsboard-open-source-iot-gateway"><em>dzone.co</em></a><em>m.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76c6597426fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>