随着互联网的高速发展,智能灯的发展趋势也逐渐向互联网方向靠拢,在现代生活中,单一功能的传统灯已经满足不了智能家居的需求,跟传统灯相比,智能灯美观大方,而且用户可以根据自己的需求,去调节智能灯的亮度,保护了用户的视力,也避免了传统灯的功能单一问题,并且智能灯的耗能也比较低,使用寿命相对比较长,触电的危险也大大地降低了。本文通过对无线供电方案、磁悬浮悬浮方式、控制方式进行论证,结合磁悬浮悬浮技术、新兴无线供电技术,设计了一个以STM32F103C8T6为主控制器的无线供电磁悬浮灯系统。系统主要由STM32最小系统、线圈驱动模块、无线供电模块、霍尔传感器输出电压差动比例运算电路模块、显示模块、辅助电源模块以及磁悬浮控制模块组成。根据谐振电磁耦合功率传输原理,通过无线发射端和无线接收端电路,对灯具进行无线供电,同时,利用STM32单片机产生PWM波通过线圈驱动模块,来驱动线圈产生磁力,通过电磁悬浮技术实现对灯具的悬浮,再通过霍尔传感器检测磁力大小,反馈输入到控制器STM32单片机中,通过PID算法来实现磁悬浮系统的悬浮稳定性,对磁悬浮系统进行控制,从而实现灯稳定悬浮在磁悬浮装置上空。 With the rapid development of the Internet, the development trend of smart lights has gradually moved closer to the Internet. In modern life, single-function traditional lights can no longer meet the needs of smart homes. Compared with traditional lights, smart lights have a more beautiful appearance, and users can adjust the brightness of smart lights according to their own needs, protecting the user’s eyesight, and avoiding the single function of traditional lights, and the energy consumption of smart lights is relatively low, the service life is relatively long, and the risk of electric shock is greatly reduced. In this paper, through the demonstration of wireless power supply scheme, magnetic levitation mode, control mode, combined with magnetic levitation technology and emerging wireless power supply technology, a wireless electromagnetic levitation lamp system with STM32F103C8T6 as the main controller is designed. The system is mainly composed of STM32 minimum system, coil drive module, wireless power supply module, Hall sensor output voltage differential proportional operation circuit module, display module, auxiliary power module and magnetic suspension control module. According to the principle of resonant electromagnetic coupling power transmission, the wireless power supply is provided to the lamps through the wireless transmitter and wireless receiver circuits. At the same time, the STM32 single-chip is used to generate PWM waves through the coil drive module to drive the coil to generate magnetic force. The suspension is detected by the Hall sensor, and the feedback is input to the STM32 microcontroller. The PID algorithm is used to achieve the suspension stability of the magnetic suspension system, and the magnetic suspension system is controlled to realize the stable suspension of the lamp above the magnetic suspension device.
随着互联网的高速发展,智能灯的发展趋势也逐渐向互联网方向靠拢,在现代生活中,单一功能的传统灯已经满足不了智能家居的需求,跟传统灯相比,智能灯美观大方,而且用户可以根据自己的需求,去调节智能灯的亮度,保护了用户的视力,也避免了传统灯的功能单一问题,并且智能灯的耗能也比较低,使用寿命相对比较长,触电的危险也大大地降低了。本文通过对无线供电方案、磁悬浮悬浮方式、控制方式进行论证,结合磁悬浮悬浮技术、新兴无线供电技术,设计了一个以STM32F103C8T6为主控制器的无线供电磁悬浮灯系统。系统主要由STM32最小系统、线圈驱动模块、无线供电模块、霍尔传感器输出电压差动比例运算电路模块、显示模块、辅助电源模块以及磁悬浮控制模块组成。根据谐振电磁耦合功率传输原理,通过无线发射端和无线接收端电路,对灯具进行无线供电,同时,利用STM32单片机产生PWM波通过线圈驱动模块,来驱动线圈产生磁力,通过电磁悬浮技术实现对灯具的悬浮,再通过霍尔传感器检测磁力大小,反馈输入到控制器STM32单片机中,通过PID算法来实现磁悬浮系统的悬浮稳定性,对磁悬浮系统进行控制,从而实现灯稳定悬浮在磁悬浮装置上空。
无线供电,磁悬浮,PWM,PID
Yuhua Tong, Maolin Li, Minsheng Yang*, Xiaoyan Mao, Yuqin Deng, Qiwen Huang
School of Electrical and Information Engineering, Hunan University of Arts and Sciences, Changde Hunan
Received: Mar. 15th, 2021; accepted: Apr. 16th, 2021; published: Apr. 27th, 2021
With the rapid development of the Internet, the development trend of smart lights has gradually moved closer to the Internet. In modern life, single-function traditional lights can no longer meet the needs of smart homes. Compared with traditional lights, smart lights have a more beautiful appearance, and users can adjust the brightness of smart lights according to their own needs, protecting the user’s eyesight, and avoiding the single function of traditional lights, and the energy consumption of smart lights is relatively low, the service life is relatively long, and the risk of electric shock is greatly reduced. In this paper, through the demonstration of wireless power supply scheme, magnetic levitation mode, control mode, combined with magnetic levitation technology and emerging wireless power supply technology, a wireless electromagnetic levitation lamp system with STM32F103C8T6 as the main controller is designed. The system is mainly composed of STM32 minimum system, coil drive module, wireless power supply module, Hall sensor output voltage differential proportional operation circuit module, display module, auxiliary power module and magnetic suspension control module. According to the principle of resonant electromagnetic coupling power transmission, the wireless power supply is provided to the lamps through the wireless transmitter and wireless receiver circuits. At the same time, the STM32 single-chip is used to generate PWM waves through the coil drive module to drive the coil to generate magnetic force. The suspension is detected by the Hall sensor, and the feedback is input to the STM32 microcontroller. The PID algorithm is used to achieve the suspension stability of the magnetic suspension system, and the magnetic suspension system is controlled to realize the stable suspension of the lamp above the magnetic suspension device.
Keywords:Wireless Power Supply, Magnetic Levitation, PWM, PID
Copyright © 2021 by author(s) and Hans Publishers Inc.
This work is licensed under the Creative Commons Attribution International License (CC BY 4.0).
http://creativecommons.org/licenses/by/4.0/
随着互联网的高速发展,智能灯 [
采用STM32为主控制器,选取2个线性霍尔传感器 [
图1. 方案框图
根据系统的整体设计框图,确定了磁悬浮的悬浮方式采用下推式进行悬浮,其中磁悬浮装置的主视图、俯视图如图2所示。
图2. 磁悬浮装置平台的主视图和俯视图
磁悬浮装置的控制原理框图如图3所示,首先,通过X、Y方向上的霍尔信号经过反馈电路输入到STM32中,然后采用模糊PID控制 [
图3. 磁悬浮装置平台的控制原理框图
STM32最小系统电路图如图4所示。STM32最小系统包括电源供电电路、晶振电路、复位电路以及下载仿真电路。第五号引脚OSCIN和第六号引脚OSCOUT都是STM32主芯片的时针电路引脚,并且还外接了一个8 MHz的晶振,给主芯片进行起振,从而使主芯片工作起来。第七号引脚NRST是STM32主芯片的复位引脚,从而组成整个系统的复位电路。第三十四号引脚SWDIO和第三十七号引脚SWTCK构成STM32主芯片的程序下载仿真电路,可以用来进行SWD仿真调试。另外,STM32主芯片上的一号引脚需要接3.3 V的电压,主要是给主芯片以及其他模块电路提供工作电源。
图4. STM32最小系统
无线供电 [
由L298N电机驱动模块作为电磁铁 [
图5. 发射端原理图
从IN3、IN4输入PWM信号驱动Y方向上的线圈产生磁能,并且输出的峰值电流能够达到2A,能够满足驱动线圈产生磁能的要求。其电路原理图如图7所示。
图6. 接收端原理图
图7. 线圈驱动电路原理图
霍尔传感器 [
V O = V r e f + R 1 R 2 ( V r e f − V i ) (3.1)
图8. 霍尔传感器输出电压差动比例运算电路原理图
辅助电源电路如图9所示。通过对整个系统的各个模块供电电压进行分析可知,整个系统所需的电压电平分别为12 V,5 V,3.3 V,其中,12 V是无线供电模块发射端的额定工作电压,因此,为了给整个系统提供相对稳定的电压,选择使用15 V的电池对整个系统进行供电。通过LM2576-12这款芯片和BUCK型降压电路将15 V电池电压降至12 V,给无线供电模块的发射端进行供电。然后,再利用LM2576-5这款芯片将12 V的电压降低到5 V,为L298N线圈驱动模块和霍尔传感器进行供电,最后,再通过LM2576这款芯片将5 V的电压降至3.3 V,对STM32最小系统进行供电。
图9. 辅助电源电路
如果外界有很大的干扰,则瞬时偏差会显着变化。对于最基本的PID调节器 [
图10. 模糊PID调节系统图
由图10可知,模糊PID系统是以误差E和误差变化率EC为输入变量,输入到模糊控制器和PID调节器里面,以PID调节器的系数Kp、Ki、Kd为输出变量,然后输出到控制对象上,构成了一个二输入三输出的模糊控制器。
系统的主程序流程图如图11所示,首先对整个系统进行初始化,然后进行对相关的变量进行定义和赋初值,再对X、Y方向上的霍尔传感器反馈回来的信号进行滤波和采样,输入两路经过滤波的采样信号到PID调节器,PID调节器对其信号进行调节,并根据产生的偏差值来计算PWM [
由于当外界有较大的扰动时,会使得瞬时偏差变化较大,对于最基本的PID调节器,会使得微分部分的输出快速增大,从而导致控制过程会出现振荡,使得浮子在上空不能稳定悬浮,导致浮子不能在线圈的中心点悬浮。为了使浮子能够在中心点进行稳定的悬浮,因此,选择模糊PID控制系统,该控制结构能够根据设定值自动调节相关的系统参数,对PID参数进行优化,从而自主调节浮子的悬浮位置,使其在中心点进行稳定悬浮。
图11. 主程序流程图
图12. 控制系统子程序流程图
根据PID参数的作用以及在不同的偏差变化下对PID参数的要求,得到针对∆Kp,∆Ki和∆Kd的参数模糊子集的模糊控制表,如表1所示。
构建规则完成后,通过模糊PID控制仿真系统,得到该模糊PID控制器∆Kp,∆Ki和∆Kd三个参数输出曲面,如图13、图14、图15所示。
E | Ec | ||||||
---|---|---|---|---|---|---|---|
NB | NM | MS | ZO | PS | PM | PB | |
NB | PB | PB | PM | PM | PS | ZO | ZO |
NM | PB | PB | PM | PS | PS | ZO | NS |
NS | PM | PM | PM | PS | ZO | NS | NS |
ZO | PM | PM | PS | ZO | NS | NM | NM |
PS | PS | PS | ZO | NS | NS | NM | NM |
PM | PS | ZO | NS | NM | NM | NM | NB |
PB | ZO | ZO | NM | NM | NM | NB | NB |
表1. ∆Kp、∆Ki和∆Kd的参数模糊子集的模糊控制表
图13. ∆Kp输出曲面图
图14. ∆Ki输出曲面图
图15. ∆Kd输出曲面图
通过 s i m u l i n k 对模糊PID控制系统 [
图16. 系统的位移阶跃响应曲线
从图16可以明显看到模糊PID控制系统的动态性能比基本PID控制器的动态性能要好的多,模糊PID控制系统基本上没有超调量,调节时间也比较短,其稳定性更加好,表明所设计的模糊PID控制器是符合磁悬浮控制系统的,能够较好的控制浮子在上空稳定悬浮,总体来说,基本符合课题的要求。
对系统的硬件原理图进行了PCB打板,其PCB样板的正反面实物图如图17、图18所示。
根据PCB的元件布局,焊接好各个元器件,然后进行调试,实现了浮子能够稳定的悬浮在线圈的上空中心,如图19所示。最后,对无线供电模块进行通电,实现了磁悬浮灯稳定的悬浮在线圈的上空中。如图20所示。
图17. PCB正面样板图
图18. PCB反面样板图
图19. 磁悬浮装置实现稳定悬浮
图20. 无线供电磁悬浮灯
本文对无线供电磁悬浮灯的设计、仿真与制作进行了详细的阐述。通过无线电能传输技术为灯具进行供电,灯具的负载光源部分采用磁悬浮设计,在外界有较大的扰动时,会使得瞬时偏差变化较大,并且会使PID微分部分的输出快速增大,从而导致控制过程会出现振荡问题,系统设计了基于模糊PID控制算法的控制系统,仿真和实验证明,模糊PID控制下,灯具部分的悬浮位置控制基本上没有超调量,调节时间也比较短,其稳定性更加好。经过实验证明,系统能较好地实现无线供电磁悬浮灯智能调控的功能。系统成本较低、操作方便、控制系统较为稳定,满足了智能灯的相关要求。
论文的研究受到国家大学生创新创业训练项目、湖南省自然科学基金研究项目(2019JJ40200)支持。
童雨花,李茂林,杨民生,毛小燕,邓玉琴,黄启文. 无线供电磁悬浮灯设计与制作 Design and Manufacture of Magnetic Levitation Lamp for Wireless Power Supply[J]. 传感器技术与应用, 2021, 09(02): 89-100. https://doi.org/10.12677/JSTA.2021.92012