A robust Data Acquisition System built with Synnax for managing NI USB-6343 devices and handling various types of data inputs and outputs.
- Automated device discovery and configuration
- Support for analog and digital I/O
- Real-time data processing
- Configurable sampling rates
- Automatic task management
- Excel-based configuration system
- Comprehensive error handling
- Extensive logging
- Python 3.8+
- uv
- National Instruments DAQmx drivers
- Synnax server running and accessible
- Clone the repository:
git clone https://github.com/Purdue-Space-Program/PSPL_DAQ.git
cd PSPL_DAQ/daq-system
uv sync- Run the program:
uv run main.pydaq_system/
├── __init__.py
├── config/
│ ├── __init__.py
│ └── settings.py # Configuration settings
├── core/
│ ├── __init__.py
│ └── daq_system.py # Main DAQ system implementation
├── processing/
│ ├── __init__.py
│ ├── analog.py # Analog input processing
│ ├── digital.py # Digital I/O processing
│ └── channel_factory.py # Channel creation utilities
└── utils/
├── __init__.py
└── exceptions.py # Custom exceptions
from daq_system import DAQSystem, DAQConfig
from pathlib import Path
# Configure the system
config = DAQConfig(
sample_rate=1000, # Hz
stream_rate=100, # Hz
host="your.synnax.server",
port=9090,
username="user",
password="pass"
)
# Initialize the system
daq = DAQSystem(config)
# Configure device paths
device_paths = {
"Dev5": DeviceWiringPaths(
data_wiring=Path("inputs/CMS_Data_Test_Dev5.xlsx"),
control_wiring=Path("inputs/CMS_Control_Test_Dev5.xlsx")
)
}
# Process devices
for device_name, paths in device_paths.items():
# Get device
device = daq.client.hardware.devices.retrieve(
model="USB-6343",
location=device_name
)
# Create and configure tasks
tasks = daq.create_device_tasks(device)
# Process data
daq.process_device_data(
device,
pd.ExcelFile(paths.data_wiring),
pd.ExcelFile(paths.control_wiring),
tasks
)The system uses Excel files for configuration:
- Sheet "AI_slope-offset": Analog input configuration
- Sheet "DI": Digital input configuration
- Sheet "DO": Digital output configuration
The system provides custom exceptions for different error types:
DAQError: Base exceptionConnectionError: Connection issuesConfigurationError: Configuration problemsDeviceError: Device-related errorsTaskError: Task creation/configuration errors
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Synnax
- Uses National Instruments DAQmx