Experiment 02 - Sound Source Localization Module Usage
- Hardware Preparation:
- Solder the sound source localization module according to the manual
The effect is shown in the figure below:


- Wiring: Connect RDK-X5 physical pin numbers 11, 13, 15, 29, 31, 37 to the sound source localization module's 0°, 60°, 120°, 180°, 240°, 300° in order. Connect the module's VCC and GND to RDK-X5's 5V and GND respectively.
RDK-X5 40pin Pinout:

Software Operation:
Run the sound_localization.py file on RDK-X5: python ./sound_localization.py
At this point, the sound sources identified at different angles will be read and printed in the terminal. The terminal operation effect is as follows:

#!/usr/bin/env python3
import sys
import signal
import Hobot.GPIO as GPIO
import time
# Using BOARD-encoded pin numbers
pins = [11, 13, 15, 29, 31, 37]
angles = [0, 60, 120, 180, 240, 300]
def signal_handler(sig, frame):
sys.exit(0)
def main():
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
for pin in pins:
GPIO.setup(pin, GPIO.IN)
print("Sound source localization started, press CTRL+C to exit")
try:
while True:
for pin, angle in zip(pins, angles):
if GPIO.input(pin) == GPIO.HIGH:
print("(Sound source detected at {}°)".format(angle))
time.sleep(0.1)
finally:
GPIO.cleanup()
if __name__ == '__main__':
signal.signal(signal.SIGINT, signal_handler)
main()