Week 09

Input devices

Learning outcomes

  • Demonstrate workflows used in sensing something with input device(s) and MCU board
Week 3 cover

Assignment requirements

Group assignment

  • Test an input device(s)'s analog levels and digital signals (As a minimum, you should demonstrate the use of a multimeter and an oscilloscope
  • 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 input device analog levels and digital signals

Individual work In progress

Add a sensor to a microcontroller board that you have designed and read it

Documentation Done

Upload source files.

1) Introduction

Closing gaps

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

2) Group assignment 1 - Test an input devices (analog & digital)

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


Project - Ultrasonic Sensor - Digital
Ultrasonic Sensor HC-SR04
Group Assignment - Input Devices (Analog & Digital)
Project idea
  • Ultrasonic HC-SR04 sensor module
  • Measures distance using sound waves
  • Includes transmitter and receiver
  • Range: 2 cm to 500 cm
  • Pins: Vcc, Trig, Echo, GND
Video demonstration

3) Group assignment 2 - Test an input devices (analog & digital)

More information at Fab Lab Peru - Group Assignment: https://fabacademy.org/2026/labs/lima/#page-top

Project - LM 393 Photosensitive light dependent resistor (LDR)
LM 393 Photosentitve light dependent resistor (LDR)
Group Assignment - Input Devices (Analog & Digital)
Project idea
  • Distance detection
  • Driving ability - 15mA with adjustable potentiometer
  • Brightness - Adjustable
  • Detect - brightness and light intensity
  • Analog and digital output
Video demonstration

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

Running 1
Reviewing the Xiao ECP32 C3, technical specitications and connections
This Wiki was useful https://wiki.seeedstudio.com/xiao_esp32s3_getting_started/
Running 2
Select the TCRT5000L reflective optical sensor
Emitter Wavelength: 950 nm - infrared
Running 3
Xiao ECP 32 C3 Connections
Running 4
New installation - download ECP 32 C3 libraries
// TCRT5000L reflective optical sensor
            // Input devices 
            // Board: Seeed Studio XIAO ECP 32 C3

            #define sensor = D6;   // cambia al GPIO/pin que uses

            void setup() {
                  Serial.begin(115200);
                  pinMode(sensor, INPUT);   
            }

            void loop() {
                  int val = digitalRead(sensor);
                  Serial.println(val);
                  delay(100);
              }
          
Swimming 2
Serial Monitor - Light and dark
Swimming 2
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 - Center or not
// 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

Running

Explore devices

Found more band for runners

Swimming

Explore an olympic pool

Devices

Grove Vision AI V2-HX6538 Processor

Camera CSI OV5647

Color and gesture sensor - RGB GY-9960-3.3 APDS-9960

Running 1
Band uses
Running 2
Band
Running 3
Band types
Running 4
Band view
Swimming 2
Pool lines & lanes
Swimming 2
Pool lines & lanes
Camera 1
Grove Vision AI V2-HX6538 Processor, Xiao ESP 32 C3, Camera
Camera 2
Testing devices

6) Final results

7) References files

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

Sections