output devices
This week we had to add an output device and program it. Now that I know how to use a thermistor to read temperature, I tried to learn how to integrate that reading into a simple function (like turning on the fan). This will be incorporated into my final project!



I still had the small breadboard from last week's assignment. Since I added the transistor, I just had to connect a small 5V fan to the microcontroller. One wire would be connected to a port on the microcontroller and the other wire would be connected to the transistor. Rob had a great guide on FET transistors and how to connect them. The FET transistor allows me to control how much current flows through the fan (and therefore determine whether it is on or off).

FET Guide


You connect the drain to the load (power supply), the source to ground and the gate to the component/port. Once those connections have been made, you just need to program when current passes through.

Connecting the fan


To determine this, you can make a sketch in Arduino. Since the fan being on should be conditional to the temperature being warm, I had to add lines of code to the sketch I made last week. I needed an extra output pin and a variable for the threshold temperature (fanTemp). I set this to 2000, since that was as hot as it would get if I placed my fingers on the thermistor. I tried one pin, but it didn't work, so I switched to pin 14.

Arduino Sketch


Once I connected everything, I tested it by putting my fingers on and off the thermistor. I propped it up in the shell of my final project. It worked!

Fan switching on


My main board has both a 5V supply and ground connection, which allows me to link the fan directly to my board as opposed to needing a separate power supply.

Board Components
PCB file


The thermal sensing board last week also has connections that allow for the fan to be connected (located on the right-hand side of the board):

Board Components


The 5V supply can be connected to both the fan and the main board. There are also port connections to the mainboard, which allows for the FET gate to operate. I added a protection diode between the motor return and 5V to prevent any issues.

The mini board thus has a dual function: it both has a built in temperature sensor and components that allow for the control of fans.
File