1.1 Preface
Hello everyone, I am Lei Chaolin, my B station name is Xiaolei DIY, and I am the official campus lecturer of Lichuang EDA. I have rich teaching experience. This time I will share what I have completed in this advanced class. I hope that the situation and my ideas can help some students with weak foundation. Sharing is also a joy! If there is anything I said that is wrong, please give me your pointers. I would be very grateful!
1.2 Design thinking
At the beginning, I still wanted to do the previous project (Internet of Things Motorcycle), but if I used the projects I was familiar with before to make up for it, there would be no need to participate in the advanced class. We are here to learn. First of all, we must have a correct attitude. Whether your project is doing well or not, I will definitely follow Song Gonglai this time and take it one step at a time. Some students will definitely feel that I talk too much when they see this, haha. Song Gong’s first product concept is to follow the market. Based on my experience in company research and development, the first thing is to ensure the competitiveness of the product, in terms of cost, sales volume, etc. , everything you can think of must have been thought of by others. Following Song Gong’s product thinking can lay a solid foundation for future work. So I started thinking: When I am in the room, sometimes in order to save power, I turn on the air conditioner for a while and then turn it off, and then use an electric fan to achieve the effect of comfort and power saving. Can I use the Internet of Things and a single-chip microcomputer to do this? Is the operation of the series more convenient? In Song Gong's plan, the home appliances are controlled through relays, but since my air conditioner has a remote control, relays are superfluous. But at the same time, I was thinking that my fan could be equipped with a relay, so it suddenly dawned on me. After a series of analyses, I decided to make an Internet of Things electric fan.
1.3 Product thinking
My electric fan is placed in the same room as the air conditioner. I can control the electric fan through my mobile phone, and then the electric fan controls the air conditioner. How to control it? Isn't the air conditioner just a remote control? I can add an infrared module to the electric fan to control the air conditioner, and at the same time add a temperature sensor to intelligently control the operating status of the air conditioner and fan, which greatly reduces human labor costs. There is another question. The IoT module is embedded inside the electric fan. Is there any way for me to develop it again and get it elsewhere? Work experience helped me a lot at this time. Our company's multi-channel lithium battery charging circuit board has multiple DCDC modules plugged into the circuit board, commonly known as a small board. This not only facilitates maintenance but also allows for secondary product development. I can pull out the IoT module when not in use. Solved this big problem. The picture below is the interface used by our company.
This picture shows our DC-DC modules, each of which can be replaced individually.
1.4 Start designing
First we need to understand the schematic diagram of Song Gong, and then transform it through our own methods. I originally planned to use an ordinary 51, but found that the temperature sensor requires an ADC module, and it is not cost-effective to buy one separately, so I used STC15w4k56s4 and the temperature sensor used MCP9700AT- E/TT, this is very cheap and of good quality. The IoT module uses EMW3080. I designed the relay module with 5 channels. It turned out that the width of the 5-channel PCB has exceeded 10cm*10cm, so I switched to 4 channels. Some students must want to Ask me why I use so many. First of all, the fan has 3 gears, which will use three relays. Secondly, Lichuang gave me 10 12V HK4100F-DC12V-SHG before, so I don’t use them in vain. The serial communication module uses CH340C. Don't ask why not CH340E. My answer is that CH340E is difficult to solder and expensive. The power supply module uses 7805 (classic and hot) to power the microcontroller and AMS117-3.3 to power the WiFi module. It is worth mentioning here that after consulting the information, the microcontroller can work at 3-5.5V, but the IoT module can only be powered by 3.3V. This is why I used 7805 in terms of expansion. I added infrared transmitter, infrared receiver, and bee. The buzzer, temperature sensor and serial communication interface of the Internet of Things module and microcontroller are reserved to prepare for subsequent development. PS: Everyone must compare the models of hardware when planning, so as to make the subsequent project smoother. For example, I started Choosing terminal blocks, they are very large on the PCB and I overlooked a big mistake because I couldn’t see them in the schematic! After repeated comparisons, I found a small and cheap terminal
2.1 Module analysis relay module
We see that it is a 4-way relay, using NPN transistors to control the opening and closing of the relay. At the same time, a 74LS04 inverter is added. After consulting the data, the voltage is 5V, and then D2-D5 are ss34 diodes for freewheeling. The relay uses NO and NC, which are normally open and normally closed. R6-R9 are pull-down resistors. PS: Song Gong’s driver was too expensive, so I started using PNP transistors. It turned out that the relay voltage was 12v and the microcontroller was 5v. The transistors were conducting anyway, so I could only use NPN because the initial state of the microcontroller was high level (above). (pull resistor), so I need to add an inverter. In order to control reliability, I added a 10K ohm resistor, so that the inverter outputs a low level.
Communication module
CH340C is used, and F1 is a self-restoring fuse (current 800ma) to ensure power supply for the rear modules. At the same time, I connected a pin header to power off the rear circuit. It should be marked on the PCB. Under normal conditions, a jumper should be inserted. cap, and the serial port uses a 330 ohm resistor for protection.
peripherals
A temperature sensor (MCP9700AT-E/TT), a buzzer (PNP control), an infrared transmitting tube, and an IRM-56384 infrared receiver. The transmitting tube is used to control the air conditioner, and the receiving tube is used to match the air conditioner remote control.
Microcontroller module
I have led out all the P4.0-P4.7 interfaces of the microcontroller for expansion. At the same time, I have led out the serial communication of the microcontroller and the Internet of Things module to burn firmware. When we make hardware, we also need to increase the scalability, so that we can adapt to product updates. Upgrading the product to expand its functionality
2.2 PCB layout
When wiring PCB, pay attention to the fact that there should be no copper under the relay, and the wiring of the relay should be at least 50mil. It is recommended that you use Lichuang’s PCB ruler, which has detailed chip component sizes, such as 0805, 0606, 1812, etc., as well as the wiring size. , the process is made of immersed gold. I will update it simultaneously on station B later so that everyone can have a quick look.
I was very cautious about the layout of the small board, because once the circuit corresponding to the interface is connected reversely, it will cause serious electrical accidents. At the same time, I modified the electrical definition of the original motherboard interface to make wiring more convenient and improve safety! Because the order of the interfaces is different, I marked on the circuit board that the female header should be installed on the reverse side of the circuit board.
2.3 Problems Found
After repeated inspections, I found the following problems. The first is the wiring at the PCB interface. We can see that the pin headers are two adjacent ones in a group, but they cannot be in the middle when wiring, so I thought about it. We can't make each pair of pin headers into one group, so I modified the schematic diagram.
The original PCB wiring
is the connection interface between the original relay and the small board.
This is the interface after I modified it, so that the PCB routing will be more convenient and safer after the modification! !
At the same time, I modified and compared the connection between the small board and the mainboard, mainly to compare whether the electrical definition is normal after the two interfaces are plugged in. This is something we must pay attention to! !
09
These are details that we must pay attention to, otherwise it will be very troublesome later, especially after the board has been laid out.
In fact, after investigating other students' plans, some students separated the relays from the motherboard and made them into separate boards. In fact, I planned to do this at the beginning. The development cost will be much higher if it is like this. It is better to just use the microcontroller and communication module. into a separate piece. Since I won’t be able to use it for the time being, I will definitely design a separate board in the future so that the communication module can be switched between ESP8266 and EMW3080. Also, it is difficult to connect two boards with a single row. It is recommended to use professional docking pin headers like mine.
By August 10th, I had designed 4 different PCBs, and then I was ready to start welding. I didn’t plan to use SMT because the coupons were not easy to use. I bought resistors and capacitors in 1206 packages. I will Buy some 0805 resistors and capacitors. Here we tell students what they need to prepare.
Resistors 0R, 330R, 1K, 4.7K, 10K. Capacitor 22PF 100nF/10V 1uF/50V 22uF/36V 100uf/16V. Try to choose a small size and be sure to prepare more at home.
现在是8月11号上午,经过昨天晚上的学习,我总结了一下几点 1、220v走线间隔要足够宽 2、电容要靠近芯片供电端 3、可以减少不必要的接口 根据这三条经验,我准备先修改继电器接口准备2个排针输出,同时要有间隔,然后再修改电容,把电容更靠近走线,最后再把多余的扩展接口去掉,但是我们值得注意的是必须留下RXD和TXD,因为这样方便我们烧录固件,而烧录不了我们前面做的就白费了 今天下午要去客户家维修手机,所以下午暂时没有时间修改,我准备上午先把视频做出来,可以先把思路理清
下面我接着说中午经过唐佐斌-371541A兄弟的指导,我已经将PCB的继电器走线重新走了一次,将继电器的驱动电路远离继电器的强电部分,同时修改了电源供电部分,提高了电源的利用率,这里非常感谢唐斌-371541A的支持!!
下面是修改过后的PCB继电器走线
这里我要说一下,PCB布线尽量不要直角,避免尖端效应,在接线端,我增加了槽孔,进一步提高安全性
同时在单片机的扩展上,我减少了io输出,使得走线更加美观,我之后会添加一些图案元素
经过修改,我先是将原来的排针改成三路单独的,然后把供电的走线全部加粗,比第一代的好多了
这个是我修改过后的电源走线,因为单片机和EMW3080模块启动瞬间需要大电流,我保险丝是设置到1A,我在走线上实心填充,加宽了5V的供电
这个是我修改之后的继电器模块,因为之前用一排排针,强电之间没有隔离,为了安全考虑,我在立创商城上找到了10P的排针,我为什么不用6P的呢,因为我整个模块电源要在排针上得到,如果太挤就不好,同时我在强电之间加了开槽,提高了安全性。强电弱电之间得到了很好的隔离
这是修改之后的扩展模块,因为之前在原理图上是选择P2.0-P2.7这种按照顺序的,现在我选择按照引脚电气排序,这样的话可以容易引出并布线规整!我们布好后一定要标记出是P几点几的口,我这里选择的是10p接口!
写到这里,基本的电路已经完全布好和修改完毕,接下来就是焊接,我会以视频的形式演示
**视频已经同步上传哔哩哔哩,链接 **https://www.bilibili.com/video/BV1ba4y1J7dy 欢迎大家观看和评论
上图为二弟帮我焊接1206的贴片LED
我之所以选择1206的,不仅仅是因为好焊,而且是亮度足够
上图为我二弟帮我修改库文件,我们大家不懂的可以提前查阅数据手册,里面都有说明的
焊接完毕了,那么现在烧录程序的时候了,
我要感谢之前在翻零妖的文档发现了他有一个介绍基于51接入阿里云的教程
我原理图就是根据上面的进行修改,我所购买的是不带固件的版本,在这里我直接刷入了阿里飞燕的固件。
同时要对单片机进行操作,我就不重点介绍如果去写入程序,这里妖零的资料非常齐全,欢迎大家参考
零妖的个人网站https://www.yuque.com/lingyao,我就是参考里面的文件,大家可以学习学习
刷入固件的时候我选择的是EMW3080的第二个通信口也就是RXD1和TXD1,结果出现无论我boot电平如何,就是无法刷机,在经过我一系列操作和查资料,我知道了只能用第一个通信口刷机也就是RXD0和TXD0,这里也是我们需要注意的地方
这个是刷固件之前的信息
同时我还要去接收空调遥控器的红外码,这里我选择了用arduion直接去读取,然后重新编译到单片机上面,红外发射信号,我后续会完善更多功能,比如控制电视等等,大家也可以为自己的模块增加功能 经过一天的调试,我的手机已经可以去控制继电器了,而且已经接入了阿里云接入阿里云的方法很简单,就是写入三元组,之后再进行与路由器之间的配对,这里我就不重点介绍,因为我是参考零妖的教程,我会把链接放过来零妖的个人网站https://www.yuque.com/lingyao
上面为红外代码,我们可以用它来控制空调
接下来就是拆解风扇,把风扇内部改造一下
我同时会拍摄视频上传!
拆解电风扇
安装电源模块,测量最大档位电流,发现只有0.14a,我非常满意,这样继电器可以完美的工作了,这里不建议大家使用大电流
通电测试
**截止8月16号,我的全部工程已经完成,功能已经进行测试,在这一次暑假训练营中,真的学到了很多,在这里感谢立创支持。视频已经同步上传哔哩哔哩,链接 ****https://www.bilibili.com/video/BV1ba4y1J7dy 欢迎大家观看和评论
最后我再总结一下,我测试了电风扇的电流,只有0.17a,用继电器完全够用,铜宽也刚刚合适,如果你使用的是大电流,建议增加参数,提高带负载能力,在PCB布线时也要考虑高速信号,还有就是最好是先看一下外壳再做打算,因为外壳限制了电路板的尺寸。我们可以在每次调试中吸取经验,失败不可怕,勇于尝试,去不断改进,这一次的PCB我改了10多次,认真听取了多方面意见,
1、220v走线间隔要足够宽
2、电容要靠近芯片供电端
3、可以减少不必要的接口
4、认真查阅资料,自己动手写代码
5、耐心调试,不懂就问,敏而好学,不耻下问
6、思考人家电路是怎么实现功能的,如何去改进自己的电路
7、日积月累,好好利用实践中学到的经验之谈
在这里感谢前公司同事陈家泉的提供的意见,感谢摄像师雷嘉伟,感谢各位提供帮助的朋友们,知来者之可追,实迷途其未远!让我们共同进步!
顺便爆一下照,感兴趣的兄弟可以帮忙介绍介绍
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet