You are using staging server - a separate instance of the ESP Component Registry that allows you to try distribution tools and processes without affecting the real registry.
This project demonstrates the use of multiple sensors integrated into a single device using an ESP32-C6 microcontroller. The sensors included in this example are a light sensor (BH1750) and a pressure sensor (BME280).
ESP32-C6 | BME280 | BH1750 |
---|---|---|
3.3V | VCC | VCC |
GND | GND | GND |
GPIO21 | SDA | SDA |
GPIO22 | SCL | SCL |
GND | SDO |
Clone the repository containing this example.
Navigate to the examples/multisensor_ex
directory.
Update the submodule(s).
Bash
git submodule update --init --recursive
Add sdkconfig.user
in the project root and set the values for your device:
File
CONFIG_MQTT_USER="sensgreen-mqtt-user"
CONFIG_MQTT_PASS="sensgreen-mqtt-password"
CONFIG_MQTT_HOST="sensgreen-broker"
CONFIG_MQTT_PORT="broker-port"
CONFIG_MQTT_TOPIC="sensor/data"
CONFIG_DEVICE_UID="my-unique-device-id"
CONFIG_EXAMPLE_WIFI_SSID="my-wifi-ssid"
CONFIG_EXAMPLE_WIFI_PASSWORD="my-wifi-password"
Monitor the serial output to view the sensor readings:
Bash
idf.py flash monitor --print-filter="app MQTT" -p /dev/ttyACM0
You should observe a similar output to the following on the serial console:
Output
--- esp-idf-monitor 1.6.0 on /dev/ttyACM0 115200
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
--- Print filter: "app MQTT"
I (12218) app: [timeSynced,48] mqtt-client started
I (12698) app: [publishTask,59] {"data":{"humidity":53.419921875,"light":63.33333206176758,"pressure":1010.489990234375,"temperature":25.489999771118164},"deviceEui":"1231231234","timestamp":1748820388730}
I (12708) MQTT: publishing to topic 'sensor/data/925878', data '{"data":{"humidity":53.419921875,"light":63.33333206176758,"pressure":1010.489990234375,"temperature":25.489999771118164},"deviceEui":"1231231234","timestamp":1748820388730}'
I (12748) MQTT: msg_id=15511
This project is licensed under the MIT License. See the LICENSE
file for details.
To create a project from this example, run:
idf.py create-project-from-example "ozanoner/sensgreen-connector=0.1.3:multisensor_ex"