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
Interfacing Adafruit Soundboard with Rasberry Pi Pico - UART
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- MageQx
- Posts: 5
- Joined: Thu Jan 06, 2022 12:38 pm
- danhalbert
- Posts: 4650
- Joined: Tue Aug 08, 2017 12:37 pm
Re: Interfacing Adafruit Soundboard with Rasberry Pi Pico -
Make sure that TX->RX and RX->TX between the two boards. Also make sure the boards' grounds are tied together.
- MageQx
- Posts: 5
- Joined: Thu Jan 06, 2022 12:38 pm
Re: Interfacing Adafruit Soundboard with Rasberry Pi Pico -
Thanks I'll try it ASAP :)
- MageQx
- Posts: 5
- Joined: Thu Jan 06, 2022 12:38 pm
Re: Interfacing Adafruit Soundboard with Rasberry Pi Pico -
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 :
Nothing happens.
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)
- Attachments
-
- Pico-Soundboard.jpg (336.47 KiB) Viewed 132 times
- danhalbert
- Posts: 4650
- Joined: Tue Aug 08, 2017 12:37 pm
Re: Interfacing Adafruit Soundboard with Rasberry Pi Pico -
I will try wiring this up tomorrow, but you could post a clear photo of your wiring as well? Thanks.
- danhalbert
- Posts: 4650
- Joined: Tue Aug 08, 2017 12:37 pm
Re: Interfacing Adafruit Soundboard with Rasberry Pi Pico -
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.
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
- MageQx
- Posts: 5
- Joined: Thu Jan 06, 2022 12:38 pm
- danhalbert
- Posts: 4650
- Joined: Tue Aug 08, 2017 12:37 pm
- MageQx
- Posts: 5
- Joined: Thu Jan 06, 2022 12:38 pm
Re: Interfacing Adafruit Soundboard with Rasberry Pi Pico -
Out of curiosity, how do I send a simple command and how to check if the device is currently playing a sound file ?
- danhalbert
- Posts: 4650
- Joined: Tue Aug 08, 2017 12:37 pm
Re: Interfacing Adafruit Soundboard with Rasberry Pi Pico -
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.
If a file is being played, it will be low. I'm guessing it returns to high when the file has finished playing.
Please be positive and constructive with your questions and comments.