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 two output devices that are directly relevant to my final project:

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).

To measure the power consumption of the output devices, we used a USB tester connected in series with the power supply. This allows us to see how much current (in Amperes) the device draws at different states, and since we know the voltage (in Volts), we can calculate the power (in Watts) using the formula P = V × I.

Buzzer + Servo Motor

For this week I chose to program a buzzer and a servo motor at the same time, simulating the alarm sound and movement when the button is pressed. The buzzer is a passive one, which means it can produce different tones depending on the frequency of the signal sent to it, unlike an active buzzer that just turns on or off. The servo motor is a micro servo (SG90) that can rotate to a specific angle based on the PWM signal it receives.

Designing the Modular ESP32-C6 PCB

For Inputs & Outputs week, I wanted to create a custom PCB that would allow me to easily connect the XIAO ESP32-C6 microcontroller with various sensors and output devices for future projects. The PCB production process follows the same steps as Week 08 (Electronics Production)

Programming the Buzzer and Servo

I programmed the buzzer and servo using the Arduino IDE. The code is structured to play a melody on the buzzer and move the servo to specific angles when a button is pressed. I used manual PWM generation for the buzzer since the tone() function is unreliable on this microcontroller.

Learning Outcomes

This week I learned how to program different output devices and its power consumption, thanks to the group assignment. While in my individual work, I learned how to combine two output devices in a single circuit.

Files

KiCad Files Code