Week 10

Output devices

Learning outcomes

  • Demonstrate workflows used in controlling an output device(s) with MCU board you have designed
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

  • Measure something: add a sensor to a microcontroller board that you have designed and read it

Progress status

Group work Done

Test an output device and measure power consumption

Individual work In progress

Measure the power consumption of an output device

Documentation Done

Upload source files

1) Introduction

Closing gaps

  • Learn about output devices
  • Interact more with Arduino IDE
  • Discuss the group project
  • Develop the individual project
Step right image

2) Group assignment 1 - Test an output device

For more details visit Fab Lab Peru - Group Assignment: https://fabacademy.org/2026/labs/lima/#page-top


Problems

Designed microcontroller board doesn't work

Review connections

Step 1 - Protoboard

Mesasure something with the microcontroller RP2040

Running 1
Reviewing output devices on lab
Running 2
Reviewing other projects
Running 3
Testing cables
Running 4
Connection with screen - download RP 2040 libraries
Swimming 2
Arduino Ide Code
Swimming 2
Uploading code to the Xiao RP 2040
Camera 1
Uploading code to the Xiao RP 2040
// Programming LCD + I2Cing three TCRT5000L reflective optical sensor
                       // Board: Seeed Studio XIAO RP 2040

                #include  
                #include 

                // Set the LCD address to 0x27 for a 16 chars and 2 line display
                // If 0x27 doesn't work, try 0x3F. You may need an I2C scanner.
                LiquidCrystal_I2C lcd(0x27, 16, 2); 

                void setup() {
                  Wire.setSDA(D4); //D4
                  Wire.setSCL(D5); //D5
                  // Initialize the I2C bus
                   Wire.begin(); 
                  
                  // Initialize the LCD screen
                  lcd.init();

                  // Turn on the backlight
                  lcd.backlight();
                  
                  // Set the cursor to column 0, row 0 (0-indexed)
                  lcd.setCursor(0, 0);
                  // Print a message to the LCD.
                  lcd.print("Fab Academy");
                  
                  // Set the cursor to column 0, row 1
                  lcd.setCursor(0, 1);
                  lcd.print("Fab Academy Peru");
                }

                void loop() {
                  // Main loop is empty, display updates once in setup
          }

            
Camera 1
Connecting multimeter
Camera 1
Measuring voltage
Camera 1
Measuring voltage and changing resistance
Camera 1
Multimeter in use
Video demonstration

Project - LM 393 Photosensitive light dependent resistor (LDR)

4) Individual assigment

Problems

Designed microcontroller board doesn't work

Posible solution - make a new board

Step 1 - Protoboard

Mesasure something with the microcontroller Xiao ESP32 C3

Step 2 - Repeat with a new board

Measure and test devices using a multimeter or an oscilloscope

Swimming 2
Considering last week's assignment - input: test with three sensors: left - center - right
Camera 1
Connections at Xiao ESP 32 C3 using the protoboard
// Using three TCRT5000L reflective optical sensor
            // Input devices 
            // Board: Seeed Studio XIAO ESP 32 C3

              #define sensor1 D6   // cambia al GPIO/pin que uses
              #define sensor2 D5   // cambia al GPIO/pin que uses
              #define sensor3 D4   // cambia al GPIO/pin que uses

              void setup() {
                  Serial.begin(115200);
                  pinMode(sensor1, INPUT);  
                  pinMode(sensor2, INPUT);  
                  pinMode(sensor3, INPUT);  
              }

              void loop() {
                  int val1 = digitalRead(sensor1);
                  int val2 = digitalRead(sensor2);
                  int val3 = digitalRead(sensor3);
            
              if(val1==1){
                  Serial.println("izquierda");
                  }
              else if(val2==1){
                  Serial.println("centro");
               }
              else if(val3==1){
                   Serial.println("derecha");
              }
              else{
                    Serial.println("error");
              }
              delay(100);
              }

            
Camera 2
Testing devices
Camera 1
Using three TCRT5000L reflective optical sensor & buzzer output
// Using three TCRT5000L reflective optical sensor & buzzer - Center or not
              // Input devices 
              // Board: Seeed Studio XIAO ESP 32 C3

              #define sensor1 D6   // cambia al GPIO/pin que uses
              #define sensor2 D5   // cambia al GPIO/pin que uses
              #define sensor3 D4   // cambia al GPIO/pin que uses


              void setup() {
                  Serial.begin(115200);
                  pinMode(sensor1, INPUT);  
                  pinMode(sensor2, INPUT);  
                  pinMode(sensor3, INPUT);  
                  pinMode(D3, OUTPUT);
              }

              void loop() {
                int val1 = digitalRead(sensor1);
                int val2 = digitalRead(sensor2);
                int val3 = digitalRead(sensor3);
                if(val1==1){
                  Serial.println("izquierda");
                    digitalWrite (D3, HIGH);
                    delayMicroseconds (5000);
                    digitalWrite (D3, LOW);
                    delayMicroseconds (100000);
                }
                else if(val2==1){
                  Serial.println("centro");
                }
                else if(val3==1){
                  Serial.println("derecha");
                    digitalWrite (D3, HIGH);
                    delayMicroseconds (5000);
                    digitalWrite (D3, LOW);
                    delayMicroseconds (100000);
                }
                else{
                  Serial.println("error");
                    digitalWrite (D3, HIGH);
                    delayMicroseconds (5000);
                    digitalWrite (D3, LOW);
                    delayMicroseconds (100000);
                }
                delay(100);
              }
            
Camera 1
Step 2 - Repeat with PCB and testing using voltimeter and an oscilloscoper

5) Final project advance

Devices

GP2Y0A21YK0F Sharp, infrared distance sensor, 10-80 cm

GP2Y0A02YK0F Sharp, infrared distance sensor, 20-150 cm

2Y0A710K Sharp, infrared distance sensor, 100 a 550cm

Camera 1
Sharp, line detector, screen
Camera 2
Grove- Vision AI Module V2, camera and signal sensort

6) Final results

7) References files

We learn how to design, make and test a PCB with sensor. Files: in each section

Sections