Electronics > Microcontrollers

Creating lookup table from analog waveform

(1/2) > >>

blue2thabone:
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..

ataradov:
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.

blue2thabone:
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?

ataradov:
I don't really understand what you need to do. You mean take 100 equally spaced points? Then for Excel you can do that https://www.ablebits.com/office-addins-blog/select-every-other-row-excel/ Select every N-th row to get 100 remaining.

WattsThat:

--- Quote --- 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.
--- End quote ---

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

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod