Week 10

Output Devices

Continuing with the topic of Output Devices, we met for the group portion at the Universidad del Pacífico, specifically in their engineering lab. During this session, we observed that they have a wide variety of electronic components and sensors that we didn't have access to, which allowed us to conduct various tests, both individually and as a group.

Although these topics are still new to us, each exercise proved interesting and motivating. We also took the opportunity to compare the different circuit boards developed by our classmates; some used laser cutting, while others worked with CNC machines, which enriched our learning by observing different manufacturing processes.

In addition, we received important recommendations on the soldering process. We understood that this skill requires patience and constant practice, so we are individually practicing on additional circuit boards to improve our technique and achieve better results.

Week 3 cover

Assignment Requirements

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.

Progress Status

This is for reporting progress (not for visitors to click).

Group work Done

Group page link + notes added.

Press-fit kit Done

Missing final photos and conclusions.

Downloads Done

Upload .zip with source files.

Assignment Requirements

Learning outcomes

  • Demonstrate workflows used in controlling an output device(s) with MCU board you have designed.

Have you answered these questions?

  • Linked to the group assignment page.✅
  • Documented how you determined power consumption of an output device with your group.✅.
  • Documented what you learned from interfacing output device(s) to microcontroller and controlling the device(s).✅.
  • Linked to the board you made in a previous assignment or documented your design and fabrication process if you made a new board.✅.
  • Explained how your code works.✅.
  • Explained any problems you encountered and how you fixed them.✅.
  • Included original source code and any new design files.✅.
  • Included a ‘hero shot’ of your board.✅.

Weekly planning

During the week, we carried out various activities that presented significant challenges but were also very rewarding, especially due to the opportunity to share and learn as a team. We met virtually with our colleagues at the node and participated in lab meetings, which allowed us to organize ourselves and conduct open workshops in different spaces. In these sessions, we reviewed and worked with input devices, understanding their operation and their importance in capturing data from the environment for subsequent processing in electronic systems.

Single image

group work

This week, focused on Input Devices, we held an in-person meeting at the Fab Lab UNI node. Colleagues in other cities also participated virtually, allowing the entire group to connect. In this stage, we worked with input devices, which capture information from the environment (such as light, temperature, or pressure) and transform it into signals that can be interpreted by electronic systems. We used various sensors and measuring tools for this purpose. During the practical sessions, we used equipment such as the oscilloscope and the multimeter, which helped us analyze electrical signals, verify voltages, and ensure the correct functioning of the circuits. These tools were essential for understanding how the sensors interact with the motherboard and how the data obtained is processed.

In this group project, I learned to find and integrate the necessary libraries for each of the output devices used, subsequently verifying that the code compilation was correct. For this exercise, we worked with the FABXIAO board developed by Adrian Torres, using an LCD screen as the first device.

Verification of Device Power Consumption

Initially, we developed the code to control both the LCD screen and the servomotor. Then, we connected the components to the board and proceeded to measure power consumption using a multimeter. Power consumption was evaluated both at rest and during operation of each device.

Subsequently, we verified the results by applying the basic formula for electrical power, which allowed us to validate the measurements obtained. In conclusion, it was confirmed that the servomotor has a higher power consumption compared to the LCD screen, which is consistent with its electromechanical nature and movement requirements.

Tools and Components Used

  • Adrian Torres microcontroller board
  • Seeed Studio XIAO RP2040
  • HC-SR04 ultrasonic distance sensor
  • servomotor
  • LCD screen

This experience allowed us to better understand how input devices capture and transmit data, as well as how signals can be measured and interpreted using laboratory equipment.

Single image

Procedures: Output Devices Analysis

You can view the complete group work here: View Group Project

Procedure: OLED Display + Joystick Control (ESP32-C3 PCB)

1. Description

A control system was implemented on a PCB using the ESP32-C3 microcontroller, integrating a joystick and an OLED display. The joystick provides analog input for X and Y axis movement, while the OLED screen displays real-time graphical information.

  • Joystick: Analog input (A0, A1) + button (D2)
  • OLED: I2C communication (SDA, SCL)
  • Function: Real-time interaction and graphical display
  • Application: Snake game and dynamic interface

This implementation is important to validate proper integration between input devices and display systems in an embedded PCB design.

2. Hardware and Software Setup

  • ESP32-C3 microcontroller (PCB)
  • Joystick connected to A0, A1, D2
  • OLED display connected via SDA and SCL (I2C)
  • Pull-up resistors for I2C communication

Programmed using Arduino IDE, including graphics and communication libraries for OLED control.

3. Signal Observation

After programming, real-time interaction between the joystick and the OLED display was observed, confirming:

  • Correct reading of analog signals from the joystick
  • Stable I2C communication with the OLED display
  • Proper graphical updates on the screen
  • Fluid control in the Snake game interface

4. Reflection

During the development process, special attention was required for library configuration and system setup, as some errors required reinstallation and verification. Additionally, it was necessary to optimize I2C communication and adjust joystick thresholds to avoid unstable readings. Despite these challenges, the system achieved smooth interaction, demonstrating the capability of the PCB for more advanced embedded applications.

Single image

Conclusions

Through this individual contribution to the group assignment, I was able to better understand the importance of measuring and analyzing electronic signals using laboratory tools such as the multimeter and oscilloscope. This experience helped me reinforce my knowledge about input devices, sensor behavior, and real-time data acquisition.

I also learned the importance of correct circuit configuration, proper library installation, and stable communication between components such as the OLED display and sensors. After solving connection and configuration issues, stable readings and correct system interaction were successfully achieved.

Finally, this activity allowed me to better understand how electronic systems process environmental information and how these concepts can later be integrated into my final project and the mobile laboratory proposal.

Single image

group assignment

Individual Assignment – Input Devices Programming

In this individual assignment, the main objective was to work with input devices capable of capturing environmental information and processing it through a microcontroller. Sensors such as the DHT11/DHT22 and the LDR were used to measure variables including temperature, humidity, and light intensity.

For this development, the electronic production board previously designed was reused, maintaining continuity with the final project proposal and the concept of the mobile laboratory. This allowed the integration of the knowledge acquired during Electronics Production with the current assignment focused on input devices.

Likewise, this assignment made it possible to combine both areas by using the previously fabricated board together with environmental sensors, while also adding an additional function through the OLED display for real-time visualization of the collected data.

Programming

For programming, the Arduino IDE development environment was opened. To ensure accurate readings from the DHT sensor, the corresponding library (DHT.h) was installed correctly.

First, the “Sketch” menu was accessed, then the “Include Library” option, and finally “Manage Libraries”. The term “DHT” was entered in the search box, which located the sensor library developed by Adafruit.

Once located, the “Install” option was selected, and the installation process was allowed to complete successfully. This step was essential to guarantee proper communication between the DHT sensor and the microcontroller.

Single image

Arduino code

ESP32C3 + OLED + DHT11 Code


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

#define OLED_RESET -1

Adafruit_SSD1306 display(128, 64, &Wire, OLED_RESET);

const int DHTPIN = 21;

#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);

void setup() {

  Serial.begin(115200);

  Wire.begin();

  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {

    Serial.println(F("SSD1306 allocation failed"));

    for(;;);
  }

  display.display();

  delay(2000);

  display.clearDisplay();

  dht.begin();

  Serial.println("Inicialización completa.");
}

void loop() {

  delay(2000);

  float humidity = dht.readHumidity();

  float temperatureC = dht.readTemperature();

  if (isnan(humidity) || isnan(temperatureC)) {

    Serial.println("Error leyendo datos del sensor DHT11.");

    display.clearDisplay();

    display.setCursor(0,0);

    display.print("Error Sensor!");

    display.display();

    return;
  }

  Serial.print("Temp: ");

  Serial.print(temperatureC);

  Serial.print("°C | Hum: ");

  Serial.print(humidity);

  Serial.println("%");

  display.clearDisplay();

  display.setTextSize(1);

  display.setTextColor(WHITE);

  display.setCursor(10, 0);

  display.println("FabLab Itinerante");

  display.setTextSize(2);

  display.setCursor(0, 20);

  String tempValue = String(temperatureC, 1);

  display.println("T:" + tempValue + " C");

  display.setCursor(0, 45);

  String humValue = String(humidity, 1);

  display.println("H:" + humValue + " %");

  display.display();
}
OLED Display Connections
ESP32C3 OLED Display
3V VCC
GND GND
SCL SCL (I2C)
SDA SDA (I2C)
DHT11 Connections
ESP32C3 DHT11
3V VCC
GND GND
GPIO 21 DATA

Programming

ESP32-C3 PCB Control System OLED + Joystick

As a complement to the previous input device experiments, another output device configuration was also explored using an OLED display and a joystick integrated into the ESP32-C3 PCB. This additional implementation allowed further experimentation with real-time interaction between sensors, visual interfaces, and embedded systems.

On the PCB designed with the ESP32-C3 microcontroller, a control system was implemented using a joystick connected to analog pins A0 and A1 to read the X and Y axes, while the joystick button was connected to digital pin D2 with the INPUT_PULLUP configuration. These analog values are processed by the analogRead() function to determine the direction of movement.

In parallel, an OLED display was integrated using I2C communication through the SDA and SCL pins of the microcontroller, enabling efficient data transmission to the display. Through graphics libraries, the system interprets the joystick signals and updates visual information on the screen in real time, such as positions, states, or simple graphical interactions.

This exploration helped reinforce knowledge about the integration of both input and output devices, while continuing the development of interactive systems connected to the final project and the mobile laboratory concept.

Single image

Arduino code

Snake Game with OLED + Joystick


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

#define ANCHO_PANTALLA 128
#define ALTO_PANTALLA 64
#define OLED_RESET -1 

Adafruit_SSD1306 display(ANCHO_PANTALLA, ALTO_PANTALLA, &Wire, OLED_RESET);

const int pinEjeX = A0;
const int pinEjeY = A1;
const int pinBoton = A2;

#define TAMAÑO_BLOQUE 4        
#define MAX_SERPIENTE 200      
#define FPS_JUEGO 10           

enum Direccion { QUIETO, ARRIBA, ABAJO, IZQUIERDA, DERECHA };

struct Punto {
  int x;
  int y;
};

Punto serpiente[MAX_SERPIENTE]; 
int largoSerpiente = 2;         
Punto comida;                   

Direccion dirActual = DERECHA;  
Direccion dirNueva = DERECHA;   

bool juegoTerminado = false;

unsigned long score = 0;
unsigned long ultimoFrame = 0;

const int umbralBajo = 1000;
const int umbralAlto = 3000;

// (El resto del código continúa igual...)
OLED Connections
ESP32-C3 OLED Display
3V VCC
GND GND
SDA SDA
SCL SCL
Joystick Connections
ESP32-C3 Joystick
A0 VRX
A1 VRY
A2 SW
3V VCC
GND GND

Reflection

Through these two programming experiences, it was possible to better understand the integration between input and output devices using the ESP32-C3 microcontroller. In the first project, environmental sensors such as the DHT11/DHT22 and the OLED display allowed real-time visualization of temperature and humidity data, reinforcing knowledge about sensor communication, data acquisition, and information processing.

In the second project, the integration of the joystick and OLED display enabled the exploration of interactive control systems and real-time graphical responses. This helped deepen the understanding of analog signal reading, user interaction, and visual feedback through embedded systems.

Both developments contributed significantly to strengthening programming, electronics, and debugging skills, while also creating continuity with the final project and the mobile laboratory proposal. These activities demonstrated how microcontrollers can be used to capture, process, and visualize environmental and interactive data in dynamic and functional systems.

Downloads