WEEK 09
Input Devices
Group assignment:
- Probe 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.
What I Learned From Teamwork
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.
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.
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.
Now, in the PCB layout, we check the physical connections for the LDR module by tracing each connection.
We place our correctly soldered board and make the corresponding connections.
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.
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:
- I learned to differentiate and analyze analog and digital signals using the LDR module and the ultrasonic sensor, understanding how they behave in real time inside the microcontroller.
- Checking signals with a multimeter and oscilloscope was essential for validation: the multimeter confirms stable levels, and the oscilloscope allows observation of fast Trigger and Echo pulses.
- Using Arduino IDE (Serial Monitor and Serial Plotter) helped me better interpret sensor data, calibrate reading ranges, and clearly visualize light variations.
- I verified that my designed PCB works correctly by integrating the LDR with the XIAO RP2040, reading useful analog values for control and automation.
- This week reinforced the importance of good wiring and soldering, because small physical errors directly affect sensor reading quality.
- As a result, I now have a stronger foundation to integrate sensors into my final project, combining electronic measurement, code validation, and data analysis.