Skip to content

issaiass/Xively_LabVIEW_Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xively and LabVIEW Example

A practical demonstration of integrating LabVIEW applications with the Xively IoT cloud platform for real-time data collection and visualization.


Brief Review

Project Overview

This repository contains a LabVIEW example showcasing how to publish data to the Xively cloud platform. Xively (now integrated with Google Cloud IoT) is a comprehensive IoT data management platform that enables real-time data collection, visualization, and analysis from connected devices and sensors.

What Does This Example Do?

The Xively.vi Virtual Instrument demonstrates:

  • Authentication: How to properly authenticate with Xively using API credentials
  • HTTP Communication: Establishing REST API connections to cloud services
  • Data Formatting: Converting LabVIEW data types into Xively-compatible JSON format
  • Real-time Publishing: Sending sensor and measurement data to cloud storage
  • Error Handling: Managing network errors and API responses gracefully
  • Configuration Management: Setting up API keys, feed IDs, and endpoint parameters

Why Xively + LabVIEW?

LabVIEW is widely used in industrial automation, scientific research, and data acquisition applications. Integrating LabVIEW with Xively enables:

  • Remote monitoring of laboratory and field equipment
  • Cloud-based data archival and historical analysis
  • Multi-site data aggregation and comparison
  • Real-time alerting and visualization
  • Scalable IoT infrastructure

Platform Evolution

Note: Xively was acquired by Google and is now part of Google Cloud IoT. The API endpoints and authentication methods may have evolved since this example was created (April 2014). When implementing production solutions, refer to current Google Cloud IoT documentation.

LabVIEW IoT Architecture

LabVIEW connecting to cloud IoT platforms

Xively Cloud Platform

Xively (now Google Cloud IoT) data dashboard and visualization


Project Structure

Directory Organization

Xively_LabVIEW_Example/
├── README.md                    # This file - comprehensive project documentation
├── Xively.vi                    # Main LabVIEW Virtual Instrument
├── .gitignore                   # Git ignore configuration
├── .gitattributes               # Git attributes for binary file handling
└── docs/
    └── imgs/                    # Documentation images folder
        ├── labview_iot.svg      # LabVIEW IoT architecture illustration
        ├── xively_dashboard.svg # Xively platform dashboard
        └── README.md            # Instructions for adding/updating images

Key Components

Xively.vi

  • Type: LabVIEW Virtual Instrument (Binary)
  • Purpose: Reference implementation of Xively integration
  • Content:
    • Block diagram with dataflow logic
    • HTTP client configuration
    • API request formatting
    • Response handling and error management
    • User interface for testing and configuration

Configuration Files

  • .gitattributes: Specifies that .vi files are binary and sets appropriate merge strategies
  • .gitignore: Ignores development IDE artifacts and temporary files

Using This Example

Prerequisites

Before using this example, ensure you have:

  1. LabVIEW Installation

    • LabVIEW 8.6 or later (recommended: LabVIEW 2015 or newer)
    • NI HTTP client toolkit or equivalent networking libraries
    • NI JSON libraries (for data formatting)
  2. Xively/Google Cloud IoT Account

    • Active account with Xively (or migrated to Google Cloud IoT)
    • API key credentials
    • Feed ID for your data stream
    • Device/channel configuration
  3. Network Connectivity

    • Internet connection for cloud communication
    • Firewall rules allowing HTTPS connections

Getting Started

Step 1: Clone the Repository

git clone https://github.com/issaiass/Xively_LabVIEW_Example.git
cd Xively_LabVIEW_Example

Step 2: Open in LabVIEW

  1. Launch LabVIEW IDE
  2. Open File → Open
  3. Navigate to the repository directory
  4. Select Xively.vi
  5. Click Open

Step 3: Configure Your Credentials

Within the Xively.vi block diagram:

  1. Locate the configuration section (typically near the beginning of the VI)
  2. Update the following parameters:
    • API Key: Your Xively authentication token
    • Feed ID: The unique identifier for your data feed
    • Datastream Name: The channel or sensor identifier
    • API Endpoint: The Xively server URL (may have changed since 2014)
    • Device ID: Your IoT device identifier

Step 4: Prepare Your Data

  1. Set up your data source:
    • DAQ hardware collecting analog signals
    • Sensors connected to I/O modules
    • Calculated/simulated data in LabVIEW
  2. Ensure data is formatted as numeric values
  3. Add timestamps if required by your feed configuration

Step 5: Run the VI

  1. Click the Run button (▶) in the LabVIEW toolbar
  2. The VI will:
    • Establish connection to Xively
    • Format your data as JSON
    • Send the data via HTTPS
    • Display status and any error messages
  3. Check the Xively dashboard to verify data reception

Step 6: Verify on Xively Dashboard

  1. Log into your Xively account
  2. Navigate to your feed
  3. Observe real-time data updates
  4. Check historical data graphs and trends

Advanced Configuration

For Multiple Sensors

Modify the block diagram to:

  • Add parallel data acquisition loops for multiple sensors
  • Create separate datastreams for each sensor
  • Aggregate multiple measurements before sending

For Continuous Operation

1. Implement a timed loop (100ms - 1s intervals recommended)
2. Add data buffering to handle network interruptions
3. Implement retry logic for failed uploads
4. Log data locally before sending for redundancy

For Error Recovery

The VI should handle:

  • Network timeouts
  • Invalid credentials
  • API rate limiting
  • Malformed responses

Add appropriate error handling nodes and logging to track issues.

Troubleshooting Guide

Issue Solution
"Connection timeout" Check internet connectivity; verify Xively API endpoint
"Authentication failed" Verify API key is correct; check for typos or expired credentials
"No data in Xively" Confirm feed ID matches; check data format; verify timestamps
"HTTP 429 error" API rate limit exceeded; increase time between sends
"SSL/TLS certificate error" Update LabVIEW SSL certificates; check system date/time

Results and Outcomes

Expected Results

When the Xively.vi example runs successfully:

  1. On LabVIEW Front Panel

    • Status indicator showing "Connected"
    • Real-time data values displayed
    • Success confirmation message
    • Timestamp of last transmission
  2. On Xively Dashboard

    • New data points appearing in real-time
    • Timestamps matching your sends
    • Automatic graphing of historical data
    • Datastream status showing "active"

Performance Metrics

  • Typical latency: 100-500ms from send to cloud visibility
  • Success rate: >99% with proper network conditions
  • Data accuracy: 100% (no rounding unless configured)
  • Throughput: Multiple sensors possible depending on LabVIEW timing

Integration Possibilities

After mastering this example, you can:

  • Integrate with SCADA systems
  • Build industrial monitoring dashboards
  • Create predictive maintenance systems
  • Aggregate multi-site data
  • Generate automated alerts
  • Export data for analysis in Excel/Python

Known Issues

API Endpoint Changes

Issue: The original Xively API endpoints (from 2014) are no longer active.

Status: Known limitation of legacy example

Workaround:

  1. Update API URL to Google Cloud IoT endpoints
  2. Adjust authentication method to OAuth 2.0 (if required)
  3. Modify JSON payload structure to match current API specifications
  4. Reference current Google Cloud IoT documentation

LabVIEW Version Compatibility

Issue: May require adjustments for LabVIEW versions newer than 2015

Status: Potential compatibility issue

Workaround:

  1. Save VI in earlier LabVIEW format if needed (File → Save As)
  2. Update deprecated function calls
  3. Verify HTTP library compatibility

Future Enhancements

Planned Improvements

  • Update to Google Cloud IoT: Migrate from legacy Xively API to current Google Cloud platform
  • Multi-sensor support: Example with 10+ simultaneous sensor streams
  • Local data buffering: Queuing mechanism for interrupted connections
  • Advanced authentication: OAuth 2.0 and certificate-based authentication
  • Real-time visualization: Embedded charts showing live data trends
  • Mobile integration: Remote control and monitoring via mobile app
  • Machine learning integration: Anomaly detection and predictive analytics
  • Open source library: Reusable component for community projects

Contribution Opportunities

Areas where community contributions would be valuable:

  • Modern API integration examples
  • Performance optimization techniques
  • Extended error handling patterns
  • Multi-protocol support (MQTT, CoAP)
  • Unit test framework implementation

Contributing

How to Contribute

Improvements and enhancements to this example are welcome!

Process

  1. Fork the repository on GitHub
  2. Create a feature branch
    git checkout -b feature/your-improvement
  3. Make your changes in LabVIEW
  4. Commit with descriptive messages
    git commit -m "Add feature: description of improvement"
  5. Push to your fork
    git push origin feature/your-improvement
  6. Create a Pull Request on the main repository

Guidelines

  • Documentation: Update README.md with changes
  • Compatibility: Test with multiple LabVIEW versions if possible
  • Comments: Add block diagram comments explaining complex logic
  • Testing: Verify changes work before submitting PR

Questions?

Feel free to open an issue for:

  • Bug reports
  • Feature requests
  • Usage questions
  • Documentation improvements

Contributing

Your contributions are always welcome! Please feel free to fork and modify the content but remember to finally do a pull request.

License


📱 Having Problems?

About

|| LabVIEW feeding example to Xively ||

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published