image of raspberry pi

IoT Data Acquisition Using the Record Evolution Platform with MCC DAQ HAT 118

This tutorial guides you through the steps of connecting an MCC 118 board with a Raspberry Pi 4 and the Record Evolution platform to read and extract measurement data. In just a few steps, you set up a foundation for IoT data acquisition.  

Here are the steps:

  1. Connect the MCC DAQ HAT 118 to a Raspberry Pi
  2. Connect the device to the Record Evolution Platform
  3. Build the app Data Logger MCC 118 onto the device
  4. Start collecting data

For more information on MCC DAQ HAT 118, see here

To retrieve the Data Logger MCC 118 app from the Record Evolution app store, see here: https://studio.record-evolution.com/en/apps/Data_Logger_MCC_118

Connecting MCC 118 to Raspberry Pi to measure analog voltage

It’s that simple: The MCC 118 header plugs into the 40-pin GPIO connector on Raspberry Pi. 

Details about MCC 118

The MCC 118 is a voltage measurement DAQ HAT (Hardware Attached on Top) board made for use with Raspberry Pi. A HAT is an add-on board with a 40W GPIO (General Purpose Input/Output) connector conforming to the Raspberry Pi HAT specification. The MCC 118 HAT provides 8 single-ended (SE) analog inputs for voltage measurements.

Any analog sensor, e.g. temperature, sound, etc., can be used on the board. You can stack up to eight MCC HATs onto one Raspberry Pi. However, the onboard jumpers must be set in order to allocate the address to the MCC HATs.

For more information on MCC 118, see the product specifications.

Details about Raspberry Pi

Raspberry Pi is a tiny single-board computer. When used as an IoT device, Raspberry Pi offers a cost-efficient way to collect data. This is why we use Raspberry Pi as our default R&D device to acquire analog voltage data from the MCC 118 device with the help of an IoT app that is installed on the Raspberry Pi.

For more information on Raspberry Pi 4, see here.

So to continue, you simply need to put the MCC 118 board onto a Raspberry Pi as shown below:

MCC 118 connected to a Raspberry Pi
Image 1. The MCC 118 connected to a Raspberry Pi 4

You install the 2×20 receptacle with extended leads onto the Raspberry Pi GPIO header by pressing the + portion of the receptacle onto the header pins. Make sure you don’t bend the leads of the receptacle.

Connecting to the Record Evolution platform for IoT & AI

Next, you need to connect the Raspberry Pi to the Record Evolution platform and bring it online. This is how you create the foundation for accessing and controlling the MCC 118 device via the Record Evolution platform

In what follows, we will go through the following steps:

  • Format/flash an SD card
  • Connect your Raspberry Pi to the Record Evolution platform
  • Bring your Raspberry Pi online
  • Install an IoT app on the Raspberry Pi

This is what you need:

  • An MCC 118 device
  • A Raspberry Pi single-board computer (preferably a Raspberry Pi 4) 
  • An SD card (8 GB or higher)
  • A Windows or a Mac computer with internet access 
  • Power supply

You may also want to use a self-powered USB hub.

To trace the process, sign up or log into the platform. 

Forming a device swarm and establishing a connection

From your homepage on the platform, go to Devices and click on ADD DEVICE SWARM to create your device management environment:

image showing user homepage with device swarms
Image 2. User homepage with device swarms

To build your own swarm, go to Devices and click ADD DEVICE SWARM.

A swarm is your basic, compact, fully autonomous IoT device management environment on the Record Evolution platform. A swarm consists of a set of IoT devices, all device and device group settings, as well as the privilege structure specific to the assets of that swarm.

To add a new device, enter your newly created swarm and select NEW DEVICE from the menu. The first step is to create a virtual device on the platform:

retrofitting: adding a virtual device to the platform
Image 3. Adding a virtual device to the swarm

Once you have created your virtual device, you may add it to a device group. See here for details.

To equip your physical device with the necessary system and configuration for the platform, you need to prepare and set up an individual SD card for that device.

The flashing process

To do that, download the Record Evolution Reflasher. This desktop app enables you to create bootable configured flash drives and is available for Windows, Linux, and macOS. If adding a device for the first time, you will trigger an automatic download of the Reflasher.

Now install the app on your computer and simply follow the instructions to go through the flashing process. Click on FLASH / FLASH ALL to continue. The app allows you to flash and configure multiple devices at once:

The first steps towards retrofitting in brownfield scenarios: making devices ready for the internet of things.
Image 4. A snapshot of the flashing process

Once done, remove the SD card from the card reader. Insert the SD card into the Raspberry Pi and power the device:

Image 5. Insert the SD card into the device

Once the device has booted successfully from the flashed SD card, it will try to connect to the platform. Connecting may take several minutes after the very first boot of your device. Go to your device swarm and see if the device icon has turned green. If yes, that means your device is online.

On the IoT platform, you can connect to any Docker-capable device running on Linux from any location using a simple secure internet connection. For details on how to connect an IoT device, see here

To learn more about the Record Evolution Reflasher, see here

Build the Data Logger MCC 118 app on the device

This app will take care of everything including the configuration of the MCC 118 device. Once built, the app can be run and the data can be collected either as a wave or binary files. This way, the collected data makes it to the cloud and lands directly in the IoT cloud platform where it is ready for further processing and advanced analytics.

Using this IoT application, you make voltage measurements of the MCC DAQ HAT channels and publish/log the data. The app continuously acquires blocks of analog input data for a user-specified group of channels and writes it into a user-specified file format.​

Writing the data to a file

Depending on the parameter settings below, the data is written as a file into the configured folder. The data written to the file can be either of binary or wave format. Wave files are playable and written separately for each channel.

The binary file is written with an npz extension and contains important environmental variables as metadata. The metadata is saved under the params_mcc118 section whereas the sound data is saved under the data_mcc118 section. Below is an example of reading data from the binary file written by the app:

Installing the app

To use the app on the Raspberry Pi, simply retrieve the app (https://studio.record-evolution.com/en/apps/Data_Logger_MCC_118) from the Record Evolution app store and click on Install:

MCC logger app in app store
Image 6. The MCC 118 logger application in the Record Evolution app store

From the dropdown menu, select the connected devices on which you want to install the app:

dropdown menu to install app on device
Image 7. Install logger app on your device

Once you hit Install, the device will start downloading the app. You will be redirected to your device swarm where you can observe the app status in the device settings:

image showing the app installed and running on device
Image 8. App installed and running on the device

To set up the device with your MCC DAQ HAT, you can also provide some parameters. To do so, go to your device swarm and pick the device group containing your Raspberry Pi.

In the group settings, click on the environmental variables and provide the environmental variables indicated in the app’s Readme file at https://studio.record-evolution.com/en/apps/Data_Logger_MCC_118. If no environmental variables are provided, default values are used.​

A note for developers

To develop and build the app, we are creating a Docker image you can run on the device. Detailed information about the installation of MCC DAQ HAT can be found in this Git repository.  

So that’s it! If curious, explore the Record Evolution platform here or get in touch to book a demo. 

Record Evolution Logo

About Record Evolution

We are a Data Science & IoT team based in Frankfurt am Main, committed to helping companies of all sizes to innovate at scale. So we’ve built an easy-to-use development platform enabling everyone to benefit from the powers of IoT and AI.