low band pass filter, PWM arduino

Hi, if someone can help me.

I generated PWM 5 MHz using arduino nano, and I should pass it through band pass filter using op amp in order to have signal similar to sine vawe.
Can someone explain to me which design of filter should I use because the frequency is high, and which cut off freq should be chosen?
I have tried to simulate in proteus some of them, but it was not successful.

Thanks a lot.

Neira96:
I generated PWM 5 MHz using arduino nano, and I should pass it through band pass filter using op amp in order to have signal similar to sine vawe.

Do you really mean 5 MHz PWM ?

Sallen Key filter might be what you want. See Second Order Filters | Second Order Low Pass Filter .

“I generated PWM 5 MHz using arduino nano,”

Well if you did, you are an expert and don’t need our help.

Try this website after you tell us how you got to 5 MHz. 1,2,4,8 all are possible.

http://sim.okawa-denshi.jp/en/Fkeisan.htm

Surely to get 8-bit resolution , you need 256 cycles of clock, which limits a 16MHz processor to 16/256 or 1/16 MHz PWM theoretical max....

or have I missed a trick?

Allan

ps you need a DDS device to do this properly at MHz speeds. They're not too expensive.

Neira96:
Hi, if someone can help me.

I generated PWM 5 MHz using arduino nano, and I should pass it through band pass filter using op amp in order to have signal similar to sine vawe.
Can someone explain to me which design of filter should I use because the frequency is high, and which cut off freq should be chosen?
I have tried to simulate in proteus some of them, but it was not successful.

Thanks a lot.

A bandpass filter for 5MHz would normally be done using an LC filter circuit, not an opamp (a video opamp could handle the frequency I suppose, but it seems an odd thing to do, most standard opamps struggle above 50 to 100kHz signal content as there is hardly any gain left at those frequencies, LC circuits are passive and simpler).

Does this code have any sense?

pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
// Set up the 100 KHz output on pin 6
Timer1.initialize(10); // Frequency, 10us = 100khz
Timer1.pwm(6, 512); // 50% DC on pin 6
// Set up the 5 MHz output on pin 5
TCCR0A = bit(COM0A1) | bit(COM0B1) | bit(WGM01) | bit(WGM00);// Frequency, 0.2us = 5000khz
TCCR0B = bit(WGM02) | bit(CS00);// 50% DC on pin 5
OCR0A = 1;
OCR0B = 0;

The comments don't make any sense, but setting the CS00 bit to 1 clocks the timer at 16 MHz, so you can only get an integer submultiple of that frequency (8, 4, 2, 1 MHz etc.). With OCR0A=1, I think it will output 8 MHz.

8, 5.333, 4, 3.2, 2.667, 2.286, 2MHz etc, are the actual frequencies from a 16MHz clock.

The clocks per cycle = OCR0A+1, so 1 for 8MHz, 2 for 5.333MHz, and don't forget to set
the duty cycle to close to 50%. For 5.333MHz the best you can do is 33% or 67% duty cycle
though...