Pidog: pinctrl: not found

Hello. I need help please :slight_smile:
I finished assembling my Pidog, and the integration with the chatGPT API works fine but only when I use the keyboard. I can’t get voice commands to work. However, when I test the microphone (Rec op.wav, sudo play op.wav) everything works, but when I launch the pidog, I get the error message “/bin/sh: 1: pinctrl: not found” which crashes everything. I made sure that my microphone was set as the default audio input in asound.conf but it still doesn’t work.

Here is what I get:
philemonii@raspberrypi:~ $ cd ~/pidog/gpt_examples/
sudo ~/my_venv/bin/python3 gpt_dog.py
/bin/sh: 1: pinctrl: not found
config_file: /home/philemonii/.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
/bin/sh: 1: pinctrl: not found
ultrasonic init … done
vilib 0.3.11 launching …
picamera2 0.3.12
Web display on:
http://192.168.0.250:9000/mjpg
Starting web streaming …

  • Serving Flask app “vilib.vilib” (lazy loading)
  • Environment: production
    WARNING: This is a development server. Do not use it in a production deployment.
    Use a production WSGI server instead.
  • Debug mode: off
    listening …
    ERROR: No Default Input Device Available
    camera close
    Stopping and returning to the initial position …
    Quit

Edit: I erased the sim card and reinstalll everything from scratch: I still get the same error.

Pinctrl is relatively new but afaik, it should be included as part of all recent pi raspbian OS’
It can be installed manually if using another / legacy OS.
Try to run the pinctrl command on the CLI, maybe it will give you extra debug info?

The full sf command is
pinctrl set 20 op dh
But not sure if that’s safe to run without any prior setup!

1 Like

thank you! I’ll wait for the Sunfounder advice before doing it manually as I’m not sure what GPIO 20 does.
Thanks again for your help. I studied programming science, but it was 20 years ago so I’m a bit rusty.

It enables the speaker according to the comment in the code

os.popen(“pinctrl set 20 op dh”) # enable robot_hat speake switch

But just run it without parameters to see if you have the command… or even safer use

which pinctrl

To see if it’s on your path

but you’re right, the weekend is almost over, so best to await Sunfounder

I started with “which pinctrl” few days ago. no luck. I also tried to download it :slight_smile:

sudo apt-get update
sudo apt-get install pinctrl

Nothing found.

It’s weird because the speaker works well. It’s the microphone that seems to be the problem. (Mic works when I test it, but not when I engage it with the openAI API. ).

i know you are awaiting an answer from Sunfounder, so this is just FYI

AFAIK pinctrl is not available under apt, you need to build from github source or use an OS with it included.

Focussing on the microphone aspect, the recognizer web page has several trouble shooting suggestions depending upon your chosen microphone

Sorry, this is an issue with robot_hat code not being compatible with the bullseye system because bullseye is missing the pinctrl used to set gpio 20 high to enable speaker, we have fixed the robot code. Please update and reinstall:
cd ~/robot-hat
git pull
sudo python3 setup.py install
sudo bash i2samp.sh

It is also recommended that you use the latest bookworm version of the Raspberry Pi, as code maintenance may not be as up-to-date for compatibility issues with older systems.

Thank you so much! I’ll install the bookworm version: we were using the Legacy version, as instructed earlier.

Have a nice day.

1 Like