Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with leds on ReSpeaker Mic Array v2.0 #266

Open
Bergoglio opened this issue Jan 19, 2025 · 4 comments
Open

Problem with leds on ReSpeaker Mic Array v2.0 #266

Bergoglio opened this issue Jan 19, 2025 · 4 comments

Comments

@Bergoglio
Copy link

Good afternoon,

I installed wyoming-satellite on this hardware :

  • raspberry pi 5
  • ReSpeaker Mic Array v2.0

I applied this tutorial , satellite and local wake word detection work good but I have problems with Led service.

When I launch 4mic_service.py, I receive an error and, so, 4mic_leds.service cannot start :

Image

I don't understand what is the problem (I'm quite a noob).

Can You help me ?

@Bergoglio
Copy link
Author

Ok, now I understand more : Respeaker 4Mic HAT is not ReSpeaker Mic Array v2.0 .........
So, 4mic_service.py is for a different hardware from mine.

But the problem, now, is how can I pilot the ReSpeaker Mic Array v2.0 leds ?

@tech-kev
Copy link

I also use the ReSpeaker Mic Array v2.0 and you can find out how to control the LEDs in the docs here.

I created the following 4 scripts and then integrated them into my systemd service:

detection.py:

#!/usr/bin/env python3
import time
from pixel_ring import pixel_ring

if __name__ == '__main__':
    pixel_ring.change_pattern('echo')
    while True:
        try:
            pixel_ring.wakeup()
            break
        except KeyboardInterrupt:
            pixel_ring.off()
            break

off.py:

#!/usr/bin/env python3
import time
from pixel_ring import pixel_ring

if __name__ == '__main__':
    pixel_ring.change_pattern('echo')
    while True:
        try:
            pixel_ring.off()
            break
        except KeyboardInterrupt:
             pixel_ring.off()
             break

stt-stop.py:

#!/usr/bin/env python3
import time
from pixel_ring import pixel_ring

if __name__ == '__main__':
    pixel_ring.change_pattern('echo')
    while True:
        try:
            pixel_ring.think()
            time.sleep(3)
            pixel_ring.think()
            break
        except KeyboardInterrupt:
             pixel_ring.off()
             break

tts-start.py

#!/usr/bin/env python3
import time
from pixel_ring import pixel_ring

if __name__ == '__main__':
    pixel_ring.change_pattern('echo')
    while True:
        try:
            pixel_ring.speak()
            time.sleep(3)
            pixel_ring.set_brightness(5)
            break
        except KeyboardInterrupt:
             pixel_ring.off()
             break

After that add the following to your wyoming-satellite.service, reload deamon and restart the service.

        --startup-command /home/USERNAME/PATH_TO_SCRIPTS/off.py \
        --detection-command /home/USERNAME/PATH_TO_SCRIPTS/detection.py \
        --stt-stop-command /home/USERNAME/PATH_TO_SCRIPTS/stt-stop.py \
        --tts-start-command /home/USERNAME/PATH_TO_SCRIPTS/tts-start.py \
        --tts-played-command /home/USERNAME/PATH_TO_SCRIPTS/off.py \

Now the ring lights up like Alexa. Other things can be integrated using the docs, such as different brightness/colors etc.

You can also use other actions and call your own scripts for other functions, see here.

@Bergoglio
Copy link
Author

@tech-kev : thank You very much !!!

Your reply is perfect for a noob like me.

@lbouriez
Copy link

Hell, I installed pixel_ring using sudo pip install pixel-ring --break-system-packages
the tts-start work, I get the blue led but the off for example gives me

Traceback (most recent call last):
  File "/home/lbouriez/wyoming-satellite/script/off.py", line 3, in <module>
    from pixel_ring import pixel_ring
  File "/usr/local/lib/python3.11/dist-packages/pixel_ring/__init__.py", line 13, in <module>
    pixel_ring = PixelRing()
                 ^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/pixel_ring/apa102_pixel_ring.py", line 22, in __init__
    self.dev = APA102(num_led=self.PIXELS_N)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/pixel_ring/apa102.py", line 90, in __init__
    self.spi.open(bus, device)  # Open SPI port 0, slave device (CS) 1
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory

What am I missing ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants