Skip to content

9. Output Devices

This week we had to:

  • Measure the power consumption of the output device.

To measure power consumption we will use 3 methods:

  • DC power supply
  • multimeter
  • a diagram created by Onik Babajanyan (which we will tell you more about a little later)

Power supply

Power supply is a universal tool to generate DC power (DC stands for direct current), set current limits, tresholds and measure power consumtion for projects that require no more than 30 Volts and 3Amps max. The Power supply we have is: Instek GPD-3303D it has 2 controlled channels 0-30V and one fixed with tis options 2.5V/3.3V/5V/3A. We mainly use the controlled channels.

At the back of the device we have the input voltage options: instek back As you can see we use 220V that’s our countries standard voltage. We are going to measure power consumtion of several DC motors and a led strip. We need to connect DC motor to power supply the polarity doesn’t matter since the only difference is the direction of rotation.

Multimeter

When working with a multimeter, there are two options for connecting wires. Since when measuring voltage or resistance you need to connect probes parralel to the pins and in case of current, you need to connect the device in series, so usually the red cable must be switched into the appropriate slot. The black probe or the (-) always goes to the “COM” slot.

Multimeter

The red one goes to different ones depending what we are measuring.

Multimeter

Connecting the motor to the Power supply

As part of a group assignment, we looked at a small DC motor designed for 12 Volts:

dc-motor

We connected the motor to the Power supply, giving a charge of 5 Volts and 0.5 Amps.

The motor was spinning, and the energy consumption was 5 Volts and 40 miAmps.

Power supply

Then we connected an ammeter in series with the motor and observed the increase in current as we applied load (by using our fingers):

Constructing an Electrical Circuit for Current Measurement

Onik Babajanyan decided to demonstrate the creation of an electrical circuit to measure current.

Building the Circuit in LTspice

To accurately represent the circuit’s operation, let’s construct it in the program LTspice.

LTspice-1

We have a power source V1 that provides 5 Volts, which can fluctuate by 0.2 Volts, meaning the supply ranges from 4.8 Volts to 5.2 Volts. The power source operates at 1 kHz.

LTspice-2

In LTspice, we replaced the DC motor with a resistor R5 of 90 Ohms.

LTspice-3

We want the motor to be controllable, meaning we can control its rotation programmatically using a microcontroller.

To achieve programmatic control of the DC motor, we added a pnp transistor Q2. We chose the (BC557B)[https://www.tme.eu/en/details/bc557c-dio/pnp-tht-transistors/diotec-semiconductor/bc557c/] transistor.

LTspice-4

The logic with the transistor is as follows: if there is no voltage applied to the transistor’s base pin and a resistor R3 is connected to it, one side of which is connected to the power source V2. V2 simulates the Output pin of an Arduino UNO board. If it is on, it supplies voltage; if off, current can flow through it, which opens the pnp transistor.

LTspice-5

Next, we connected a resistor R1 with a low resistance of 1.8 Ohms in series with the imaginary motor to ensure the voltage drop in this section is not 0 Volts.

Then, we connected a resistor R2 with a resistance of 220 Ohms in parallel with the transistor R1, to which a capacitor C1 with a capacitance of 47 microfarads is connected in series for voltage stabilization.

LTspice-6

The circuit is ready. The logic is that there is a voltage between the transistor R2 and the capacitor C1. In LTspice, we can measure this with a multimeter. In the future, we will connect a PIN configured as OUTPUT to this point to read the voltage drop in this section of the circuit.

Once the circuit is ready, by clicking the Run button, we can take measurements.

Let’s measure the value between R5 and R1. The graph will show that the values are distorted.

LTspice-7

Let’s measure the values between R2 and C1 (blue graph), and then overlay it on the graph of R5 and R1 (green graph). The graph will show that the capacitor smooths out the values.

LTspice-8

We can conclude that the circuit with the capacitor is more accurate for measurements.

Building a Circuit Based on Arduino UNO

Onik Babajanyan also assembled a circuit to demonstrate its operation in real conditions.

arduino-1

The essence of the circuit is to detect when the motor encounters resistance and to stop the motor using a microcontroller. This principle can be applied, for example, in elevator systems.

When the motor encounters resistance, the current increases. Since R1, R2, and C1 are connected in series with the motor, the current will also increase in this part of the circuit when the motor is under load.

If the current increases while the resistance remains the same, the voltage must increase according to the formula:

U = IR

First, Onik wrote the following code to read the voltage values and output them to the Serial Monitor:

int motor = 2;
int sensor = A0;

void setup() {
  Serial.begin(115200);
  pinMode(motor, OUTPUT);
  pinMode(sensor, INPUT);
  digitalWrite(motor, 0);
  delay(1000);
}

void loop() {
  int var = analogRead(sensor);
  Serial.println(var);
  delay(100);
}

The analog pin can output values from 0 to 1023. A value of 0 corresponds to 0 Volts, and a value of 1023 corresponds to 5 Volts. Therefore, we can convert the values from the analog pin to volts by applying a coefficient of 0.0048.

Then, after understanding the values we are dealing with, the following code logic was written:

int motor = 2;
int sensor = A0;

void setup() {
  Serial.begin(115200);
  pinMode(motor, OUTPUT);
  pinMode(sensor, INPUT);
  digitalWrite(motor, 0);
  delay(1000);
}

void loop() {
  int var = analogRead(sensor);
  Serial.println(var);
  if (var > 23) {
    digitalWrite(motor, 0);
    delay(5000);
  }
  delay(100);
}

When turned on, the motor starts to rotate. Since the motor consumes a lot of power at startup, the measurement should begin a bit later (delay(1000);). We wrote a condition that if var > 23, the motor stops for 5 seconds.


Last update: June 15, 2024