I require my MCC USB-1808X to sample hydrophone readings of a 25kHz pinger at a sampling frequency of 200kHz. The pinger sends out a pulse every 2 seconds or so.
I have a dedicated PCB connected to four TC4013 hydrophones from Teledyne Marine to amplify their outputs. The schematic of each channel is attached below, with vGND1 and vGND2 held at ~+2.5V.
The PCB itself works, as I have verified using an oscilloscope directly at the analog input of the DAQ device (shown below), although the magnitude is slightly smaller than desired and there's quite a fair bit of reflected waves picked up too (also shown below).
However, oddly enough, when I record the DAQ readings, all I acquire is noise centred around the DC offset. This is not true, however, when I use a signal generator (also offset to +2.5V), which results in very nice readings. The readings from the channels that are connected to the PCB are in the first three columns, and the green column is the recorded readings of the DAQ channel reading directly from the signal generator. I recorded the data for ~10s (so that I don't just miss out on the pinger's pings) and the readings are generally similar to this.
I have attached below my C code for recording this, which is a modified version of the AInScan.c example from the MCC ULDAQ GitHub repository https://github.com/mccdaq/uldaq (via running ./AInScan > AInScan.csv):
#include<stdint.h>#include<stdio.h>#include<stdlib.h>#include<sys/time.h>#include<time.h>#include"uldaq.h"#include"utility.h"#define MAX_DEV_COUNT 100#define MAX_STR_LENGTH 64#define MAX_SCAN_OPTIONS_LENGTH 256int main(void){int descriptorIndex =0;DaqDeviceDescriptor devDescriptors[MAX_DEV_COUNT];DaqDeviceInterface interfaceType = ANY_IFC;DaqDeviceHandle daqDeviceHandle =0;unsignedint numDevs = MAX_DEV_COUNT;// set some variables that are used to acquire dataint lowChan =0;int highChan =3;AiInputMode inputMode = AI_SINGLE_ENDED;Range range = UNI5VOLTS;int samplesPerChannel =200000;double rate =200000;ScanOption scanOptions =(ScanOption)(SO_CONTINUOUS);AInScanFlag flags = AINSCAN_FF_DEFAULT;int index =0;int chanCount = highChan - lowChan +1;double* buffer = NULL;UlError err = ERR_NO_ERROR;double prevLastFour[4]={0,0,0,0};int i =0;goto boot;
boot:
err = ulGetDaqDeviceInventory(interfaceType, devDescriptors,&numDevs);// verify at least one DAQ device is detectedif(numDevs ==0){
printf("No DAQ device is detected\n");goto error;}// get a handle to the DAQ device associated with the first descriptor
daqDeviceHandle = ulCreateDaqDevice(devDescriptors[descriptorIndex]);if(daqDeviceHandle ==0){
printf("\nUnable to create a handle to the specified DAQ device\n");goto error;}// printf("\nConnecting to %s...\n", devDescriptors[descriptorIndex].devString);// establish a connection to the DAQ device
err = ulConnectDaqDevice(daqDeviceHandle);if(err != ERR_NO_ERROR)goto error;goto acquisition;
acquisition:// allocate a buffer to receive the data
buffer =(double*) malloc(chanCount * samplesPerChannel *sizeof(double));double* lastFour = buffer + chanCount * samplesPerChannel -4;for(i =0; i <4; i++){
prevLastFour[i]= lastFour[i];}// start the acquisition
err = ulAInScan(
daqDeviceHandle, lowChan, highChan, inputMode, range, samplesPerChannel,&rate, scanOptions, flags, buffer
);// printf("Scan started\n");if(err == ERR_NO_ERROR){ScanStatus status;TransferStatus transferStatus;// get the initial status of the acquisition
ulAInScanStatus(daqDeviceHandle,&status,&transferStatus);int loopCount =0;while(status == SS_RUNNING &&!enter_press())// while(status == SS_RUNNING && !enter_press() && loopCount < maxLoop) // for debugging purposes{// get the current status of the acquisition
err = ulAInScanStatus(daqDeviceHandle,&status,&transferStatus);if(err == ERR_OVERRUN)// restarts the acquisition if an overrun error occurs{
printf("FIFO overrun\n");
err = ulAInScanStop(daqDeviceHandle);goto acquisition;}elseif(err != ERR_NO_ERROR){goto error;}if((prevLastFour[0]!= lastFour[0])||(prevLastFour[1]!= lastFour[1])||(prevLastFour[2]!= lastFour[2])||(prevLastFour[3]!= lastFour[3])){// TODO: send data to MUSICfor(i =0; i <4; i++){
prevLastFour[i]= lastFour[i];}for(int j =0; j < samplesPerChannel; j++){for(i =0; i < chanCount; i++){
printf("%f", buffer[i + chanCount * j]);if(i !=3){
printf(", ");}else{
printf("\n");}}}// usleep(100);
loopCount = loopCount +1;// printf("Looped %d times \n", loopCount);if(loopCount ==10){return0;}}}}
error:// release the scan bufferif(buffer)
free(buffer);// disconnect the DAQ device
ulDisconnectDaqDevice(daqDeviceHandle);if(err != ERR_NO_ERROR){char errMsg[ERR_MSG_LEN];
ulGetErrMsg(err, errMsg);
printf("Error Code: %d \n", err);
printf("Error Message: %s \n", errMsg);}
printf("Restarting... \n");goto boot;}
I would greatly appreciate any assistance or insight into this as I am at my wit's end trying to solve this issue.
Question
Henry Walker
I require my MCC USB-1808X to sample hydrophone readings of a 25kHz pinger at a sampling frequency of 200kHz. The pinger sends out a pulse every 2 seconds or so.
I have a dedicated PCB connected to four TC4013 hydrophones from Teledyne Marine to amplify their outputs. The schematic of each channel is attached below, with vGND1 and vGND2 held at ~+2.5V.
The PCB itself works, as I have verified using an oscilloscope directly at the analog input of the DAQ device (shown below), although the magnitude is slightly smaller than desired and there's quite a fair bit of reflected waves picked up too (also shown below).
However, oddly enough, when I record the DAQ readings, all I acquire is noise centred around the DC offset. This is not true, however, when I use a signal generator (also offset to +2.5V), which results in very nice readings. The readings from the channels that are connected to the PCB are in the first three columns, and the green column is the recorded readings of the DAQ channel reading directly from the signal generator. I recorded the data for ~10s (so that I don't just miss out on the pinger's pings) and the readings are generally similar to this.
I have attached below my C code for recording this, which is a modified version of the AInScan.c example from the MCC ULDAQ GitHub repository https://github.com/mccdaq/uldaq (via running ./AInScan > AInScan.csv):
I would greatly appreciate any assistance or insight into this as I am at my wit's end trying to solve this issue.
Edited by Henry WalkerLink to comment
Share on other sites
1 answer to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now