Let's first look at how to install the DockerPi series of SensorHub with Raspberry Pi

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 on your raspberrypi,please execute following command:

sudo raspi-config

Then operate following the instruction on the picture

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:

Go to the following directory:


Open the following file:update_twin_reported_properties.py

You will see the source file codes following on the picture:

change to the following codes on the picture:

the HostName...which you could get from the Azure webiste.

Open the file:get_twin.py and do the same:

You also need import some python3 libraries in file update_twin_reported_properties.py :

Then join following codes on the picture,you can also copy and paste on your file:

    bus = smbus.SMBus(1)
    await device_client.connect()
    aReceiveBuf = []
    aReceiveBuf.append(0x00) # 占位符
    for i in range(0x01,0x0D + 1):
        aReceiveBuf.append(bus.read_byte_data(0X17, i))
    if aReceiveBuf[0X01] & 0x01 :
        state0 = "Off-chip temperature sensor overrange!"
    elif aReceiveBuf[0X01] & 0x02 :
        state0 = "No external temperature sensor!"
    else :
        state0 = "Current off-chip sensor temperature = %d Celsius" % aReceiveBuf[0x01]

    light = (bus.read_byte_data(0x17,0x03) << 8) | (bus.read_byte_data(0x17,0x02))
    temp = bus.read_byte_data(0x17,0x05)
    humidity = bus.read_byte_data(0x17,0x06)
    temp1 = bus.read_byte_data(0x17,0x08)
    pressure = (bus.read_byte_data(0x17,0x0B) << 16) | ((bus.read_byte_data(0x17,0x0A) << 8)) | ((bus.read_byte_data(0x17,0x09)))
    state = bus.read_byte_data(0x17,0x0C)
    if (state == 0):
        state = "the sensor of BMP280 is ok"
        state = "the sensor of BMP280 is bad"

    human = bus.read_byte_data(0x17,0x0D)
    if (human == 1):
        human = "live body has been detected"
        human = "no live body"

Then run the file update_twin_reported_properties.py and you will see the result:

Then open the file:get_twin.py and input following codes,you could also copy the codes and paste on your files:

    print("Reported light is: {}".format(twin["reported"]["light"]),"Lux")
    print("Reported temperature of board is: {}".format(twin["reported"]["temperature"]),"degC")
    print("Reported humidity is: {}".format(twin["reported"]["humidity"]),"%")
    print("Reported temperature of sensor is: {}".format(twin["reported"]["temperature1"]),"degC")
    print("Reported pressure of air is: {}".format(twin["reported"]["pressure"]),"Pa")
    print("Reported {}".format(twin["reported"]["state"]))
    print("Reported whether detect live body is: {}".format(twin["reported"]["human"]))

Then run the file get_twin.py and you will see the result which is updated from the file update_twin_reported_properties.py :

you can use this to view the status of your family.