Support for Industruino PROTO

Prototyping with small maker boards is fun and things can be implemented really quickly. And maker boards such as Arduinos and ESPs are not only suitable for fun projects, but also for seriuos use cases. However, sometimes support for suitable enclosures, especially with water or dust protection is missing - or the ability to mount boards in industrial boxes. Furthermore, industrial environments often come with 12V or 24V supply, whereas maker boards run on 3V, and need supply of typically 3-9 V. So we're in need of additional components, or a complete solution instead.

Industruino is an Arduino-compatible board in a DIN-rail mountable case, with quite some interesting features. Inside is an Atmel SAMD21G18 microcontroller with 48MHz, 256KB Flash and 32KB of SRAM. It has on onboard LCD with backlight and three buttons, so it's possible to build interactive menus. For small data storage, it contains a 1KB EEPROM, so configuration or state data can be stored there. Thanks to a built-in power regulator, it can be powered with anything between 8V and 28V on the VIN pin - great for putting it in a fuse box with a 24V power supply. Programming is done via USB, using the Arduino IDE. It has 17 digital I/O pins in total, 12 of which can be used as analog inputs. 12 pins are PWN-capable.

Industruino PROTO

The Industruino PROTO

There are two versions of the Industruino: The PROTO is suited for electronical prototyping, because its baseboard has a large proto area for custom components to fit in. The Industruino IND.I/O is already populated with isolated circuits to measure and control voltages/currents. This post is going to be abotu the PROTO, and how to program it.

This post is an excerpt of a screen cast series, consisting of 6 parts about the Industruino, how to program it, about REST and the Web Thing API. You can find it at my page at PATREON:

Patreon

patreon.com/aschmidt75 for screencast/video tutorials

Connectivity

Industruino is already great for programming custom I/O logic, but communication with the outside world is very important in an IoT solution. Luckily, there are companion modules to bring in connectivity. The Industruino Ethernet module is one of them, makeing it really easy to implement networking on it. And it has more features, it also includes 8KB of FRAM (non-volatile), and Micro-SD card slot. So data logging is easy. Both module are connected over an IDC expansion port adapter, so they need to be placed next to each other:

Industruino PROTO

Industruino Ethernet module

Module support

The Industruino is programmed using the Arduino framework and the Arduino IDE. For a REST API and an Web Thing Device implementation, most of the libraries such as ArduinoHTTPServer and ArduinoJSON are reusable. However, Industruino comes with its own Ethernet Library, and we'd need an additional library for controlling the LCD display. So it has been time for a new module :)

Generate a sample Web Thing API

Open a new browser with with THNG:STRUCTIONs app. It starts with "Create a new Thing Description". For simplicity, start from a pre-defined template and select "Humidity Alerter" from the first dropdown, then click "Create from" to create a new Thing Description from this template.

The next screen shows available code generation modules. From the "available" section, locate the "industruino" chip and click on it. The lower list of available generators should display the Industruino module:

Iindustruino Module

THNG:STRUCTION code generation module

Select the module. The upcoming app steps lead through the definition of properties, actions and events, which are already filled out by the template. Click through the "Generate" section to generate the code artifacts. What comes back is a table with code parts which can be viewed and/or downloaded:

  • the Thing Description,
  • the main sketch sketch.ino containing setup/loop, networking, http, json processing, Web Of Things processing,
  • an app.cpp skeleton, with empty callbacks to be implemented. These are called back by HTTP processing functions.
  • a README markdown document with instructions on how to get the code up and running in the Arduino IDE, and
  • a LICENSE document. (it's all public domain)

Run sketch on an industruino.

Download sketch.ino and app.cpp. Open the Arduino IDE, select "Board > Boards Manager" from the menu, search for "Industruino" and install the most recent version. Select "Sketch > Include Library" from the menu and add the following libraries to your project. If not present, these libraries can be searched for within the Library Manager (Sketch > Include Libraries > Manage Libraries) and installed:

Open a new sketch and copy/paste the contents of sketch.ino into the main sketch, the click on "New tab" under the right drop down field (in editor window), and open a new tab named app.cpp. Add the contents of the downloaded app.cpp to it. Connect your Industruino to USB and Ethernet, Build and upload the sketch to the Industruino board. After booting, the display should show the networking configuration with an IP address etc.

Testing it using curl like so yields the Thing Description:

$ curl http://--IP-OF-YOUR-DEVICE--/wot/ | jq
{
  "name": "HumidityAlerter",
  "type": "thing",
  "description": "Measures Humidity and compares it against defined thresholds.",
  "properties": {
    "Humidity": {
      "type": "Integer",
      "description": "Humidity in [%]"
    }
  },
(...)

Great, the Web Thing API is alive! Now maybe curl is not everybodies favourite tool, but the blog post on testing with Postman shows a viable alternative.

Attaching a BME280

If you have an BME280 temperature/humidity sensor at hand, try connect it the Industruino's I2C port. Its on the top pin row, D2=SDA, D3=SCL, 3.3V and GND pins are available as well. This gist is the application part for reading humidity from the BME280. You might need to include the Seeed_BME280 library into the Arduino IDE to compile this.

All details on patreon.

If you want to know more about Industruino, how to program it, about the Web Thing API and Mozillas Project Things, please have a look at my page at PATREON. The whole industruino setup is recorded in 6 parts, available for free. I hope you find it useful and start prototyping for Industrial use cases.