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.
Here you can see the fabrication process in Week08

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 connect the LDR module by wiring its VCC to 3.3V, its GND to ground through the resistor network, and its signal output to pin D1 on the XIAO board. This setup lets the microcontroller read the light-dependent voltage as an analog value with analogRead. Work in progress Week 01

Work in progress Week 01
LDR module
LDR Module Characteristics
Sensor type Light Dependent Resistor (photoresistor)
Operating voltage 3.3V to 5V
Output Analog voltage proportional to light intensity
Main use Light detection and automatic lighting control
Connection in this project Analog input on the XIAO board

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.

Prompt: Generate me a code to test my LDR module with my XIAO RP2040, keep in mind that it is connected to pin D1, and I can see the measured values in the serial monitor.

Work in progress Week 01
Code: LDR Module   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.

In the LDR test, the serial values change continuously with ambient light ads. During the test, the measured values were around 600 to 700 with normal ambient light, around 10 to 20 when a flashlight directly illuminated the sensor, and around 1000 to 1100 when the sensor was in darkness. This confirms stable analog behavior on pin D1 and validates the ON/OFF decision used for the LED output on D2.

Conclusions:

DOWNLOAD FILES

HEXAMODULAR PCB PROJECT Download .ZIP
GERBER FILES Download .ZIP