Maybe this helps to set up the differential ADC in principle. https://forum.pjrc.com/threads/57890...dout-with-T3-2
Maybe this helps to set up the differential ADC in principle. https://forum.pjrc.com/threads/57890...dout-with-T3-2
Unfortunately, your circuit diagram illustrates a major problem with direct connection of Wheatstone bridges. They often present several K Ohms of impedance at the ADC inputs. This can slow the response of the circuit significantly. Depending on the connections, those high-impedance inputs can also pick up noise from nearby digital circuits. Differential sampling will help with that, but may not fully eliminate the noise. Another problem with these circuits is that the output voltage differential may be just a few millivolts.
This circuit really needs a fast differential amplifier with high-impedance inputs to convert the signal into a single-ended output. We always needed something like that on our oceanographic pressure sensors and we were only sampling at about 400Hz.
If you could post the type of sensor you are using, I might be able to give you an amplifier design that could clean up the signal and require only a single ADC input--which could easily be sampled at 1MHZ using code posted earlier.
Hello mborgerson, thanks that would be amazing (in the meantime I will start looking into this myself, I was not aware that I could use an amplifier to get a single output...yes my electronics noob status is still firmly intact)! I am using the Endevco 8530C-100 pressure sensor, datasheet link below:
https://buy.endevco.com/ContentStore..._DS_082219.pdf
Can I really push my luck and also ask, how did you convert the .DAT file created by the code in post #45 to a readable format? I use matlab to convert the data from code in post #26 to a readable format but have not been able to do the same for the code in post #45.
For a strain-guage wheatstone bridge configuration you need an instrumentation amp to boost the differential mode signal.
There are many instrumentation amps you can get, its basically 3 opamps in a single package.
https://en.wikipedia.org/wiki/Instrumentation_amplifier
https://www.ti.com/amplifier-circuit.../overview.html
The output data from the 1MSample logger is a binary file with a sequence of 16-bit unsigned integers. Each integer can have a value between 0 and 4095, which represents the range of values output by the ADC in 12-bit mode. Here is a simple Matlab function to read and display the data on the SD Card.
Code:function [dout]=load1MSample(filnam) % load analog logger collection of 1MSample data with ADC Timer % 1/22/21 MJB if nargin == 0 [raw_name,temp,filterindex]=uigetfile('*.dat','Load 1MSample Logger File'); filnam=[temp raw_name]; else filnam = [filnam]; end disp(sprintf('Reading data from %s',raw_name)); fid = fopen(filnam,'r'); fseek(fid,0,'eof'); % move to end of file pos2 = ftell(fid); % pos2 is overall length of file frewind(fid); % move back to beginning of file % each record is 2 bytes % uint16 adc A9 value nrecords=floor((pos2)/2); % number of records disp(sprintf('%d records of data in the file',nrecords)); fseek(fid,0,'bof'); % next read ADC adcref = 3.32; % assumed value of adc reference % in 12-bit mode max output count is 4095 adcounts = fread(fid,nrecords,'uint16'); dout = adcounts * (adcref/4095.0); fclose(fid); plot(dout); end
I assume that you are driving the sensor with 5V and ground for your power. The outputs should be at about 2.5V each. The T4.1 ADC has an input limit of about 3.3Volts, so you probably need a design that offsets the output signal down closer to zero volts. Otherwise pressure signals over 0.8 Volts will saturate your ADC inputs. You need to go through your sensor's sensitivity specs and calculate the maximum signal you expect in your tests, then design the circuit so that the output will be within the 0 to 3.3V range of the ADC. You also need to make sure that the amplifier has the bandwidth and slew rate to handle the fast pressure transients. (If the transients were slow, there would be no need to sample at 1MHz!)