NodeMCU와 Azure iot-Hub 연결

사용 모듈

NodeMCU(ESP8266) [SZH-WFBB-017]

 

 

 

1. Azure IoT Hub 만들기

https://docs.microsoft.com/ko-kr/azure/iot-hub/iot-hub-create-through-portal

 

Azure Portal을 사용하여 IoT Hub 만들기

Azure Portal을 통해 Azure IoT Hub를 만들고 관리하고 삭제하는 방법입니다. 가격 책정 계층, 보안, 배율 및 메시징 구성에 대한 정보가 포함됩니다.

docs.microsoft.com

2. 디바이스 새로 등록 후 기본 문자열 복사

 

 

3. Arduino IDE를 열고 NodeMCU를 컴퓨터와 연결

 

4. 필요한 라이브러리를 설치

 

- AzureIoTHUb

- AzureIoTUtility

- AzureIoTProtocol_MQTT

- ArduinoJson

- DHT sensor library

 

 

 

5. 예제 불러오기

파일>예제>AzureIoTHub>iothub_II_telemetry_sample

 

iot_configs.h 에 복사했던 기본 문자열 붙여넣고, 와이파이 이름, 비밀번호 수정

 

 

 

6. Arduino.h, platform.txt 파일 수정

https://github.com/Azure/azure-iot-arduino

 

Azure/azure-iot-arduino

Azure IoT library for the Arduino. Contribute to Azure/azure-iot-arduino development by creating an account on GitHub.

github.com

7. 에러 : exec: "{runtime.tools.python.path}/python": file does not exist

 

해결>>

/esp8266/tools 의 python3 를  복사하여 python으로 수정 

 

 

8. 컴파일, 업로드

 

메세지는 VS Code를 해 확인할 수 있음

https://docs.microsoft.com/ko-kr/azure/iot-hub/iot-hub-vscode-iot-toolkit-cloud-device-messaging

 

VSCode 용 Azure IoT 도구를 사용 하 여 IT 허브 메시징 관리

디바이스-클라우드 메시지를 모니터링하고 클라우드를 Azure IoT Hub의 디바이스 메시지로 보내기 위해 Azure IoT Tools for Visual Studio Code를 사용하는 방법을 알아봅니다.

docs.microsoft.com

 

 

 

 

참고 사이트

https://www.thingforward.io/techblog/2018-05-22-connecting-nodemcu-to-microsoft-azure-iot-hub-part-1.html

https://github.com/Azure/azure-iot-arduino#simple-sample-instructions

https://github.com/Azure/azure-iot-pal-arduino/blob/master/build_all/README_template.md

 

728x90