Giter Site home page Giter Site logo

esp32c3-no-std-async-mqtt-demo's Introduction

esp32c3-no-std-async-mqtt-demo

This is a simple demo that we will use on the upcoming Espressif DevCon23.

ESP32 variant: https://github.com/JurajSadel/esp32-no-std-async-mqtt-demo

ESP32S3 variant: https://github.com/JurajSadel/esp32s3-no-std-async-mqtt-demo

What it does

The application measures temperature (BMP180) and sends the results to MQTT via WiFi - everything is done asynchronously.

It's async no_std application that uses esp-hal, esp-wifi, and rust-mqtt crates. The main skeleton is made of embassy_dhcp and no_std_temperature_logger with a bunch of changes.

The first change is MQTT part added. We are using MQTTv5. As a broker, we usepublic-mqtt-broker and websocket-client to see the results.

As a next change, we had to make bmp180.rs async.

Build and run

You have to set the SSID and PASSWORD environment variables before building/running the program

cargo run --release

WARN: Be sure you are using release mode!

License

Licensed under either of:

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

esp32c3-no-std-async-mqtt-demo's People

Contributors

jurajsadel avatar mabezdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

esp32c3-no-std-async-mqtt-demo's Issues

ESP32 and ESP32-S3 example

It's very nice example for ESP32-C3.

Please, could you provide also the example for other most common ESP32 chips like plain old ESP32 and ESP32-S3 which are popular in some ePaper based boards?

Porvide instructions how to build

Current version of README does not contain instructions on how to build the project.
Build fails with:

error: environment variable `SSID` not defined at compile time
  --> src/main.rs:49:20
   |
49 | const SSID: &str = env!("SSID");
   |                    ^^^^^^^^^^^^
   |
   = help: use `std::env::var("SSID")` to read the variable at run time
   = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)

error: environment variable `PASSWORD` not defined at compile time
  --> src/main.rs:50:24
   |
50 | const PASSWORD: &str = env!("PASSWORD");
   |                        ^^^^^^^^^^^^^^^^
   |
   = help: use `std::env::var("PASSWORD")` to read the variable at run time
   = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)

Document how to increase the smoltcp DNS max server count

In some routers, the program crashes with the following panic:

I (270) boot: Disabling RNG early entropy source...
start connection task
Device capabilities: Ok(EnumSet(Client | AccessPoint))
Starting wifi
Wifi started!
About to connect...
Wifi connected!
Waiting to get IP address...
 
 
!! A panic occured in '/home/sergio/.cargo/registry/src/index.crates.io-6f17d22bba15001f/smoltcp-0.10.0/src/socket/dns.rs', at line 170, column 49
 
PanicInfo {
    payload: Any { .. },
    message: Some(
        called `Result::unwrap()` on an `Err` value: (),
    ),
    location: Location {
        file: "/home/sergio/.cargo/registry/src/index.crates.io-6f17d22bba15001f/smoltcp-0.10.0/src/socket/dns.rs",
        line: 170,
        col: 49,
    },
    can_unwind: true,
}

The solution was proposed by @MabezDev in #1 (comment):

For my router I also needed to bump the number of DNS servers smoltcp has capacity for with:

# .cargo/config.toml
[env]
SMOLTCP_DNS_MAX_SERVER_COUNT = "3"

Be warned that you have to do a clean build for those changes to take effect, see: rust-lang/cargo#10358

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.