problem with range of voltage output from TRIAC/optoisolator dimmer

Thanking you in advance for any help on solving our problem.

We are attempting to use a TRIAC/optoisolator (MOC3011M / BT136) dimmer together with a zero-crossing detector (H11A1) in order to control voltage administered to a 100 or 200W heat cable. Ultimately this control is to be used to incubate sea turtle eggs at precise temperature regimes (constant and variable in the range 24-35C) to study the impacts of temperature on biometrics and locomotor performance, part of our research on the impacts of global warming on these species.

We are working in Mexico where the mains electricity runs on 127V and 60Hz. PCBs based on the design shown in the attached figure have been etched. The intention was to have the dimmer control voltage output to the heat cable in a range of 0 to 127V, depending on values generated by sketches for an Arduino Mega.

The current test sketch is as follows:

#define Calentador0  12		 // MOC3011 connected to pin 12
word DutyC[2];                  // duty cycle control values for temporizer
word output;

void setup()
{
  Serial.begin(9600);
  
/** Configure MOC3011 pins as output and start them at 0 */
  pinMode(Calentador0, OUTPUT);		// ouptut MOC Pin
  digitalWrite(Calentador0, LOW);	// Place MOC pin to  zero

/* Define interrupt for zero cross detection */
  attachInterrupt(0, PWM_TRIAC, FALLING);  // Interrupt for zero cross detection (Pin2)

/** Configure  Temporizer 1 for TRIAC activation  */
  TCCR1A = 0;		// TCCR1A is configured for:
  TCCR1B = (1<<CS11);	// Timer1 Normal mode, prescaler of  8 (with frequency of XTAL=16MHz). Hence, the temporizer do single steps every 0.5us
  TCNT1 = 51526;	// The timer overflows upon reaching 65535,
			//Starting at 51526, and starting with DutyC[0] = 0, 7010 microseconds will pass (14mil counts of 0.5 us)
  TIMSK1 = (1<<TOIE1);	//before the interrupt is initiated in Timer1 upon overflow (0xFFFF, or 65535). So,our range is 0 to 14000 steps.
}

void loop()
{
  // cycle routine to test range of output possible 
  output = 00;
  do
  {
    DutyC[0] = output;
    output = output + 100;
    Serial.println(output);
    delay (1000);
  } while (output < 14000);
} 


void PWM_TRIAC()
{
  TCNT1 = 51526 + DutyC[0];	// Timer1 is initated to start count 
}

ISR(TIMER1_OVF_vect)
{
  digitalWrite(Calentador0, HIGH);	// MOC0 pin is activated
  delayMicroseconds(10);
  digitalWrite(Calentador0, LOW);	// MOC0 pin is switched off
}

The problem we are facing, (besides not having an electronics expertise- we’re either geneticists or biologists), is that the voltage output we are getting with this sketch follows an inverted-U pattern, changing from 14.5 Volts at DutyC = 1000, to a maximum of 31 V at DutyC = 7000 then drops to 8.4 V at DutyC = 14000. We were hoping to obtain the whole range 0-127 V for the DutyC range of 0-14000.

The help we require is advice on what to change on the PCB components and/or in our Arduino sketch. Ideally we wouldn’t need to change the PCB.

regards, Alberto

Hi, I don't think you are detecting both zero crossing points in the full cycle. To detect both you will have to feed the input of the H11A1 AC via a full wave rectifier, so both positive and negative cycles conduct through it.

I haven't had a good look at your sketch yet, but don't forget you only effect the trigger point of half the cycle, then it repeats.

Tom.... :)

TomGeorge: Hi, I don't think you are detecting both zero crossing points in the full cycle. To detect both you will have to feed the input of the H11A1 AC via a full wave rectifier, so both positive and negative cycles conduct through it.

I haven't had a good look at your sketch yet, but don't forget you only effect the trigger point of half the cycle, then it repeats.

Tom.... :)

If that turns out to be the problem (I'm not very good with the code, someone else will have to verify) you can just switch out the H11A1 for an H11AA1 http://www.vishay.com/docs/83608/h11aa1.pdf

Just make sure you double check all the maximum ratings and make sure you're not going to fry anything!

There's a good tutorial on the arduino site that I've used and worked out great here. It has some good info if you're not too familiar with the electronics. It's essentially the same set up that you're using, except with 0 crossing detection on both halves of the AC wave.

http://playground.arduino.cc/Main/ACPhaseControl

Hope this help!

Josh