Skip to main content

▷ Data visualization: of Temperature, Humidity, and CPU Temp.

 


For this post, two sensors have been deployed for real-time data collection, currently operational in the city of Guayaquil: one for humidity and another for temperature. Both sensors utilize LoRA technology to transmit collected information to a Gateway. This Gateway serves as a central connection point, receiving data from the sensors and forwarding it to the Google Cloud platform via LTE cellular connectivity.

Leaflet viewer with OpenStreetMap

Leaflet viewer with OpenStreetMap


Once the data is stored on the Google Cloud platform, a customized web interface has been developed. This interface facilitates the visualization and analysis of the sensor-collected data, offering users a clear and easily accessible representation.

In this post, we'll explore how to visualize real-time data from Google Cloud using JavaScript and the powerful charting library, Chart.js. The goal is to create an interactive environment that visually and dynamically displays valuable information.

The code we're showcasing is an exciting introduction to real-time data visualization. The first thing you'll notice is that the web page has a striking title, 'Real-time Data Visualization,' which sets the main purpose of the page.

The body of the page contains a chart canvas <canvas> and a 'Download CSV' button. The magic begins in the JavaScript script embedded in the HTML code. This script has three key functions:

  • loadSheetData(): This function loads data from a Google Cloud spreadsheet. It uses the Google Cloud API to retrieve information about temperature, humidity, and CPU temperature from the second row of the spreadsheet. These data are then used to create a dynamic chart using the Chart.js library. The line chart displays the evolution of these variables over time.
  • convertToCSV(dataArray): This function converts the data obtained from Google Cloud into a CSV format (comma-separated values) commonly used for data exchange. This allows users to download the data in CSV format for external use.
  • downloadCSV(): Here, the CSV conversion functionality is used to download a CSV file containing all the available data in the Google Cloud spreadsheet. Clicking the 'Download CSV' button automatically generates and downloads the file with the data for later use.
Here is the list of programming languages used for data visualization:
  • HTML: Used to structure the web page.
  • JavaScript: Used for dynamic operations, interacting with the Google Sheets API, manipulating dates, filtering data, and creating charts.
  • Chart.js: JavaScript library used to render interactive charts on the HTML canvas.
In summary, HTML is used for structure, JavaScript for logic and data manipulation, and the Chart.js library for visualizing data in the form of charts.

This code is an exciting first step towards real-time data visualization from Google Cloud. It serves as an excellent starting point for those interested in understanding how to access and display data in an attractive and accessible graphical format..

Real-time data visualization

Real-time data visualization


Read related topics

Comments

Popular posts from this blog

▷ SD3031 Precision #RTC Module for #Arduino

  ➡️  #RTC #Arduino #DFRobot About this item This real-time clock #RTC module uses the SD3031 chip, which has an integrated crystal oscillator and temperature compensator. This provides high-precision timing and stability. At a temperature of 25 °C, the accuracy is maintained at ±3.8ppm (±0.32832 seconds/day). The SD3031 can be powered by button-cell batteries. This allows for accurate timing even when the main power source is interrupted. The RTC keeps track of seconds, minutes, hours, days of the week, dates of the month, and months and years. It also automatically adjusts the date at the end of each month and includes leap year corrections. The SD3031 has a built-in 70-byte SRAM for low-power data storage. Please note that due to recent air cargo regulations, special items such as batteries, magnets, and liquids are strictly audited for air transport. As a result, the RTC module does not come with batteries. You will need to purchase them locally. The button cell model that...

▷ USRP USB Software-Defined Radio Platform

➡️  #USRP #SoftwareDefinedRadio #28GHz #DFRobot About this item RF Specifications: Channels: 1 TX, 1 RX; Frequency range: 70 MHz to 6 GHz; Instantaneous Bandwidth: Up to 56 MHz; IIP3 (at typical NF): -20 dBm; Power Output: >10 dBm; Receive Noise Figure: <8 dB Conversion Performance and Clocks: ADC Sample Rate (Max.): 61.44 MS/s; ADC Resolution: 12 bits; DAC Sample Rate (Max.): 61.44 MS/s; DAC Resolution: 12 bits; Host Sample Rate (16b): 61.44 MS/s; Frequency Accuracy: +/-2.0 ppm Environment: Operating Temp. Range: 0 - 45 °C USRP; Hardware Driver 3.9.2 (or later); GNU Radio Synchronization: 10 MHz clock reference; PPS time reference Power: USB Power 5V Product Description The USRP B205mini-i is a flexible and compact platform that is ideal for both hobbyist and OEM applications. It is designed by Ettus Research and provides a wide frequency range (70 MHz to 6 GHz) and a user-programmable, industrial-grade Xilinx Spartan-6 XC6SLX150 FPGA. The RF front end uses the Analog Device...

▷ What is the MQTT protocol?

➡️  #MQTT #IoT #SensorNetwork The  #MQTT  (Message Queuing Telemetry Transport) protocol is a lightweight communication protocol designed to facilitate communication between IoT (Internet of Things) devices. It was developed in 1999 by Andy Stanford-Clark and Arlen Nipper and has become one of the most widely used protocols in the IoT world. ➡️ How does MQTT work? MQTT works with a publish/subscribe model, in which devices connect to a centralized broker or server and send and receive messages. The protocol uses an asynchronous communication model, which means that devices can send messages at any time, without needing an immediate response. In addition, MQTT uses a "topics" model, which allows devices to publish and subscribe to messages related to a specific topic. For example, a device could publish messages related to the "temperature" topic, while another device could subscribe to that same topic to receive the messages. ➡️ What are the advantages of MQTT? MQTT...

▷ Display of last 24 hours of Temperature, Humidity and Temp. CPU

  For this post, two sensors have been deployed for real-time data collection, currently operational in the city of Guayaquil: one for humidity and another for temperature. Both sensors utilize LoRA technology to transmit collected information to a Gateway. This Gateway serves as a central connection point, receiving data from the sensors and forwarding it to the Google Cloud platform via LTE cellular connectivity. Leaflet viewer with OpenStreetMap Leaflet viewer with OpenStreetMap Once the data is stored on the Google Cloud platform, a customized web interface has been developed. This interface facilitates the visualization and analysis of the sensor-collected data, offering users a clear and easily accessible representation. In today's interconnected world, the ability to gather and visualize real-time data is essential for understanding and making informed decisions. On this occasion, we will explore how to visualize the data from the last 24 h...