Skip to content

10. Output Devices.

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.

Assignment Checklist.

item Activity Status
task 1 Linked to the group assignment page. DONE
task 2 Documented how you determined power consumption of an output device with your group. DONE
task 3 Documented what you learned from interfacing output device(s) to microcontroller and controlling the device(s) DONE
task 4 Linked to the board you made in a previous assignment or documented your design and fabrication process if you made a new board DONE
task 5 Explained the programming process/es you used. DONE
task 6 Explained any problems you encountered and how you fixed them. DONE
task 7 Included original source code and any new design files. DONE
task 8 Included a ‘hero shot’ of your board. DONE

Group Assignment

MEASURING EQUIPMENT AND INSTRUMENTS.

ADJUSTABLE SOURCE

Adjustable power supplies are devices capable of supplying electrical power to a circuit or component. Well, when we talk about an adjustable power supply, it is one in which the voltages can be adjusted within a certain range, and even the intensities. Depending on the need, for the example we will work with a UNI-T / UTP3315TFL source.

For a better understanding of the component, we will also attach the technical data sheet of the equipment.

MULTIMETER

Multimeters are measuring instruments that can measure quantities such as voltage, current and resistance. The measured values ​​are displayed on a digital screen, allowing them to be read easily and directly. There are various brands and models, for example we have a UNI-T / UT39C. X

WORKSTATION

DIRECT CURRENT TEST MOTORS

INDIVIDUAL ASSIGNMENT.

Within the individual task we will use an output device, subject to the programming within the development board made with the SEEED XIAO RP2040 board, let’s see the section and code that is loaded within it.

Code Example

Use the three backticks to separate code.

/* Sweep
 by BARRAGAN <http://barraganstudio.com>
 This example code is in the public domain.

 modified 8 Nov 2013
 by Scott Fitzgerald
 https://arduino.cc/en/Tutorial/Sweep
*/

#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position

void setup() {
  myservo.attach(5);  // attaches the servo on pin 5 to the servo object
}

void loop() {
  for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
}

0.96 inch OLED display.

For an output device, let’s take a 0.96 inch OLED display as an example, on which we will display text in different sizes, and with some scrolling games. We also use I2C communication, so be careful when programming, using the appropriate address.

In the following image I took of an OLED screen, you can see that it shows you the I2C link code with the option to change it for another one, simply by changing the soldering points.

Pin connection between Arduino NANO and 0.96 inch OLED display

Oled-Pin Arduino Nano Pin Conection
VCC 5V
GND GND
SDA A4
SCL A5

Connected Sensor

Sample code to display text on the screen.

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

// Dimensiones de la pantalla
#define ANCHO_DE_PANTALLA 128
#define ALTO_DE_PANTALLA 64

// Pin de reset (-1 si no se usa)
#define OLED_RESET -1

// Creación del objeto pantalla
Adafruit_SSD1306 display(ANCHO_DE_PANTALLA, ALTO_DE_PANTALLA, &Wire, OLED_RESET);

void setup() {
  // Inicializar pantalla OLED con dirección 0x3C
  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    for (;;); // Detener si no se encuentra
  }

  display.clearDisplay();

  // Texto tamaño 1 con scroll
  display.setTextColor(SSD1306_WHITE);
  display.setTextSize(1);
  display.setCursor(0, 0);
  display.println("Alcides Rios Quispe");
  display.display();


  // Activar scroll horizontal a la derecha
  display.startscrollright(0x00, 0x0F); // (línea inicial, línea final)

  delay(9000); // Pausa para que se vea el scroll antes de mostrar otros textos

  // Detener scroll
  display.stopscroll();

  // Texto tamaño 2 (fijo)
  display.setTextSize(2);
  display.setCursor(36, 18);
  display.println("FABLAB");

  // Texto tamaño 3 (fijo)
  display.setTextSize(2);
  display.setCursor(36, 39);
  display.println("UC-CUS");

  display.display();
}

void loop() {
  // Nada por ahora
}

Functional Operational Video

VIDEO

Pin connection Seeed XIAO RP2040 and 0.96 inch OLED display

BH1750-Pin XIOA RP2040 Pin Description
VCC 5 V Voltage
GND GND Ground
SDA D4 (GPIO6) I2C Comunication
SCL D5 (GPIO7) I2C Comunication

Connected Sensor

Sample code to display text on the screen.

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

// Dimensiones de la pantalla
#define ANCHO_DE_PANTALLA 128
#define ALTO_DE_PANTALLA 64

// Pin de reset (-1 si no se usa)
#define OLED_RESET -1

// Creación del objeto pantalla
Adafruit_SSD1306 display(ANCHO_DE_PANTALLA, ALTO_DE_PANTALLA, &Wire, OLED_RESET);

void setup() {
  // Inicializar I2C en pines de Seeed XIAO RP2040
  Wire.setSDA(6);
  Wire.setSCL(7);
  Wire.begin();

  // Inicializar pantalla OLED con dirección 0x3C
  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    for (;;); // Detener si no se encuentra
  }

  display.clearDisplay();

  // Texto tamaño 1 con scroll
  display.setTextColor(SSD1306_WHITE);
  display.setTextSize(1);
  display.setCursor(0, 0);
  display.println("Alcides Rios Quispe");
  display.display();

  // Activar scroll horizontal a la derecha
  display.startscrollright(0x00, 0x0F);

  delay(9000); // Tiempo de scroll

  // Detener scroll
  display.stopscroll();

  // Texto tamaño 2 (fijo)
  display.setTextSize(2);
  display.setCursor(36, 18);
  display.println("FABLAB");

  // Texto tamaño 2 (fijo)
  display.setTextSize(2);
  display.setCursor(36, 39);
  display.println("UC-CUS");

  display.display();
}

void loop() {
  // Nada por ahora
}

Functional Operational Video

VIDEO

LEARNING, FINDING AND LESSONS

I think my learning curve is installing the right libraries for using OLED displays; the most compatible ones are those from Adafruit.

Pay close attention to the I2C addresses because otherwise, the image, text, or whatever you want to display on the screen simply won’t be projected properly. This can even cause noise on the output device.

Finally, review the code we have written, looking for any errors, screen dimensions, and additional functions that can be provided.


Last update: August 13, 2025