Skip to content

Week 10: Output Devices

Week 10 assignment is to measure the power consumption of an output device. For this assignment we are using a PCB that Noel made this week.

NoelBoard

This is how a servo should be connected:

ServoPinouts

Setup and Equipment Used

  • MG90S Servo Motor
  • Power Supply
  • PCB made by Noel (should have pinouts for Servos)

Programming the Servo Motor

  1. The servo is programmed to the servo sweep code in Arduino IDE.

ServoProg

#include <ESP32Servo.h>
Servo myServo;

#define PULSEMIN 500
#define PULSEMAX 2500
int pos = 0;
int sPin = 44;

void setup(){
  Serial.begin(9600);
  pinMode (sPin, OUTPUT);
  ESP32PWM::allocateTimer(0);
  myServo.attach (sPin, PULSEMIN, PULSEMAX);
}

void loop (){
  // // //To caibrate
  // myServo.write(pos);
  // Serial.print("Servo position: ");
  // Serial.println(pos);

  // To sweep
  for (pos=0; pos<=180; pos+=1){
    myServo.write(pos);
    Serial.print("Servo position: ");
    Serial.println(pos);
    delay(50);

  }

  // delay(1000); //Stops for a second after reaching 180 degree

  for (pos=180; pos>=0; pos-=1) {
    myServo.write(pos);
    Serial.print("Servo position: ");
    Serial.println(pos);
    delay(50); 
  }

  // delay(1000); //Stops for a second after reaching 0 degree

}

Checking the power consumption of the servo motor

Test Setup

  1. The PCB was connected to the Bench Power supply after uploading the servo sweep program.

  2. We set the voltage at 5V, max current is set at 0.5A

  3. We press On/Off to power the PCB and observe the readings.

Bench Top Power Supply

PoweSupplySetup

Make sure to provide (+) to VCC and connect (-) to GND by verifying with your PCB design.

PowerConnections PCBPinout

Output

As you can see the servo draws a maximum of ~0.3A at 5V PCBPinout

The SG90 servo draws a maximum power of $1.5 W$.

Conclusion

This week we learnt to calculate power consumption of electronic devices using a bench power supply.


Last update: April 2, 2025