Skip to content

10. Output devices

Weekly Assignment:

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.

Breadboard

I decided to use a servo motor as my output device. I first connected the motor to an ESP32C3 microcontroller.

This is the code that I used to program the servo.

#include <ESP32Servo.h>

Servo myServo;
const int servoPin = 21; // GPIO21 (D6 on ESP32-C3)

void setup() {
 Serial.begin(115200);
 myServo.setPeriodHertz(50);    // Standard 50 Hz servo
 myServo.attach(servoPin, 500, 2400); // Attach with min/max pulse width
}

void loop() {
 for (int pos = 0; pos <= 180; pos++) {
   myServo.write(pos);
   delay(15);
 }

 for (int pos = 180; pos >= 0; pos--) {
   myServo.write(pos);
   delay(15);
 }
}

This is a video of the code running with the servo connected on a breadboard.


PCB

Design

I made the schematic design and ran an ERC. I made sure to use the pin 13 ground because I did not plan on having my microcontroller flush with the copper for connection with pin 21. I spent way too much time trying to find the right item name for the pin header, but I realized it ultimately doesn't matter because it will just be 3 holes.

I then made the PCB design.

I made the traces 0.5mm

Soldering

I then milled out a PCB.

I started by soldering on pin header sockets so that I would be able to reuse microcontrollers for new boards.

And then the pin header.

When I finished soldering all the components, I tried powering the microcontroller. However, I faced an issue where the LED that indicates the microcontroller is on was not lighting up properly, and so my board wasn't working. It was really weird because when the microcontroller was powered outside of the board, the LED would stay lit up. Once I plugged it into the board, the LED would stop lighting up. This can be seen in the video below.

Angel suggested I strengthen the soldering of the trace connected to the servo's ground.

Once I did that, the light would stay on and my board worked! This is a video of it finally working.


Group

This week's assignment was to measure the power consumption of an output device. We decided to measure the power consumption of a servo. My group documentation can be found here.

Individual Contribution

I used my servo pcb board from my individual work to measure voltage, current, and calculate power consumption.

Measuring Voltage

In order to find Power, I needed to first find voltage and current and use the formula Power(W) = Voltage(V) * Current (A). I used a multimeter with the dial positioned at the first option (other than OFF). I had the COM port (the black one) plugged into COM and the red plug on VΩHz.

Below is a picture of how I measured it on the multimeter.

I measured the voltage to be around 3.3V, which adds up because the servo is powered on the 3.3V pin.

Measuring Current

To measure current, I turened the dial to the second to last node (excluding NCV Live). I kept the black plug where it was on COM and moved the red plug to mA to measure current.

While I was measuring, I noticed that the current value began at 0.230 mA and decreased, slowing down as it did. Below is a video of the decrease.

Here are also some photos of how the value kept on getting smaller and smaller. The longest I waited was until it got to 188 mA (that took around 40 seconds) and I'm sure it would have kept on going.

![](../images/week11/group/2.jpg{width=200} ![](../images/week11/group/3.jpg{width=200} ![](../images/week11/group/4.jpg{width=200}

I learned that it was normal for current to not be constant, but it did complicate my calculation.

Calculating Power

For my first calculation, I used the peak current, 0.230 mA.

Power(W) = Voltage(V) * Current (A) Using the values we found, it becomes Power= 3.3V * 0.230A (230mA)= 0.759 watts

I did another one averaging the range of values I observed.

Average Current= (230+188)/2=209 Power= 3.3V * 0.209A= 0.690 watts


Overview

This week was a good opportunity to incorporate what I learned from previous PCB heavy weeks (electronics production and inputs) and it shows because the process went much more smoothly. I didn't even have to remill my PCB because it worked properly the first time and I was also able to solder it without issue.

For group, it was a nice application of what I learned in the fall semester in my school's electrical engineering elective course. I'm glad I learned how to use the multimeter beyond continuity. It did take a bit of time to remember how to move around the plugs to measure current. Calculating power was also a bit challenging because of how the current changed for my servo.


Files

Design:

Print:



Last update: May 5, 2025