All Projects → andriyadi → AzureIoTHubMQTTClient

andriyadi / AzureIoTHubMQTTClient

Licence: other
Azure IoT Hub client for ESP8266 using MQTT

Programming Languages

C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language
CMake
9771 projects

Projects that are alternatives of or similar to AzureIoTHubMQTTClient

thingspeak-esp-examples
ESP8266 / NodeMCU Examples for https://ThingSpeak.com
Stars: ✭ 76 (+192.31%)
Mutual labels:  esp8266
dirty-leds
Music reactive WS2812b LEDs with an ESP8266
Stars: ✭ 24 (-7.69%)
Mutual labels:  esp8266
docker-esp-sdk
Executable docker image to easily compile and flash for the ESP32 and ESP8266
Stars: ✭ 30 (+15.38%)
Mutual labels:  esp8266
LetsHack
Notes & HowTo's covering the Raspberry Pi, Arduino, ESP8266, ESP32, etc.
Stars: ✭ 37 (+42.31%)
Mutual labels:  esp8266
thermomat
Low cost smart home IOT heating with adapted eq3n and esp8266-07. Server, Webapp and ESP8266 code for autonomous thermostat controling over the internet.
Stars: ✭ 17 (-34.62%)
Mutual labels:  esp8266
ESPHome-Air-Quality-Monitor
ESPHome configuration for a DIY indoor air quality monitor for CO₂ concentration, PM2.5 and PM10 concentrations, and temperature, humidity and pressure
Stars: ✭ 42 (+61.54%)
Mutual labels:  esp8266
esp8266-dht22
ESP8266 Lua script running on NodeMCU firmware which sends DHT22 data to web server, with deepsleep mode
Stars: ✭ 14 (-46.15%)
Mutual labels:  esp8266
PCF8575 library
Library to use i2c digital expander with arduino, esp8266 and esp32. Can read write digital value with only 2 wire (perfect for ESP-01).
Stars: ✭ 28 (+7.69%)
Mutual labels:  esp8266
esp8266-upy
MicroPython Cross-platform Drivers - collection of code, wiring and sample for various breakout boards - Works with ESP8266, Pyboard, PYB405, Wemos, etc))
Stars: ✭ 36 (+38.46%)
Mutual labels:  esp8266
split-flap
code for split-flap display
Stars: ✭ 141 (+442.31%)
Mutual labels:  esp8266
WemosD1 HomeMatic RFID
RFID Reader integration for HomeMatic house automation
Stars: ✭ 18 (-30.77%)
Mutual labels:  esp8266
esphome-components
ESPHome components
Stars: ✭ 62 (+138.46%)
Mutual labels:  esp8266
supla-arduino
SuplaDevice library for Arduino IDE that helps you build your own IoT device based on ESPx and Arduino Mega boards.
Stars: ✭ 25 (-3.85%)
Mutual labels:  esp8266
ADEM
Mobile device for distributed measurements of particulate matter (fine dust)
Stars: ✭ 12 (-53.85%)
Mutual labels:  esp8266
OTGW-firmware
A ESP8266 devkit firmware for the Nodoshop version of the Opentherm Gateway (OTGW)
Stars: ✭ 88 (+238.46%)
Mutual labels:  esp8266
esp8266 homekit temp
Small project to send data from a temperature sensor connected to an esp8266 to a HomeKit server, running on a Raspberry Pi.
Stars: ✭ 38 (+46.15%)
Mutual labels:  esp8266
WiFiSpiESP
SPI Slave for ESP8266 module
Stars: ✭ 94 (+261.54%)
Mutual labels:  esp8266
LibTeleinfo
Librairie Universelle Teleinformation (TIC)
Stars: ✭ 77 (+196.15%)
Mutual labels:  esp8266
CloudMyIp
Know your router public IP address, from anywhere. Great for cheap routers or IP cameras.
Stars: ✭ 38 (+46.15%)
Mutual labels:  esp8266
esp8266-workshop
2015-09-21 s4a 在松山工農舉辦的 ESP8266 Workshop 範例程式
Stars: ✭ 33 (+26.92%)
Mutual labels:  esp8266

AzureIoTHubMQTTClient

It's unofficial Azure IoT Hub client library for ESP8266. The main class AzureIoTHubMQTTClient extends PubSubClient class in order to access Azure IoT Hub using MQTT protocol.

PubSubClient I use is the one that's optimized for ESP8266, and I included all classes into this project to ease the pain, hope it's OK. I also use NTPClientLib to get current timestamp from NTP server, and use the timestamp to determine the SAS token expiration time. All needed classes are also included in this repo.

I try to write the client library to be as familiar as possible. I name the method sendEvent instead of publish, so it's similar as another Azure IoT Hub client library. If you're familiar with MQTT, you know you should use topic in order to publish payload to MQTT broker. But since the MQTT topic used to publish message to Azure IoT Hub cannot be arbitrary, library sets it for you.

Why?

You know how hard/cryptic Azure IoT Hub client library for Arduino (and ESP8266) is, right? Well, at least to me. It's written in C (remember the song?).

Hey, Azure IoT Hub already supports MQTT protocol since the GA, doesn't it? Why don't we just access it using MQTT? Yes, you can, go ahead and deal with that SAS token :)

I took a liberty to write an easy to use class AzureIoTHubMQTTClient, all you need to provide are:

  • Azure IoT Hub name --> the name you use to create the IoT Hub
  • Device ID --> the ID you use to register a device, either via DeviceExplorer or iothub-explorer
  • Device Key --> the primary key that you can get using DeviceExplorer app or using iothub-explorer get "[device_id]" --connection-string

Get started

First thing first, you should have already set up an Azure IoT Hub and add a device. To create your Microsoft Azure IoT Hub and add a device, follow the instructions outlined in the Setup IoT Hub Microsoft Azure Iot SDK page. Then, download this library and add to your Arduino IDE like usual. Along with that, you also need to install following dependency libraries, either manually or via Library Manager:

To get started, just take a look the example TempToIoTHub.ino sketch. Change the followings:

  • [YOUR_SSID_NAME] and [YOUR_SSID_PASS] to connect to WiFi
  • [YOUR_IOTHUB_NAME]
  • [YOUR_DEVICE_ID]
  • [YOUR_DEVICE_KEY]

Upload the sketch to your ESP8266 board. I'll recommend to use the ESP8266-based dev board designed by my team: ESPectro, it will make your maker life easier :P

And after that, (hopefully) you're good to go. Hey, would be great if you can connect a temperature sensor as the sketch is about reading temperature data and publish it to Azure IoT Hub. I use BMP180 and Adafruit's BMP085/BMP180 library. You can change #define USE_BMP180 from 1 to 0 if you don't have the sensor and let the random on your side.

Or... get a PlatformIO-based sample project from here

Enjoy!

Credits

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].