사용 모듈
NodeMCU(ESP8266) [SZH-WFBB-017]
1. Azure IoT Hub 만들기
https://docs.microsoft.com/ko-kr/azure/iot-hub/iot-hub-create-through-portal
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
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
참고 사이트
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