Espressif offers a wide range of fully-certified Wi-Fi & BT modules powered by our own advanced SoCs. For more details, see Espressif Modules.
Azure cloud is one of the most wonderful clouds that collects data from lots of devices or pushes data to IoT devices. For more details, see Azure IoT Hub.
This demo demonstrates how to firstly connect your device (ESP devices or IoT devices with ESP devices inside) to Azure, using MQTT protocol, then send data to Azure as well as receive message from Azure.
Main workflow:
- An ubuntu environment should be set up to build your demo;
- Any ESP device can be used to run your demo.
- Get iothub connection string (primary key) from the Azure IoT Hub, which will be used later. An example can be seen below:
HostName=yourname-ms-lot-hub.azure-devices.cn;SharedAccessKeyName=iothubowner;SharedAccessKey=zMeLQ0JTlZXVcHBVOwRFVmlFtcCz+CtbDpUPBWexbIY=
- For step-by-step instructions, please click here.
- Install Node.js;
- Install iothub-explorer with command line
npm install -g iothub-explorer
.- If failed, please check here for more information.
- If succeeded, please check the version information with the command lines below:
$ node -v
v6.9.5
$ iothub-explorer -V
1.1.6
After that, you should be able to use iothub-explorer to manage your iot-device.
- login with the iothub connection string (primary key) you got earlier with command lines;
- create your device, and get a device connection string. An example can be seen:
"HostName=esp-hub.azure-devices.net;DeviceId=yourdevice;SharedAccessKey=L7tvFTjFuVTQHtggEtv3rp+tKEJzQLLpDnO0edVGKCg=";
For detailed instruction, please click Here.
- AZURE-SDK can be implemented to connect your ESP devices to Azure, using MQTT protocol.
- Espressif SDK
- For ESP32 platform: ESP-IDF
- For ESP8266 platform: ESP8266_RTOS_SDK
This repo uses Git Submodules for its dependancies. To successfully clone these other repositories, after cloning this repo, use the following command in the root:
git submodule update --init --recursive
- Go to
make menuconfig
->Example configuration
to configure your Azure IOT Hub Device Connection String, Wi-Fi SSID and Password; - Go to
make menuconfig
->Serial flasher config
to configure you serial port.
If failed, please:
- make sure your ESP device had connected to PC with serial port;
- make sure you have selected the corrected serial port;
- command
> sudo usermod -a -G dialout $USER
can also be used.
- command
To monitor the device output while running, run
make monitor
To exit the monitor, hit Control-]
You can also run the build and monitor in onte step and run with multiple compiler threads:
make -j4 flash monitor
This will build with four concurrent build processes to take advantage of more cores on your workstation.
Please check results on both the iothub and device side:
- iothub: log into iothub-explorer, and monitor events with command
iothub-explorer monitor-events yourdevice --login 'yourprimarykey'
- ESP device: monitor events with command
make monitor
ESP device would send data to the Azure cloud, and then you would be able to receive data at the iothub side.
-
Some common problems can be fixed by disabling the firewall.
-
You can try with the followings, if your build fails:
- git submodule init
- git submodule update
- export your compiler path
- export your IDF path
- get start from Here
-
Make sure the device connection string you are using, which you get from Azure IoT Hub, is correct.