找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 2630|回復(fù): 10
打印 上一主題 下一主題
收起左側(cè)

arduino+moc33021+bta16為什么啥只有半波控制,求大佬解疑

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
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);
}

這個(gè)是arduino代碼,檢測(cè)到過零后延時(shí)5ms控制moc3021開通。

不知道為什么只有在220v的負(fù)半波能開通可控硅,正的半波一點(diǎn)反應(yīng)都沒有,可控硅觸發(fā)電路是參考的moc3021手冊(cè)推薦電路,是不是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項(xiàng)目文件

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

沙發(fā)
ID:633947 發(fā)表于 2019-11-4 09:37 | 只看該作者
沒有人嗎?
回復(fù)

使用道具 舉報(bào)

板凳
ID:342822 發(fā)表于 2019-11-4 10:31 | 只看該作者

這是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);
   }
}
回復(fù)

使用道具 舉報(bào)

地板
ID:342822 發(fā)表于 2019-11-4 10:51 | 只看該作者
檢測(cè)到過零后延時(shí)5ms控制moc3021開通????
用10ms試一試~~
回復(fù)

使用道具 舉報(bào)

5#
ID:633947 發(fā)表于 2019-11-4 14:33 | 只看該作者
taotie 發(fā)表于 2019-11-4 10:31
這是Proteus 8 中的例程看一看吧
/* Main.ino file generated by New Project wizard
*

這個(gè)例子名稱叫什么,我想看看完整項(xiàng)目
回復(fù)

使用道具 舉報(bào)

6#
ID:633947 發(fā)表于 2019-11-4 14:44 | 只看該作者
可以看到單片機(jī)觸發(fā)信號(hào)應(yīng)該是沒問題的,但是只有負(fù)半波可控硅開通了

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

51hei截圖20191104095454.jpg
回復(fù)

使用道具 舉報(bào)

7#
ID:342822 發(fā)表于 2019-11-4 16:24 | 只看該作者
jzli2019 發(fā)表于 2019-11-4 14:33
這個(gè)例子名稱叫什么,我想看看完整項(xiàng)目

Arduino Dimming 230V AC
回復(fù)

使用道具 舉報(bào)

8#
ID:342822 發(fā)表于 2019-11-4 17:12 | 只看該作者
按你的程序仿真沒得問題。。


回復(fù)

使用道具 舉報(bào)

9#
ID:633947 發(fā)表于 2019-11-4 18:02 | 只看該作者
taotie 發(fā)表于 2019-11-4 17:12
按你的程序仿真沒得問題。。

大佬,我把proteus8.7卸載了重新裝了proteus8.9,現(xiàn)在模擬也沒問題了。。。很莫名其妙啊
回復(fù)

使用道具 舉報(bào)

10#
ID:633947 發(fā)表于 2019-11-4 18:03 | 只看該作者
taotie 發(fā)表于 2019-11-4 17:12
按你的程序仿真沒得問題。。

你用的是哪個(gè)版本,我感覺就是版本不對(duì)導(dǎo)致的。。。
回復(fù)

使用道具 舉報(bào)

11#
ID:342822 發(fā)表于 2019-11-5 13:01 | 只看該作者
jzli2019 發(fā)表于 2019-11-4 18:03
你用的是哪個(gè)版本,我感覺就是版本不對(duì)導(dǎo)致的。。。

呵呵8.8
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表