High Frequency

HI all!

I'm looking to be able to get frequencies between 300khz-500khz out of my Arduino Uno, I've only owned it for a couple days so I'm very new to Micro-controller programming :slight_smile: . Now the research I've done, my understanding is that it can't really be done... I had this idea to try using all 6 PWM channels! I'm currently working on a Solid State Tesla Coil Driver and hoping to be able to use the Arduino with a simple bread board circuit to achieve this, I can come up with the diagram if needed. It involves using 2 N-Channel FET's to drive an H-Bridge with the Primary as my Load :slight_smile: now my understanding is you can't achieve more than roughly 60Khz per PWM Channel. But what if you were to use all 6 to drive 2 N-Channel FET's. Here's the program I typed up for it.. I don't have a scope to test the frequency so I'm using little light bulbs. Therefore I can only test what I see.. and I can clearly tell it works at a lower frequency. I'm getting my HIGH/LOW driver. could someone possibly scope this at a higher frequency and post there results?? That or any help at all would be very enlightening!!

Thank you!

int led10 = 10;
int led5 = 5;
int led3 = 3;
int led11 = 11;
int led6 = 6;
int led9 = 9;

void setup() {

pinMode(led10, HIGH);
pinMode(led5, HIGH);
pinMode(led3, HIGH);
pinMode(led11, HIGH);
pinMode(led6, HIGH);
pinMode(led9, HIGH);
}

void loop()
{
digitalWrite(led10, LOW);
digitalWrite(led5, HIGH);
digitalWrite(led3, LOW);
digitalWrite(led11, LOW);
digitalWrite(led6, LOW);
digitalWrite(led9, LOW);
delay(50);
digitalWrite(led10, HIGH);
digitalWrite(led5, LOW);
digitalWrite(led3, LOW);
digitalWrite(led11, LOW);
digitalWrite(led6, LOW);
digitalWrite(led9, LOW);
delay(50);
digitalWrite(led10, LOW);
digitalWrite(led5, LOW);
digitalWrite(led3,HIGH);
digitalWrite(led11,LOW);
digitalWrite(led6, LOW);
digitalWrite(led9, LOW);
delay(50);
digitalWrite(led10, LOW);
digitalWrite(led5, LOW);
digitalWrite(led3,LOW);
digitalWrite(led11,HIGH);
digitalWrite(led6, LOW);
digitalWrite(led9, LOW);
delay(50);
digitalWrite(led10, LOW);
digitalWrite(led5, LOW);
digitalWrite(led3,LOW);
digitalWrite(led11,LOW);
digitalWrite(led6, HIGH);
digitalWrite(led9, LOW);
delay(50);
digitalWrite(led10, LOW);
digitalWrite(led5, LOW);
digitalWrite(led3,LOW);
digitalWrite(led11,LOW);
digitalWrite(led6, LOW);
digitalWrite(led9, HIGH);
delay(50);
}

A H bridge needs 4 Fets to drive it .
2 Fets will only drive a 1/2 H bridge which isnt applicable .
Why do you want to use an Arduino to drive the H bridge?
Wouldnt a simple NE555 timer be a lot easier.

The NE555 cant drive FET's in opposite phase..? Sorry for being unclear, I do wish to drive a 1/2 Bridge for now. I chose the Arduino for its multipurpose use, other projects :slight_smile: .. My first SSTC used a single FET and an NE555, but could only handle between 110-115v DC before cooking the FET... I'm looking for more lol. If the Arduino cant do it then I'll move on to PWM DIP's but I was hoping the Arduino could do this!

You need to look at programming the timers directly. You can count once per clock cycle, so for
300kHz you'd need to set the timer to reset every 50 clocks, for 500kHz every 32 clocks. Timers
have modes for such programmed limits, but note each timer is slightly different in its programming.

People have written libraries to make programming timers easier.

Not an expert here, but wouldn't the SG3525 be easier.
Well documented.
Two complementary outputs with 20volt/500mA drive current, adjustable dead time, 400Khz max frequency, etc.
Widely used in switching supplies.
Leo..

Hi,

Google tesla coil arduino

Tom... :slight_smile:

MarkT:
You need to look at programming the timers directly. You can count once per clock cycle, so for
300kHz you’d need to set the timer to reset every 50 clocks, for 500kHz every 32 clocks. Timers
have modes for such programmed limits, but note each timer is slightly different in its programming.

People have written libraries to make programming timers easier.

I’ve come across this Forum here and have found a code that allows me to get 10Hz-1MHz…

Here’s the code I’m currently using…

//dynamic frequency generator
//for timer2
#include <avr/io.h>
#include <avr/interrupt.h>
unsigned long frequency = 1000000 ;
void setup(){
pinMode(9,1);
pinMode(10,1);
DFG(frequency);
Serial.begin(57600);

}

void loop(){

}

void DFG(unsigned long tempfreq){
cli();//disable interupts
TCCR1A = 0;//registers for timer 1
TCCR1B = 0;
TCNT1=0;
TCCR1A |= _BV(COM1A0) + _BV(COM1B0);
TCCR1B |=_BV(WGM12);
TCCR1C = _BV(FOC1A);
if(tempfreq > 122 && tempfreq < 1000001){
OCR1A = (8000000/tempfreq)-1;//#TIMER COUNTS
TCCR1B |= _BV(CS10);
}
else if(tempfreq <= 122 && tempfreq > 15){
OCR1A = (1000000/tempfreq)-1;
TCCR1B |= _BV(CS11);
}
else if(tempfreq <= 15 && tempfreq > 4){
OCR1A = (125000/tempfreq)-1;
TCCR1B |= _BV(CS10) + _BV(CS11);
}

//TIMSK1 = _BV(OCIE1A);//TIMER1 COMPARE INTERUPT
sei();//enable interupts
}

Now using this code to drive the gates of 2(2N222A) Transistors would this be a somewhat reliable way to work myself up to a Half Bridge Driver? I’m using it now to drive a 12v Half Bridge with a speaker as my load and I’m getting 10Hz to 15Khz from what I can hear, But I have no scope to test anything here :frowning: . I want to test higher input voltages and bigger FET’s to see if it can drive a Primary as my Load but don’t want to get ahead of myself… :slight_smile: I feel I’m not there yet even though It “seems” to be working…

Thank you!!

unsigned long frequency = 1000000 ;

This is the line of code I'm using to make my adjustments.. It seems to be TRUE when adjusting to 15,000 to get roughly 15Khz...

Such as:
unsigned long frequency = 15000 ; // for 15 KHz?

Wawa:
Not an expert here, but wouldn't the SG3525 be easier.
Well documented.
Two complementary outputs with 20volt/500mA drive current, adjustable dead time, 400Khz max frequency, etc.
Widely used in switching supplies.
Leo..

This looks like a great alternative!! :slight_smile:
Would you know of any that could possibly
give me a frequency up to maybe 1 Megahertz?
Just for a greater tuning range.. with the same DIP16?

Thank you!!

Hi,

Sorry for asking, but, what is your electronics, programming, arduino, hardware experience?

You talk of gates on 2N2222 transistors, you are talking about frequencies you have no method of measuring.
You need to consider that the coils you are designing and driving have significant inductance, so driving them will not bejust slapping a bigger transistor in and higher drive voltage.
Tesla designs are great to build and watch, but the design considerations are not simple.

Tom… :slight_smile:

I've

TomGeorge:
Hi,

Sorry for asking, but, what is your electronics, programming, arduino, hardware experience?

You talk of gates on 2N2222 transistors, you are talking about frequencies you have no method of measuring.
You need to consider that the coils you are designing and driving have significant inductance, so driving them will not bejust slapping a bigger transistor in and higher drive voltage.
Tesla designs are great to build and watch, but the design considerations are not simple.

Tom.... :slight_smile:

No need to be sorry!

I'm very new to the Arduino lol.. I've had it for only a week now :slight_smile: and my apologies on referring to a Transistor with a Gate.. I'm using these smaller Transistors and N channel Mosfet's for testing do to how new I am to using the Arduino.. And I'm simply using the small transistor to drive the N channel FET's Gate to Ground rather than using it to drive the gate itself. I've built a solid state coil with a single FET.. Roughly 250W input with break out around 9" at "roughly" 350Khz lol.. if my math is correct! Again all done without a scope :slight_smile: Im just looking to move onto a Half Bridge circuit and eventually a 1KW Full Bridge circuit.. Just trying to progress slowly and take in all the info I can on the "how to" part :smiley: especially since I currently don't own any proper testing equip..

If you would like to see where I currently stand with my circuit I have no problem drawing it up!!
Id love to get some second opinions :smiley:

Bradley_DA:
Again all done without a scope :slight_smile:

Well, Tesla didn't have access to an oscilloscope but on the other hand he used a spark gap rather than an oscillator to drive his coils.

Russell.