找回密码
 立即注册

QQ登录

只需一步,快速开始

帖子
查看: 2682|回复: 10
打印 上一主题 下一主题
收起左侧

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的负半波能开通可控硅,正的半波一点反应都没有,可控硅触发电路是参考的moc3021手册推荐电路,是不是proteus仿真元件有问题?moc3021?bta16-600bw?


51hei截图20191101174505.jpg (204.17 KB, 下载次数: 66)

51hei截图20191101174505.jpg

51hei截图20191101174746.jpg (66.37 KB, 下载次数: 61)

51hei截图20191101174746.jpg

Arduino 328.rar

92.11 KB, 下载次数: 12

proteus项目文件

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

举报

沙发
ID:633947 发表于 2019-11-4 09:37 | 只看该作者
没有人吗?
回复

举报

板凳
ID:342822 发表于 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);
   }
}
回复

举报

地板
ID:342822 发表于 2019-11-4 10:51 | 只看该作者
检测到过零后延时5ms控制moc3021开通????
用10ms试一试~~
回复

举报

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

这个例子名称叫什么,我想看看完整项目
回复

举报

6#
ID:633947 发表于 2019-11-4 14:44 | 只看该作者
可以看到单片机触发信号应该是没问题的,但是只有负半波可控硅开通了

51hei截图20191104095454.jpg (67.34 KB, 下载次数: 68)

51hei截图20191104095454.jpg
回复

举报

7#
ID:342822 发表于 2019-11-4 16:24 | 只看该作者
jzli2019 发表于 2019-11-4 14:33
这个例子名称叫什么,我想看看完整项目

Arduino Dimming 230V AC
回复

举报

8#
ID:342822 发表于 2019-11-4 17:12 | 只看该作者
按你的程序仿真没得问题。。


回复

举报

9#
ID:633947 发表于 2019-11-4 18:02 | 只看该作者
taotie 发表于 2019-11-4 17:12
按你的程序仿真没得问题。。

大佬,我把proteus8.7卸载了重新装了proteus8.9,现在模拟也没问题了。。。很莫名其妙啊
回复

举报

10#
ID:633947 发表于 2019-11-4 18:03 | 只看该作者
taotie 发表于 2019-11-4 17:12
按你的程序仿真没得问题。。

你用的是哪个版本,我感觉就是版本不对导致的。。。
回复

举报

11#
ID:342822 发表于 2019-11-5 13:01 | 只看该作者
jzli2019 发表于 2019-11-4 18:03
你用的是哪个版本,我感觉就是版本不对导致的。。。

呵呵8.8
回复

举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表