Raspberry pi 3b
Standard Camera from Pihut
So, my grand idea is to have a camera taking still images (raspistill) that I can then stitch together later, to make a short movie seen out through the windscreen of our motorhome.
So I have managed to make a script that works perfect for this, if I run the script after booting and logging in to my PI.
Now, obviously I do not want to login to my pi to start the script every time, I want it to work as I power on my pi. Here starts my problems. After searching high and low, I have found that the way to do that in NOOBS (at least with still logging in) is to call the script in .bashrc - So I did. I can run every script fine, but if I want to use the camera I now get this error.
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC mmal: camera component couldn't be enabled mmal: main: Failed to create camera component mmal: Failed to run camera app. Please check for firmware updates
And if I try to close the script and restart it (or others with camera code) I keep getting this error until I reboot with out the script being run on boot.
I have spend a lot of time trying to figure out what I do wrong. I have even tried to make a separate script that I run from .bashrc that will then sleep 100 seconds (just to be extra extra sure) and then opens my camera script, still same problem.
What am I doing wrong? Is it just NOOBS that are unable to do what I ask or am I doing something completely wrong? My real goal is to have a script start when I power on the Pi, without logging in, that I can start taking pictures with a push of a button.
Here is the code of the camera script I use: (yes I am using raspistill instead of timelaps)
import RPi.GPIO as GPIO import time import os GPIO.setmode(GPIO.BCM) GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(24, GPIO.OUT) x = 0 def runner(x): print("***** RUNNER: " + str(x)) if x < 5: StorageLeft = os.popen("df -Ph /dev/sda1 | grep -Po '\d+(?=%)'").read() print("Storage left: " + str(100-int(StorageLeft)) + "%") for p in range(0,int(StorageLeft)): GPIO.output(24, True) time.sleep(0.5) GPIO.output(24, False) time.sleep(0.5) if x > 4: t = 0 while True: print("Picture: " + str(t)) os.system("raspistill -w 640 -h 480 -o /media/pi/TEST/" + str(t) + ".jpg") GPIO.output(24, True) t += 1 time.sleep(1) input_state = GPIO.input(18) if input_state==False: print("Break") break GPIO.output(24, False) time.sleep(4) StorageLeft = os.popen("df -Ph /dev/sda1 | grep -Po '\d+(?=%)'").read() print("Storage left: " + str(100-int(StorageLeft)) + "%") if 100-int(StorageLeft) < 99: print("***** Card full, script ended") break while True: input_state = GPIO.input(18) if input_state==False: x += 1 print(x) time.sleep(1) else: if x > 0: runner(x) x = 0