When running a program on the Raspberry Pi Zero W, which involved the RPi Camera, I encountered an issue. This was based on the Joy Detector Demo, from the AIY Kit. Normally, it would change LED colours and make noised based on camera facial input (emotions), but I also added a part which would stream the extent of joy to ThingSpeak.
The expected output was for the program to run, using the camera , instead the following message appeared:
mmal: mmal_vc_port_enable: failed to enable port vc.null_sink:in:0(OPQV): ENOSPC
mmal: mmal_port_enable: failed to enable connected port (vc.null_sink:in:0(OPQV))0xdd2800 (ENOSPC)
mmal: mmal_connection_enable: output port couldn't be enabled
ERROR:__main__:Exception while running joy demo.
Traceback (most recent call last):
File "/home/pi/AIY-projects-python/src/examples/vision/joy/joy_detection_demo.py", line 383, in main
args.enable_streaming, args.streaming_bitrate, args.mdns_name)
File "/home/pi/AIY-projects-python/src/examples/vision/joy/joy_detection_demo.py", line 307, in joy_detector
camera = stack.enter_context(PiCamera(sensor_mode=4, resolution=(820, 616)))
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 433, in __init__
self._init_preview()
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 513, in _init_preview
self, self._camera.outputs[self.CAMERA_PREVIEW_PORT])
File "/usr/lib/python3/dist-packages/picamera/renderers.py", line 558, in __init__
self.renderer.inputs[0].connect(source).enable()
File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 2212, in enable
prefix="Failed to enable connection")
File "/usr/lib/python3/dist-packages/picamera/exc.py", line 184, in mmal_check
raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Failed to enable connection: Out of resources
Please let me know if I need to add the code from these python files, but my best bet is it is too intensive. Using python 3.7.
you should enable the camera. In command-line type 'raspi-config' and then enable camera