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
Test an output device and measure power consumption
Measure the power consumption of an output device
Upload source files
1) Introduction
Closing gaps
- Learn about output devices
- Interact more with Arduino IDE
- Discuss the group project
- Develop the individual project
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
// 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
}
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
// 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);
}
// 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);
}
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
6) Final results
- 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
- Linked to the board you made in a previous assigment or documented your design and fabrication
- Explain how your code works
- Explained any problems you encountered and how you fixed them
- Include original source code and any design files
- Included a 'hero shot' of your board
7) References files
We learn how to design, make and test a PCB with sensor. Files: in each section