# 電晶體MOS模組

![](https://1275793585-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LaZQFBYOS3O0ksiEmR1%2F-LwvhLTFdYgAe6IncST3%2F-Lwvo-f8U7cM3bEyth_5%2F01.png?alt=media\&token=64675664-2410-4c54-91ba-67fe4d10a570)

## 專案說明

使用「科易KEYES Arduino UNO R3 開發板」連接「電晶體MOS模組」, 每2秒鐘開啟關閉一次。

{% hint style="info" %}
注意：驅動1A以上的負載需安裝散熱片
{% endhint %}

此**電晶體MOS模組**包含於「[洞洞兩教學材料包 Education Kit 002](https://www.robotkingdom.com.tw/product/rk-education-kit-002/)」內。

## 電路圖

* [KEYES Arduino UNO R3&#x20;  ](https://www.robotkingdom.com.tw/product/keyes-uno-r3/)
* 通用型彩色Sensor shield v5.0感測器擴充板
* 電晶體MOS模組
* 微型N20直流減速馬達
* 9V電池

**電晶體MOS模組**是**類比訊號**輸出， 可以接「D0 \~ D13」的 KEYES Arduino UNO R3訊號端上。 本範例連接到「**D3**」。VIN部分需要使用外接電源，這裡我們使用9V電池。輸出我們使用微型N20直流減速馬達來控制。

![](https://1275793585-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LaZQFBYOS3O0ksiEmR1%2F-LxKUzSYthUZJR05gX3k%2F-LxKVC39Xpe-DUWjV1N4%2F02.png?alt=media\&token=50e5287e-08f3-4672-aac8-be6ea0ce1646)

## Arduino 程式

將3號腳位的電位拉低、拉高，每2秒鐘會切換**電晶體MOS模組**的開關一次。

產生出的 Arduino 程式如下

```c
#define control 3 // pin that controls the MOSFET

void setup() {
  // IRF520 MOSFET Tutorial by Robojax
  pinMode(control,OUTPUT);// define control pin as output
  Serial.begin(9600);

}

void loop() {
  // IRF520 MOSFET Tutorial by Robojax

  digitalWrite(control,HIGH); // turn the MOSFET Switch ON
  delay(2000);// Wait for 2000 ms or 2 second

  digitalWrite(control,LOW); // Turn the MOSFET Switch OFF
  delay(2000);// Wait for 2000 ms or 2 second


}

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cavedu.gitbook.io/cavedu/rk002/module/002_transistor_mos.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
