jmharvey1 / DDS_AD9850_AntennaAnalyzer

This is a no frills DIY Analyzer intended for frequencies ranging from 1.6 to 30 Mhz
GNU General Public License v2.0
136 stars 25 forks source link

Compensation Values #1

Open etchorner opened 7 years ago

etchorner commented 7 years ago

Your video, and the code base, have been very enlightening in understanding this sort of project. The offset, diode, and gain compensation factors make perfect sense to me. I'm a bit confused about the source of the factors used in the CorrectReading() function used to deal with diode non-linearity, though.

You mention the analysis in your video and you show a plot of the data. From this I infer that you broke the "curve" up piece wise and did a linear regression for each piece to determine the correction factor equations, but unless I missed it, I'm unclear on what data was used for this process. Can you enlighten me on the process you use to reach your non-linearity compensation equations?

Your circuit is similar, but not identical, to an attempt I'm working on here, soI don't think the correction factors you use can be just plopped into my code, I would need to cook up my own CorrectReading() function, no?

jmharvey1 commented 7 years ago

Excellent question... And, I suspect you're right (you'll need code to match your circuit). Also I think you followed my thought process pretty well. At the time I did this work I was probably working off (at most a 1/2 dozen data points) Later I made this video: https://www.youtube.com/watch?v=x7DOaQpAy3s In it, while I don't spend a lot of time talking about the linearity issue, its same problem. But in this case I have a high degree of confidence that the digital data points I can collect using the PSK signal should map to a sinusoidal trace. So it was a fairly straight forward process to come up with and actual vs expected set of values, and then from that generate a response plot. The new formula found in the PSK sketch reads as follows: double CorrectReading(double ReadVal){ double CalcVal;//22.0417; if( ReadVal<=167){ CalcVal = -(4.61597ReadValReadValReadValReadVal/10000000)+(0.000194461ReadValReadValReadVal)-(0.0294468ReadValReadVal)+(2.42394ReadVal); } else{ CalcVal =0.44324138 ReadVal+(78.242-24.841); } CalcVal = 2.01 CalcVal;// this bumps the slope back to where a count of 1024 in gives a count of ~1024 out return CalcVal; }

In the analyzer sketch ( as I recall it now) I broke the response plot down into three regions, and manually fitted an equation to each region that would mirror closely that region's path.

The PSK code was done in a similar way. But as I said, I now I had many more data points. And with that set ( I think) I used an on line (similar to this site: http://www.xuru.org/rt/pr.asp) Regression Tool to come up with the equation used in the above code. Not sure exactly what you are building there, or what you have to work with, but maybe you can find a similar approach to excite your circuit, Collect the data it generates, and compare it to what was expected, and from that work out an algorithm that will convert real data back to expected values. GL & thanks for your question Jim (KW4KD)