IoT-EXT usage Example
Internet of Things is a very present topic today. We want everything connected and monitored when and where we like. And just like everything, we want to keep it simple. Therefore, we have our SBC-SAMA5D36 IOT_EXT developer kit. It provides ready to use WiFi/Bluetooth connectivity and six I/O connectors that comply with the Grove sensor system from Seeed.
The following article gives a short overview on how to use and customize the product to your own needs.
The dev-kit comes with a preconfigured image and a manual how to set it up. With the image the system can read data from a BMP280, a combined pressure and temperature sensor, and sends them to an Adafruit MQTT broker where the data can be visualized (2).
Over the last few years MQTT became a commonly used protocol especially for Internet of Things solutions. It's a lightweight publish and subscribe system what makes it easy to establish communication between multiple devices. All devices are clients either in the role of a publisher or a subscriber. The "man in the middle" is a MQTT broker which works as a server receiving and filtering messages and deciding who is interested. With topics it is specified where the messages are published. The subscribers subscribe the topics they are interested in so the broker can distribute the messages correctly. MQTT provides three different levels of Quality of Service (QoS), "At most once", "At least once" and "Exactly once". The publisher-broker connection and the broker-subscriber connection can have different QoS-levels. The broker can down- but not upgrade the QoS. (3)
You can build your own, customized, image using buildroot (4), an embedded-linux tool, and our board-support-package as a base (a manual on how to configure buildroot is provided). The BSP contains the 4.9-at91 kernel (5), which supports a variety of other sensors. They can be easily added with just a few minor modifications on kernel and device-tree. Check the .../driver/iio directory in the kernel to see if your sensor driver is provided. If not you can always contact emtrion to enquire a driver, we are happy to help you. If it's already there look up your sensor in the documentation of the kernel for the required changes in the device-tree.
You can just append the entry to the dts-file in the BSP. Execute "make linux-menuconfig" to open the kernel configuration. Navigate to Device Drivers -> Industrial I/O support. Go to your sensor and enable it. Now you are good to go. Execute "make menuconfig" to open the buildroot config. Keep the default settings and close the menu. Execute "make" to start the build. Depending on your machine it will take between 45 and 60 minutes. When the build is finished simply replace the old rootfilesystem with your new one. Reboot the device and your sensor should now be functional.
The emtrion-BSP provides a complete setup to connect with the Adfruit website via MQTT-protocol. You can either use the given test-script and add your sensor. Or write your own software to process your data. Here is a list of MQTT tools you can use (7).
There are also free clients for your phone such as MQTT Buddy (6).
With these few steps you have a simple but useful IoT-solution up and running.
For further information about the SBC-SAMA5D36 IOT_EXT developer kit see: https://www.emtrion.de/de/details_developer-kits/sbc-sama5d36-iot-ext-dev-kit-linux.html