打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
实验室:使用晶体管通过Arduino控制高电流负载 - ITP物理计算

                                 实验室:使用晶体管通过Arduino控制高电流负载

最初由Matt Richardson
2014年7月1日撰写最后修改于2016年9月2日,作者:Benedetta Piantella Simeonidis

介绍

内容[ 显示 ]

在本教程中,您将学习如何控制高电流直流负载,例如直流电机或微控制器的白炽灯。微控制器只能从其输出引脚输出非常少量的电流。这些引脚用于发送控制信号,而不是用作电源。从微控制器控制另一个直流设备的最常用方法是使用晶体管。晶体管允许您控制来自低电流源的高电流电路的流量。

你需要知道什么

为了充分利用本实验,您应事先熟悉以下概念。如果您不是,请查看以下链接:

  • 安全警告:  本教程介绍如何控制高电流负载。与早期教程相比,这会带来更高的电力伤害危险。在插入任何东西之前,请小心并仔细检查接线,并且在电路通电时切勿更换接线。

你需要的东西

对于本实验,您需要:
无焊面包板22-AWG连接线Arduino微控制器模块10Kohm电位器
功率二极管(仅限直流电机版本)DC power supplyTIP120 transistorDC Motor
OR 
Incandescent lamp and socket

Connect the Breadboard

Connect the breadboard to the Arduino, running 5V and ground to the side rails:

Add a potentiometer

Connect a potentiometer to analog in pin 0 of the module:

Schematic viewArduino with Potentiometer

Connect a transistor to the microcontroller

The transistor allows you to control a circuit that’s carrying higher current and voltage from the microcontroller. It acts as an electronic switch. The one you’re using for this lab is an NPN-type transistor called a TIP120. The datasheet for it can be found here. It’s designed for switching high-current loads. It has three connections, the base, the collector, and the emitter. The base is connected to the microcontroller’s output. The high-current load (i.e. the motor or light) is attached to its power source, and then to the collector of the transistor. The emitter of the transistor is connected to ground.

Pinout of a TIP-120 transistor from left to right: base,collector, emitterSchematic symbol of a TIP-120 transistor

Note: Using MOSFETS instead

You can also use an IRF510 or IRF520 MOSFET transistor for this. They have the same pin configuration as the TIP120, and perform similarly. They can handle more amperage and voltage, but are more sensitive to static electricity damage. MOSFETs are grouped into N-Channel and P-Channel, which are equivalent to NPN and PNP bipolar transistors. Here’s a quick translation table for the pin names on both:

Bipolar TransistorMOSFET
BaseGate
CollectorDrain
EmitterSource

Connect the base to an output pin of the microcontroller, and the emitter to ground like so:

Safety Warning: You can generally connect the base to a microcontroller’s pin directly without a current limiting resistor because the current from the pin is low enough. But it’s necessary if you’re controlling a transistor circuit without a microcontroller.

Connect a motor and power supply

Attach a DC motor to the collector of the transistor. Most motors will require more amperage than the microcontroller can supply, so you will need to add a separate power supply as well. If your motor runs on around 9V, you could use a 9V battery. A 5V motor might run on 4 AA batteries. a 12V battery may need a 12V wall wart, or a 12V battery. The ground of the motor power supply should connect to the ground of the microcontroller, on the breadboard.

Next, add a diode in parallel with the collector and emitter of the transistor, pointing away from ground. The diode to protects the transistor from back voltage generated when the motor shuts off, or if the motor is turned in the reverse direction.

The circuit with protection diode across the transistorThe TIP120 can be replaced with a MOSFET if you prefer.

You may also find that adding a diode across the motor helps with back voltage protection as well, particularly when you’re running multiple transistor-motor circuits. If you plan to add a diode across the motor, here’s the circuit:

A diode across the motor helps with back voltage protection as well 

Be sure to add the diode to your circuit correctly. The silver band on the diode denotes the cathode which is the tip of the arrow in the schematic, like so:

This circuit assumes you’re using a 12V motor. If your motor requires a different voltage, make sure to use a power supply that’s appropriate. Connect the ground of the motor’s supply to the ground of your microcontroller circuit, though, or the circuit won’t work properly.

Connect a lamp instead

You could also attach a lamp using a transistor. Like the motor, the lamp circuit below assumes a 12V lamp. Change your power supply accordingly if you’re using a different lamp. In the lamp circuit, the protection diode is not needed, since there’s no way for the polarity to get reversed in this circuit:

Schematic viewWhen the motor is replaced with a lamp there is no need for the protection diode

Program the microcontroller

Write a quick program to test the circuit. Your program should make the transistor pin an output in the setup method. Then in the loop, it should turn the motor on and off every second, just like the blink sketch does.

const int transistorPin = 9;    // connected to the base of the transistor
 void setup() {
   // set  the transistor pin as output:
   pinMode(transistorPin, OUTPUT);
 }
 void loop() {
   digitalWrite(transistorPin, HIGH);
   delay(1000);
   digitalWrite(transistorPin, LOW);
   delay(1000);
 }

Now that you see it working, try changing the speed of the motor or the intensity of the lamp using the potentiometer.

为此,请使用电位计读取电压  analogRead()然后将结果映射到0到25​​5的范围,并将其保存在新变量中。使用该变量设置电机的速度或灯的亮度  analogWrite()

const int transistorPin = 9;    // connected to the base of the transistor
 void setup() {
   // set  the transistor pin as output:
   pinMode(transistorPin, OUTPUT);
 }
 void loop() {
   // read the potentiometer:
   int sensorValue = analogRead(A0);
   // map the sensor value to a range from 0 - 255:
   int outputValue = map(sensorValue, 0, 1023, 0, 255);
   // use that to control the transistor:
   analogWrite(transistorPin, outputValue);
 }

对于电机用户:这样控制的电机只能向一个方向转动。为了能够反转电动机的方向,需要H桥电路。有关控制带H桥的直流电机的更多信息,请参阅  直流电机控制实验室

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Building a SLAM bot with a Kinect | joel
你离英文的技术文档大神,只差这个中英文对照!(收藏版)
电子电路
(SKU:DRI0035)步进电机驱动扩展板(TMC260)
开始上手SimpleFOClibrary
常用电子元器件中英文对照表
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服