Introduction: Visualizing Wireless Sensor Data Using Google Charts

About: For Remote Supervision

Predictive analysis of the machines is very necessary in order to minimize the downtime of the machine. Regular check up helps in enhancing the duty time of the machine and in turn enhances its fault tolerance. Wireless Vibration and Temperature sensors can help us to analyse the vibration in the machine. We have seen in our previous instructables that how the wireless vibration and temperature sensors served different applications and helped us in fault detection and irregular vibrations in the machine.

In this instructable we will be using Google Charts to visualize the sensor data. Google charts are the interactive way to examine and analyzing the sensor data. It provides us many options like line charts, pi charts, Histogram, multi value charts etc. So, here we will be learning about the following:

  • Wireless Vibration and Temperature Sensors
  • Hardware Setup
  • Gathering the data using Wireless gateway device
  • Vibration analysis using these Sensors.
  • How to make a webpage using ESP32 webserver.
  • Load google charts in the webpage.

Step 1: Hardware and Software Specifications

Step 2: Guidelines to Check Vibration in the Machines

As mentioned in the last instructable " Mechanical Vibration Analysis of Induction Motors ". There are certain guidelines that are to be followed in order to segregate the fault and fault identifying vibration. For the brief rotational speed frequency is one of them. Rotation speed frequencies are characteristic of different faults.

  • 0.01g or Less - Excellent condition - The machine is properly working.
  • 0.35g or less - Good condition. The machine is working fine. No action required unless the machine is noisy. There can be a rotor eccentricity fault.
  • 0.75g or more - Rough Condition- Need to check the motor there can be rotor eccentricity fault if the machine is making too much noise.
  • 1g or more - Very Rough condition - There can be a severe fault in a motor. The fault might be due to bearing fault or bending of the bar. Check for the noise and temperature
  • 1.5g or more- Danger Level- Need to repair or change the motor.
  • 2.5g or More -Severe Level-Shut down the machinery immediately.

Step 3: Getting the Vibration Sensor Values

The vibration values, that we are getting from the sensors are in milis. These consists of the following values.

  • RMS value- root mean square values along all three axes.The peak to peak value can be calculated as
peak to peak value = RMS value/0.707
  • Min value- Minimum value along all three axes
  • Max values- peak to peak value along all three axes. The RMS value can be calculated using this formula
RMS value = peak to peak value x 0.707

  • Earlier when the motor was in good condition we got the values around 0.002g. But when we tried it on a faulty motor the vibration we examined was about 0.80g to 1.29g. The faulty motor was subjected to high rotor eccentricity. So, we can improve the fault tolerance of the motor using the Vibration sensors.

Step 4: Serving a Webpage Using ESP32webServer

First of all we will be hosting a web page using ESP32. To host a webpage we just need to follow these steps:

  • include library "WebServer.h"
#include "WebServer.h"
  • Then initialize an object of Web Server class. Then send a server request to open the web pages at root and other URL's using server.on(). and begin the server using server.begin().
 Webserver server

server.on("/", handleRoot);
server.on("/dht22", handleDHT); server.onNotFound(handleNotFound); server.begin();

  • Now call the callbacks for different URL paths we have stored the web page in SPIFFS. for more on SPIFFS follow this instructable. The "/dht22" URL path will give the value of sensor data in JSON format.

void handleRoot() {
File file ="/chartThing.html", "r"); server.streamFile(file,"text/html"); file.close(); }

void handleDHT(){
StaticJsonBuffer<100> jsonBuffer; JsonObject& root = jsonBuffer.createObject(); root["rmsx"] = rms_x; root["rmsy"] = rms_y; char jsonChar[100]; root.printTo((char*)jsonChar, root.measureLength() + 1); server.send(200, "text/json", jsonChar); }

  • Now create a HTML web page using any text editor, we are using notepad++ in our case. To know more about creating web pages go through this instructable. Here in this web page we are calling google charts API feeding the sensor values to the charts. This web page is being hosted at root web page. You can find the HTML web page code here.
  • In the next step we just need to handle the web server.


Step 5: Data Visualization

Google Charts provides very efficient way to visualize data on your website or static webpages. From simple line charts to complex hierarchical tree maps, the google chart gallery provides a large number of ready-to-use chart types.

Step 6: Overall Code

The firmware for this instructable can be found here.