Greetings,
I need some assistance with solving my issue of creating a lookup table from a waveform that is not perfectly sinusoidal. My first thought was to record the sample with my digital Oscope and save it out as a cvs file. But that doesn’t provide me with a lookup table that can be used in a AVR attiny micro.
The other thought I had was to get one of those cheap sparkfun logic analyzer kits that work with an Arduino board and open source software. I am an analog electronics guy, so im not very familiar with the data acquisition and conversion part.
Any suggestions? Oh, and I believe the lookup table needs to be a 0-512 bit x-axis and 2-4095 bit in the y-axis. Again, im not familiar with the digital side of the force..
Why does CSV file not work for you? You will get floating point values, which you can scale in any spreadsheet program according to your needs. The capture would likely have more points, so you would need to decimate the data until you get a number of samples you want.
Assuming you mean 512 samples of 12 bits (4096 levels), you would need a 1 KByte table. I don't know if there are any ATTiny micros that can support that, so you may need to compress that somehow.
EDIT: Actually nevermind that. If you need the table to be fixed, you can store it in the flash, and plenty of tinys have that.
Thanks for the reply.
so after a little more research and figuring some things out, forget about what i said about the 512/4096 etc. I need to segment the period of the waveform into 100 equal time values, then get the amplitude (Y-values) at that specific time value. with a CSV file of the captured waveform, i don't understand how to split the time axis into 100 then find the amplitude of each 100 time values. from this data i would input it into a lookup table.
any ideas?
My first thought was to record the sample with my digital Oscope and save it out as a cvs file. But that doesn’t provide me with a lookup table that can be used in a AVR attiny micro.
Yes, it does. You just need to translate the values from floating point to integers that fit the size of your DAC.
If you’re working with Arduino, have a look the MCP4725 library code, it sounds like it is exactly what you want. You just have to figure out the changes required to fit your data into the resolution of your DAC and the timing required to match your sample.
https://github.com/RobTillaart/MCP4725/blob/master/examples/MCP4725_wave_generator/MCP4725_wave_generator.ino
You might also consider a curve fitting operation, though how much depends on how fast you need the samples, and how much time you can spend calculating them beforehand. (As you've said nothing about application, I take that as free license to suggest anything that might possibly be applicable.)
Tim
Thanks for the reply.
so after a little more research and figuring some things out, forget about what i said about the 512/4096 etc. I need to segment the period of the waveform into 100 equal time values, then get the amplitude (Y-values) at that specific time value. with a CSV file of the captured waveform, i don't understand how to split the time axis into 100 then find the amplitude of each 100 time values. from this data i would input it into a lookup table.
any ideas?
Sounds like you want to interpolate a time series. Spreadsheets should be able to do it, e.g.:
https://exceloffthegrid.com/interpolate-values-using-the-forecast-function/
if you want to transform waveform captured with oscilloscope to a usable lookup table, you're needs to downsample record from oscilloscope to a DAC clock used on your circuit. In order to do it, you're needs to apply low pass filter with cut-off below Fs/2 where Fs is your DAC sample clock, after that you can decimate filtered record to your DAC sample clock, you can do by skipping unused samples.
But you're needs to apply low pass filter before decimation, because if you do it with no filtering, you will get aliased distortions on the output.
If your circuit DAC has higher sample rate than your recording, then you're needs to upsample it. You can to it by adding zero samples and then apply low pass filter with cut-off at Fs/2 where Fs is your recording sample rate.
if you want to transform waveform captured with oscilloscope to a usable lookup table, you're needs to downsample record from oscilloscope to a DAC clock used on your circuit. In order to do it, you're needs to apply low pass filter with cut-off below Fs/2 where Fs is your DAC sample clock, after that you can decimate filtered record to your DAC sample clock, you can do by skipping unused samples.
But you're needs to apply low pass filter before decimation, because if you do it with no filtering, you will get aliased distortions on the output.
maybe as slight tangent, but you can do low pass filtering at the same time as decimation, no point in calculating samples you are going throw away
maybe as slight tangent, but you can do low pass filtering at the same time as decimation, no point in calculating samples you are going throw away
Yes, you can combine decimation with FIR low pass filter, since you can skip calculation for samples which will be rejected, it allows to reduce required computation resources. This is how it usually implemented.