(SOLVED) Take snapshot with pi camera at print end?

What is the problem?
I would like to use event hooks to take a snapshot of the finished print a short time after the print finishes. The goal is to use some service driven by Node Red to send the picture to my phone via something like Twillo or send an email.
I suspect this is a RTFM issue so a pointer to the correct man page would be great.

What did you already try to solve it?
I searched the FAQs and forum posts and haven't found anything. I have searched the interwebs without success. I started by trying to use the command raspistill -o image.jpg but get the 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

Which, say the interwebs, is most likely caused by the fact that the webcam stream has ahold of the camera. A pointer on how to get around this would be helpful.

Logs
This isn't an error, so there is nothing to share.

Additional information about your setup
Ender 5, RPi 3+, Pi camera, latest everything, Assorted plugins (MQTT, TouchUI, etc.). SSH access no problems, works like a dream.

Thanks,

--Jeff

Let's start with a camera checklist

  • Is the CSI cable inserted the right way? The silvery contacts need to face away from the Ethernet connector!
  • Is the CSI cable fully seated?
  • Did you insert the CSI cable into the Display connector? It needs to be inserted into the CSI connector, which is the one closer to the Ethernet connector.
  • Is the other end of the CSI cable correctly attached to the camera board?
  • Is the camera activated in raspi-config?

You might have disabled one of the necessary things in your /boot/config.txt because you thought you wouldn't need them when running headless.

start_x=1             # essential
gpu_mem=128           # at least, or maybe more if you wish
disable_camera_led=1  # optional, if you don't want the led to glow
1 Like

Thanks for the quick response.
The camera is completely functional and streams without problem, so I don't think the cable, connector or raspi-config are the problems. I made no special changes to accommodate the camera in config.txt, but since streaming works perfectly, I don't think that's an issue either.
I have a print running with a timelapse and here is the first frame copied from the ~/.octoprint/timelapse/tmp folder:
LED_Clip_1_20200504235938-0
Obviously what I want is possible because the web stream is running and the timelapse is working simultaneously. I am in need a pointer on how those two things work together.
Thanks,
--Jeff

Alright I got your question wrong.
Yeah the camera is already in use by the mjpeg streamer.

Mjpeg streamer provides both. The snapshot is just one frame of the jpeg stream.

Why don't you just fetch the image from the snapshot url?

wget http://localhost:8080/?action=snapshot -O snapshot.jpg
3 Likes

Boom. I didn't know you could do that.
That gives me a solution to my problem.
Thanks!

1 Like

Great solution!
And, where is the image store?

In the current folder - if you cd into another folder it will be saved there.

you can also add a path to the output like

wget http://localhost:8080/?action=snapshot -O /tmp/snapshot.jpg

It works.
Thank you for your quick reply.

1 Like