Continue to Site

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.

PIC AC Motor Control - 18F2331 using CCS

Status
Not open for further replies.

deperkin

Member level 2
Joined
Apr 12, 2009
Messages
47
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,776
Hello all,

I am trying to control the speed of an AC motor (i know it is problematic).

Here is the simple code i have thus far:

#include <18F2331.H>
#include <STDLIB.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, NOPUT, NOLVP, NOMCLR
#ocs 500 kHz
int16 fanL, fanspeed;
int8 portB;

#INT_RB
void AC_isr(){
disable_interrupts(int_RB);
portB = input_b()
output_low(PIN_C2); //MOTOR
delay_us(fanL);
output_toggle(PIN_C4); //LED
output_high(PIN_C2); //MOTOR
}

void main() {
SET_TRIS_A(0xFF); //PINS A0-A7 are inputs
SET_TRIS_B(0xFF); //PINS B0-B7 are inputs
while(TRUE){
enable_interrupts(INT_RB);
enable_interrupts(GLOBAL);
fanspeed = 0x0F & input_a();
switch(fanspeed){
case 10:fanL=0;break;
case 9: fanL=58;break;
case 8: fanL=1515;break;
case 7: fanL=2272;break;
case 6: fanL=3030;break;
case 5: fanL=3788;break;
case 4: fanL=4545; break;
case 3: fanL=5303;break;
case 2: fanL=6060;break;
case 1: fanL=6818;break;
case 0: fanL=7576; break;
default: fanL= 0; break;
}
}
}

I am using a solid state relay attached to pin_C2.
On the opposite of the SSR I have AC(L) and the motor.
The motor also has a starting capacitor connected to AC(N).

I have a 1Mohm resistor connected to AC(L) then going to pin_B5.
I am trying to get a good zero-crossing interrupt from this.

The idea is to interrupt-on-change, output to the SSR a low signal for a short period of time, then output high to the SSR for the remaining 1/120th of that second.
(i.e. for a half period = 1/120 sec = 8333.33 usec)
depending on my fanspeed setting (coming from another microcontroller on port A), i take this 8333 microseconds and split it up. (e.g. at a lower speed setting I output_low to the SSR for almost the whole 1/120 sec. and at full speed I output_low to the SSR for zero seconds).

My problem is that I do not get a zero-crossing interrupts, and my speeds for the AC motor are not consistently changing (not really variable).

Any help would greatly be appreciate as always.

Thank you.
 

let me just say that you need some serious reading on ac motor control and embedded programming before you have any realistic chance of being remotely successful in doing what you want to do.
 

thanks for the most vague recommendation i have seen yet.

I am basically just trying to control the ac motor with a fan speed control.
its really not that tough, but it does have its difficulties.

i am doing a zero crossing in order to sync fairly well... using an interrupt-on-change, and adjusting the output to a solid-state relay.

Can you give me a recommending reading? or do you just want to say 'good luck wit that...'

this microcontroller is dedicated only to speed control and recieves an input on port A from another main controller.

I am not trying to design a FOC for God sake, I am just making a fan speed controller.

I would just like some recommendations that I can actually follow.

Added after 17 minutes:

would it be best to go with a IGBT driver???

if so, any recommeded P/N's ??

It is a single phase, 2.3A, AC motor and I only need one direction...

the solid state relay i have been trying to use is a Crydom 2410.
 

Although you don't agree with his comment, he is right.
AC motors are not controlled the way you want. What you describe is a PWM control, suitable for dimming light bulbs.
AC motors are controlled by changing the frequency of the AC signal.
 

Thank you.

I am not describing at all a PWM. i am trying to do a phase angle control.

Dont get me wrong, I do appreciate his response, but It is just vague...
"go read" ...

there is no suggestions on any articles, or anything for that matter.

I have read alot on the subject, and I know that it is difficult to control the speed of an AC motor, but i also know that it can be done with a dimming circuit (not PWM).

anyways, dont take my comment as not appreciating a response, It is just not helpful.

I am just trying to get a phase angle control working with a PIC...
The code does work, but it does not behave well enough.

Thanks again.
 

Hi friend

i am controlling Fan speed using micro-controller recently.
And I am testing other AC Motor speed using that Circuit.

I used AT89c52 Microcontroller, Zero-Crossing Circuit, MOC3021, and BT136
I am use Phase angle control concept.

Try MOC3021 and BT136 IC for your project, It is working
I test it.

Shyam
INDIA
 

Thank you... I will try this when I am able.

How are you varying the speed though? are you just controlling the delay for when to output low?

Thank you again.
 

How are you varying the speed though? are you just controlling the delay for when to output low?

Yes,
I connect Zero crossing signal at External Interrupt Pin.
When Interrupt comming, Trigger One Timer to control delay time,

And then fire MOC3021.

it is very simple process. if your zero crossing signal OK.
I faced problem in Zero crossing signal.
And i think, your problem is in Zero crossing Circuit

Shyam
INDIA
 

why don't you use external interrupt? if i were you i would use external interrupt and a zero crossing circuit instead of 1M resistor.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top