You can see the group page here: https://fabacademy.org/2026/labs/lima/Weeks/Week9/Week9.html
For the group part, since I am in Madre de Dios and could not travel to Lima due to work-related reasons, I connected virtually with my classmates in order to develop the work, and I learned a lot during those sessions, which helped me in the development of the individual work.
In this group work, we used laboratory measurement tools to analyze input devices using a microcontroller board specifically designed for this purpose. To do this, we verified the operation of sensors using a board based on the Seeed Studio XIAO RP2040 microcontroller, together with an HC-SR04 ultrasonic distance sensor and an LDR LM393 photoresistor. In addition, we analyzed the obtained signals using a multimeter and an oscilloscope, which allowed us to observe their behavior in real time.
| Tool | Model | Use |
|---|---|---|
| Portable mini digital oscilloscope | DSO152 FNIRSI | Visualize waveforms, verify voltages, and signal stability |
| Digital multimeter | PR-75 | Verify power supply, continuity, and rule out short circuits |
| Microcontroller board | PCB with XIAO RP2040 | Generate and measure signals |
| Power supply | USB | Power and program the board |
First, we reviewed the specifications of the HC-SR04 ultrasonic sensor, which works through the Trigger and Echo pins to measure distances by calculating the return time of the signal.
Then we made the connection:
Later, we programmed the board in Arduino IDE and observed the distance values in the serial monitor. This allowed us to verify the correct operation of the sensor and validate the input signal.
Results:
Variations in the distance in centimeters were observed when changing the position of the object, confirming that the sensor was working correctly.
Learnings:
In this case, we analyzed a light sensor (LDR LM393), which allows light intensity to be measured through an analog and digital output.
We connected the sensor as follows:
Then we programmed the XIAO RP2040 to read analog values and visualize the data in the serial monitor.
Results:
Changes in the values were observed depending on the amount of light, confirming the correct functioning of the sensor.
Learnings:
During the process we faced several problems:
After reviewing the connections and correcting the pins, we managed to obtain correct results.
Important:
Always review the device specifications:
First, the power supply must be verified and short circuits ruled out with the multimeter, and then the oscilloscope must be used correctly configured to observe clean signals and validate the operation of the circuit.
This activity made it possible to understand how to safely verify a board before measuring signals, how to correctly connect an oscilloscope, and how to interpret digital and analog signals in real hardware.
We also learned that a correct ground connection, the proper selection of GPIO pins, and a good oscilloscope configuration are essential to obtain reliable measurements and validate the operation of the system.
I worked on the board that I produced in week 8. For this, I used 2 sensors related to my final project, and in this case I got the sensors.
The DS18B20 sensor is a digital device widely used for temperature measurement in electronic projects, both at the academic and industrial level. It is characterized by its ease of use, high precision, and its ability to communicate through the 1-Wire protocol, which allows the use of a single microcontroller pin for data transmission.
One of its main advantages is that each sensor has a unique 64-bit identifier, which allows multiple sensors to be connected on the same bus without interference. In addition, it can work with different microcontrollers such as Arduino, ESP32, or Raspberry Pi, which makes it a versatile solution for monitoring systems. More information here: https://naylampmechatronics.com/blog/46_tutorial-sensor-digital-de-temperatura-ds18b20.html
The sensor measures temperature and directly converts it into a digital signal, eliminating the need for external analog converters. This information is transmitted to the microcontroller through the 1-Wire protocol, which considerably simplifies the wiring.
In addition, it can operate in normal power mode or in parasite mode, where it is powered directly from the data line, further reducing the number of required connections.
The DS18B20 is a sensor designed for long-term applications. Its useful life depends mainly on the conditions of use (temperature, humidity, and physical protection), but under normal conditions it can operate for several years without significant degradation, especially in encapsulated or waterproof versions that protect the sensor from external environments.
The sensor used is the Gravity TDS Meter V1.0, a device designed to measure the amount of total dissolved solids (TDS) in water. This type of sensor is widely used in applications such as water quality monitoring, hydroponic systems, aquariums, and environmental projects.
This system is composed of two main parts:
The module acts as a signal conditioning stage, converting the measurement into an analog signal that can be read by a microcontroller such as Arduino or ESP32. More information here: https://www.hellasdigital.gr/electronics/sensors/humidity-sensor/gravity-analog-tds-sensor-meter-for-arduino-sen0244/
The sensor measures the electrical conductivity of water through its probe. Dissolved solids (salts, minerals, nutrients) increase conductivity, which makes it possible to estimate the TDS concentration.
The probe generates a signal that is processed by the module, which delivers an analog voltage proportional to the TDS level.
It is important to highlight that:
The Gravity TDS Meter V1.0 module uses alternating current (AC) excitation, which allows:
This increases the reliability of the sensor in continuous measurements.
The sensor has a long useful life, especially thanks to the use of AC signal. However, its duration depends on factors such as:
Under normal conditions, it can operate for several years without significant degradation.
This week I connected two input devices to my board, which I developed in week 8. You can review the information here: https://fabacademy.org/2026/labs/lima/students/rociomilagros-maravi/week-8.html
On my board I connected a DS18B20 temperature sensor and a Gravity TDS Meter V1.0 water quality sensor. The temperature sensor was connected to pin A0, in addition to 5V and GND, using a 4.7 kΩ pull-up resistor between 5V and A0 to ensure a stable reading in the sensor communication. On the other hand, the TDS sensor was connected to pin A1, together with 5V and GND.
From this practice I better understood how to integrate analog and digital sensors to a board designed by myself, and I also understood that it is not enough to make the physical connection: it is necessary to carefully review the pin assignment, the power supply, and the reading logic in the code in order to obtain correct data. In particular, I learned that the TDS sensor depends on temperature to obtain a more precise measurement, so it was important to integrate both sensors in the same system.
The connection of the sensors did not generate many problems for me, since I followed the tutorials for each device and respected their basic power and signal connections. In the case of the DS18B20, it was important to consider the 4.7 kΩ pull-up resistor, while the TDS module only required its analog output, power, and ground.
Thanks to this, I managed to mount both sensors on my board and leave them ready for the programming and testing stage, although I see them as messy, but it has helped me understand that I must redesign my board for my final project.
To make both sensors work, I used a code that a friend from Systems Engineering helped me correct. The program was developed for a XIAO ESP32-C3 board and integrates three main functions: reading the DS18B20 temperature sensor, reading the TDS sensor, and controlling two LEDs through a button.
First, the code defines the pins used by each component: the DS18B20, the TDS, the button, and the LEDs. Then it initializes the libraries required for communication with the temperature sensor and configures the internal memory to store the calibration value of the TDS.
During execution, the program performs periodic readings of temperature and the analog value of the TDS sensor. To improve the stability of the TDS measurement, the code takes several readings, calculates an average, and then applies a compensation according to the temperature recorded by the DS18B20. This is important because the conductivity of water changes with temperature, and therefore the TDS value needs to be corrected to be more reliable.
In addition, the program includes a serial port calibration routine, which allows the K factor of the sensor to be adjusted using a known solution. It also controls two LEDs with a button: when the button is pressed, the LEDs turn on; when it is released, they turn off.
During the development, I mainly had problems in the code part, not so much in the physical connection. The greatest difficulty was the pin designation, because initially I was not correctly using the correspondence between the analog/digital pins and the real GPIOs of the microcontroller. This caused the sensors not to respond as I expected.
After reviewing the program and correcting the pin assignment, both sensors started working correctly. This part was important because it allowed me to understand that, even if the circuit is well connected, a logical error in the software can completely prevent the data from being read.
Another relevant aspect was understanding that the TDS sensor should not be interpreted in isolation, since its measurement depends on the water temperature. By integrating the DS18B20 within the same code, I was able to obtain thermal compensation and a more realistic TDS reading.
To calibrate the TDS sensor, I used a standard solution that indicated 1413 on the bottle. However, when performing the tests, my system measured around 1168. This led me to review the calibration process in more detail and better understand how this value is interpreted.
In this case, the value 1413 that appears on the solution normally corresponds to electrical conductivity (µS/cm) and not directly to ppm of TDS. In many TDS systems, that conductivity value is converted to approximately 707 ppm, depending on the conversion factor used by the sensor. Therefore, the difference observed in my tests allowed me to understand that the calibration depends on both the K factor and the temperature compensation, as well as on the way the code converts the analog signal to ppm.
Thanks to this process, I understood that the TDS sensor needs to be calibrated carefully and that it is not enough to immerse it in a standard solution: it is also necessary to correctly interpret whether the reference value is expressed in conductivity or in TDS.
Video
This experience helped me better understand the relationship between hardware and software in the development of electronic systems. On one hand, the physical connection of the sensors was relatively simple by following the tutorials; however, the real difficulty appeared in the programming and in the interpretation of the measurements.
I learned that small errors, such as an incorrect pin assignment, can completely prevent the system from working, and that some sensors, such as the TDS sensor, require additional variables such as temperature to obtain reliable results. I also understood that calibration is not only a technical part, but a fundamental step to ensure the quality of the final measurement.
In this practice, I managed to correctly integrate a DS18B20 temperature sensor and a TDS sensor into my custom board. The physical connection was relatively straightforward, but the greatest difficulty was in the code development and in the correct pin assignment. Finally, after correcting these errors, I got both sensors to work and understood that the TDS sensor depends on temperature in order to provide a more precise measurement.
In addition, the calibration process allowed me to learn to differentiate between conductivity values and TDS values, which was key to correctly interpreting the obtained results.