A practical demonstration of integrating LabVIEW applications with the Xively IoT cloud platform for real-time data collection and visualization.
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.
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
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
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.
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
- 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
- .gitattributes: Specifies that
.vifiles are binary and sets appropriate merge strategies - .gitignore: Ignores development IDE artifacts and temporary files
Before using this example, ensure you have:
-
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)
-
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
-
Network Connectivity
- Internet connection for cloud communication
- Firewall rules allowing HTTPS connections
git clone https://github.com/issaiass/Xively_LabVIEW_Example.git
cd Xively_LabVIEW_Example- Launch LabVIEW IDE
- Open File → Open
- Navigate to the repository directory
- Select Xively.vi
- Click Open
Within the Xively.vi block diagram:
- Locate the configuration section (typically near the beginning of the VI)
- 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
- Set up your data source:
- DAQ hardware collecting analog signals
- Sensors connected to I/O modules
- Calculated/simulated data in LabVIEW
- Ensure data is formatted as numeric values
- Add timestamps if required by your feed configuration
- Click the Run button (▶) in the LabVIEW toolbar
- The VI will:
- Establish connection to Xively
- Format your data as JSON
- Send the data via HTTPS
- Display status and any error messages
- Check the Xively dashboard to verify data reception
- Log into your Xively account
- Navigate to your feed
- Observe real-time data updates
- Check historical data graphs and trends
Modify the block diagram to:
- Add parallel data acquisition loops for multiple sensors
- Create separate datastreams for each sensor
- Aggregate multiple measurements before sending
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 redundancyThe VI should handle:
- Network timeouts
- Invalid credentials
- API rate limiting
- Malformed responses
Add appropriate error handling nodes and logging to track issues.
| 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 |
When the Xively.vi example runs successfully:
-
On LabVIEW Front Panel
- Status indicator showing "Connected"
- Real-time data values displayed
- Success confirmation message
- Timestamp of last transmission
-
On Xively Dashboard
- New data points appearing in real-time
- Timestamps matching your sends
- Automatic graphing of historical data
- Datastream status showing "active"
- 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
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
Issue: The original Xively API endpoints (from 2014) are no longer active.
Status: Known limitation of legacy example
Workaround:
- Update API URL to Google Cloud IoT endpoints
- Adjust authentication method to OAuth 2.0 (if required)
- Modify JSON payload structure to match current API specifications
- Reference current Google Cloud IoT documentation
Issue: May require adjustments for LabVIEW versions newer than 2015
Status: Potential compatibility issue
Workaround:
- Save VI in earlier LabVIEW format if needed (File → Save As)
- Update deprecated function calls
- Verify HTTP library compatibility
- 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
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
Improvements and enhancements to this example are welcome!
- Fork the repository on GitHub
- Create a feature branch
git checkout -b feature/your-improvement
- Make your changes in LabVIEW
- Commit with descriptive messages
git commit -m "Add feature: description of improvement" - Push to your fork
git push origin feature/your-improvement
- Create a Pull Request on the main repository
- 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
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.
📱 Having Problems?
- LabVIEW Community Forums: https://forums.ni.com/t5/LabVIEW/ct-p/labview
- Xively/Google Cloud IoT Support: https://cloud.google.com/iot/docs/support
- Stack Overflow: Tag with
labviewandiot