10. Output Devices

This week's individual assignment is to add an output device to a microcontroller board and program it to do something. I chose to document three output devices that are directly relevant to my final project a pill dispenser, where I may use any of these to signal dispensing events, control a compartment mechanism, or provide user feedback:

All devices were connected to my custom PCB made on Week 08 (that works with the XIAO RP2350) and was programmed using Arduino IDE. For full power consumption measurements, check out the group assignment.

Group Assignment.

What are Output Devices?

An output device is a component that takes an electrical signal from the microcontroller and converts it into a physical effect. It can produce movement (motor), light (LED), sound (buzzer), or an image on a screen (display). They work along with input devices to create interactive systems: the microcontroller reads data from sensors (inputs), processes it and transform it into a effect in the real world (outputs).

Understanding how much power each device consumes is critical for designing safe circuits: it determines the power supply you need, it prevents system failures or safety hazards like overheating and it helps you optimize the components efficiency in our projects.

Power formula diagram

This image represents the Ohm's Law and Joule's Law Wheel. It shows the mathematical relationships between the four primary electrical quantities.

The Four Core Variables

The inner circle identifies the four variables and the units they are measured in:

  • P (Power): Measured in Watts (W) This represents the rate at which electrical energy is consumed or produced meaning how fast electricity or work is done.

  • I (Current): Measured in Amps (A). The flow of electric charge through a conductor.

  • V (Voltage): Measured in Volts (V). Known as electrical potential difference, it represents the electrical pressure that pushes the current.

  • R (Resistance): Measured in Ohms (Ω). This is the opposition to the flow of current.

For this week we will be using the power formula: Power= Voltage × Current

Why use this formula? Voltage and current are the easiest electrical quantities to measure directly with common instruments like multimeters and USB testers. Rather than trying to measure power or resistance directly, we simply measure volts and amps, then multiply them together to get power instantly.

Example

A servo motor running at 6 V draws 0.3 A while moving. Meaning it consumes 1.8 W
P = 6 V × 0.3 A = 1.8 W

Power Consumption Tests

What is a DC Motor?

A DC (Direct Current) motor converts electrical energy into rotational mechanical energy. When a DC voltage is applied across its terminals, the motor shaft spins. The direction of rotation depends on the polarity, and the speed depends on the voltage level. To control a DC motor with a microcontroller, an H-bridge driver IC is needed: it allows the microcontroller's low-current signals to safely switch the higher motor current, and also enables forward/reverse direction control.

The passive buzzer I used was from the 37-arduino sensor kit and it was connected directly to the XIAO RP2350, trough three pins: S (signal/PWM), VCC, and GND. I chose a passive buzzer instead of an active one because I can play with the tone which is useful for the pill dispenser project to signal different events with different alarm melodies. I didn't use a transistor, however after the group assignment I found that the buzzer draws around 30 mA at 5 V, which is within the safe limits of the XIAO pin (40 mA max). So for future reference, I will add a 100 µF capacitor across VCC and GND to smooth out any voltage spikes when the buzzer is active.

Pin connections

Buzzer pinXIAO RP2350 pin
S (signal)D4
VCC (+)3.3V
GND (−)GND
Important: The XIAO RP2350 runs at 3.3 V — not 5 V like Arduino UNO. The tone() function does not work reliably on the RP2350 core, so all audio was generated manually by toggling the pin at the desired frequency.

The two potentiometers from the kit were used to control note selection (5 kΩ on D1) and were later repurposed to control melody playback speed once the songs were programmed.

Reflections

Working with three different output devices in the same week gave me a clear picture of the trade-offs for my pill dispenser project: