Cheap DAQ DIY - Page 1
Forum section: electronics / beginners

author: phiza
author_rank: Contributor
timestamp: May 17, 2022, 06:26:48 pm
content: HelloLet'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 watchingxandf(x)voltages as if we were watching real numbers)So we can havef(x)=log(x)orf(x)=x^2orf(x)=5*xand 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 inputx0then the digital value sets an EEPROM in order to output from a DAC the desired voltage that isf(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 tonightCheers

author: ebastler
author_rank: Super Contributor
timestamp: May 17, 2022, 06:39:11 pm
content: 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.

author: ledtester
author_rank: Super Contributor
timestamp: May 17, 2022, 07:22:11 pm
content: Quote from: phiza on May 17, 2022, 06:26:48 pmYou 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.pdfYou can find Ultrascope for the DS1052E on this page in the Downloads section:https://www.rigolna.com/products/digital-oscilloscopes/1000/

author: phiza
author_rank: Contributor
timestamp: May 17, 2022, 07:32:30 pm
content: Quote from: ebastler on May 17, 2022, 06:39:11 pmThanks!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 dof(x)=e^xand I need to see how closer I'm to the real one, turning trimmers at the same time.Quote from: ledtester on May 17, 2022, 07:22:11 pmYeah 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.

author: ebastler
author_rank: Super Contributor
timestamp: May 17, 2022, 07:56:16 pm
content: Quote from: phiza on May 17, 2022, 07:32:30 pmIt 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?

author: phiza
author_rank: Contributor
timestamp: May 17, 2022, 10:21:44 pm
content: Quote from: ebastler on May 17, 2022, 07:56:16 pmYes You are right but I haven't done the math yetIt'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?Quote from: ebastler on May 17, 2022, 07:56:16 pmNo, 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

author: ledtester
author_rank: Super Contributor
timestamp: May 17, 2022, 11:32:29 pm
content: You might this alternative to Rigol's Ultrascope:https://github.com/ralfstx/rigol-linux

author: ebastler
author_rank: Super Contributor
timestamp: May 18, 2022, 06:47:13 am
content: Quote from: phiza on May 17, 2022, 10:21:44 pmThat'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.QuoteIf 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?QuoteThere 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).

author: Maurizio1957
author_rank: Contributor
timestamp: May 18, 2022, 07:15:10 am
content: What do you think about a VNA? There are a lot of cheap instruments like nanovna, VNWA from DG8SAQ ( I have this ) ...Cheers Maurizio

author: phiza
author_rank: Contributor
timestamp: May 18, 2022, 11:00:23 am
content: Quote from: ebastler on May 18, 2022, 06:47:13 amYes, 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.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)Quote from: Maurizio1957 on May 18, 2022, 07:15:10 amI 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 functionf(x)as if it were a calculator. Then if it also have a good frequency response is good but not necessary.Thanks!

author: rstofer
author_rank: Super Contributor
timestamp: May 18, 2022, 02:46:16 pm
content: 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 bandwidth14 bit DACs, 12 MHz bandwidthOr 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.htmlAchieving simultaneity is still an issue. Maybe less so on the AD2.

author: phiza
author_rank: Contributor
timestamp: May 18, 2022, 03:14:57 pm
content: Quote from: rstofer on May 18, 2022, 02:46:16 pmI 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!

author: phiza
author_rank: Contributor
timestamp: May 18, 2022, 03:56:13 pm
content: btw this is the actual setupMy "DC sweeps" comes from a Korg SQ-1 sequencer

author: BeBuLamar
author_rank: Super Contributor
timestamp: May 18, 2022, 04:00:05 pm
content: 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.

author: rstofer
author_rank: Super Contributor
timestamp: May 18, 2022, 04:08:02 pm
content: 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.OTOHSimultaneity 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.pdfIt'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.pdfBack 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.