Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sergiogasquez/thingspeak-example
Simple example built for esp-rust-board that sends temperature and humidity to ThingSpeak.
https://github.com/sergiogasquez/thingspeak-example
esp-rs esp32 esp32c3 espressif iot mqtt rust thingspeak
Last synced: 4 days ago
JSON representation
Simple example built for esp-rust-board that sends temperature and humidity to ThingSpeak.
- Host: GitHub
- URL: https://github.com/sergiogasquez/thingspeak-example
- Owner: SergioGasquez
- Created: 2022-10-05T14:33:08.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-04-20T09:58:21.000Z (over 1 year ago)
- Last Synced: 2024-11-04T11:03:22.519Z (4 days ago)
- Topics: esp-rs, esp32, esp32c3, espressif, iot, mqtt, rust, thingspeak
- Language: Rust
- Homepage: https://thingspeak.com/channels/1882512
- Size: 81.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# ThingSpeak Example
[![Continuous Integration](https://github.com/SergioGasquez/thingspeak-example/actions/workflows/ci.yaml/badge.svg)](https://github.com/SergioGasquez/thingspeak-example/actions/workflows/ci.yaml)
Simple example built for [esp-rust-board](https://github.com/esp-rs/esp-rust-board) that sends temperature and humidity to
ThingSpeak, via MQTT, where it can be [visualized in this dashboard](https://thingspeak.com/channels/1882512).![ThingSpeak Dashboard](static/thingspeak_dashboard.png)
If you want to reproduce this example:
1. [Sign in or create an account](https://thingspeak.com/login?skipSSOCheck=true).
2. [Create a new channel](https://www.mathworks.com/help/thingspeak/channel-settings.html)
1. Add the proper fields (in this case `humidity` and `temperature`)
3. [Create a MQTT Device](https://www.mathworks.com/help/thingspeak/mqtt-basics.html)
1. Make sure you authorize acess to your channel when creating the device.
4. Rename `cfg.toml.example` to `cfg.toml`
5. Fill the `cfg.toml` with
1. `wifi_ssid`: Wifi SSID
2. `wifi_pass`: Wifi password
3. `client_id`: MQTT Client ID
4. `username`: Username of the MQTT Device (It's the same as MQTT Client ID)
5. `password`: Password of the MQTT Device
6. `channel_id`: Channel ID (You can find this info in your channel pannel.)
6. Modify the Field Charts from the dashboard.## Dev Containers
This repository offers Dev Containers supports for:
- [Gitpod](https://gitpod.io/)
- ["Open in Gitpod" button](https://www.gitpod.io/docs/getting-started#open-in-gitpod-button)
- [VS Code Dev Containers](https://code.visualstudio.com/docs/remote/containers#_quick-start-open-an-existing-folder-in-a-container)
- [GitHub Codespaces](https://docs.github.com/en/codespaces/developing-in-codespaces/creating-a-codespace)
> **Note**
>
> In order to use Gitpod the project needs to be published in a GitLab, GitHub,
> or Bitbucket repository.
>
> In [order to use GitHub Codespaces](https://github.com/features/codespaces#faq)
> the project needs to be published in a GitHub repository and the user needs
> to be part of the Codespaces beta or have the project under an organization.If using VS Code or GitHub Codespaces, you can pull the image instead of building it
from the Dockerfile by selecting the `image` property instead of `build` in
`.devcontainer/devcontainer.json`. Further customization of the Dev Container can
be achived, see [.devcontainer.json reference](https://code.visualstudio.com/docs/remote/devcontainerjson-reference).When using Dev Containers, some tooling to facilitate building, flashing and
simulating in Wokwi is also added.
### Build
- Terminal approach:```
scripts/build.sh [debug | release]
```
> If no argument is passed, `release` will be used as default- UI approach:
The default build task is already set to build the project, and it can be used
in VS Code and Gitpod:
- From the [Command Palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) (`Ctrl-Shift-P` or `Cmd-Shift-P`) run the `Tasks: Run Build Task` command.
- `Terminal`-> `Run Build Task` in the menu.
- With `Ctrl-Shift-B` or `Cmd-Shift-B`.
- From the [Command Palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) (`Ctrl-Shift-P` or `Cmd-Shift-P`) run the `Tasks: Run Task` command and
select `Build`.
- From UI: Press `Build` on the left side of the Status Bar.### Flash
> **Note**
>
> When using GitHub Codespaces, we need to make the ports
> public, [see instructions](https://docs.github.com/en/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace#sharing-a-port).- Terminal approach:
- Using `flash.sh` script:```
scripts/flash.sh [debug | release]
```
> If no argument is passed, `release` will be used as default- UI approach:
- From the [Command Palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) (`Ctrl-Shift-P` or `Cmd-Shift-P`) run the `Tasks: Run Task` command and
select `Build & Flash`.
- From UI: Press `Build & Flash` on the left side of the Status Bar.
- Any alternative flashing method from host machine.### Wokwi Simulation
When using a custom Wokwi project, please change the `WOKWI_PROJECT_ID` in
`run-wokwi.sh`. If no project id is specified, a DevKit for esp32c3 will be
used.
> **Warning**
>
> ESP32-S3 is not available in Wokwi- Terminal approach:
```
scripts/run-wokwi.sh [debug | release]
```
> If no argument is passed, `release` will be used as default- UI approach:
The default test task is already set to build the project, and it can be used
in VS Code and Gitpod:
- From the [Command Palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) (`Ctrl-Shift-P` or `Cmd-Shift-P`) run the `Tasks: Run Test Task` command
- With `Ctrl-Shift-,` or `Cmd-Shift-,`
> **Note**
>
> This Shortcut is not available in Gitpod by default.
- From the [Command Palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) (`Ctrl-Shift-P` or `Cmd-Shift-P`) run the `Tasks: Run Task` command and
select `Build & Run Wokwi`.
- From UI: Press `Build & Run Wokwi` on the left side of the Status Bar.> **Warning**
>
> The simulation will pause if the browser tab is in the background.This may
> affect the execution, specially when debuging.#### Debuging with Wokwi
Wokwi offers debugging with GDB.
- Terminal approach:
```
$HOME/.espressif/tools/riscv32-esp-elf/esp-2021r2-patch3-8.4.0/riscv32-esp-elf/bin/riscv32-esp-elf-gdb target/riscv32imc-esp-espidf/debug/thingspeak_example -ex "target remote localhost:9333"
```> [Wokwi Blog: List of common GDB commands for debugging.](https://blog.wokwi.com/gdb-avr-arduino-cheatsheet/?utm_source=urish&utm_medium=blog)
- UI approach:
1. Run the Wokwi Simulation in `debug` profile
2. Go to `Run and Debug` section of the IDE (`Ctrl-Shift-D or Cmd-Shift-D`)
3. Start Debugging by pressing the Play Button or pressing `F5`
4. Choose the proper user:
- `esp` when using VS Code or GitHub Codespaces
- `gitpod` when using Gitpod