Firstly,let us look how to install it to raspiberrpi
It is very easy to install,you just need to insert their 40pin pins into it.
Please turn off the power when you are installing them.
Above all,please open the I2C.
sudo raspi-config
Secondly,you need to check your python3's version,it needs to be 3.7 or above.Or,you need to update your python3's version:
python3 --version
Then you need to install the Azure relevant components.Be careful,you must use the command which include the "python3":
pip3 install azure-iot-device
Next you need to check whether you have already installed the tool of git,if you have installed the git,please execute the following commands:
git clone https://github.com/Azure/azure-iot-sdk-python --depth=1
Go to the following directory:
~/azure-iot-sdk-python/azure-iot-device/samples/advanced-hub-scenarios
Then open the file:update_twin_reported_properties.py and add some codes:
Change to the following codes on the picture:
the HostName...which you could get from the Azure webiste.
Then add some codes following on the picture:
Next,execute by the python3 in terminal.
Open the Microsoft Azure,please choose the device _twin and open it like the picture showing:
You will see the phenomenon on the picture:
Of course,we can do the same operation to open other Relays:
From the codes we can know we could use to transmit "5" to shutdown all the Realys:
At the same time,you could see all the Relay's LED has been turned off.