270j Final Project

From CSclasswiki
Revision as of 16:08, 6 May 2020 by 270j (talk | contribs) (Part 2)
Jump to: navigation, search

Project Proposal

This is an Arduino-Only project.


The goal of this project is to implement a fan blade whose rotational speed is dependent on the temperature read from the temperature sensor. The higher the temperature, the faster the fan will operate. The fan will operate at maximum rotational speed if temperature is above 30 degrees Celsius.

External References

Part 1

Connect a 64-LED matrix display to my Arduino and program it to display my name "NOX".


Wiring of a 8x8 LED matrix to Arduino Mega2650

Source Code

The following program displays the letters 'N', 'O', 'X' one at a time repeatedly.

 *  led64
 *  Nox Yu 
 *  part 1 of the final project for csc270
 *  this program makes the 8x8 LED matrix displays N, O, X, one at a time repeatedly
#include <LedControl.h>

int DIN = 12;
int CS = 11;
int CLK = 10;
byte n[8] = {0xE3, 0xF3, 0xFB, 0xDD, 0xDD, 0xCF, 0xCF, 0xC7};
byte o[8] = {0x3C, 0x7E, 0xE7, 0xC3, 0xC3, 0xE7, 0x7E, 0x3C};
byte x[8] = {0x81, 0xC3, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0xC3};
LedControl lc = LedControl(DIN, CLK, CS, 0);

// display each row on the matrix according to the bytes array input
void printByte(byte bytes[]){
  int i=0;
  for (i=0; i<8; i++ ){
    lc.setRow(0, i, bytes[i]); 

void setup() {
  // put your setup code here, to run once:
  lc.shutdown(0, false); // shutdown the power saving mode
  lc.setIntensity(0, 15); // set brightness to max

void loop() {
  // put your main code here, to run repeatedly:

Part 2

Connect a temperature sensor to my Arduino. To verify that it works correctly, the 4-digit-7-segment display will show the current temperature read by the temperature sensor

Part 3

Connect the fan blade and its motor to my Arduino. To verify that it works correctly, how fast the fan blade rotates will be proportional to the value read from a potentiometer.

Part 4

The fan blade's rotational speed should be proportional to the temperature read from the temperature sensor. It should have four levels:

  • below 15 degrees Celsius: fan does not rotate
  • between 15 and 25 Celsius: fan operates at 1/3 of its maximum rotational speed
  • between 25 and 30 Celsius: fan operates at 2/3 of its maximum rotational speed
  • above 30 Celsius: fan operates at its maximum rotational speed