5 Channel ADC (adc4D)
The ADC4D module is a 5-channel differential analog-to-digital converter (ADC) that provides high-precision voltage sensing capabilities for the D-Bay system.
Features
- 5 Differential Channels: Each channel can measure differential voltages
- High Precision: Built on the AD7124-4 ADC chip
- Real-time Monitoring: Continuous voltage measurement and display
- Individual Channel Control: Each channel can be enabled/disabled independently
- Modern UI: Clean, intuitive interface for voltage monitoring
Hardware Specifications
- ADC Resolution: 24-bit
- Input Range: Configurable (typically ±2.5V with internal reference)
- Sampling Rate: Configurable
- Input Impedance: High impedance differential inputs
- Communication: SPI interface with D-Bay controller
Software Components
Frontend Components
adc4D.svelte: Main module componentadc4D_data.svelte.ts: Data management and state handlingSenseChannel.svelte: Individual channel componentSenseChannelBar.svelte: Channel grouping componentSenseDisplay.svelte: Voltage value displaySenseChannelContent.svelte: Channel control content
Backend Integration
- API Endpoint:
/adc4D/vsense/ - Controller:
adc4DControllerfor hardware communication - Data Structure:
VsenseChangeinterface for voltage sensing operations
Usage
Basic Operation
- Channel Activation: Enable individual channels for measurement
- Voltage Monitoring: Real-time voltage values displayed in the UI
- Measurement Control: Start/stop measurements per channel
- Data Export: Voltage readings available through API
API Integration
// Request voltage measurement update
const senseUpdate = await requestSenseUpdate(
{
module_index: 0,
index: 0,
voltage: 0,
measuring: true,
name: "Channel 1",
},
"/adc4D/vsense/"
);Code Example
// Create ADC4D module instance
const adc = new adc4D({
core: { slot: 0, type: "adc4D", name: "Voltage Sensor" },
});
// Enable channel 0 for measurement
adc.vsense.channels[0].measuring = true;Channel Configuration
Each channel supports the following properties:
index: Channel number (0-4)voltage: Current measured voltage valuemeasuring: Enable/disable measurementname: Custom channel name for identification
Integration with D-Bay System
The ADC4D module integrates seamlessly with the D-Bay module system:
- Automatic Discovery: Detected and registered automatically
- Hot-swap Support: Can be added/removed during operation
- State Persistence: Settings maintained across sessions
- Error Handling: Robust error detection and reporting
Technical Details
Hardware Communication
- SPI Protocol: High-speed serial communication
- Chip Select: Individual CS pin for each module
- Reference Voltage: Internal or external reference options
- Filtering: Hardware and software filtering options
Data Processing
- Real-time Updates: Continuous measurement updates
- Noise Filtering: Software filtering for stable readings
- Calibration: Built-in calibration routines
- Error Detection: Input range and connection monitoring
Troubleshooting
Common Issues
-
No Voltage Readings
- Check channel enable status
- Verify hardware connections
- Confirm module power
-
Inaccurate Readings
- Check reference voltage
- Verify calibration
- Check for noise sources
-
Communication Errors
- Verify SPI connections
- Check module addressing
- Restart module controller
Error Codes
- Channel Out of Range: Invalid channel index (0-4)
- Communication Timeout: SPI communication failure
- Reference Error: Reference voltage issue
- Overrange: Input voltage exceeds range
Development Notes
Adding New Features
The ADC4D module follows the standard D-Bay module architecture:
- Frontend: Svelte components for UI
- Data Layer: TypeScript classes for state management
- API Layer: FastAPI endpoints for backend communication
- Hardware Layer: Firmware drivers for ADC control
Testing
- Unit Tests: Component and function testing
- Integration Tests: Full system testing
- Hardware Tests: Real hardware validation
- Performance Tests: Speed and accuracy validation
See Also
- DAC4D Module - Complementary voltage source
- DAC16D Module - Higher channel count DAC
- Module Development Guide