Interfacing Adafruit Soundboard with Rasberry Pi Pico - UART

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
MageQx
 
Posts: 5
Joined: Thu Jan 06, 2022 12:38 pm

Interfacing Adafruit Soundboard with Rasberry Pi Pico - UART

Post by MageQx »

Hello,
I'm fairly novice with programming with CircuitPython, I tried several times to connect the Soundboard module of Adafruit with the raspberry Pi Pico in UART mode. Unfortunately I am not able to connect to it.

I'm using the latest firmware for the Pico and using the library for the soundboard at https://github.com/mmabey/Adafruit_Soundboard. I'm trying to use the Pico on the UART0 pins [GP16, GP17 and reset pin on 18].

Can you help me ?

Thanks

Dominic

User avatar
danhalbert
 
Posts: 4650
Joined: Tue Aug 08, 2017 12:37 pm

Re: Interfacing Adafruit Soundboard with Rasberry Pi Pico -

Post by danhalbert »

Make sure that TX->RX and RX->TX between the two boards. Also make sure the boards' grounds are tied together.

User avatar
MageQx
 
Posts: 5
Joined: Thu Jan 06, 2022 12:38 pm

Re: Interfacing Adafruit Soundboard with Rasberry Pi Pico -

Post by MageQx »

Thanks I'll try it ASAP :)

User avatar
MageQx
 
Posts: 5
Joined: Thu Jan 06, 2022 12:38 pm

Re: Interfacing Adafruit Soundboard with Rasberry Pi Pico -

Post by MageQx »

Unfortunately, it doesn't work, I've included my diagram on how I've wired my two boards, and here's the code I'm using :

Code: Select all

from adafruit_soundboard import Soundboard

# uart_tx, uart_rx, rst_pi
sound = Soundboard("GP16", "GP17", "GP18", debug=True)
sound.play_now(0)
Nothing happens.
Attachments
Pico-Soundboard.jpg
Pico-Soundboard.jpg (336.47 KiB) Viewed 132 times

User avatar
danhalbert
 
Posts: 4650
Joined: Tue Aug 08, 2017 12:37 pm

Re: Interfacing Adafruit Soundboard with Rasberry Pi Pico -

Post by danhalbert »

I will try wiring this up tomorrow, but you could post a clear photo of your wiring as well? Thanks.

User avatar
danhalbert
 
Posts: 4650
Joined: Tue Aug 08, 2017 12:37 pm

Re: Interfacing Adafruit Soundboard with Rasberry Pi Pico -

Post by danhalbert »

The problem is that the adafruit_soundboard library was written a long time ago, and assumes that the UART timeout is in milliseconds. It changed to be in floating-point seconds. This happened in CircuitPython 4.0. The library is waiting 30 seconds instead of 30 milliseconds for a response from the Sound FX board. If it doesn't receive a response in time, then it resets the soundboard. But it's waiting 30 seconds to do that with the old code.

Here is a patched version of the library which fixes the problem. Unzip and replace adafruit_soundboard.py. Once I fixed this, it worked for me.

You could submit a PR (pull request to the library) to fix it. If you don't know how to do that, I can do that.
Attachments
adafruit_soundboard.py.zip
(6.93 KiB) Downloaded 6 times

User avatar
MageQx
 
Posts: 5
Joined: Thu Jan 06, 2022 12:38 pm

Re: Interfacing Adafruit Soundboard with Rasberry Pi Pico -

Post by MageQx »

It works !

User avatar
danhalbert
 
Posts: 4650
Joined: Tue Aug 08, 2017 12:37 pm

Re: Interfacing Adafruit Soundboard with Rasberry Pi Pico -

Post by danhalbert »


User avatar
MageQx
 
Posts: 5
Joined: Thu Jan 06, 2022 12:38 pm

Re: Interfacing Adafruit Soundboard with Rasberry Pi Pico -

Post by MageQx »

Out of curiosity, how do I send a simple command and how to check if the device is currently playing a sound file ?

User avatar
danhalbert
 
Posts: 4650
Joined: Tue Aug 08, 2017 12:37 pm

Re: Interfacing Adafruit Soundboard with Rasberry Pi Pico -

Post by danhalbert »

I believe you can check the Act pin: https://learn.adafruit.com/adafruit-aud ... 1386552-16
If a file is being played, it will be low. I'm guessing it returns to high when the file has finished playing.

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”