Peltier Thermo Electric Cooler Fridge
Arduino Generate Interleaved PWM - 180º Out of Phase
int PWM1 = 192; // PWM1 width - 75% duty cycle
int PWM2 = 191; // PWM2 width - 75% duty cycle
void setup() {
//TCNT1=0x7FFF; //Set Timer1 Counter Register to half of its maximum value (32767)
TCNT1=0x7FF7; // Real 180º out phase measured with oscilloscope
pinMode(9, OUTPUT); //Set Pin 9 to output
pinMode(11, OUTPUT); //Set Pin 11 to output
TCCR1B = TCCR1B & B11111000 | B00000001; // set timer 1 divisor to 1 for PWM frequency of 31372.55 Hz
TCCR2B = TCCR2B & B11111000 | B00000001; // set timer 2 divisor to 1 for PWM frequency of 31372.55 Hz
analogWrite(9, PWM1); //write PWM1 value to output on Pin 9
analogWrite(11,PWM2); //Write PWM2 value to output on Pin 11
}
void loop() {
delay(500); //delay 500ms to see change in PWM
//analogWrite(9, PWM1); //write PWM1 value to output on Pin 9
//analogWrite(11,PWM2); //Write PWM2 value to output on Pin 11
//PWM1++; //increment PWM1
//PWM2++; //increment PWM2
}
Oscilloscope
Front Door