We’ve got a good BrickPi build and have tested motors and sensors successfully in Scratch. We are having trouble programming the camera. We’ve tried Scratch and Python. Scratch doens’t seem to have all the necessary code elements. Python fails when “camera = PiCamera()” command is entered to create the camera variable.
We followed the instructions at https://www.raspberrypi.org/learning/getting-started-with-picamera/worksheet/.
We made it to the second portion on step 3 to the command “camera = PiCamera()” and that’s where we receive error messages. Can you help? We did look through all the related forum material.
Thanks,
Chris
Hello there,
sorry the camera’s not behaving. Could you post the exact error message that Python is giving you?
And are you using Raspbian for Robots or the default Raspbian image on your SD Card?
Also the camera preview will only work if you have an actual HDMI screen connected to the Pi. VNC will not let you do a preview. However it seems you’re experiencing the problem before that.
thanks.
Hi cleoqc, thanks for replying. Here is the error if I just start typing the commands into the shell:
https://drive.google.com/file/d/0B8fVS1Jyk9puanBlTlJhalNCY1E/view?usp=sharing
This is the error I receive if I create the file and run it:
https://drive.google.com/file/d/0B8fVS1Jyk9pud0I4X2E0Ny1xRXc/view?usp=sharing
cleoqc, we are using the default load on our card from Dexter Industries, which is Raspbian for Robots.
Thanks for the screenshot. It confirms what I thought, the Pi doesn’t see the camera. But before we blame the hardware let’s double check a few things:
I’m assuming you’ve done this section of the tutorial you linked to:
Does it still say that the camera is enabled?
Have you double check the orientation of the cable as in
Is the cable solidly in?
We have our own installation tutorial here. Please double check the orientation of the cable, both at the Pi level and at the camera level.
If you’ve double checked everything then I fear you may have a bad cable. Those camera cables are somewhat fragile. I have a stack of dead cables over here.
Good luck!
Cable was bad. We purchased a 300mm cable from a local store and we’ve successfully previewed and captured images with the camera.
Thanks CleoQc
thanks for letting me know the outcome. Sorry you had to deal with bad cables. They do break easily, best to avoid bending them too much. I have cables which croaked under a slight bend, others that have survived going into a pretzel. Who knows?
Glad you figured it out!
Cleo
Couple of small notes:
sometimes the Pi Camera won’t play nice and a reboot is required. It may not be the cable. Or it may be.
I’ve added camera support in Scratch for the BrickPi. Available to y’all on the next DI Update.
This topic was automatically closed after 24 hours. New replies are no longer allowed.