Toto je starší verze dokumentu!
Regulator acts as power switch driven by low-frequency PWM signal from MCU. For safety and lucidity purposes, regulator will be placed at separate PCB, its interface to MCU will consist of logic supply pins and single trigger pin for each driven phase.
Power triac was chosen as sufficient switch component in terms of power/price efficiency. Any triac allowing >12A continual working current (incl. 3A margin) would be acceptable (BTA12-600B - TO220 ~0.8$), however these packages do not provide insulation to common terminal (case). This problem would require additional electric insulation between the package and the heatsink, in cost of worsening thermal insulation. In case of common heatsink to all 3 triacs (3 phases), the peak voltage will reach over 500V peak. This lead to use of BTA26B/600V - TOP3 ~3.6$ as one of the cheapest available triacs with insulated package.
Optotriac provides considerable solution for direct drive of power triac, together with ensuring galvanic isolation of power and logic part. MOC3031 is optotriac with builtin logic providing zero-cross switching, which decreases power loss on power triac and significantly reduces EMC.
MSP430G2553 from TI was chosen as the MCU for this project. MSP430 family are 16-bit RISC microcontrollers aimed at simplicity and extremely low power consumption. MSP430G2553 (in PDIP-20) has 10 bit ADC unit, common interface peripherals (I2C, SPI, UART) and two 16-bit timers with 3 capture/compare units.
Currently tested temperature measuring is based on direct measuring of output voltage of LM35 - precision centigrade temperature sensor from TI, packaged in TO92. Its output voltage increases by 10mV per 1°C increase. Sensor is loaded with 1k pulldown resistor and connected directly to ADC input.
ADC circuitry is clocked from SMCLK/8 with internal reference (1.5V). Noise is reduced by use of sample and hold at 2kHz. ADC is triggered from timer interrupt and its value is further filtered with exponetial window. Detailed information about ADC settings are obvious from ADC init procedure (vid. init.c)
inline void init_ADC()
void __attribute__ ((interrupt(ADC10_VECTOR))) ADC_ISR (void) { temp_current = (ALPHA * ADC10MEM) + (1.0 - ALPHA) * temp_current; }
Proportional - Integral - Diferential (PID) regulator is used for driving of output unit (motors, heaters, …) based on input values (rpm, temperature). Output value consists of sum of P, I and D parts. Proportional contribution is difference of current value and required value, integral contribution is accumulator of all previous and current errors and differential contribution represents the difference (trend) of current and previous error at measured time. To ensure required functionality, all three contributions must be weighted by coefficients, depending on system. PID is implemented in getPID()
function:
#define KP 24 #define KI 0.2 #define KD 60 uint8_t getPID(float set_point, float measured_value){ float actual_error, P, D; static float error_previous; static float I; actual_error = set_point - measured_value; // PID P = actual_error; //Current error I += error_previous; //Sum of previous errors D = actual_error - error_previous; //Difference with previous error error_previous = actual_error; float result = KP*P + KI*I + KD*D; if(result > 254) result = 255; if(result < 0) result = 0; return result; }
While the output of PID regulator is directly driving the 8bit PWM controller, output value must be limited to fit uint8_t
borders.