Figure 5-12. Fritzing circuit build of an Arduino-based servo motor controller with angle-positioning potentiometer
Figure 5-13. Circuit schematic diagram for the Arduino-based servo motor controller with angle-positioning potentiometer
Figure 5-14. Prototype of the Arduino-based servo motor controller with angle-positioning potentiometer
Figure 5-15. Obtaining the Knob sketch within the Arduino-Processing IDE
With the code uploaded to the Arduino, turning the shaft of the 10K potentiometer allows the servo motor to move in precise angular increments (or steps) with the variable resistor. The faster the potentiometer’s shaft is turned, the quicker the servo motor responds. Besides the angular positions hard-coded in Listing 5-1, discrete movements of the servo motor can be commanded by the potentiometer quite easily. Once again, a well- commented sketch allows you to experiment with the servo motor’s operation easily.
Listing 5-2. The Knob Sketch
// Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>
#include<Servo.h>
Servo myservo; // create servo object to control a servo
int potpin = 0; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop()
{
val = analogRead(potpin); // reads the value of the potentiometer
(value between 0 and 1023)
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo
(value between 0 and 180)
myservo.write(val); // sets the servo position according to the
scaled value
delay(15); // waits for the servo to get there
}
电机物理计算的基础知识控制直流电机和传感器的概念(或传感器),单片机,晶体管继电器驱动程序说明了模拟电路和物理控制项目。使用一个机电继电器是一种传统的方法驱动电动机,因为继电器的开关接触能够处理几安培的电流。电动马达就是机电设备,因为它们需要一个电信号(电压或电流),将其转化为机械动作。为了克服旋转的机制,需要很高的涌流的电源驱动机电部分。
示例中讨论了简单物理计算直流电机控制项目,机电继电器使用一对高额定载荷容量有负担地提供了电源电流。但有控制电动马达的另一种备选方案:使用功率晶体管而不是机电继电器。转矩和速度是两个与电机有关的重要参数,驱动他们的设备必须能够有效地控制这些元素。单片机,以及功率晶体管提供一种高效、清洁的方法来保持对电机的恒转矩和速度控制。
Arduino内部的嵌入式软件有一个专门的计算机/数学方法,使用测试程序(算法)保持转矩和速度控制电动机。算法仅仅是一个循序渐进的过程,计算电机的输出是用带有反馈的转换器/传感器的单片机监测的,它提供电压或电流信号数据,因为它关系到机电设备的扭矩和速度。单片机的嵌入式软件不断检查信号的数据,如果有偏差,则靠调整控制电路的输出信号来驱动它。所以,在某种程度上,转换器或传感器,监测电机的输出参数为电动机提供间接的物理计算活动。
- 上一篇:拉丝机英文文献和中文翻译
- 下一篇:冲压模具英文参考文献和中文翻译
-
-
-
-
-
-
-
十二层带中心支撑钢结构...
当代大学生慈善意识研究+文献综述
乳业同业并购式全产业链...
河岸冲刷和泥沙淤积的监测国内外研究现状
大众媒体对公共政策制定的影响
电站锅炉暖风器设计任务书
java+mysql车辆管理系统的设计+源代码
酸性水汽提装置总汽提塔设计+CAD图纸
中考体育项目与体育教学合理结合的研究
杂拟谷盗体内共生菌沃尔...