Skip to content

12. Output devices

  • Group assignment:

Measure the power consumption of an output device. Document your work on the group work page and reflect on your individual page what you learned.

  • Individual assignment:

Add an output device to a microcontroller board you’ve designed and program it to do something.

Group Reflection:

Here is the link to our group documentation.

For this week’s group assignment, we measured the power consumption of an OLED display. This task helped me better understand how to analyze energy use in electronic components. By using a multimeter, we were able to measure both the voltage and the current drawn by the display during operation.

I learned how to probe the circuit. I placing the multimeter leads across the VCC and GND pins of the OLED. Because the display was activated through a touch sensor, I had to keep contact with the sensor to keep the display on while taking measurements. The current went up and down, but we recorded an approximate value of 0.256A with a constant 5V supply, allowing us to calculate the power consumption using the formula P = V × A. This gave us a result of 1.28W.

Overall, this exercise gave me practical insight into how power consumption is measured and how even small components can add up in energy usage, which is especially important when designing efficient systems.

Individual

To successfully program my output device, I used:

  • DC motor
  • Motor driver
  • XIAO RP2040
  • 9 Volt battery

I prompted ChatGPT to give me a code that would spin a motor on and off for 2 seconds. I decided to do this because, for my final project, I will need a motor to alternate between spinning and stopping in order for my record player to start and stop playing music. ChatGPT provided me with this code:

#define IN1 D2  // Pin D2 connected to IN1
#define IN2 D3  // Pin D3 connected to IN2

void setup() {
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
}

void loop() {
  // Move Motor Forward
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
  delay(2000);  // Motor runs for 2 seconds

  // Stop Motor
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, LOW);
  delay(2000);  // Wait 2 seconds

  // Move Motor Backward
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, HIGH);
  delay(2000);  // Motor runs in reverse for 2 seconds

  // Stop Motor
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, LOW);
  delay(2000);  // Wait 2 seconds
}

Wire Connection:

  • RP20204

    • Pin 2 is connected to IN1
    • Pin 3 is connected to IN2
  • Battery

    • One wire connected to ground on the motor driver and the other was connected to the 5 volt.
  • DC Motor

    • One wire connected to Out 1 and the other was connected to Out 2.

Once everything is connected, here is it all tested on a bread board.

Once I knew that my everything I designed a small pcb for the RP2040 and its connected wires.

In the symbol library, I added these symbols and their correct footprints

  • Module_XIAO-RP2040 ----- fab:SeeedStudio_XIAO_RP2040
  • PinHeader_01x02_P2.54mm_Vertical_THT_D1mm ----- fab:PinHeader_01x02_P2.54mm_Vertical_THT_D1mm

This is the final Kicad schematic:

Here is the final PCB design:

Here is the milled and soldered PCB board:

Here is the motor spinning in 2-second intervals while connected to the PCB board:

Final Reflection

For this week’s individual assignment, I added a DC motor as the output device to a microcontroller board I designed using the Seeed Studio XIAO RP2040. I connected the motor through an L293D motor driver and powered the system with a 9V battery. I programmed the motor to spin forward for 2 seconds, stop for 2 seconds, spin in reverse for 2 seconds, and stop again for 2 seconds, repeating this cycle. This behavior mimics the start-stop motor control needed for my final record player project. After successfully testing the setup on a breadboard, I designed a compact PCB in KiCad using appropriate symbols and footprints such as the Module_XIAO-RP2040 and PinHeader_01x02_P2.54mm_Vertical_THT_D1mm. This task helped me understand how to interface and control output devices in both code and hardware. I documented the wiring, linked the motor to the custom PCB from a previous assignment, and explained the programming process I used in Arduino. Overall, this week grew my skills in embedded programming, PCB design, and integrating output devices into a complete system.

Here is the link to all of the files for this week


Last update: May 29, 2025