Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Signal generation (sampling issue)

Status
Not open for further replies.

Robert_

Newbie level 3
Joined
May 1, 2015
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
32
Hello,

I'm currently working on a projet for fun and to learn about signal synthesis.
My setup is a digital to analog converter of 8bits (home made R2R) driven by an FPGA.

I'd like to generate different waves forms (square, sawtooth, triangle, sine) with a frequency of 1 to ~20kHz.

Let's take for example the sine wave :

How to calculate the number of sample I need to get a good reconstruction ?
I know Shannon theory that tells frequency sampling must be at least twice of the max frequency.

What is the link between the number of bit in my DAC and the complexity of the signal I'd like to produce ?
I mean if you have a 1bit DAC you won't be able to produce a sine wave but square wave is ok.

Let's say I have fmax= 20kHz I take as sampling frequency fs = 200Khz.
Given that I have 256 possible states and assuming 0 of my sine wave is at 128. It is useless to take more than 128 dots per half period.

I'm lost ,I would be grateful if somebody could help me :)

Robert
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
19,960
Helped
4,372
Reputation
8,753
Reaction score
4,357
Trophy points
1,393
Activity points
132,137
Hi,

frequency sampling must be at least twice of the max frequency.
True. But mind that you must not use "fundamental" frequency, but the frequency of the highest overtone.

Sine is simple: no overtones, just use fundamental frequency.
All others have overtones up to unlimited frequency. You see the problem?
So you have to decide what distortion or deformation you can accept.

The most difficult regarding the overtones is a square wave. On the other side it needs no true "reconstruction". So outputting without filters may give the best results.

With sawtooth or triangle you need a reconstruction filter to avoid those small steps caused by the DAC. Here you have to make a compromise. Try 20 times the fundamental frequency. But you will see the small jitter in amplitude.

*****
An example to show the mystery....
Sampling frequency 200kHz. Output 1kHz sawtooth with 50% amplitude.
This gives 200 samples per period and 128 steps in amplitude. The digital data output will be something like this:
0, 0, 1, 1, 2, 2, 3, 4, 4, 5, 5, 6, 6, 7, 8, 8, ...
Most of the values come twice in row, but others only once ( here 3 and 7).
So it is almost impossible for a reconstruction filter to "interpolate" a unique slope..

******

A relatively cheap solution with good quality an low part count is: using audio DACs.
They are cheap, have high resolution and most of them have built in oversampling technique with almost ideal digital reconstruction filter ( up to the given frequency limit) and they need only a simple analog filter.
Maybe go for a 192kHZ sample rate one if you are interested in.

But i find this is a good (and useful) way to learn about FPGA programming and signal processing.

Good luck
 

Vbase

Full Member level 6
Joined
Apr 7, 2015
Messages
367
Helped
74
Reputation
148
Reaction score
72
Trophy points
28
Activity points
1,997
Sampling 20KHz with 200K samplings per second will give you 10 dots per period.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top