Page 1 of 1

1 phase inverter frequentie adjust?

Posted: Thu Jul 21, 2011 7:42 pm
by Jordy101091
Hi all,

I'm currently working on an application for driving a 1 phase FAN and if all goes well I'm going a step further and try to drive a 1 phase induction motor.
I have searched online how other people have done the same thing and did some research myself and with some help of a online calculator I have made a full sine wave look-up-table.
The lookup table contains 50 measurement point with an amplitude of 1023. This data is been stored in a data array within a calculation block.

(I dont know how to use a lookup-table in combination with the PWM module.)

This data is been givin to the PWM module via a simple while loop.
With the data of my lookup table and the following PWM module settings:

Period Register = 255
Clock Source = Clk / 1
uC clock = 19.6608 MHz

The output PWM signal looks like this.

Image


On the output of CCP1 (PWM1) I have build an RC-filter to filter the AC signal out so i'm able to see it.
After the RC filter the signal looks like this.

Image

As you can see my sinewave has a frequentie of 25.1Hz and a period time of 39.8 milli seconds. ( F = 1 / T or T = 1 / F)
My goal is to alter the frequentie from 25 Hz to about 150Hz. But I dont know how to do this. Maybe you can help me with this.

Also in my flowcode I needed to put an delay of 780 micro seconds to get a 25Hz signal.

I hope that you can help me change the frequentie between 25 and 150Hz with the use of a pot. meter.

Regards Jordy

Re: 1 phase inverter frequentie adjust?

Posted: Fri Jul 22, 2011 9:56 am
by Benj
Hello,

I've done a bit of maths and this seems to be about correct.

If your delay for the 25.1hz output is 780us then your delay for outputting 150hz should be around 130us.

For a potentiometer reading you could do something like this to give you a range between 150hz and 17.5hz.

ByteVar = ADC ReadAsByte
IntVar = (ByteVar * 3) + 130

Then for your delay you will have to do something like this.

DelayVar = IntVar
While DelayVar > 255
{
delayus(255)
DelayVar = DelayVar - 255
}
delayus(DelayVar)

Re: 1 phase inverter frequentie adjust?

Posted: Fri Jul 22, 2011 6:37 pm
by Jordy101091
He,

Thanks for youre reply but I dont exactly know what you mean.
Maybe you can modify my flowcode so I can see what you mean.

Thanks,

Regards Jordy

PS. How did you calculate this.

Re: 1 phase inverter frequentie adjust?

Posted: Mon Jul 25, 2011 11:31 am
by Benj
Hello,

Ok here is my version of your program with the delay control.

Here is the calculations I was using to work out what the delay periods need to be.

1 / 25.1 = 0.0398
0.0398 / 780E-6 = 51.07

1 / 150 = 6.66E-3
6.66E-3 / 51.07 = 130.53E-6

Re: 1 phase inverter frequentie adjust?

Posted: Mon Jul 25, 2011 4:50 pm
by medelec35
Hi. This is how I worked out delay between PWM intervals. I don’t know if correct or not since not done this type of thing before, but here goes:

Time delay = 1/(Frequency X intervals).
Since 50 intervals then time delay for 25Hz = 1/(25x50)= 800us
For 150Hz = 1/(150*50) = 133uS
So the delay should be variable between 133us and 800us
So the formula I used is IntVar = (ByteVar *65)/25+133

I did notice that this formula would not have worked in the flowchart since IntVar was left as a byte not integer.

If flowchart does work then please give credit to Ben as I only changed formula slightly( which may not be correct :p) and a byte to an integer.

Martin

Re: 1 phase inverter frequentie adjust?

Posted: Mon Jul 25, 2011 7:35 pm
by Jordy101091
I noticed something when I was testing the modified flowcode programs.

The frequentie adjustment by delays is not reliable. My results are jumping all over the place.
from 25 Hz to 296 Hz back to 68,9 Hz. Its really crazy. So I was thinking How can i do this so precise as possible.


I need something where I can control the period time of one PWM signal.

By a clock speed of 19.6608 MHz and a period register of 255 and clock divided by 1 I get a
pwm frequentie of 19.2 KHz and a PWM period of 52 uS.

The frequentie of my output signal depends on the the 52 uS if decrease this value my frequentie goes up if increase this my frequentie goes down.

My question can I control this.
Ore do I need to generate PWM in software.
If so please explaine to my how I can do this.

Regards Jordy

Re: 1 phase inverter frequentie adjust?

Posted: Mon Jul 25, 2011 9:09 pm
by medelec35
Is voltage on pin 2 (AN0) stable?

Re: 1 phase inverter frequentie adjust?

Posted: Mon Jul 25, 2011 9:29 pm
by Jordy101091
Yes voltage is stable up to 0.001 volt.
in combination with an RC filter 1k ,0.1uf

Re: 1 phase inverter frequentie adjust?

Posted: Sun Jul 31, 2011 10:14 pm
by billduck
This is a real interesting project. I just have a couple of questions. I understand the LUT. But why was the data biased to make it all positive. Also, I do not understand how to change the frequency. Lastly, were you going to drive some power transistors to provide some serious power to the motor.
Thanks in advance.