標(biāo)題: arduino+moc33021+bta16為什么啥只有半波控制,求大佬解疑 [打印本頁]

作者: jzli2019    時間: 2019-11-1 17:54
標(biāo)題: arduino+moc33021+bta16為什么啥只有半波控制,求大佬解疑
void up()
{
  digitalWrite(12, HIGH);
  delayMicroseconds(5000);
  digitalWrite(12, LOW);
  delayMicroseconds(1000);
  digitalWrite(12, HIGH);
}

void setup() {
  pinMode(2, INPUT);
  pinMode(12, OUTPUT);
  // put your setup code here, to run once:
  attachInterrupt(0, up, RISING);
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(100);
}

這個是arduino代碼,檢測到過零后延時5ms控制moc3021開通。

不知道為什么只有在220v的負(fù)半波能開通可控硅,正的半波一點反應(yīng)都沒有,可控硅觸發(fā)電路是參考的moc3021手冊推薦電路,是不是proteus仿真元件有問題?moc3021?bta16-600bw?


51hei截圖20191101174505.jpg (204.17 KB, 下載次數(shù): 66)

51hei截圖20191101174505.jpg

51hei截圖20191101174746.jpg (66.37 KB, 下載次數(shù): 61)

51hei截圖20191101174746.jpg

Arduino 328.rar

92.11 KB, 下載次數(shù): 12

proteus項目文件


作者: jzli2019    時間: 2019-11-4 09:37
沒有人嗎?
作者: taotie    時間: 2019-11-4 10:31
jzli2019 發(fā)表于 2019-11-4 09:37
沒有人嗎?

這是Proteus 8 中的例程看一看吧
/* Main.ino file generated by New Project wizard
*
* Created:   mer ago 22 2018
* Processor: Arduino Uno
* Compiler:  Arduino AVR
*/

int AC_LOAD = 3;    // Output to Opto Triac pin
int dimming = 128;  // Dimming level (0-128)  0 = ON, 128 = OFF

void setup()
{
  pinMode(AC_LOAD, OUTPUT);// Set AC Load pin as output
  attachInterrupt(0, zero_crosss_int, RISING);  // Choose the zero cross interrupt # from the table above
}

//the interrupt function must take no parameters and return nothing
void zero_crosss_int()  //function to be fired at the zero crossing to dim the light
{
  // Firing angle calculation : 1 full 50Hz wave =1/50=20ms
  // Every zerocrossing thus: (50Hz)-> 10ms (1/2 Cycle)
  // For 60Hz => 8.33ms (10.000/120)
  // 10ms=10000us
  // (10000us - 10us) / 128 = 75 (Approx) For 60Hz =>65

  int dimtime = (75*dimming);    // For 60Hz =>65   
  delayMicroseconds(dimtime);    // Wait till firing the TRIAC
  digitalWrite(AC_LOAD, HIGH);   // Fire the TRIAC
  delayMicroseconds(10);         // triac On propogation delay (for 60Hz use 8.33)
  digitalWrite(AC_LOAD, LOW);    // No longer trigger the TRIAC (the next zero crossing will swith it off) TRIAC
}

void loop()  {
  for (int i=5; i <= 128; i++){
    dimming=i;
    delay(10);
   }
}
作者: taotie    時間: 2019-11-4 10:51
檢測到過零后延時5ms控制moc3021開通????
用10ms試一試~~
作者: jzli2019    時間: 2019-11-4 14:33
taotie 發(fā)表于 2019-11-4 10:31
這是Proteus 8 中的例程看一看吧
/* Main.ino file generated by New Project wizard
*

這個例子名稱叫什么,我想看看完整項目
作者: jzli2019    時間: 2019-11-4 14:44
可以看到單片機觸發(fā)信號應(yīng)該是沒問題的,但是只有負(fù)半波可控硅開通了

51hei截圖20191104095454.jpg (67.34 KB, 下載次數(shù): 68)

51hei截圖20191104095454.jpg

作者: taotie    時間: 2019-11-4 16:24
jzli2019 發(fā)表于 2019-11-4 14:33
這個例子名稱叫什么,我想看看完整項目

Arduino Dimming 230V AC
作者: taotie    時間: 2019-11-4 17:12
按你的程序仿真沒得問題。。



作者: jzli2019    時間: 2019-11-4 18:02
taotie 發(fā)表于 2019-11-4 17:12
按你的程序仿真沒得問題。。

大佬,我把proteus8.7卸載了重新裝了proteus8.9,現(xiàn)在模擬也沒問題了。。。很莫名其妙啊
作者: jzli2019    時間: 2019-11-4 18:03
taotie 發(fā)表于 2019-11-4 17:12
按你的程序仿真沒得問題。。

你用的是哪個版本,我感覺就是版本不對導(dǎo)致的。。。
作者: taotie    時間: 2019-11-5 13:01
jzli2019 發(fā)表于 2019-11-4 18:03
你用的是哪個版本,我感覺就是版本不對導(dǎo)致的。。。

呵呵8.8




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1