Skip to content

critchards/ESP32-Azure-Iot-Central

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESP32-Azure-Iot-Central

This should allow a generic ESP32 with a DHT11 sensor to connect to Azure Iot Central via MQTT and send temperature and humidity telemetry. Azure IoT Central can be used to toggle the onboard LED on the ESP32 Devboard as well as write messages to the serial monitor via commands.

This was written in VS Code using the PlatformIO extension and the Arduino framework.

Wifi settings and the specific connection string for your Azure IoT Central app should be added to the iot_configs.h file. Note the connection string is generated by provisioning your device. The getting started tutorial from Microsoft suggests using Azure IoT Device Workbench to handle all the Azure IoT Hub setup and device provisioning but it didnt work for me. I had to use a stand alone tool to create the connection string from the user supplied scope-id, device-id and primary-key using the dps-keygen tool found here https://github.com/Azure/dps-keygen.

Further details on how to provision with different approaches are found here, https://github.com/Azure/azure-iot-device-ecosystem/blob/master/setup_iothub.md#create-new-device-in-the-iot-hub-device-identity-registry

platformio.ini was modified to include necessary libraries and build flags. Thank you to https://github.com/maxgerhardt/pio-azure-iot-arduino-demo for providing details

This code was originally taken from https://github.com/lzyms/ESP32IoTCentral, and appears to be in alignment with the current getting started guide for ESP32 on Azure Samples at https://github.com/Azure-Samples/esp32-iot-devkit-get-started

Many changes were made

Instructions

  1. Plug in a DHT11 with data pin connected to GPIO19 (or another but you will need to change the code)
  2. Download and unzip the repo
  3. Open the unzipped folder in VS Code with the platformio extension installed
  4. Update iot_configs.h with your WiFI credentials and connection string (you get this from setting up your Azure IoT Central App and provisioning a device)
  5. Try compiling, lots of warnings, but we live life on the edge
  6. Upload and open the serial monitor. You should see messages about connecting to Wifi, to Azure IoT and then every 10 seconds about an attempt to send data
  7. Messages should be available in your Azure Iot Central app now

About

Testing an ESP32 devboard on Azure Iot Central

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published