PICAR-X speaker not working

Hello,

I’m new to robotics, so thanks in advance for your patience. I’m assembling the PICAR-X and have been going through the Quick Guide on Python section of the documentation site. Everything is installing correctly and I had no issues with zeroing the servo motor.

However, despite installing the i2samp.sh module multiple times, I cannot get the speaker to work. I’ve tried removing and reinstalling the speaker connection to the HAT, but nothing seems to be working.

Am I missing something obvious, or is it possible my HAT is faulty?

Thanks in advance for any guidance.

Did you get an error while installing the i2samp.sh module? If so, please provide us with the error message so that we can analyze and solve the problem.
If possible, we would like you to provide us with a video of the problem.

After you have installed the i2samp.sh module and restarted your system, go back and execute
cd /home/pi/picar-x/example
sudo python3 tts_example.py
Do you hear a sound?
If not, do the following
sudo killall pulseaudio
Go back and run:
cd /home/pi/picar-x/example
sudo python3 tts_example.py
When you install all modules, be sure to follow the steps in our tutorial one by one. Be sure to follow the order before and after.

Hello,

Thank you for your response. The “sudo killall pulseaudio” command worked for me. The audio is extremely faint however; I’m going to check the documentation to understand volume controls, but at least I know my HAT isn’t a dud.

Appreciate your help!

Kevin

1 Like

I am having the same problem (not on the one I put together last week). I tried this and it still will not say anything (though it does print it).

1、What system are you using and what is the system version.
2、Did you follow our tutorial to install i2samp.sh, and did you report any error during the installation process.
If there is no sound after reboot, you may need to run the i2samp.sh script several times.
3、You can provide us with a video of the problem of running the code process, so that we can analyze and solve the problem.

My speaker stopped working too…here’s what error I get.

pi@Picar-X:~/picar-x/example $ sudo killall pulseaudio
pi@Picar-X:~/picar-x/example $ sudo python3 3.tts_example.py
Traceback (most recent call last):
File “/home/pi/picar-x/example/3.tts_example.py”, line 9, in
music = Music()
^^^^^^^
File “/usr/local/lib/python3.11/dist-packages/robot_hat/music.py”, line 71, in init
self.pygame.mixer.init()
pygame.error: ALSA: Couldn’t open audio device: Device or resource busy
pi@Picar-X:~/picar-x/example $

pi@Picar-X:~/picar-x $ sudo bash i2samp.sh
Support for your operating system is experimental. Please visit
forums.adafruit.com if you experience issues with this product.

This script will install everything needed to use
i2s amplifier

— Warning —

Always be careful when running scripts and commands
copied from the internet. Ensure they are from a
trusted source.

If you want to see what this script does before
running it, you should run:
\curl -sS github.com/adafruit/Raspberry-Pi-Installer-Scripts/i2samp

Do you wish to continue? [y/N] y

Checking hardware requirements…

Adding Device Tree Entry to /boot/firmware/config.txt
dtoverlay already active
i2s mmap dtoverlay already active

Commenting out Blacklist entry in
/etc/modprobe.d/raspi-blacklist.conf
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
alsa-utils is already the newest version (1.2.8-1+rpt1).
The following packages were automatically installed and are no longer required:
libcamera0.3 libwlroots12 lxplug-network
Use ‘sudo apt autoremove’ to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Installing aplay systemd unit
Removed “/etc/systemd/system/multi-user.target.wants/aplay.service”.

You can optionally activate ‘/dev/zero’ playback in
the background at boot. This will remove all
popping/clicking but does use some processor time.

Activate ‘/dev/zero’ playback in background? [RECOMMENDED] [y/N] y

Created symlink /etc/systemd/system/multi-user.target.wants/aplay.service → /etc/systemd/system/aplay.service.

Configuring sound output
card_num=

We can now test your i2s amplifier
Set your speakers if possible!
Do you wish to test your system now? [y/N] y
Testing…

speaker-test 1.2.8

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
WAV file(s)
Playback open error: -16,Device or resource busy

All done!

Enjoy your new i2s amplifier!

Some changes made to your system require
your computer to reboot to take effect.

Would you like to reboot now? [y/N]

After successfully reinstalling i2samp.sh, please run the sound sample to see if it produces sound.

If there is no sound, try executing the alsamixer command to adjust the volume to the maximum, and then run the sample again to check the results.