Skip to content

ThingsBoard demo for Industruino

Manage your Industruino devices with this open-source IoT platform

gemma

Published January 31, 2023

Original author: TomOriginal source (new tab)

ThingsBoard demo for Industruino

Components

Hardware components Software Apps and online services

x 1


Project description

ThingsBoard demo for Industruino
ThingsBoard demo for Industruino

Serial Monitor on the left shows the output when the Industruino is successfully connected to Thingsboard. It sends the dummy data every 3 seconds, and receives the RPC instructions.

The [SDK] messages are printed by the Thingsboard library so you need to modify this to SerialUSB for use with Industruino.

The Industruino shows the last instruction of the control knob, and the LCD backlight.

 

ThingsBoard demo for Industruino

This is the sketch for the Industruino D21G, be sure to modify your TOKEN. It uses the unique MAC address stored in the RTC chip, and gets an IP address via DHCP.

/*
  Basic Thingsboard example for Industruino D21G

  Industruino PROTO or INDIO with Ethernet module
  > upload this sketch after modifying your own TOKEN (different from below industruino_test1)
  > the sketch creates 2 random data streams temperature/humidity
  > the sketch receives instructions from the dashboard: lcd backlight on/off and analog knob value

  Thingsboard.io:
  > create an account on live-demo
  > create a device 'industruino' with credentials: unique access token (different from below industruino_test1)
  > create a dashboard
  > edit dashboard, click on 'entity aliases', add alias: name 'industruino', filter type 'single entity', type 'device', device 'industruino'
  > go back to device > latest telemetry > watch the 2 values for humidity and temperature being updated
  > device > latest telemetry > check box of 1 value and click 'show on widget' to add to your dashboard
  for RPC (remote procedure calls)
  > manually add switch and knob, and attach the functions in tab 'advanced'
  switch: RPC set value method = example_set_switch
  knob: set value method = example_set_dial, and get value method = example_get_dial (requires modifying Thingsboard.cpp, comment out lines 183-185 "params" check)
*/

#include <SPI.h>              // for Ethernet
#include <Ethernet2.h>        // Industruino version of Ethernet2
#include <Wire.h>             // for RTC MAC
byte mac[6] ;                 // use Industruino unique MAC
EthernetClient ethClient;

#include "ThingsBoard.h"
#define TOKEN               "industruino_test1"   // TO BE REPLACED BY YOUR OWN TOKEN
#define THINGSBOARD_SERVER  "demo.thingsboard.io"
ThingsBoard tb(ethClient);

#include <UC1701.h>           // LCD screen
static UC1701 lcd;

Comments

Comments