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

Group Difficulties and Conclusions

Difficulties

  • We faced difficulties configuring the required libraries, which led to errors that required reinstallation and verification.
  • Incorrect initial connections between the joystick and OLED caused unstable or no response from the system.
  • Improper I2C configuration (SDA/SCL or missing pull-up resistors) affected communication with the OLED display.
  • After correcting connections, adjusting thresholds, and verifying communication, we achieved stable readings and smooth real-time interaction in the system.

Conclusions

In conclusion, the multimeter proved to be an essential tool for accurately measuring the power consumption of electronic devices. Through this analysis, we confirmed that the servo motor consumes more power than the LCD screen, due to its internal motor and mechanical movement, which require greater energy. Additionally, we verified that power consumption in idle conditions is lower compared to active operation, as devices demand more energy when performing their functions. This comparison highlights the importance of understanding energy requirements when designing and evaluating electronic systems.

Single image

group assignment

Individual Task

Individually, I conducted tests with sensors and simulations using a breadboard, the Wokwi platform, and a physical circuit board. This allowed me to validate the functionality of the components before their final implementation.

For the development of the circuit board, I attended the ESAN Fab Lab, where I was guided by Professor Jorge. This process presented a significant challenge, as we acquired knowledge about the operation of CNC machines from different perspectives each week.

On this occasion, we worked with the Carvera desktop CNC machine, which requires the use of additional software compared to other CNCs we had previously used. This necessitated a greater level of learning and adaptation.

For the circuit board design, I used a Silva Espinoza board as a base, since it contained components related to the final project I want to develop. From this base, I was able to customize the design according to my needs; however, achieving its correct adaptation and functionality also presented a challenge.

Single image

fairs for entrepreneurs and artisans.Fab Lab ESAN

Carvera CNC Machine

The CARVERA Maker is an advanced and intelligent desktop CNC machine designed to meet the demands of digital manufacturing in confined spaces. Despite its compact size, it offers a high level of precision, automation, and versatility, making it an ideal tool for designers, engineers, and machining enthusiasts.

It integrates innovative features such as automatic leveling, automatic tool change, a dust collection system, and the option to add a 4-axis module. Thanks to these features, CARVERA sets a new standard in desktop CNC machining.

One of its main advantages is the automatic tool change system along with the automatic probe function. With machines lacking these functionalities, the user must manually perform tool changes and calibration, which is tedious and time-consuming, especially for complex tasks like PCB manufacturing.

In contrast, CARVERA allows for the automated execution of multiple processes—such as leveling, cutting, cleaning, drilling, and engraving—selecting the appropriate tool at each stage. This not only optimizes working time, but also improves the accuracy and quality of the final result, allowing the user to focus primarily on the design.

Single image

Motherboard

Work began using the KiCad program, after verifying that all necessary libraries were correctly installed. The motherboard file was also opened for review, ensuring the FabLab library was properly incorporated.

From this motherboard, the required components were selected and adapted. First, the XIAO microcontroller was chosen, specifically the Xiao ESP32-C3 model. The footprints for each component were also verified, guaranteeing their compatibility with the design. Subsequently, the electronic schematic was updated.

During the schematic design, the various components, such as the DHT sensor and the OLED display, were placed and properly connected to the ESP32-C3. The microcontroller's technical specifications were consulted to ensure correct pin assignment and proper circuit operation.

Using a motherboard optimized the design process; however, it also required additional adjustments and validations to correctly integrate the new components into the existing circuit.

Single image Single image Single image

Gerber to PNG Conversion

Gerber2PNG is the process (or tool) that allows you to convert Gerber files into PNG images. This is very useful when you need to use PCB designs on CNC milling machines, such as in a Fab Lab.

What is it used for?

  • Converting the PCB design into an image that can be interpreted by machining software (such as mods)
  • Generating toolpaths
  • Quickly visualizing the design layers

Workflow

  1. Design the PCB in KiCad
  2. Export the Gerber files
  3. Use Gerber2PNG to convert to an image
  4. Import the PNG into mods or other software
  5. Machine the design on the CNC (e.g., Carvera)
Single image Single image

Mods configuration

After designing the board in KiCad, the Gerber file was exported and processed in Gerber2PNG to obtain the SVG file. This file was imported into Mods, where the color inversion function was used to generate an inverted version of the design. This step facilitated the visualization of the board, allowing for clearer identification of the components and connection paths.

Next, the parameters in the Mill Raster 2D settings were adjusted, and the corresponding calculations were performed to obtain the updated machining paths. Modifying these values allowed for refining the milling parameters, resulting in a more precise and efficient process.

These adjustments were applied to both the internal machining (tracks) and the external cutting of the board. This optimized the milling strategy according to the specific needs of the project, significantly improving the quality and accuracy of the final result.

Single image Single image Single image

Carvera Controller

First, open a web browser and go to the official Makera website. Then, locate the "Support" or "Downloads" section in the main menu. Within this section, search for the software called Carvera Controller.

Next, select the program version according to your computer's operating system (Windows or macOS) and click download. Once the file has downloaded, open the installer and follow the instructions to complete the installation.

Finally, run the Carvera Controller program to begin configuring and using your Carvera CNC machine.

Single image Single image Single image Single image Single image Single image

manufacturing of the plate on a Carvera CNC Machine

First, the board design is prepared in KiCad and the files are exported in Gerber format. These files are then converted to PNG or SVG using Gerber2PNG and processed in Mods to generate the machining toolpaths for both the internal traces and the external contour.

Next, the Carvera CNC machine is turned on and connected to the computer using the Carvera Controller software, ensuring it is properly calibrated.

The sacrificial bed is then positioned and checked, ensuring it is clean and level. The copper board (PCB) is placed on this surface and firmly secured with double-sided tape or clamps to prevent any movement during machining.

Then, the necessary milling tools are installed. The Carvera allows for automatic tool changes, so the tools are configured according to the type of work (internal traces and external cutting).

Next, the origin point is defined on the X, Y, and Z axes, either using the automatic probe or manually. This is essential to ensure the accuracy of the process.

Once everything is configured, the toolpath files are loaded into the software, and machining begins. First, the internal tracks are milled, followed by the external cutting of the plate.

Finally, the plate is carefully removed, the surface is cleaned, and the connections and cuts are verified to ensure a high-quality final result.

Single image

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

m/* ESP32C3 OLED DISPLAY 3V ------------- VCC GND ------------ GND SCL -------------- SCL (Bus I2C) SDA ------------- SDA (Bus I2C) ESP32C3 DHT11 3V ------------- 3V GND ------------ GND D6 ------------ Pin de Datos del DHT */ #include // DHT Library por Adafruit #include #include #include // Se corrigió la ortografía aquí // Pin donde está conectada la pantalla OLED. Para I2C, a veces se usa un reset imaginario. #define OLED_RESET -1 Adafruit_SSD1306 display(128, 64, &Wire, OLED_RESET); // Se especifican dimensiones y bus // Pin al que está conectado el sensor DHT11. const int DHTPIN = 21; // Especificar el tipo de sensor DHT. #define DHTTYPE DHT11 // Inicializar el sensor con el pin y tipo. DHT dht(DHTPIN, DHTTYPE); void setup() { Serial.begin(115200); // Iniciar comunicación serial para depurar. Wire.begin(); // Iniciar bus I2C (en ESP32C3 suele usar pines por defecto, verifica tu placa). // Iniciar pantalla OLED en dirección 0x3C (común para estas pantallas) if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { Serial.println(F("SSD1306 allocation failed")); for(;;); // Detener ejecución si no encuentra la pantalla } display.display(); delay(2000); display.clearDisplay(); dht.begin(); // Iniciar comunicación con DHT. Serial.println("Inicialización completa."); } void loop() { // El DHT11 es lento, esperar 2 segundos entre lecturas. delay(2000); // Leer valores. float humidity = dht.readHumidity(); // Leer temperatura en Celsius. float temperatureC = dht.readTemperature(); // Verificar si la lectura fue exitosa. 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; } // Mostrar datos en Monitor Serial para verificar Serial.print("Temp: "); Serial.print(temperatureC); Serial.print("°C | Hum: "); Serial.print(humidity); Serial.println("%"); // Mostrar datos en pantalla OLED display.clearDisplay(); display.setTextSize(1); display.setTextColor(WHITE); display.setCursor(10, 0); // Ajusté un poco el cursor display.println("FabLab Itinerante"); // Actualicé año, o bórralo si prefieres. display.setTextSize(2); // Texto más grande para los datos display.setCursor(0, 20); String tempValue = String(temperatureC, 1); // 1 decimal display.println("T:" + tempValue + " C"); display.setCursor(0, 45); String humValue = String(humidity, 1); // 1 decimal display.println("H:" + humValue + " %"); display.display();

Programming

ESP32-C3 PCB Control System OLED + Joystick

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, utilizing the microcontroller's SDA and SCL pins, which allows for efficient data transmission to the display. Through graphics libraries, the system interprets the joystick signals and updates the visual information on the screen in real time, such as positions, states, or game graphics, thus achieving dynamic interaction between the user and the embedded system implemented on the PCB.

Single image

Arduino code

Código Snake con 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...)

reflections

During the process, special attention had to be paid to the environment configuration and libraries, as errors arose in some cases that required reinstalling and verifying system components. Despite these difficulties, the device was successfully programmed and its operation customized to the project requirements, although this involved additional tuning and testing time. Connection Configuration: The physical connection of the components, including the ESP32-C3, the OLED display, and the DHT11 sensor, is detailed in the code comments section. The pins assigned to each device are specified, ensuring proper system integration. Library Inclusion: The libraries necessary for the program's operation are included, such as the DHT.h library for the DHT11 sensor and the corresponding libraries for controlling the OLED display, enabling the correct visualization of data and graphics. Additionally, the implementation of the OLED display along with the joystick allowed for the development of an interactive interface, as demonstrated in the creation of a Snake-like game. This development involved not only the real-time visualization of elements but also the accurate interpretation of analog joystick signals to control movement within the graphical environment. This integration presented a significant challenge, as it required optimizing I2C communication, adjusting the screen refresh rate, and preventing erratic joystick readings. As a result, a seamless interaction between the user and the system was achieved, demonstrating the potential of the PCB designed for more complex and interactive applications.

test on a breadboard

A breadboard test was conducted to practice circuit assembly and, simultaneously, verify the correct operation of the sensors before their implementation on the final board.

For this test, the XIAO ESP32-C3 microcontroller was used along with various sensors, including a DHT11 for measuring temperature and humidity, and an LDR sensor for detecting light levels.

During the tests, the system's behavior was evaluated under different environmental conditions. Measurements were taken both indoors and outdoors, allowing for the observation of real-world variations in ambient temperature and humidity. Similarly, the LDR sensor responded correctly to changes in lighting, registering different values in the presence of bright light and in low-light conditions.

These breadboard tests were essential for validating the connections, verifying system stability, and detecting potential errors before board fabrication. Furthermore, they provided a better understanding of the sensors' behavior in real-world situations, facilitating the subsequent integration and optimization of the project.

Single image Single image Single image

Video (local)

Reflection

Developing the project using a breadboard, simulation in Wokwi, and the fabrication of the circuit board allowed for a comprehensive understanding of the electronic design process, from the initial idea to its physical implementation.

The use of the breadboard was fundamental for performing quick tests and validating connections in a real-world environment, allowing for the practical identification of errors before moving on to more advanced stages. It also allowed for the addition and testing of various sensors, which is directly related to my final project, facilitating experimentation with different configurations and components.

On the other hand, the simulation in Wokwi facilitated risk-free experimentation, helping to test the code, integrate components, and understand the system's behavior without the need for physical hardware. This allowed for multiple tests and adjustments to be performed quickly and efficiently.

Finally, the design and fabrication of the circuit board represented the most demanding stage, as it required greater precision, planning, and technical knowledge. This phase allowed for the consolidation of everything learned, integrating both electronic design and the manufacturing process.

Together, these tools and methodologies complement each other: simulation allows for anticipating errors, the breadboard validates functionality in practice, and the final board brings the project to life. This process not only strengthened technical skills but also problem-solving abilities and adaptability to difficulties, resulting in a functional and customized product aligned with the final project objectives.

Downloads