Skip to main content

This is the first look at the DockerPi SensorHub Development Board, this SensorHub is an environmental sensor ideal for IoT. It includes a wealth of sensors: temperature sensors, humidity sensors, air pressure sensors, lighting, and thermal infrared sensors. This article will be divided into two parts, hardware setup, and software setup.

The Hardware Part

To begin with, the hardware part, let's have a look at what is inside the box! We have one SensorHub development board, 4 M2.5x12 copper sticks, 4 pairs of M2.5x6 screws and nuts, one NTC temperature sensor (waterproof).

Inside the box...

20191011_1027231_90e3beabbdf135c17153ec115531a6d8a0b109a1.jpg

Now let's move to the hands-on part. 

First, we have to use the copper sticks and M2.5*6 nuts to set up the SensorHub.

20191011_1028041_1487a8f05f52cdee000603359f8f795bc3d48c45.jpg

And now we attach the SensorHub to the Raspberry Pi, finish as below:

20191011_1031131_08e0acac41023af337f8d2779afb0c91c0d5b6f7.jpg

Then, we secure the Raspberry Pi to the SensorHub, using the 4 M2.5x6 screws.

20191011_1031331_fb194b43279690a5d360f3264e58afb2338af92c.jpg

Finish as below:

20191011_1032171_b285c4558c3b6bd7a121c9f1c5acf4edca7d3b61.jpg

Finally, we have to plug in the NTC temperature sensor 

20191011_103346_e6dfad63a6eb382ef72cb85ff897ac94d840eae5.jpg

Finish as below:

20191011_1034061_c79b822cadaa046ece81718d1ae7e993668320e5.jpg

The Software Part

I created an ep0106.py with the following code on the desktop of my Raspberry Pi, here is the software part.

The program as below

import smbus

DEVICE_BUS = 1
DEVICE_ADDR = 0x17

TEMP_REG = 0x01
LIGHT_REG_L = 0x02
LIGHT_REG_H = 0x03
STATUS_REG = 0x04
ON_BOARD_TEMP_REG = 0x05
ON_BOARD_HUMIDITY_REG = 0x06
ON_BOARD_SENSOR_ERROR = 0x07
BMP280_TEMP_REG = 0x08
BMP280_PRESSURE_REG_L = 0x09
BMP280_PRESSURE_REG_M = 0x0A
BMP280_PRESSURE_REG_H = 0x0B
BMP280_STATUS = 0x0C
HUMAN_DETECT = 0x0D

bus = smbus.SMBus(DEVICE_BUS)

aReceiveBuf = []

aReceiveBuf.append(0x00) # 占位符

for i in range(TEMP_REG,HUMAN_DETECT + 1):
    aReceiveBuf.append(bus.read_byte_data(DEVICE_ADDR, i))

if aReceiveBuf[STATUS_REG] & 0x01 :
    print("Off-chip temperature sensor overrange!")
elif aReceiveBuf[STATUS_REG] & 0x02 :
    print("No external temperature sensor!")
else :
    print("Current off-chip sensor temperature = %d Celsius" % aReceiveBuf[TEMP_REG])


if aReceiveBuf[STATUS_REG] & 0x04 :
    print("Onboard brightness sensor overrange!")
elif aReceiveBuf[STATUS_REG] & 0x08 :
    print("Onboard brightness sensor failure!")
else :
    print("Current onboard sensor brightness = %d Lux" % (aReceiveBuf[LIGHT_REG_H] << 8 | aReceiveBuf[LIGHT_REG_L]))

print("Current onboard sensor temperature = %d Celsius" % aReceiveBuf[ON_BOARD_TEMP_REG])
print("Current onboard sensor humidity = %d %%" % aReceiveBuf[ON_BOARD_HUMIDITY_REG])

if aReceiveBuf[ON_BOARD_SENSOR_ERROR] != 0 :
    print("Onboard temperature and humidity sensor data may not be up to date!")

if aReceiveBuf[BMP280_STATUS] == 0 :
    print("Current barometer temperature = %d Celsius" % aReceiveBuf[BMP280_TEMP_REG])
    print("Current barometer pressure = %d pascal" % (aReceiveBuf[BMP280_PRESSURE_REG_L] | aReceiveBuf[BMP280_PRESSURE_REG_M] << 8 | aReceiveBuf[BMP280_PRESSURE_REG_H] << 16))
else :
    print("Onboard barometer works abnormally!")

if aReceiveBuf[HUMAN_DETECT] == 1 :
    print("Live body detected within 5 seconds!")
else:
    print("No humans detected!")


The program just runs once so we need to type the Linux command to compute it up to every 10 seconds to renew a script.

watch -n 10 python3 ep0106.py


You will find the data shown like this.

resut_836670febd1e2cadd99de4415986ab2681b98706.jpg

Brian0925 has not written a bio yet…
DesignSpark Electrical Logolinkedin