Go Down

### Topic: Multitask device. Timing of an event. (Read 586 times)previous topic - next topic

#### VT91

##### Jun 10, 2014, 09:05 pmLast Edit: Jun 10, 2014, 09:16 pm by VT91 Reason: 1
Hello.
I am trying to push a Tesla transformer to the limits by oscillating it at the self-resonance frequency and compensating for the fluctuations in that frequency from heat/ ionization/other losses. (Not exactly a Tesla transformer, but a very similar device.)

I want to write a computer program so my Arduino Nano measures frequency at a very high resolution by the means of a timer interrupt.
As the resonator is oscillating, the frequency is recorded as a value of N divided by the number of (external) clock oscillations.
(Seconds are too big here and are only good for me, the programmer.)

When the frequency value of N oscillation events / time is established, the program will record and output the value maybe will track how it changes in time.

The amount of N oscillation events that will have to pass before the output pin gives another square impulse will depend on the impedance of the oscillator.

I will have a dedicated analog input that will tell me that it is time to add a boost of energy to my oscillator. After the amplitude decays below the value of A, the value N is noted and is taken as a self-frequency of the oscillator. A boost of energy is added to the oscillator via a sharp spiked impulse. This is when the value of N/timer clock pulses will be recorder

1) What is the minimal impulse duration that Arduino Nano can generate on an output pin? Can it be as little as approximately 16 nanoseconds?
This is the limitation of the MOSFET paired with a LTC4449.

A power MOSFET with a mosfet driver IC will provide a spike at the command of the output pin of Arduino.

It is similar to when a toddler is sitting on a swing and their parent pushes the swing at the right time to keep it at resonance.
Since wind/ air resistance / friction and other factors cause the swing self-frequency to fluctuate, there is a need to push it at the right time every time the amplitude of the swing falls below a certain value.

This frequency meter of the circuit is very similar to example with a bicycle speedometer poster here:
http://www.instructables.com/id/Arduino-Timer-Interrupts/?ALLSTEPS
2nd example.

http://www.atmel.com/Images/doc8161.pdf
I am reading the datasheet and searching it for all the register names mentioned in the above example.

2) If I use an external clock source for my timers, how fast can this external clock be?

My circuit will run at around 10kHz to 10MHz. I want the resolution to be two orders higher than this if it can be.

3) I still need my timer interrupt function to get the desired result?
ISR(TIMER1_COMPA_vect){//timer1 interrupt 1Hz checks sum and ticks seconds)

I want to make my circuit run with minimal code - induced delays and if delays are significant, I want the circuit to compensate for them when the timing of the spike impulse is calculated.

If that requires that I learn more assembly-level commands, post some good links where I can read about this. I found few myself but examples are not relevant to my task.

4)What is the most efficient way to solve this problem? I can read the A328P datasheed through but it won't help me much because I cannot state what I exactly I want to code.

5) How do I position the sharp output pulse in relationship to the inputs from my frequency counter. I can use standard PWM functions, but I would rather not.
I want the output to reference to the same clock source as the frequency counter.

N events passes -> amplitude decays -> value of frequency is recorder -> MOSFET fires right before the nearest peak.
The firing before the nearest peak is similar to how ignition is timed in automobiles. This is where I will need my math.

I am better with theoretical mathematics than electronics and programming and I am already getting lost in the Instructables example I mentioned above.
( http://www.instructables.com/id/Arduino-Timer-Interrupts/?ALLSTEPS )

Some variables of this program may be entered via an encoder or a number pad.
I will try to build this program so it is self-learning, the memory size of the microcontroller will be my limit.

There will be an output text LCD screen of 4X20 lines. I know how to hook those things up as I did it before many times.
There will also be an ordinary DDS attached to this circuit, an AD9833. If you know any good examples of this DDS being interfaced to the Arduino, please post a link.

I am building an experimental jig with several functions to make things cheaper. Arduino Nano will be the heart of this device.

Thank you.

This is the sample code, but I am not sure what I want to do with it. If I can overclock the timer, I will do it and then go from there.
Maybe I don't have to work at 10MHz maximum.

http://forum.arduino.cc/index.php/topic,108434.0.html
6) Do I need to solder a thin copper wire to the SMD IC 328P and connect it to the external clock? What would be my circuit setup?
7) Do I hook up to TOSC2 pin to bring in external clock for the Timer2?

Code: [Select]
`void setup(){//set timer2 interrupt at 8kHz  TCCR2A = 0;// set entire TCCR2A register to 0  TCCR2B = 0;// same for TCCR2B  TCNT2  = 0;//initialize counter value to 0  // set compare match register for 8khz increments  OCR2A = 249;// = (16*10^6) / (8000*8) - 1 (must be <256)  // turn on CTC mode  TCCR2A |= (1 << WGM21);  // Set CS21 bit for 8 prescaler  TCCR2B |= (1 << CS21);    // enable timer compare interrupt  TIMSK2 |= (1 << OCIE2A);  }`

Good image hosting service that works well with Ardunio Forum: http://imgur.com/

#### VT91

#1
##### Jun 11, 2014, 02:15 am
Can I hook up some kind of an additional quartz clock source to the pin T0?
What part / circuit / configuration can I use to get frequencies that are higher than the processor chip itself?

(IF it is possible at all?)
Good image hosting service that works well with Ardunio Forum: http://imgur.com/

Go Up