Author Topic: Cheap DAQ DIY  (Read 1657 times)

0 Members and 1 Guest are viewing this topic.

Offline phizaTopic starter

  • Contributor
  • Posts: 13
  • Country: it
Cheap DAQ DIY
« on: May 17, 2022, 06:26:48 pm »
Hello

Let's say I want to measure the output voltage vs the input voltage of a device (see blackbox.PNG).

Also we know that ideally we can caractherize the device behavior with a real-valued function of a real variable.
(in other words we're watching x and f(x) voltages as if we were watching real numbers)
So we can have f(x)=log(x) or f(x)=x^2 or f(x)=5*x and so on...

Also we know that the device isn't really perfect at the moment and we need to trim some potentiometers on the device to match (to approximate) perfectly this function.

What is the best method to achieve that?

I mean i can see for example the function with a 2-channel scope in XY mode and it's ok but i can't got really the numbers...
(maybe it's only me with a Rigol DS1052E but yeah I can store the csv data but I have to plug and unplug the USB stick every time I change something...NO!)

We can try to acquire data with an arduino but we can't read two input simultaneusly (1 ADC only, I've seen that the Portenta H7 have two but don't know more on that)

Another idea, the simplest to me but possibly can be the worst is to take one ADC to read the input x0 then the digital value sets an EEPROM in order to output from a DAC the desired voltage that is f(x0)
(those digital values were previously written to the EEPROM but we don't care about that)
Then this voltage is compared with the one caming from the output of the device (the blackbox) using an opamp (maybe you can approach different techniques at this point, don't matter)
Finally we read the difference in some way using an arduino or simply the scope.

I don't know, I have searched for DAQs online but seems a bit too expensive option to me, the ones that can read more input simultaneously starts from 1900 euros!
Also would be ideal to connect this acquiring process to scilab or others free numeric computing environment but maybe I'm asking too much for a cheap thing.

Please advise me! I'm sure that there is a better option but I can't figure it out, please let me sleep tonight :D
Cheers

"Resist the temptation to take refuge in equations as a substitute for understanding how a circuit really works." The Art of Electronics
 

Online ebastler

  • Super Contributor
  • ***
  • Posts: 6422
  • Country: de
Re: Cheap DAQ DIY
« Reply #1 on: May 17, 2022, 06:39:11 pm »
Have you considered using one DAC to output the x value (under microprocessor control) and one ADC to read the f(x) value?

Also, computer sound cards have pretty good ADCs (at least two of them) and also DACs. There are various commercial and shareware programs around which turn your computer into an "audio analyzer". Important limitation: Most sound cards are not DC-coupled, hence can only generate and measure AC signals, typically from some 10 Hz upwards.
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3035
  • Country: us
Re: Cheap DAQ DIY
« Reply #2 on: May 17, 2022, 07:22:11 pm »
...
I mean i can see for example the function with a 2-channel scope in XY mode and it's ok but i can't got really the numbers...
(maybe it's only me with a Rigol DS1052E but yeah I can store the csv data but I have to plug and unplug the USB stick every time I change something...NO!)
...

You might try the Rigol's Ultrascope software which allows computer control of the scope:

https://beyondmeasure.rigoltech.com/acton/attachment/1579/f-0695/1/-/-/-/-/DS1000Z%20DS2000%20DS4000%20DS6000%20UltraScope%20Getting%20Started%20Guide.pdf

You can find Ultrascope for the DS1052E on this page in the Downloads section:

https://www.rigolna.com/products/digital-oscilloscopes/1000/
 

Offline phizaTopic starter

  • Contributor
  • Posts: 13
  • Country: it
Re: Cheap DAQ DIY
« Reply #3 on: May 17, 2022, 07:32:30 pm »
Have you considered using one DAC to output the x value (under microprocessor control) and one ADC to read the f(x) value?

Also, computer sound cards have pretty good ADCs (at least two of them) and also DACs. There are various commercial and shareware programs around which turn your computer into an "audio analyzer". Important limitation: Most sound cards are not DC-coupled, hence can only generate and measure AC signals, typically from some 10 Hz upwards.
Thanks!

Yes maybe it's the cleanest technique but we're going to lose the "simultaneous reading feature" this way and the input is not anymore in real domain because it can "only" assume values defined by DAC resolution.
Theorethically this may be a problem if you deal with non-linear fuctions because you can lose a lot of accuracy in key points. Instead with an EEPROM you can choose were to lose accuracy (kinda).

With less abstaction: I've maded some exponential converters with different approaches, a circuit that basically do f(x)=e^x and I need to see how closer I'm to the real one, turning trimmers at the same time.  :-/O

...
I mean i can see for example the function with a 2-channel scope in XY mode and it's ok but i can't got really the numbers...
(maybe it's only me with a Rigol DS1052E but yeah I can store the csv data but I have to plug and unplug the USB stick every time I change something...NO!)
...

You might try the Rigol's Ultrascope software which allows computer control of the scope:

https://beyondmeasure.rigoltech.com/acton/attachment/1579/f-0695/1/-/-/-/-/DS1000Z%20DS2000%20DS4000%20DS6000%20UltraScope%20Getting%20Started%20Guide.pdf

You can find Ultrascope for the DS1052E on this page in the Downloads section:

https://www.rigolna.com/products/digital-oscilloscopes/1000/


Yeah I've those two software currently installed, no way to acquire data from two channel remotely, only one at time and no way to stream data.
The only way to acquire 2-channel data is with a USB stick. Maybe that they simply lock those features on cheap models.
"Resist the temptation to take refuge in equations as a substitute for understanding how a circuit really works." The Art of Electronics
 

Online ebastler

  • Super Contributor
  • ***
  • Posts: 6422
  • Country: de
Re: Cheap DAQ DIY
« Reply #4 on: May 17, 2022, 07:56:16 pm »
[...] but we're going to lose the "simultaneous reading feature" this way and the input is not anymore in real domain because it can "only" assume values defined by DAC resolution.
Theorethically this may be a problem if you deal with non-linear fuctions because you can lose a lot of accuracy in key points.

It might help if you disclose the precision (resolution) requirements...  ::)

Also, if "simultaneous reading" is important, I assume you want a defined response over a certain input frequency range, and are concerned about phase shifts? Again, what frequency range and hence time resolution are we talking about?

Depending on the required frequency range, using some analog signal generator (which I assume you have?) and a sound card to sample x and f(x) might still work?
 

Offline phizaTopic starter

  • Contributor
  • Posts: 13
  • Country: it
Re: Cheap DAQ DIY
« Reply #5 on: May 17, 2022, 10:21:44 pm »
It might help if you disclose the precision (resolution) requirements...  ::)

Yes You are right but I haven't done the math yet :D
It's a bit tricky because let's say that I want to approximate the function with a relative error of 0.1%. Or that I want to approximate the function with an absolute error of 0.1mV in a 0-5V range.
Without sweeping frequencies for the moment, let stay in DC. I mean how can you be sure that the voltages you are providing from the signal generator (that I have) have enough resolution for that?

Also, if "simultaneous reading" is important, I assume you want a defined response over a certain input frequency range, and are concerned about phase shifts? Again, what frequency range and hence time resolution are we talking about?

Depending on the required frequency range, using some analog signal generator (which I assume you have?) and a sound card to sample x and f(x) might still work?

No, it's not important for those things but how can you be sure that the x voltages you are reading at the input are the ones that produces the f(x) voltages at the output if not by reading them at the same time?
Of course one can say "we are in DC so input isn't changing" but measurements in real world can be affected by a lots of different things. Am I too paranoid?

Anyway Thanks for your time and patience :)

"Resist the temptation to take refuge in equations as a substitute for understanding how a circuit really works." The Art of Electronics
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3035
  • Country: us
Re: Cheap DAQ DIY
« Reply #6 on: May 17, 2022, 11:32:29 pm »
You might this alternative to Rigol's Ultrascope:

https://github.com/ralfstx/rigol-linux

 
The following users thanked this post: phiza

Online ebastler

  • Super Contributor
  • ***
  • Posts: 6422
  • Country: de
Re: Cheap DAQ DIY
« Reply #7 on: May 18, 2022, 06:47:13 am »

It's a bit tricky because let's say that I want to approximate the function with a relative error of 0.1%. Or that I want to approximate the function with an absolute error of 0.1mV in a 0-5V range.

That's quite a range. One part in 1000 should be easy; a 12 bit ADC as found in various microcontrollers should do the job. In contrast, one in 50000 takes some effort; a 16 bit DAC or ADC won't be good enough in practice if you consider noise and nonlinearity.

Quote
Without sweeping frequencies for the moment, let stay in DC. I mean how can you be sure that the voltages you are providing from the signal generator (that I have) have enough resolution for that?

If you don't trust your signal generator, I assume you want to set the x values manually from some adjustable DC source? If that's the idea and you have to cope with the manual setting step, why not use two multimeters to measure x and f(x), write them down and be done with it?

Quote
[...] how can you be sure that the x voltages you are reading at the input are the ones that produces the f(x) voltages at the output if not by reading them at the same time?
Of course one can say "we are in DC so input isn't changing" but measurements in real world can be affected by a lots of different things. Am I too paranoid?

There may be deviations from the nominal values due to nonlinearities, but these should be constant over time. So if you have a DAC-controlled voltage source which you don't trust, and an ADC you trust, you could measure the DAC transfer function first, in a separate sweep, and then capture your f(x) in a subsequent sweep.

There's always random thermal noise as well, but that is best dealt with in the analog domain (by generous low-pass filtering, i.e. capacitors on the input and output of your f(x) device).
 
The following users thanked this post: phiza

Offline Maurizio1957

  • Contributor
  • Posts: 39
  • Country: it
Re: Cheap DAQ DIY
« Reply #8 on: May 18, 2022, 07:15:10 am »
What do you think about a VNA? There are a lot of cheap instruments like nanovna, VNWA from DG8SAQ ( I have this ) ...
Cheers Maurizio
« Last Edit: May 18, 2022, 07:20:30 am by Maurizio1957 »
 
The following users thanked this post: phiza

Offline phizaTopic starter

  • Contributor
  • Posts: 13
  • Country: it
Re: Cheap DAQ DIY
« Reply #9 on: May 18, 2022, 11:00:23 am »

If you don't trust your signal generator, I assume you want to set the x values manually from some adjustable DC source? If that's the idea and you have to cope with the manual setting step, why not use two multimeters to measure x and f(x), write them down and be done with it?


Yes, I agree, this is probably the best way to go.
And I hadn't thiking about it because I still had in mind this kind of automated process to collect data and analyze them on the laptop.

As I wrote before I have done the same circuit in different flavours so I would like to find out the one that performs better.
So build a device that do it for me was my first idea. Like an evaluation board for my boards.  :-BROKE
Then if it works I can start dreaming about some kind of circuit that automatically set the "potentiometers" to their best value.
(obviously we have to replace the "potentiometers" with transistors and op amps, also for that there are different workaround)

What do you think about a VNA? There are a lot of cheap instruments like nanovna, VNWA from DG8SAQ ( I have this ) ...
Cheers Maurizio

I had never thought about it but i'll give it a look even if it looks to me that is a device made to analyse response over high frequency variations, am I wrong?
Sorry I haven't specified that well, the input should be a DC sweep (just realized that), I'm not much interested in frequency response.
This circuit "only" do the function f(x) as if it were a calculator. Then if it also have a good frequency response is good but not necessary.

Thanks! :D


« Last Edit: May 18, 2022, 11:05:09 am by phiza »
"Resist the temptation to take refuge in equations as a substitute for understanding how a circuit really works." The Art of Electronics
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: Cheap DAQ DIY
« Reply #10 on: May 18, 2022, 02:46:16 pm »
I know it is expensive (and violates the 'cheap' criteria) but I would use something like the Digilent Analog Discovery 2 since it has two AWGs and 2 isolated input scope (ADC) channels.  It's less expensive because I already have one (and an original Analog Discovery).

In theory, I could take both x and f(x) as inputs and do whatever with the results.  There are voltage limitations on the inputs that need to be obeyed.  Not an issue at 5V.

https://digilent.com/shop/analog-discovery-2-100ms-s-usb-oscilloscope-logic-analyzer-and-variable-power-supply/

14 bit ADCs, 30 MHz bandwidth
14 bit DACs, 12 MHz bandwidth

Or the Teensy 4.1, a 600 Hz ARM with 18 analog input pins and the Teensyduino tools that integrate into the Arduino IDE.  System calls are identical to Arduino, etc.

https://www.pjrc.com/store/teensy41.html

Achieving simultaneity is still an issue.  Maybe less so on the AD2.
« Last Edit: May 18, 2022, 02:51:22 pm by rstofer »
 
The following users thanked this post: phiza

Offline phizaTopic starter

  • Contributor
  • Posts: 13
  • Country: it
Re: Cheap DAQ DIY
« Reply #11 on: May 18, 2022, 03:14:57 pm »

In theory, I could take both x and f(x) as inputs and do whatever with the results.  There are voltage limitations on the inputs that need to be obeyed.  Not an issue at 5V.

https://digilent.com/shop/analog-discovery-2-100ms-s-usb-oscilloscope-logic-analyzer-and-variable-power-supply/

14 bit ADCs, 30 MHz bandwidth
14 bit DACs, 12 MHz bandwidth

Achieving simultaneity is still an issue.  Maybe less so on the AD2.


I was watching it just yesterday but I haven't found much about the acqusition process of WaveForm software.
Seems a very good option, could you explain how do you do measurements using the AD2?
It's like an oscilloscope? Or you have to program it in some way? Also is possible to save data in format like .csv?

Thanks!
"Resist the temptation to take refuge in equations as a substitute for understanding how a circuit really works." The Art of Electronics
 

Offline phizaTopic starter

  • Contributor
  • Posts: 13
  • Country: it
Re: Cheap DAQ DIY
« Reply #12 on: May 18, 2022, 03:56:13 pm »
btw this is the actual setup ^-^
My "DC sweeps" comes from a Korg SQ-1 sequencer

« Last Edit: May 23, 2022, 02:30:49 pm by phiza »
"Resist the temptation to take refuge in equations as a substitute for understanding how a circuit really works." The Art of Electronics
 

Offline BeBuLamar

  • Super Contributor
  • ***
  • Posts: 1188
  • Country: us
Re: Cheap DAQ DIY
« Reply #13 on: May 18, 2022, 04:00:05 pm »
What is the range of voltage for the input and output? Also AC or DC?
I assume it's DC and less than 10VDC. If so 2 DMM and manually record the data is good.
I can use a PLC with analog output and input and log the data on an SD card in *.csv file.
I don't know about cost. I think of the 2 methods because it's what I can do with what I have on hand.
« Last Edit: May 18, 2022, 04:04:08 pm by BeBuLamar »
 
The following users thanked this post: phiza

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: Cheap DAQ DIY
« Reply #14 on: May 18, 2022, 04:08:02 pm »
The AD2 can be scripted but I haven't done it.  The two ADC inputs are floating (differential) meaning that one side of the input signal need not be at circuit ground as would be common with a scope probe.  Think about measuring the voltage drop across a transistor base resistor where neither end is grounded.  This is a real handy feature.

You can download the Waveforms software and play with the 'Demo' device to get some kind of feel for the device.  I am a HUGE fan of the AD2 but I was a bigger fan at the pre-Covid opportunistic price.  Today it is a little hard to justify unless it is for a student.  Someone who is going to spend a lot of time experimenting with circuits.

OTOH

Simultaneity is a problem in sampling so here is a 2 channel 24 bit ADC with simultaneous sampling:

https://www.ti.com/lit/ds/symlink/ads131b02-q1.pdf

It's just the first one I ran across when I was looking for simultaneous sampling and is clearly over the top in terms of resolution.

Here is a 14 bit version at Mouser and there is stock:

https://www.mouser.com/datasheet/2/609/ad7264-1605323.pdf

Back to the AD2:  I can take a 0.1 ufd capacitor and a 10k resistor (RC time constant = 1 ms) and display the low pass filter characteristics and the forced response as attached.  I REALLY wish something like this had been available when I was in school!

I attached a couple of plots just as simple examples of the kinds of things I do with the AD2.  The phase shift shows the 90 degree shift in a simple RC circuit.  From ELI the ICE man.  'I' leads 'E' in a Capacitive circuit.
« Last Edit: May 18, 2022, 04:34:08 pm by rstofer »
 
The following users thanked this post: phiza


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf