{"id":19141356,"url":"https://github.com/thealbertdev/esp32-ubidots-wifi","last_synced_at":"2026-06-23T14:32:01.199Z","repository":{"id":104041454,"uuid":"407293722","full_name":"TheAlbertDev/esp32-ubidots-wifi","owner":"TheAlbertDev","description":"Arduino code example for ESP32 sending/receiving data to/from Ubidots through Wi-Fi using the MQTT protocol","archived":false,"fork":false,"pushed_at":"2021-09-17T09:50:22.000Z","size":133,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-22T19:15:00.076Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheAlbertDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-16T19:41:40.000Z","updated_at":"2024-06-03T10:58:18.000Z","dependencies_parsed_at":"2023-04-28T19:48:00.466Z","dependency_job_id":null,"html_url":"https://github.com/TheAlbertDev/esp32-ubidots-wifi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TheAlbertDev/esp32-ubidots-wifi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAlbertDev%2Fesp32-ubidots-wifi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAlbertDev%2Fesp32-ubidots-wifi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAlbertDev%2Fesp32-ubidots-wifi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAlbertDev%2Fesp32-ubidots-wifi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheAlbertDev","download_url":"https://codeload.github.com/TheAlbertDev/esp32-ubidots-wifi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAlbertDev%2Fesp32-ubidots-wifi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34694780,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T07:22:55.893Z","updated_at":"2026-06-23T14:32:01.180Z","avatar_url":"https://github.com/TheAlbertDev.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Arduino + ESP32 + Wi-Fi + Ubidots\n\nThis an example of how to configure an ESP32 dev kit connecting to Wi-Fi, and subscribing and publishing data from/to topics with [Ubidots](https://ubidots.com/) using the [MQTT protocol](https://en.wikipedia.org/wiki/MQTT).\n\n## Requeriments\n\n### :computer: Software\n\n- [Arduino IDE](https://www.arduino.cc/en/software) (recommended for beginners) or [VSCode](https://code.visualstudio.com/) with [Arduino VSCode Extension](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.vscode-arduino) (not covered in this README)\n\n### :cd: Board drivers\n\n- [Arduino-ESP32](https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json)\n\n\u003c!-- Installation instructions of ESP32 boards using the Board Manager [:link:](https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html) --\u003e\n\n### :books: Libraries:\n\n- [UbidotsEsp32Mqtt](https://github.com/ubidots/esp32-mqtt)\n- [PuSubClient](https://github.com/knolleary/pubsubclient)\n\n\u003c!-- Installation instructions of Arduino libraries [:link:](https://www.arduino.cc/en/guide/libraries) --\u003e\n\n## Getting started\n\n### Preparing Ubidots\n\n#### :satellite: Create a device\n\nBefore this, you need to create an account in [Ubidots](https://ubidots.com/). Once created, follow the next steps:\n\n1. Go to your [dashboards page](https://stem.ubidots.com/app/dashboards/).\n2. Click on `Devices \u003e Devices`.\n3. Hover the Add icon and click on `Add new Device`.\n4. From all the device types listed, select `Blank Device`.\n5. Indicate as a name and label 'ESP32 01' and 'esp32-01', respectively.\n\n   \u003e You can use another name and label, but then you have to edit the code example accordingly.\n\n6. Now, click in the recently created device, and click on `Add Variable \u003e Raw`. Name it 'Led status'.\n7. Repeat step 6 with a variable named `ADC`.\n\n   \u003e By default, Ubidots labels your variables automatically, but if you didn't indicate any name during the creation of the variable, it will use a generic non-readable label. Ensure that the variable 'Led status' and 'ADC' have as labels 'led-status' and 'adc', respectively.\n\nYour new device should look like this.\n\n![Ubidots device](assets/imgs/new_device.jpeg)\n\n#### :chart_with_upwards_trend: Create a dashboard\n\nWe have created our device and its available variables. Let's create a dashboard to plot them.\n\n1. Go to the dashboards page clicking on `Data \u003e Dashboards`.\n2. Create a new dashboard clicking on the \u003ckbd\u003eAdd new Dashboard\u003c/kbd\u003e button.\n3. Indicate a name for the dashboard and create the dashboard.\n4. Click on 'Add new Widget' and select 'Switch'. Name it 'Led status'.\n5. In the data section, click 'Add Variables' and select `ESP32 01 \u003e Led status`.\n6. Once created, the widget will serve us to publish the led status to the cloud and the board will read the variable to control the on board led accordingly.\n7. Create another widget of type 'Line chart' named 'ADC values' and with the variable `ESP32 01 \u003e ADC`. The widgets can be moved and resized.\n\nOnce finished, you should have a dashboard like this (no data are shown as we have not sent something yet).\n\n![Ubidots dashboard](assets/imgs/new_dashboard.jpeg)\n\n### Preparing Arduino\n\n#### :heavy_plus_sign: Add board to Arduino IDE\n\nFirst of all, we need to add our ESP32 board in Ardunio IDE in order to make it appear in the board manager. Follow these steps:\n\n1. Open Arduino IDE (how to install is not covered here... it's just a `Next`, `Next`, `Next`, ..., procedure).\n2. Go to `File \u003e Preferences`.\n3. In Additional Boards Manager URLs, add the URL\n\n   ```URL\n   https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json\n   ```\n\n   If you have other board URLs, add a comma at the end and then place the new URL.\n\n4. Then, go to `Tools \u003e Board \u003e Boards Manager...` and, after an update, type `ESP32` in the search field. The esp32 board **by Espressif Systems** will be listed. Click \u003ckbd\u003eInstall\u003c/kbd\u003e.\n5. Once finished, you have your available in Arduino IDE. To select it, go to `Tools \u003e Board \u003e ESP32 Arduino` and select `ESP Dev Module`.\n6. Plug your board to the PC using a USB cable and then select the proper COM port in `Tools \u003e Port`.\n\nNow you can develop code for your board and upload it to the [MCU](## \"microcontroller unit\").\n\n#### :exclamation: Upload code to the MCU\n\nIn order to upload code to your MCU, you must hold the \u003ckbd\u003eBOOT\u003c/kbd\u003e in your board when the terminal outputs `Connecting...`. Once connected, you can release the \u003ckbd\u003eBOOT\u003c/kbd\u003e button.\n\n#### :file_folder: Adding libraries\n\nTo add the required libraries:\n\n1. Download them from [here](https://github.com/ubidots/esp32-mqtt/archive/refs/heads/main.zip) and [here](https://github.com/knolleary/pubsubclient/archive/refs/heads/master.zip).\n2. In Arduino IDE, go to `Sketch \u003e Include Library \u003e Add .ZIP Library...` and select the downloaded `.ZIP` files (one at a time).\n\nEasy peasy.\n\n#### :warning: Personal credentials\n\nThe code needs the Wi-Fi credentials and your Ubidots token to operate. These are sensitive data that must not be shared with anyone. For this reason, the file containing this information must not be committed.\n\nThe sensitive data must be added to a file called `private_data.h` in the root of the project. This file is in the `.gitignore` file and will not be committed.\n\nA `private_data.template.h` file is provided with the variables to be initialized. Rename this file `private_data.h` and fill it with your personal data.\n\nYou can find the `UBIDOTS_TOKEN` in the web page of your device on Ubidots.\n\n#### :runner: Running the code\n\nNow just plug you board to the PC, verify and upload the code to the MCU (remeber the \u003ckbd\u003eBOOT\u003c/kbd\u003e button). Check the output at the serial terminal and, once connected, control the on board led from the dashboard and view the data from the ADC.\n\n![Ubidots dashboard with data](assets/imgs/dashboard_with_data.jpeg)\n\nYou have implemented a node for an [IoT](## \"Internet of Things\") application! Congrats!! :tada:\n\nPlay with the code to subscribe to more topics, to publish more data or to change the publish frequency, or add more nodes/devices in the network.\n\n# License\n\nThis code is released under the [MIT License](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthealbertdev%2Fesp32-ubidots-wifi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthealbertdev%2Fesp32-ubidots-wifi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthealbertdev%2Fesp32-ubidots-wifi/lists"}