Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

The Matrix Creator: IoT

DZone's Guide to

The Matrix Creator: IoT

Dive into this quick tutorial to setting up and using the Matrix Creator, a multiple sensor adapter, and using a Raspberry Pi to send data to assorted flows.

· IoT Zone ·
Free Resource

The Matrix Creator is an interesting multiple sensor hat that fits on a Raspberry Pi 3.

The first step is to connect it, which is a simple snap, no soldering required.

The specs are pretty impressive:

  • Xilinx Spartan 6 XC6SLX4 FPGA
  • Amtel Cortex-M3 ATSAM3S2 Microcontroller
  • 8 MEMS MP34DB02 audio sensor digital microphones
  • ST LSM9DS1 3D accelerometer, 3D gyroscope, 3d magnetometer IMU
  • ST HTS221 capacitive digital sensor for relative humidity and temperature
  • NXP MPL3115A2 precision pressure sensor with altimetry
  • Silicon Labs EM358X — 2.4 GHz IEEE 802.15.4 Zigbee
  • Sigma Designs ZM5202 — 868/908/921 MHz ZWave
  • Vishay TSOP573 — carrier 38.0 kHz IR Receiver
  • Vishay VEML6070 UV light sensor
  • NXP PN512 NFC reader
  • Everloop 35 RGBW LEDs

It runs on Raspian lite and installs via:

curl https://matrix-io.github.io/matrix-documentation/install.sh | sh

Our Apache NiFi flow for processing the three types of data:

Our versioned Apache NiFi and MiniFi flows:

We tail the three files produced by the three example Python sensor readers:

Both our MiniFi and Apache NiFi flows are very simple and documented above. As Python writes, tail the data from files, then send it from MiniFi to Apache NiFi, which separates the files into different flows for future processing. We could create schemas, convert to JSON, merge the feeds with JSON, and store them in three different data stores or more depending on what you want to do. This can be one on the edge or in Apache NiFi on a cluster. You could have MiniFi or NiFi trigger off specific values or ranges as the need arises. Or, like me, you can just store it for later use in your endless HDFS Data Lake.

Using Three Existing Examples

Getting temperature, UV, and IMU values:

python /home/pi/matrix-creator-malos/src/python_test/test_humidity.py 
nohup ./humidity.sh &
    fh = open("/opt/demo/logs/humidity.log", "a")
    fh.writelines('{0}'.format(humidity_info))
    fh.close
python /home/pi/matrix-creator-malos/src/python_test/test_uv.py 
/opt/demo/logs/uv.log
python /home/pi/matrix-creator-malos/src/python_test/test_imu.py
/opt/demo/logs/imu.log
/Volumes/seagate/Apps/minifi-toolkit-0.3.0/bin/config.sh transform $1 config.yml
scp config.yml pi@192.168.1.197:/opt/demo/minifi-0.3.0/conf

Example Data

imu.2603753-2604002.log

yaw: 141.655654907
roll: 1.66126561165
accel_x: -0.0261840820312
accel_y: 0.0283813476562
accel_z: 0.978576660156
gyro_x: -0.0672912597656
gyro_y: 2.06359863281
gyro_z: 1.33087158203
mag_x: 0.23982000351
mag_y: 0.189700007439
mag_z: -0.480480015278

uv.172512-172528.log
oms_risk: "Low"


humidity.29015-29074.log

temperature: 21.9526348114
temperature_is_calibrated: true


Topics:
iot ,nifi ,minifi ,data lake ,matrix creator

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}