电子产业
数字化服务平台

扫码下载
手机洽洽

  • 微信小程序

    让找料更便捷

  • 扫码下载手机洽洽

    随时找料

    即刻洽谈

    点击下载PC版
  • 华强电子网公众号

    电子元器件

    采购信息平台

  • 华强电子网移动端

    生意随身带

    随时随地找货

  • 华强商城公众号

    一站式电子元器件

    采购平台

  • 芯八哥公众号

    半导体行业观察第一站

使用廉价器件的测电机转速电路

来源:-- 作者:-- 浏览:364

标签:

摘要: 基于微处理器电路提供LCD显示和模拟 电机转速 输出。   本设计方案使用微处理器、16×2的LCD和旋转编码器, 测量 和显示电机转速(图1)。使用与电机轴相连的递增编码器测量电机的转轴速度,编码器提供积分脉冲,其频率与转轴速度成比例。1024脉冲旋转编码器为Hengstler 公司的RS-32-0/1024ER.11KB。可以通过计算一段tP时间内,编码器轴的转数nV,计算电机转动速度ωR。通

  基于微处理器电路提供LCD显示和模拟 电机转速 输出。

  本设计方案使用微处理器、16×2的LCD和旋转编码器, 测量 和显示电机转速(图1)。使用与电机轴相连的递增编码器测量电机的转轴速度,编码器提供积分脉冲,其频率与转轴速度成比例。1024脉冲旋转编码器为Hengstler 公司的RS-32-0/1024ER.11KB。可以通过计算一段tP时间内,编码器轴的转数nV,计算电机转动速度ωR。通过计算固定tP时间内,编码器产生的脉冲数nP,计算nV:对编码器有nV=nP/1024。转速为公式

 

使用微处理器

  在此,δ=60/(tP×1024) rpm表示所测转速的分辨力。本应用为获得1rpm的分辨力,使用60/1024=58.59ms作为时间基准确定周期。在本设计方案中,廉价微处理器IC1为MicroChip公司的PIC16F873完成这些操作。微处理器也驱动IC2的LCD,在每分钟旋转中显示转动速度。

  参考文献1中类似方式的电路,将编码器的积分脉冲用于IC1的RB0/INT输入,在脉冲上升沿产生高优先级中断。这些中断允许通过递增计数器计算nP,计数器达到固定时间tP后进行初始化。并且,

微处理器内部的8位定时器(定时器0)记录tP,对14.3 MHz的时钟频率fCLK,定时器每286µs产生一个tM(定时器中断):tM=4×28/fCLK/4=286 µs。这个公式意味着固定时基tP需要205个定时器中断(tP/tM)。当计数器达到这个次数,根据公式计数nP确定转速。最后,这个值在LCD屏上显示。

  此外,如果控制系统必须测量转速,数模转换是必需的。可以将微处理器的PWM(脉宽调制)输出用于R2组成的低通滤波器,不增加昂贵的DAC也完成这个转换。PWM信号的频率为20kHz,低通滤波器的截止频率为160Hz,大大低于PWM频率。本设计中,PWM信号的最大占空周期与1500rpm转速相应。

  可以下载IC1程序的源代码,用Microchip的MPLab软件编译。可以根据使用的编码器和公式所需分辨力,改变软件中常量。

  英文原文:

  Circuit for measuring motor speed uses low-cost components

  A microcontroller-based circuit provides both an LCD readout and an analog motor-speed output.

  R García-Gil, J Castelló, and JM Espí, Escola Tècnica Superior d’Enginyeria, University of Valencia, Spain; Edited by Charles H Small and Fran Granville -- EDN, 11/8/2007

  This Design Idea uses a microcontroller, a 16×2-key LCD, and a rotary encoder to measure and visualize the speed of a motor (Figure 1). You measure the rotor speed of the motor using an incremental encoder coupLED to the motor shaft, which provides quadrature pulses with a Frequency proportional to the rotor speed. The 1024-pulse rotary encoder is the RS-32-0/1024ER.11KB from Hengstler. You CAN calculate the rotational speed of the motor, ωR, by counting the number of revolutions that the encoder axis, nV, makes during a certain time period, tP. You calculate nV by counting the number of pulses, nP, that the encoder generates during this fixed period, tP: nV="nP/1024" for this encoder. And the rotational speed is

 
  There δ=60/(tP×1024) rpm represents the resolution of the measured speed. To obtain a resolution of 1 rpm for this applICation, the fixed period you use as a timebase is 60/1024=58.59 msec. In this Design Idea, a low-cost microcontroller, the PIC16F873, IC1, from MicroChip performs these operations. This microcontroller also drives the LCD, IC2, which shows the rotational speed in rotations per minute.

  In a similar fashion to the circuit in Reference 1, you apply the quadrature pulses of the encoder to IC1’s RB0/INT input, which ge

nerates a high-priority interrupt at the rising edge of the pulse. These interruptions allow you to compute nP by increasing a counter, which initializes after it reaches fixed period tP. Moreover, the microcontroller’s internal 8-bit timer, Timer 0, registers tP, which generates a tM (timer interruption) each 286 µsec for a cLOCk Frequency, fCLK, of 14.3 MHz: tM="4"×28/fCLK/4=286 µsec. This calculation means that fixing the timebase, tP, requires 205 timer interruptions (tP/tM). When the counter reaches this time, the count, nP, determines the rotational speed, aCCording to the equation. Finally, this value appears on the screen of the LCD.

  In addition, a digital-to-analog conversion is necessary if the control system must measure the rotational speed. You CAN do this conversion without adding an expensive DAC by applying a PWM (pulse-width-modulation) output of the microcontroller to a lowpass fiLTEr comprising R2, R3, C4, C6, and IC3. The frequency of the PWM signal is 20 kHz, and the cutoff frequency of the lowpass filter is 160 Hz, which is much lower than the PWM frequency. In this design, the maximum duty cycle of the PWM signal corresponds to a rotational speed of 1500 rpm.

  You can download the source code for IC1’s program and assemble the SOFtware with MPLab from Microchip. You can alter constants within the software according to the encoder you use and your required resolution from the equation.

  Reference

  Jain, Abhishek, “Versatile digital speedometer uses few components,” EDN, May 12, 2005, pg 95.

  英文原文地址: http://www、edn、com/article/CA6495300、html

型号 厂商 价格
EPCOS 爱普科斯 /
STM32F103RCT6 ST ¥461.23
STM32F103C8T6 ST ¥84
STM32F103VET6 ST ¥426.57
STM32F103RET6 ST ¥780.82
STM8S003F3P6 ST ¥10.62
STM32F103VCT6 ST ¥275.84
STM32F103CBT6 ST ¥130.66
STM32F030C8T6 ST ¥18.11
N76E003AT20 NUVOTON ¥9.67