9. Output Devices - Evan Park and Kabir Nawaz¶
Measuring Power Consumption¶
This week’s group assignment was to measure the power consumption of an output device.
We decided to measure the power consumption of a servo. To do this, we ran the servo off an ATTiny412 with code to sweep the servo from 0º-180º across the valid positions:
This was our code:
#include <Servo_megaTinyCore.h>
Servo servo;
#define delay_between_write 15
#define pause_time 0
#define write_change 2
#define servo_pin PIN_PA1
void setup() {
servo.attach(servo_pin);
}
void loop() {
for (int deg = 180; deg >= 0; servo.write( write_change+(deg-=write_change))) delay(delay_between_write);
delay(pause_time);
for (int deg = 0; deg <= 180; servo.write(-write_change+(deg+=write_change))) delay(delay_between_write);
delay(pause_time);
}
To actually use the multimeter, we first had to set the dial to Amps, make sure it was set to measure DC current, and then move the red probe to the correct (top left) port on the multimeter.
The probes had to go in between the jumper wires here such that all the current for the servo was passing through the multimeter, in order to ensure that it could be measured accurately:
This was the multimeter display:
The multimeter did not stay at a stable amperage but instead varied between 0.07 A to 0.08 A; this was likely due to the acceleration and deceleration of the servo during the moments in which the servo was changing movement directions. On average, though, the multimeter measured 0.074 A of current.
For voltage, we put the multimeter to the voltage measurement mode, put the red probe in the correct position, and touched one probe to the +5V pin and the other probe to the ground pin. Unlike the procedures for measuring amperage, the current does not have to flow through the multimeter, so the circuit remains connected even without the multimeter. We measured a voltage of 5.001 V with very slight variance; this 5V source comes from the voltage coming out from the computer USB port through which the ATTiny412 was getting its power.
Calculating Power¶
Since watts are defined as volts times amps, with the voltage and amperage, we can calculate the power drawn by the servo.
0.074 A * 5.001 V = 0.37 W
Note that this servo was being run at an approximate speed of 133 deg/sec, based on the delays set up in the code; the power consumption would likely vary if the servo was run at a different speed. This random datasheet we found online for the servo model claims that the servo has an operating speed of “0.1 s/60 degree”; this implies a maximum speed of 600 degrees/sec (ignoring the effects of acceleration and deceleration)