https://github.com/memfault/esp32-standalone-example
https://github.com/memfault/esp32-standalone-example
esp-idf esp32 memfault sample
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/memfault/esp32-standalone-example
- Owner: memfault
- Created: 2023-02-06T21:12:58.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-28T14:01:22.000Z (about 1 year ago)
- Last Synced: 2025-03-28T14:37:03.388Z (about 1 year ago)
- Topics: esp-idf, esp32, memfault, sample
- Language: C
- Homepage:
- Size: 89.8 KB
- Stars: 2
- Watchers: 11
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# esp32 Demo Application
This Demo App is based on the console example from ESP-IDF, which can be found
here relative to the ESP-IDF SDK root folder:
- `examples/system/console/advanced/`
```bash
$ git submodule update --init --recursive
$ echo 'CONFIG_MEMFAULT_PROJECT_KEY="YOUR_KEY"' >> sdkconfig.defaults
# by default, 'idf.py build' will target esp32
$ idf.py build
# flash the board and start the serial monitor
$ idf.py flash monitor
```
Get your project key from https://mflt.io/project-key.
## Configuring for MQTT
This application includes an option to send Memfault data over MQTT. This option requires a few extra pieces to set up.
You can either follow the steps outlined here or use your own MQTT setup.
### Broker Setup
1. Install a local installation of Cedalo by following the [installation guide](https://docs.cedalo.com/management-center/installation/)
2. Login to Cedalo at
3. Create a new client login for the device
- Ensure device client has the "client" role to allow publishing data
4. Create a new client login for the Python service
- Ensure Python service client has "client" role to allow subscribing to data
### Service Setup
1. Modify the script found in [Docs->Best Practices->MQTT](https://docs.memfault.com/docs/best-practices/mqtt-with-memfault#service-examples)
with Memfault with the the following:
1. The service client login information previously created
2. Connection info for your local broker
3. Map of Memfault projects to project keys
2. Start the service by running `python mqtt.py`
### Device Setup
1. Make the following modifications to `main/app_memfault_transport_mqtt.c`:
1. Update `MEMFAULT_PROJECT` macro with your project's name
2. Update `s_mqtt_config` with your setup's IP address, and MQTT client username and password
2. Clean your existing build with `idf.py fullclean && rm sdkconfig`
3. Set your target: `idf.py set-target `
4. Build your image: `idf.py -D SDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.mqtt" build`
5. Flash to your device using `idf.py flash`