Pi Dog on Pi Zero. Fail to init Camera and Audio

Good afternoon.
I got the Pi Dog for my son who recently got into robotics after a summer camp.
We were able to assemble the PiDog with a PiZero. We also got a USB adapter for the included USB mic since the PiZero only has micro usb.

We were able to setup the calibration and run through the sample movements via python.

We are now stuck on the
gpt_dog.py --keyboard
script for the AI interaction.

This is the response:

sudo ~/my_venv/bin/python3 gpt_dog.py --keyboard

config_file: /home/admin/.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 … pinctrl set 20 op dh

done

ultrasonic init … done

vilib 0.3.18 launching …

picamera2 0.3.30

ALSA lib pcm.c:8570:(snd_pcm_recover) underrun occurred

Web display on:

eth0: error fetching interface information: Device not found

http://192.168.2.248:9000/mjpg

Starting web streaming …

* Serving Flask app ‘vilib.vilib’

* Debug mode: off

ERROR: [Errno 5] Input/output error

camera close

Stopping and returning to the initial position …

Close error: [Errno 5] Input/output error

What have we tried?

Resetting the camera ribbon.
Securing the camera ribbon from the actual camera to the camera board.

We are loosing our minds.

Does anyone have any other ideas? I read something about re-formatting the os and starting over, so we will try that as well, then go through the calibration again.

Thanks

Camera not initializing?
Please confirm if the wiring is correct and make sure the connections are secure.
We suggest providing a wiring diagram for us to review.
What system are you currently using? If it’s the Bookworm version, please execute the rpicam-hello test to see if the camera module is recognized.
If you are not using the Bookworm system, please run libcamera-hello to test the camera.
Also, run pidog/examples/7_face_track.py to check if the camera works properly.
If it works correctly, this indicates that there may be an issue with the installation of required packages and dependencies for AI interaction using GPT-4O.

Please check if any errors occurred during the installation of packages and dependencies. If there are errors, please provide the error messages for us to assist you.
Additionally, verify if you correctly obtained the API key and Assistant ID, and if you filled them in properly.
Please follow the tutorial steps:
https://docs.sunfounder.com/projects/pidog/en/latest/openai.html#

Audio not working?
We recommend reinstalling i2samp.sh:
cd ~/pidog
sudo bash i2samp.sh
Then, run pidog/examples/9_howling.py to see if the speaker produces sound.
Next, execute the command rec -c 1 op.wav, then speak to Pidog or make some sounds; the microphone will record the sound into op.wav. Press Ctrl + C to stop recording.
Finally, run sudo play op.wav to play back the recorded sound and confirm that the microphone is functioning properly.

I have relaced the pi with a newer pi3b+ and the camera is now working, but I am still getting errors:
sudo ~/my_venv/bin/python3 gpt_dog.py --keyboard
config_file: /home/admin/.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 … pinctrl set 20 op dh
done
ultrasonic init … done
vilib 0.3.18 launching …
picamera2 0.3.30

Web display on:

http://192.168.2.248:9000/mjpg

Starting web streaming …

  • Serving Flask app ‘vilib.vilib’
  • Debug mode: off

ERROR: [Errno 5] Input/output error
camera close
Stopping and returning to the initial position …
Close error: [Errno 5] Input/output error

Any ideas on what Errno 5 error is?

It’s typically a hardware error, where the rpi has tried to read or write to some hardware that isn’t responding correctly. Do all the other examples work correctly using all of pidogs systems? If so, then we can assume it’s not any pidog fault. Is your sdcard full? Can you try a different sdcard? Or booting from.usb? Just to eliminate a faulty sdcard.

Based on your error message, it is very likely that the camera cable is not connected properly.

Even though you changed to the Pi 3B+, the camera ribbon cable may not be fully inserted. We recommend checking again to ensure the camera is correctly connected to the Pi 3.

If you are using the Bookworm system, please run the rpicam-hello test to see if the camera is recognized and working.

thanks, we are starting from scratch on the os to see if the switch from pi zero to pi 3b+ is needing a fresh install of the os.

The PiDog camera does work, the URL produced http://192.168.2.248:9000/mjpg allows us to view a live feed from another computer.

The speakers work, we can hear the speakers during one of the test scripts.

I am not sure on the mic, the USB mic that was included in the kit comes with no instructions, so I wonder if that is causing issues?

The PiDog can walk, the ultrasonic sensor is also working, it senses objects and stops.

The lights on the front also work.

So I am hoping that another full re-build of the os will work. But my question is what to do with the usb microphone, does anyone know? Is it automatically supported? Is there another script to run?

Try to use

 arecord -l

To see which sound input devices are attached. I honestly think it should be fine, but let’s see.

When I ran this command I get a couple of messages:

sudo python3 setup.py install

/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
/usr/lib/python3/dist-packages/setuptools/command/easy_install.py:146: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
warnings.warn(

admin@joshysdog:~/pidog $ uname -r
6.12.34+rpt-rpi-v8

@SunFounder_Moderator

(my_venv) admin@joshysdog:~/pidog/gpt_examples $ rpicam-hello
[0:42:29.264789122] [3519] INFO Camera camera_manager.cpp:326 libcamera v0.5.1+100-e53bdf1f
[0:42:29.315495228] [3523] WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[0:42:29.323040266] [3523] INFO RPI vc4.cpp:440 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media2 and ISP device /dev/media0
[0:42:29.323324120] [3523] INFO RPI pipeline_base.cpp:1107 Using configuration file ‘/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml’
Made X/EGL preview window
Made DRM preview window
Preview window unavailable
Mode selection for 1296:972:12:P
SGBRG10_CSI2P,640x480/0 - Score: 3296
SGBRG10_CSI2P,1296x972/0 - Score: 1000
SGBRG10_CSI2P,1920x1080/0 - Score: 1349.67
SGBRG10_CSI2P,2592x1944/0 - Score: 1567
Stream configuration adjusted
[0:42:29.847554996] [3519] INFO Camera camera.cpp:1205 configuring streams: (0) 1296x972-YUV420/sYCC (1) 1296x972-SGBRG10_CSI2P/RAW
[0:42:29.848827754] [3523] INFO RPI vc4.cpp:615 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1296x972-SGBRG10_1X10 - Selected unicam format: 1296x972-pGAA
#10 (0.00 fps) exp 33239.00 ag 7.94 dg 1.01
#11 (30.01 fps) exp 33239.00 ag 7.94 dg 1.01
……….. all the way to #146

@Spf650

admin@joshysdog:~/pidog $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 2: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

When I run sudo bash i2samp.sh there are a couple of interesting findings, first, the USB mic is plugged in, but it shows: “is_with_mic: false”

Another interesting finding is that during the speaker testing, I only hear “Front Right” there is no audio coming from the Front Left.

I think that the robodov has robohat v4 right? Why is robohatv5 tryung to be installed and checked when I run this, anyway:
check robothat 5 …
find: ‘/proc/device-tree/hat’: No such file or directory
hat_dir:
No robothat 5 found
robothat_spk_en: 20
is_with_mic: false

config soundcard without mic …

After a couple hours of re-installing, I am at the same place I was before:

(my_venv) admin@joshysdog:~/my_venv $ cd ~/pidog/gpt_examples/
sudo ~/my_venv/bin/python3 gpt_dog.py --keyboard
config_file: /home/admin/.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 … pinctrl set 20 op dh
done
ultrasonic init … done
vilib 0.3.18 launching …
picamera2 0.3.30
ALSA lib pcm.c:8570:(snd_pcm_recover) underrun occurred

Web display on:

http://192.168.2.248:9000/mjpg

Starting web streaming …

  • Serving Flask app ‘vilib.vilib’
  • Debug mode: off

ERROR: [Errno 5] Input/output error
camera close
Stopping and returning to the initial position …
Close error: [Errno 5] Input/output error

The camera does work when I open the url, so I am at a loss.
Is there a way to enable debug mode? “Debug mode: off”