10—Output Devices

Assignment

00— Reflection

It went well we tested several different sensors.

01—DC Motor (brushed)

For the DC Motor we just used a simple MOSFET circuit that was provided in one of the diagram on the IAAAC Fab Barcelona website.

  1. First we followed this diagram
  1. This was the circuit on the breadboard below using the 30N06LE and the Barduino.
  1. Below is the final code we used it took several attempts to get the code to work do to simple errors. We also had originally written as a simple LOW/HIGH loop with a delay until we realized it needed to run on a PWM capable pin on the Barduino and the code need to use PWM syntax. Below is the Barduino pinout we refferenced as well as the arduino code used.
void setup() {
  pinMode(5, OUTPUT); // Use PWM-capable pin like 5
}

void loop() {
  for (int i = 0; i <= 255; i++) {
    analogWrite(5, i); // Increase brightness
    delay(10);
  }
  for (int i = 255; i >= 0; i--) {
    analogWrite(5, i); // Decrease brightness
    delay(10);
  }
}
  1. Final result and a recording of the varying power consumption likely as a result of the higher power input as the motor starts up for each cycle. Consumption of current is ~.4 mA →130mA.

`