FAB ACADEMY 2026

WEEK 09

Input Devices

Group assignment:

What I Learned From Teamwork

Work in progress Week 08

Using Arduino IDE - Serial Monitor / Serial Plotter

For this test, we used Arduino IDE to monitor and plot sensor data in real time. To do this, we generated test code with Gemini AI for the sensors used, specifically the LDR module and the ultrasonic proximity sensor that supported this assignment.

Work in progress Week 01

Checking digital and analog signals with a multimeter and oscilloscope

By running tests with the portable DSO510 oscilloscope and a multimeter, I was able to verify the dual nature of the signals: while the multimeter confirms a stable and proportional 3.3V voltage on the LDR module as ambient light changes, the oscilloscope allows you to "freeze" and measure the critical Trigger and Echo pulses from the ultrasonic sensor, which occur too quickly for a conventional meter. This technical validation ensures that your XIAO analog inputs receive safe voltage levels and that digital signals keep the integrity required for your code to calculate distances with millimetric precision.

Work in progress Week 09
Work in progress Week 09

Conclusion

In conclusion, the multimeter and oscilloscope are complementary tools that let you "see" what code does not always reveal: while the multimeter is ideal for measuring stable voltages and verifying that the 3.3V from your XIAO reaches the LDR module correctly, the oscilloscope is essential for analyzing fast signals such as ultrasonic sensor pulses or electrical noise. By using the Serial Plotter together with these instruments, you gain full control of your project and can clearly differentiate between a variable analog reading and the binary transition of a digital signal with strong technical accuracy.




Individual assignment:

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

Testing my PCB with the LDR sensor

First, we verify whether the connections in the schematic are correct.
To do this, we open KiCad and load the project, then open the schematic to confirm the connections. In this case, the LDR is connected to 3.3V and to a resistor to ground, and it is wired to pin D1 on the XIAO. This lets us read an analog value that changes with ambient light.

Work in progress Week 01

Now, in the PCB layout, we check the physical connections for the LDR module by tracing each connection. Work in progress Week 01

We place our correctly soldered board and make the corresponding connections. Work in progress Week 01

Work in progress Week 01

Now we need to generate a test code for the LDR sensor. For that, we explained the wiring to Gemini AI and copied the code into Arduino IDE. Work in progress Week 01

Code: LDR Module  Edit: David Avila     Original code: Gemini

const int ldrPin = D1;
const int ledPin = D2;

void setup() {
  Serial.begin(115200);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  int ldrValue = analogRead(ldrPin);

    Serial.println(ldrValue); // numeric value only

  if (ldrValue < 2000) {
    digitalWrite(ledPin, HIGH);
  } else {
    digitalWrite(ledPin, LOW);
  }

    delay(150); // faster updates for a clearer graph
}

The LDR module measures light intensity by converting it into an analog value that the XIAO RP2040 reads with analogRead, producing an approximate range from 0 to 4095. These values are sent to the computer with Serial.println for analysis. The Serial Monitor is used to view exact numeric values and calibrate the sensor (for example, identifying which value corresponds to light or darkness), while the Serial Plotter displays the same data as a real-time graph, making it easier to see changes when you shine a flashlight on the sensor or cover it. It is important to send only numbers (without text) so the plotter works correctly and to use a delay (such as 150 ms) to avoid an overly fast signal and improve readability. These values can also be used to control an LED or other devices based on detected light level.

Conclusions: