Assignment 5:
High Voltage Transistor

Due Date: February 22nd, 2022

Back to Project Page

Creative Overview

This assignment is to create a schematic, circuit, and code that uses a transistor to control load power separate from logic power, using analogWrite(), a high-load output device, and an input sensor that uses a library.

The way my project works is similar to the heat/AC at home: We set up the temperature at a certain degree. In the case of AC, the machine will be on if the detected temperature is higher than the setting temperature in order to cool the environment, otherwise, the machine is off.

In my project, I have a temperature sensor (using library), a potentiometer as toggle, and a fan that requires external power source. The environment temperature and the set temperature are both printed in the serial monitor.

FINAL GIF

Process

CIRCUIT

SCHEMATIC, CALCULATION

The first component is connected to the external 12v power source. The second and the third components are connected in parallel using 5v voltage power source.

The max current value from the external power source is 2A, which is way below the max current value of 32A for MOSFET at room temperature. In my code, when the environment temperature is above the setting, I set up the motor speed to be 64, which is only 1/4 of the maximum output value for the analogWrite, in order to further limit the current.

HOW DOES IT WORK?

The detected environment temperature and the setting temperature, which is controlled by the potentiometer, are printed to the serial monitor.

In this case, the set temperature is at 30 celsius, which is greater than 23.8 celsius. The motor fan is off.

In the below case, we toggle the potentiometer to be 16 celsius, which is below 23.9 celsius at that moment, the motor is on. To make the reading more obvious, I also added a * sign at the beginning of the line to show the fan is on, which corresponds to the behavior of the motor fan (see the video at the top).

ARDUINO CODE

Back to Project Page