element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products & Partners
    Products & Partners
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Smart Home & Healthcare Challenge
  • Challenges & Projects
  • Design Challenges
  • Smart Home & Healthcare Challenge
  • More
  • Cancel
Smart Home & Healthcare Challenge
Forum VitalSense – Part 10 : Building a Real-Time Sensor Data Visualizer for MAXREFDES117 / USB CDC
  • News
  • Projects
  • Forum
  • Details
  • Leaderboard
  • Files
  • Members
  • DC
  • More
  • Cancel
  • New
Join Smart Home & Healthcare Challenge to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 0 replies
  • Subscribers 18 subscribers
  • Views 42 views
  • Users 0 members are here
Related

VitalSense – Part 10 : Building a Real-Time Sensor Data Visualizer for MAXREFDES117 / USB CDC

jelektro
jelektro 2 days ago

Table of Contents
Part 1: System Concept and Architecture
Part 2 : Sponsored Kit Overview
Part 3 : Alternatives for Heart Rate, SpO₂, and Temperature Sensing
Part 4 : MAX30208EVSYS Evaluation System – Technical Overview & Operation
Part 5 : Reverse-Engineering the MAX30208EVSYS Communication Protocol
Part 6 : Communicating with the MAX30208EVSYS in LabVIEW
Part 7 : Building a Cross-Platform Qt6 Desktop Application for the MAX30208EVSYS Temperature Sensor
Part 8 : STM32 Pulse Oximeter & Heart Rate Monitor (MAXREFDES117 + USB CDC)
Part 9 : MAXREFDES117 – JSON Data Acquisition via USB-CDC in LabVIEW
Part 10 : Building a Real-Time Sensor Data Visualizer for MAXREFDES117 / USB CDC
Part 11 : Research Workstation System Architecture
Part 12 : Combined Pulse Oximeter & Temperature Monitoring System in LabVIEW
Part 13 : Dual-Port Biomedical Telemetry Dashboard - Integrating STM32 (MAXREFDES117) and MAX30208EVSYS in C++ and Qt

1. Introduction and Architectural Overview

When developing embedded systems, Internet of Things (IoT) devices, or biomedical monitoring tools (such as pulse oximeters using the MAXREFDES117 optical sensor), developers frequently encounter a common bottleneck: visualizing telemetry data streaming from a microcontroller. Relying solely on serial console logs or terminal windows is insufficient for diagnostic evaluation, signal processing validation, or user-interface prototyping.

To bridge this gap, a cross-platform desktop application was engineered using C++ and the Qt Framework. The architecture is structured around a decoupled event-driven model that handles serial communication asynchronously, parses lightweight JSON payloads, manages dynamic data buffers, and renders real-time graphical representations using Qt Charts.

Rather than dumping raw text to the screen, the application offers an interactive dashboard featuring live numerical readouts, independent multi-parameter rolling-window charts, layout adaptability, and fault-tolerant parsing mechanisms.

image

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

2. Core Modules and Component Breakdown

The codebase is modularized cleanly into configuration files, header definitions, and implementation logic:

  • MaxRefdesReader.pro (The Build Specification): Configured via qmake, the project links against essential Qt modules—specifically core, gui, widgets, serialport, and charts. It mandates modern C++17 standards to ensure safe memory handling, efficient STL utilization, and clean syntax.

  • MainWindow Class (mainwindow.h / mainwindow.cpp): Acting as the central controller, this class inherits from QMainWindow and orchestrates lifecycle management, user interface layout switching, hardware connectivity states, and serial stream processing.

3. Key Technical Features & Implementation Details

A. Asynchronous Serial Port Management & Robust Framing

Communication with the target microcontroller occurs over a virtual COM port established via USB CDC (Communications Device Class).

  • Port Discovery: Upon startup, the application queries QSerialPortInfo::availablePorts() to dynamically populate a dropdown menu with all active hardware and virtual serial interfaces available on the host operating system.

  • Stream Handling & Buffer Accumulation: Serial data does not always arrive in neat, atomic packages; packets can be fragmented or batched together. To prevent data corruption or missing frames, the application implements a line-buffered parsing algorithm. Incoming byte arrays are appended to a persistent QByteArray buffer (buffer). The application scans this buffer for a newline delimiter (\n), extracts complete lines individually, and strips them from the buffer, ensuring uninterrupted telemetry streams.

B. JSON Deserialization and Data Extraction

The microcontroller transmits sensor data packets formatted as JSON strings (e.g., {"bpm": 72, "spo2": 98, "filtered_ir": 1621.45}).

  • Once a full line is isolated from the serial buffer, it is passed through QJsonDocument::fromJson().

  • The parser validates whether the document successfully evaluates to a JSON object containing the required keys (bpm, spo2, and filtered_ir).

  • Validated parameters are extracted as double-precision floating-point numbers, instantly driving both the text label updates and the graphic plotting pipelines.

C. Multi-Chart Architecture with Rolling Windows

To prevent visual clutter, the system avoids plotting conflicting scales on a single chart (since raw/filtered infrared signals span thousands of units, whereas heart rate and blood oxygen operate in much tighter numerical ranges). Instead, it implements three independent charts:

  1. Heart Rate (BPM): Tailored for standard physiological ranges.

  2. Blood Oxygen (SpO2): Constrained to monitor oxygen saturation shifts.

  3. Filtered IR Signal: Configured with a wider dynamic range to capture raw photoplethysmogram (PPG) waveforms.

  • Rolling Window Buffer Mechanism: To prevent memory bloat and application slowdowns over long monitoring sessions, a pointCounter tracks total incoming samples. Once the sample count exceeds 100, the X-axis range dynamically shifts using axisX->setRange(pointCounter - 100, pointCounter), creating a real-time sliding-window oscilloscope effect.

D. Dynamic Layout Switching (User Adaptability)

Flexibility in workspace organization is achieved through a dynamic layout manager. Users can toggle a dropdown menu to instantly rearrange the visual presentation:

  • Vertical Layout (Stacked): Positions the three chart views neatly on top of one another, which is ideal for widescreen monitors or detailed waveform inspection.

  • Horizontal Layout (Side by Side): Arranges charts horizontally, maximizing horizontal space resolution.

  • The Underlying Mechanism: When a layout switch is triggered, the application safely detaches the QChartView instances from the active layout container, destroys the old layout manager, instantiates the alternative layout manager, re-inserts the chart widgets, and forces a UI refresh (show()) without losing existing serial connections or historical plot data.

image

4. Summary of Benefits & Extensibility

By leveraging Qt's mature graphics rendering pipeline and robust hardware abstraction layers (QSerialPort), this application transforms a basic microcontroller sensor setup into a professional-grade telemetry suite.

The architecture is deliberately built for extension. Future enhancements can easily integrate features such as:

  • Data Logging: Exporting buffered stream arrays directly into CSV files for post-processing in Python or MATLAB.

  • Threshold Alerts: Triggering visual or auditory alarms if bpm or spo2 breach critical safety margins.

  • Automatic Y-Axis Scaling: Implementing dynamic auto-scaling algorithms for adaptive signal tracking.

  • Sign in to reply
  • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube