Post

Homework 9: Motorized Pinwheel

Homework 9 project

This homework was more enjoyable because there is something inherently more entertaining about making things move and spin than static objects, though, unfortunately the crafting part ended up a bit more janky than I would have liked.

The Circuit

Circuit

Parts List

NameQuantityComponent
U11Arduino Uno R3
S11Pushbutton
R1110 kΩ Resistor
T11nMOS Transistor (MOSFET)
D11Diode
M11DC Motor
BAT119V Battery

Parts List CSV

Schematics

Schematics Schematics pdf

Building the Circuit

Building the circuit went by quickly and I don’t really have much more to say about it. However, constructing the pinwheel itself didn’t go too well and the resulting pinwheel was falling apart quite a bit.

Falling apart Pinwheel

I guess I need stronger tape or something, though I wasn’t too disappointed since after loading the example sketch for testing, it worked out and span well enough.

Motorized Pinwheel

Programming

After confirming that the circuit was mostly working, I then unloaded the example sketch and began programming the arduino, which this time, the program was way simpler than expected, and was just turning on / off the motor according to the switch.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const int switchPin = 2, motorPin = 9; 

int switchState = 0;

void setup() {
  pinMode(motorPin, OUTPUT);
  pinMode(switchPin, INPUT);
}

void loop() {
  switchState = digitalRead(switchPin);

  if (switchState == HIGH) {
    digitalWrite(motorPin, HIGH);
  } else {
    digitalWrite(motorPin, LOW);
  }
}
This post is licensed under CC BY 4.0 by the author.