# Pidog sound direction - behavior change when calling rgb\_strip - Possible bug?

**URL:** <https://forum.sunfounder.com/t/pidog-sound-direction-behavior-change-when-calling-rgb-strip-possible-bug/1647>\
**Category:** Robotic kit for Raspberry Pi\
**Created:** [September 11, 2024, 11:47am UTC](https://forum.sunfounder.com/t/pidog-sound-direction-behavior-change-when-calling-rgb-strip-possible-bug/1647 "2024-09-11T11:47:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sia](https://avatars.discourse-cdn.com/v4/letter/s/ba9def/32.png) [@sia](https://forum.sunfounder.com/u/sia)\
**Post date:** [September 11, 2024, 11:47am UTC](https://forum.sunfounder.com/t/pidog-sound-direction-behavior-change-when-calling-rgb-strip-possible-bug/1647/1 "2024-09-11T11:47:15Z")

</div>

Hello,  
I was just wondering if someone else could run a simple test to verify if this is a bug or my system behave differently.

Test file: pidog/basic\_examples/11\_sound\_direction\_read.py

When I run this script, I always get one direction detected as console log below:

config\_file: /home/sia/.config/pidog/pidog.conf  
robot\_hat init … done  
imu\_sh3001 init … done  
rgb\_strip init … done  
dual\_touch init … done  
sound\_direction init … done  
sound\_effect init … done  
sound direction: 250  
ultrasonic init … done

This by itself is quite strange because no sound should be detected at all. So it has a first time false positive.

Now, if I add:  
my\_dog.rgb\_strip.set\_mode(“breath”, “blue”, bps=0.2)  
before while loop

```auto
from pidog import Pidog

my_dog = Pidog()
my_dog.rgb_strip.set_mode("breath", "blue", bps=0.2)
try:
    while True:
        if my_dog.ears.isdetected():
            direction = my_dog.ears.read()
            print(f"sound direction: {direction}")
finally:
    my_dog.close()

```

I get false reading in every read.  
Here is a sample of console log:

config\_file: /home/sia/.config/pidog/pidog.conf  
robot\_hat init … done  
imu\_sh3001 init … done  
rgb\_strip init … done  
dual\_touch init … done  
sound\_direction init … done  
sound\_effect init … done  
sound direction: 71  
ultrasonic init … done  
sound direction: 130  
sound direction: 129  
sound direction: 129  
sound direction: 129  
sound direction: 129  
sound direction: 129  
sound direction: 129  
sound direction: 129

It keeps detecting false sound/reading.( terminated the program manually)

Just want to know if this is a known problem or there is something wrong in my setup.

By the way, there are two LED on the back of sound direction sensor. One is green and the other is red. Anyone knows what they indicate? D2 is green, D1 is red

 ![sound-direction-sensor-led](https://canada1.discourse-cdn.com/flex029/uploads/sunfounder/original/1X/e0f0dda8f45c950323fb9bdd1605ca81d52d1b05.jpeg)

Thank you

---

<div class="post-metadata">

**Author:** ![SunFounder\_Moderator](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@SunFounder\_Moderator](https://forum.sunfounder.com/u/SunFounder_Moderator)\
**Post date:** [September 13, 2024, 1:49am UTC](https://forum.sunfounder.com/t/pidog-sound-direction-behavior-change-when-calling-rgb-strip-possible-bug/1647/2 "2024-09-13T01:49:49Z")

</div>

When you run the example, the sound-producing device must be activated before the sound direction sensor prints the readings. If you plug and unplug the sound direction sensor directly after running the example, it may cause the printed readings to become blocked, resulting in continuous detection errors in sound/readings.

---

<div class="post-metadata">

**Author:** ![sia](https://avatars.discourse-cdn.com/v4/letter/s/ba9def/32.png) [@sia](https://forum.sunfounder.com/u/sia)\
**Post date:** [September 13, 2024, 7:28am UTC](https://forum.sunfounder.com/t/pidog-sound-direction-behavior-change-when-calling-rgb-strip-possible-bug/1647/3 "2024-09-13T07:28:46Z")

</div>

I did not plug or unplug sound direction sensor. In both example above, I just turn on the robot Hat, and run the example code.

Just now for confirmation, I ran simple test of **11\_sound\_direction\_read.py** in a very quite room and it just keep outputting sound direction data until i terminate with Ctrl-C

 ![sound-direction-output](https://canada1.discourse-cdn.com/flex029/uploads/sunfounder/original/1X/baf73343c38a5ea416c907b2f1d008739eea4dce.jpeg)

This is a slightly modified code of original 11\_sound\_direction\_read.py, so I can demonstrate the output:

```auto
from pidog import Pidog

my_dog = Pidog()
my_dog.rgb_strip.set_mode("breath", "blue", bps=0.2)
try:
    while True:
        if my_dog.ears.isdetected():
            direction = my_dog.ears.read()
            print(f"sound direction: {direction}")
finally:
    my_dog.close()

```

---

<div class="post-metadata">

**Author:** ![SunFounder\_Moderator](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@SunFounder\_Moderator](https://forum.sunfounder.com/u/SunFounder_Moderator)\
**Post date:** [September 14, 2024, 6:55am UTC](https://forum.sunfounder.com/t/pidog-sound-direction-behavior-change-when-calling-rgb-strip-possible-bug/1647/4 "2024-09-14T06:55:01Z")

</div>

We will send you a new sound direction sensor and ribbon cable as a replacement.Please contact us at [service@sunfounder.com](mailto:service@sunfounder.com)
