實(shí)驗(yàn)室:使用晶體管通過Arduino控制高電流負(fù)載
最初由Matt Richardson
于2014年7月1日撰寫最后修改于2016年9月2日,作者:Benedetta Piantella Simeonidis 介紹內(nèi)容[ 顯示 ] 在本教程中,您將學(xué)習(xí)如何控制高電流直流負(fù)載,例如直流電機(jī)或微控制器的白熾燈。微控制器只能從其輸出引腳輸出非常少量的電流。這些引腳用于發(fā)送控制信號(hào),而不是用作電源。從微控制器控制另一個(gè)直流設(shè)備的最常用方法是使用晶體管。晶體管允許您控制來自低電流源的高電流電路的流量。
你需要知道什么為了充分利用本實(shí)驗(yàn),您應(yīng)事先熟悉以下概念。如果您不是,請(qǐng)查看以下鏈接:
你需要的東西
Connect the BreadboardConnect the breadboard to the Arduino, running 5V and ground to the side rails: Add a potentiometerConnect a potentiometer to analog in pin 0 of the module: Connect a transistor to the microcontrollerThe 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.
Note: Using MOSFETS insteadYou 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:
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 supplyAttach 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.
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: 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 insteadYou 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:
Program the microcontrollerWrite 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.
Now that you see it working, try changing the speed of the motor or the intensity of the lamp using the potentiometer. 為此,請(qǐng)使用電位計(jì)讀取電壓
對(duì)于電機(jī)用戶:這樣控制的電機(jī)只能向一個(gè)方向轉(zhuǎn)動(dòng)。為了能夠反轉(zhuǎn)電動(dòng)機(jī)的方向,需要H橋電路。有關(guān)控制帶H橋的直流電機(jī)的更多信息,請(qǐng)參閱 直流電機(jī)控制實(shí)驗(yàn)室 |
|