# Group Work 2026 – Multimeter and Oscilloscope

**Assignment:** Use the test equipment available in the laboratory to observe and analyse the operation of a microcontroller-based circuit.

In this group work, we used a VICTOR VC9806+ digital multimeter and a RIGOL DS2102A oscilloscope. Our practical experiment focused on the trigger and echo signals of an ultrasonic distance sensor connected to a Seeed Studio XIAO ESP32-S3 Sense development board.

## 1. Test Equipment

### 1.1 Digital Multimeter – VICTOR VC9806+

We used a [VICTOR VC9806+](https://www.victormultimeter.com/sale-13775638-vc9806-dcv-manual-ranging-digital-multimeter-2mf-capacitance.html) digital multimeter. A multimeter is used to measure electrical quantities such as voltage, current and resistance. In this experiment, it could be used to check the sensor supply voltage, verify the ground connection and inspect the circuit before oscilloscope measurements.

**Key specifications (as listed in the original assignment):**

| Parameter | Specification |
| --- | --- |
| Display | 4½-digit LCD (maximum count: 19,999) |
| DC voltage | 200 mV–1000 V (±0.05%) |
| AC voltage | 200 mV–750 V (±1.0%) |
| DC current | 200 µA–20 A |
| AC current | 200 µA–20 A |
| Resistance | 200 Ω–200 MΩ |
| Capacitance | 20 nF–2 mF |
| Frequency | 200 Hz–2 MHz |
| Temperature | −20°C to 1000°C |
| Sampling rate | 2–3 readings per second |
| Input impedance | 10 MΩ |
| True RMS / ranging | True RMS; manual ranging |

Measuring a 220 Ohms resistor.
<div align="center"><img src="\2.jpg"/></div>


### 1.2 Oscilloscope – RIGOL DS2102A

We used a [RIGOL DS2102A](https://rigolshop.eu/product-oscilloscope-mso/ds2000/ds2102a.html) oscilloscope to examine how the sensor's digital signals changed over time. Unlike a multimeter, an oscilloscope displays voltage waveforms and enables measurements of pulse width, period, amplitude and signal timing.

<div align="center"><img src="\tgOlnIIJ.png"/></div>

The oscilloscope was particularly useful for observing the short trigger pulse sent by the microcontroller and the longer echo pulse returned by the ultrasonic sensor. Its main relevant functions include waveform display, automatic timing measurements, edge triggering and signal troubleshooting.

[Oscilloscope quick guide](https://supportjp.rigol.com/Public/Uploads/uploadfile/files/ftp/%E6%96%B0%E8%B5%84%E6%96%99%E5%BA%93-%E5%90%AB%E6%89%8B%E5%86%8C%E5%9B%BA%E4%BB%B6%E8%BD%AF%E4%BB%B6/%E5%AE%98%E7%BD%91%E8%B5%84%E6%96%99/DS/%E6%89%8B%E5%86%8C/MSO2000A/EN/MSO2000A_QuickGuide_EN%26CN.pdf)

## 2. Ultrasonic Sensor Test Using XIAO ESP32-S3 Sense (Oscilloscope)

### 2.1 Aim

The aim of this test was to examine the electrical signals exchanged between a XIAO ESP32-S3 Sense microcontroller and an ultrasonic distance sensor, and to understand how the duration of an echo pulse can be used to calculate distance.

### 2.2 Circuit and Connections

The 2026 setup used a **Seeed Studio XIAO ESP32-S3 Sense**, replacing the Arduino Uno in the previous experiment. The pin assignments below follow the supplied 2026 Arduino sketch (`xiao_red_ultrasonic(1).ino`).

| Ultrasonic sensor pin | Connection | Function |
| --- | --- | --- |
| VCC | Suitable sensor power supply | Powers the ultrasonic module |
| GND | XIAO GND | Common ground |
| TRIG | XIAO D3 | Trigger output from the microcontroller |
| ECHO | XIAO D6, through level shifting if needed | Echo pulse input to the microcontroller |

**Important:** The XIAO ESP32-S3 uses 3.3 V GPIO and is not 5 V tolerant. If the ultrasonic module is powered at 5 V and outputs a 5 V ECHO pulse, a suitable voltage divider or logic-level shifter must be used before connecting ECHO to D6. A software pull-down does not provide voltage protection. The precise ultrasonic module and supply voltage were not specified in the supplied files and should be confirmed against the actual hardware.

### 2.3 Working Principle

The microcontroller generates a short HIGH pulse on the TRIG pin. The ultrasonic module emits an ultrasonic burst and drives ECHO HIGH for a duration related to the round-trip travel time of the sound wave. The microcontroller measures this duration and calculates distance using:

\[
\text{Distance (cm)} = \frac{\text{Echo duration (µs)} \times 0.0343}{2}
\]

The factor of two accounts for the outward and return paths of the sound wave. For example, an echo pulse lasting 1,000 µs corresponds to approximately 17.15 cm under the assumed sound-speed conditions.

### 2.4 Arduino Code

The supplied 2026 program also contains camera-based red-colour detection and an LED indicator. Since this group-work exercise concerns oscilloscope measurement of the ultrasonic sensor, the code below isolates the **ultrasonic measurement logic** from that program; it is not presented as the complete original sketch. It retains the same D3/D6 connections, 12 µs trigger pulse, 30,000 µs timeout, 2–400 cm accepted range and 300 ms measurement interval.

```cpp
#include <Arduino.h>

// XIAO ESP32-S3 Sense: ultrasonic sensor connections
constexpr uint8_t PIN_TRIG = D3;
constexpr uint8_t PIN_ECHO = D6;
constexpr uint32_t ECHO_TIMEOUT_US = 30000;
constexpr uint32_t READ_INTERVAL_MS = 300;

void setup() {
  Serial.begin(115200);
  pinMode(PIN_TRIG, OUTPUT);
  digitalWrite(PIN_TRIG, LOW);
  pinMode(PIN_ECHO, INPUT_PULLDOWN);
}

void loop() {
  if (digitalRead(PIN_ECHO) == HIGH) {
    Serial.println("ECHO is unexpectedly HIGH");
  } else {
    digitalWrite(PIN_TRIG, LOW);
    delayMicroseconds(5);
    digitalWrite(PIN_TRIG, HIGH);
    delayMicroseconds(12);
    digitalWrite(PIN_TRIG, LOW);

    uint32_t echoUs = pulseIn(PIN_ECHO, HIGH, ECHO_TIMEOUT_US);
    if (echoUs == 0) {
      Serial.println("Echo timeout");
    } else {
      float distanceCm = echoUs * 0.0343f / 2.0f;
      if (distanceCm >= 2.0f && distanceCm <= 400.0f) {
        Serial.printf("Echo: %lu us | Distance: %.1f cm\n",
                      (unsigned long)echoUs, distanceCm);
      } else {
        Serial.println("Distance out of range");
      }
    }
  }
  delay(READ_INTERVAL_MS);
}
```

In the complete supplied program, a three-sample median filter is also applied to valid distance readings, and the filter is reset after an invalid reading. The simplified code above omits that filtering to make the oscilloscope experiment easier to follow.

### 2.5 Oscilloscope Measurement Procedure

1. Power the XIAO ESP32-S3 Sense through USB and connect the ultrasonic sensor using the wiring described above.
2. Connect the oscilloscope ground clips to the circuit's common GND. Use a suitable bench-safe grounding arrangement.
3. Connect **Channel 1 (CH1)** to the TRIG signal at D3 and **Channel 2 (CH2)** to the ECHO signal at the protected D6 input.
4. Set the probe attenuation consistently on the probes and oscilloscope (for example, 10× if 10× probes are used).
5. Start with a vertical scale appropriate for 3.3 V logic (for example, 1 V/div) and a timebase of approximately 100 µs/div to 1 ms/div for viewing echo pulses. Zoom in to approximately 5 µs/div to inspect the short trigger pulse.
6. Use an edge trigger on CH1 to stabilise the waveform display. Measure the TRIG pulse width and the HIGH duration of ECHO.
7. Move a flat object closer to and farther from the sensor. Observe how the ECHO pulse width changes and compare it with the distance reported in the Serial Monitor.

<div align="center"><img src="\1.jpg"/></div>

The video for measurement shows the result. We can see that the echo signal length change with hand movement.
<video src="\1.mp4" controls></video>


