April 2020
The ThingsBoard IoT Platform supports HTTP, MQTT, and CoAP APIs. It has a rich set of features including a Dashboard, Rule Engine (node flow based), and Trendz Analytics. You can sign up for a free Community Edition subscription to test it out on an unlimited number of devices. A Live Demo Server is available for sandbox testing.
ThingsBoard provides an online live demo server, but in order to use it for a commercial application, you need to install the ThingsBoard software on a local server, or a cloud based server such as Azure, Google Cloud, AWS, etc.
Begin by creating a free personal account on the ThingsBoard live demo server. After you login, click on the 'Devices' tab and then on the + link at the bottom right to 'Add new item'. Choose 'Add new device', then enter any name for the device, 'default' for 'Device type', an otpional 'Label', don't check the 'Is gateway' box, and optionally add a description. Click the 'Add' button to complete adding a device. In the list of devices, find the device you just added (by name) and click on the name to see the device details. Click on the 'COPY DEVICE ID' and 'COPY ACCESS TOKEN' buttons to get the values and paste them in a Notepad or other text editor for now. Note that ThingsBoard uses the ACCESS TOKEN to determine the link between a received POST and a device. Close the device details for now, but don't logout or close the window.
Configure your Particle device to publish an event with a numerical floating point value to the Particle Cloud using the Particle.publish() command within a timer (abbreviated code reference shown below). General information about creating a Webhook can be found on my Particle software details page.
const byte ADCbits = 12; // Argon, Boron, Xenon have 12-bit ADC
unsigned int A0ADC = analogRead(A0);
double A0V = (A0ADC * (3300.0 / (double(pow(2,ADCbits)))))*1.0/1000.0;
iResult = Particle.publish("batt_a_vdc", String::format("%.2f",A0V), PRIVATE);
Verify that the event is being published by visiting the Particle console events page. Go to the Particle integrations page and click on the link for NEW INTEGRATION. Choose the Webhook option, and then enter the event name you chose in your Particle device code (same as what appears under name in the Particle console events page. The URL should be of the format shown below, but replacing '$ACCESS_TOKEN' with your ThingsBoard access token.
https://demo.thingsboard.io/api/v1/$ACCESS_TOKEN/telemetry
The Request Type should be 'POST' and the Request Format should be 'JSON'. Under Device choose your device from the list. Click on 'Advanced Settings' and for 'JSON DATA' choose the 'Custom' radio button option. Enter the following in the numbered text area field:
{
"voltage":{{{PARTICLE_EVENT_VALUE}}}
}
You may replace "voltage" with whatever label you wish to pass to ThingsBoard.
Click the 'SAVE' button at the bottom of the web page. After the page is refreshed, scroll down to the bottom of the page to the 'LOGS' section and watch for activity. Hopefully you will see a green check with a date/time stamp indicating a successfull Webhook communication with ThingsBoard, otherwise you will see a red X. Click on the log to see more information.
If the Particle logs indicate communication with ThingsBoard was successful, go into your ThingsBoard, click on 'Device', and look at the 'Telemetry' log to see the last value received from the Particle Cloud.
Connect your device to a widget, and add it to a new dashboard to create a visualization of your data.
Particle Photon code to send sensor data via MTTQ directly to ThingsBoard
bytesofgigabytes.com Thingsboard Tutorial
Do you need help developing or customizing a IoT product for your needs? Send me an email requesting a free one hour phone / web share consultation.
The information presented on this website is for the author's use only. Use of this information by anyone other than the author is offered as guidelines and non-professional advice only. No liability is assumed by the author or this web site.