Allow configuration for sending triggers to a DSLR via GPIO instead of or in addition to taking a snap with an onboard camera. And/Or launching an external script which can trigger an external camera by other means.
I would like to make some super high resolution and quality timelapses with Octolapse. In the past I've triggered my DSLR via arduino and think my method/circuit can work with the Raspberry Pi GPIO as well.
Alternatively allowing a python script to be run when a snap is taken could be beneficial as some DSLRs can be hooked up to a Raspberry Pi or PC via USB.
This would be really helpful as the only way I've seen to have a DSLR show up as a webcam on a raspberry pi is with a $100+ UVC USB to HDMI converter
Cheers,
Brian
Octolapse Version: Octolapse 0.3.1
OctoPrint Version: OctoPrint 1.3.8 running on OctoPi 0.15.1
Diagnostic Logging was Enabled: YES_OR_NO
PUT_YOUR_DESCRIPTION_HERE
PUT_YOUR_DESCRIPTION_HERE
OS Name: OS_NAME_GOES_HERE
Os Version: OS_VERSION_GOES_HERE
Printer Model: PRINTER_MODEL_GOES_HERE
Printer Firmware Version: PRINTER_FIRMWARE_VERSION_GOES_HERE
Browser: BROWSER_VERSION_GOES_HERE
Browser OS: BROWSER_OS_GOES_HERE
Link to Gcode File: GCODE_FILE_LINK_GOES_HERE
Link to settings.json with all passwords removed: SETTINGS_JSON_LINK_GOES_HERE
Link to plugin_octolapse.log: LINK_GOES_HERE
Link to octoprint.log: LINK_GOES_HERE
Link to javascript console output: LINK_GOES_HERE
Screenshot/Video Links: LINKs_GO_HERE
If you like this project, please support my work by becoming a patron, and consider adding a 'star' to the repository. It takes a lot of time and effort to maintain the project and respond to issues. The cost of test prints, software, cameras, printer parts, etc. can quickly add up, so every bit helps. I'm currently saving for some additional test cameras in preparation for develiping multi-camera support.
Thanks for the suggestion! There are actually a few requests like this now, and I will soon combine them into one, and will close this issue out when I do. I plan to allow a few options: GPIO signaling, Send Gcode, Call bat/bash script, acquire from stream (current option).
I should have a dev build with external camera script capability soon. I've gotten it to work on Windows and now have to test the pi. I'm currently installing gphoto2, and next will be writing a bash script to take the image and save it to the snapshot folder. Let me know if you have any pointers, or if you'd be interested in testing the development version.
This feature is now working in the devel branch. It took some doing to get the bash script to work. I'm going to update the wiki soon with some tips on how to get it going. If anyone wants to test it out I can provide a sample .bat or bash script and some installation instructions.
Awesome. I'm not sure I'll have time this week to test but definitely willing to help!
Thanks!
That's great @FormerLurker I would be happy to test, if you agree.
Great! I'll post install instructions here as soon as they are finished.
I created some beta instructions for getting a DSLR working on pi with gphoto2. You can find it here: https://github.com/FormerLurker/Octolapse/wiki/Configuring-and-External-Camera
Please let me know what works and what does not. I appreciate any input you have on the guide, especially where things are unclear, or if I need to add more links. FYI, I did NOT run through the script from a fresh install of octopi, but that would be REALLY appreciated if you have the time.
Also, I just merged some pull requests and haven't had time to adequately test, so let me know if there are any problems with the plugin in general.
Thanks!
It works, just like what you instruct, well done @FormerLurker thanks.
I have some minor issue I will do some other tests and will list these issues later, one note you mentioned in the instructions this
`sudo apt-get install gphoto2``
there is additional ` at the end of the line,,, this made some delay for me ;)
Thanks.
Awesome, I'm very glad it worked for you! I fixed the issue you pointed out (extra `) and fixed the URL (changed and to an), but the old URL no longer works. Here is the updated link:
https://github.com/FormerLurker/Octolapse/wiki/Configuring-an-External-Camera
Thanks for your feedback!
Now the video quality is scary, I can use my DSLR camera instead of the low quality webcam,
the script works just fine, I noticed that when I aborted printing for two times the Octoprint restarted!, but when the printing completed fine, nothing happens to the Octoprint.
here is a sample
AI3M_test_20180724200049.zip
I am glad to be the first one to test :+1: :grinning:
Wow, that is insane! It's above the resolution of my monitor (4k), so I can't even see how good it really is without zooming in. You could probably crank up the bitrate in the rendering properties to get an even better image. Also, there is now a new rendering codex available thanks to @shadowen - H.264/MPEG-4 AVC, in case you haven't seen that. A fine combo if you ask me.
If you have the time, send me a video of an actual print. I would like to see more of these scary quality videos :)
Oh, and to my knowledge you are indeed the first one to test! Bravo and thanks!
Hi!
Thanks for this awesome update and your amazing work!
I wanted to try this setup and can't get it to work.
I'm using the "v0.3.3rc1.dev"-Version. The newer versions won't work with my new installation of octoprint.
Sadly the dropdown-menu does not exist in my interface. I tried reinstalling, updating and so on.
The only dropdown is in the normal menue. I can choose between "Default Camera" and "Logitech Camera" there.
Maybe you got an idea.
Jonas
@SmartnPrint, yeah there is no preset for this camera yet. You have to create your own profile. Go into the regular octoprint settings, then click the octolapse link (bottom left corner). Now find the camera tab in the octolapse settings and click create new profile and follow these steps: https://github.com/FormerLurker/Octolapse/wiki/Configuring-an-External-Camera.
You might be better off installing from the devel branch too. Several fixes in there. Here is the link you can use to install from the plug-in manager: https://github.com/FormerLurker/Octolapse/archive/devel.zip
Do that before following the steps above.
@FormerLurker Thanks for your answer!
Yeah, thats what i tried so far. I evaluated it one more time.
After pressing "Add Profile" I can type in a name and a description for the camera. Below that there is an area called "Webcam Setup". If i type in "External Camera - Script" as the name nothing changes. I also can not find the "Snapshot acquire Script"-field.
I'm currently running the 0.3.3rc2.dev0 version, as the newer one always fails to load: "No profile found - Internal Server Error".
I think that I am doing something wrong, but can't figure it out... Maybe you can give me one more hint.
Jonas
Version of Octolapse
Octolapse Version: Octolapse 0.3.3rc2
Version of OctoPrint
OctoPrint 1.3.9 running on OctoPi 0.15.1
So got this setup last night. No problems with detecting the camera or manually taking snapshops.
However every time I run a print a snapshot error occurs after the first snapshot. It seems like there's only ever 1 image in each folder created and thus rendering always fails.
Example of error:
Also the preview that's in that image is from the last complete print I did with the Pi camera
I've tried running it with both the sudo line in the *sh script uncommented as well as with the other line uncommented...
In the logs there's an error after trying to run the script about "Error output was returned from the snapshot script: [sudo] password for pi: ERROR: Could not get image."
I'm fairly certain sudo password is correct when I have it in there. I believe I set up everything as prescribed int the configuration page of the wiki.
Here's what my script file looks like
Attached is my log. I've also tried both timed and at layer change and it doesn't seem to work either
@SrgntBallistic, I'll create a manual download script for you to try, but it will take me a day or two. It might be either a script or a timeout issue (currently hardcoded to 5 seconds, but in the newest version there is a setting for this in the camera profile).
Thanks for getting this far with testing!
@FormerLurker dude this is giving me a hardon. I've just spent last hour looking online how to do this with a DLSR. I'm happy to beta test - i'm at your service!
I'll jump on the beta instructions page now and give it a go now. Let you know how I get on.
@SrgntBallistic and @jetsloth,
Some bugfixes/enhancements have been pushed to devel, so please try installing from this most recent commit: https://github.com/FormerLurker/Octolapse/archive/fd2ab947061ea2d1e8c36fd978039b89eb04754c.zip
As always, ctrl + F5 (or shift + f5) to clear your browser cache after reboot, else you'll get old script, and nobody wants that, lol!
Please check your new DSLR camera profiles after they have been created and crank up the 'Snapshot Timeout' to 10000 (10 seconds). That's outrageously huge, I understand, but the usb xfer of an ultra high res image is slow and sometimes unpredictable. While we're testing it's better to avoid a timeout error if possible. I need to improve the logging and error reporting too to make debugging somewhat bearable. I'm working on a 'test script camera' button that should be very helpful for this purpose.
@SrgntBallistic, adding the late download option is quite tricky as it turns out. It's much easier to defer until the end of the print and download all at once, though that too has its challenges. They will be overcome, but I wanted to let you know I haven't forgotten about it.
Thanks!
@FormerLurker thanks for they update and work you're putting in. Hopefully finishing up a project tonight and can try the new version.
@FormerLurker OK got it setup and 90% working.
If I have the snapshot delay at 0 nothing happens (no photo), but a value in there and it holds for ages (5 seconds like you mention) and takes the shot. It's kind of like the new user-defined delay option gets ignored.
SO i'm getting it to actually take multipple photos and stores them all in job folders in the temp dir. Just ran a full test print and finished with 67 photos and completed. However was getting snapshot errors the whole time so rendering did not happen.
Cannon 70D. Running the save time-lapse to Dropbox plugin also.






Hope that helps, the images are amazing qlty!!!
This is going to be mindblowing when it's stable!
@jetsloth, did you use the link I sent to install? Your interface does NOT look right (the icons should be different, you should have multiselect camera options on the tab). Either reinstall from the link I posted in my previous comment, or try pressing ctrl+F5 to refresh your cache.
Once this is done your screen should look like this:
Also, the error popup (failed repeatedly to capture camera.....) I think is from the built in timelapse plugin.
Go back into your camera settings. Now you should have 2 options: Delay and Timeout. Your delay should be at 0 and your timeout should be at 10000.
Try that and let me know how it goes.
@FormerLurker Sorry yeh By the time I posted that last message I had then seen the updated Link. New interface is correct now. Will try it again. Set to 10000 timeout and 0 delay.
@jetsloth, that's cool! These versions are changing so fast it's a wonder anyone can keep up :)
Also, I was looking at the first error message and you might want to double check your password in the snapshot script to make sure it's correct if you encounter more errors.
@FormerLurker Could imagine! Looking good brother, the updates are working. I've got my C920 running along with the Cannon 70D (it's freezing in the garage so nicer to watch whats happening in the office :D)
3 Shots in, no errors.....snaps below. I'll let it go (short print) to see if it complies into a render.




@FormerLurker it worked! Nicely done mate. ZIP of render attached. Few things I've found:
The render worked, but took about 5-10minutes to render out the 65 images - I was shooting at like 5000x4000 px res so makes sense. Each shot would of been around 5-8MB. I'm scared to think how long a 40hour print would take to render. I'm not sure how to tackle that one besides perhaps setting the camera to shoot at a more reasonable say 2000px wide res?
The final mp4 was only like 22MB which is amazing given the quality of each shot
Sorry I started moving the camera around - my bad
Whilst the camera was being moved, the video looks a bit uneven. Some frames stay on for longer etc. This could just be the delay or timeout? Or missed frames?
Lighting, fairly sure it's on my end, but wanted to check if you're doing any lighting effects liek auto exposure etc? Seems to flicker a bit. Could be the lens grabbing different lighting focal areas per shot - aka ISO set to Auto on camera.
Regardless, great work mate. Let me know if you want to test further.
Video and log attached.
LogitechCamMount_20180809024109.mp4.zip
plugin_octolapse.log
@jetsloth, at least there were no errors! I'm not sure what is going on with the jerky video. I will look through the log to see if I can find out what is going on. Even if there are missing frames, it should just skip over them. It shouldn't appear to jerk like that, unless for some reason the same image is being copied down from the camera each time. I'll definitely take a look after work.
Regarding the rendering time, remember there's going to be a lot more images than 65 if you use pre or post roll (first and last image gets copied to fill out the video length), but yes it takes an enormous amount of time. I'm thinking of adding a setting for 'number or rendering threads'. My pi has plenty to spare, and it should decrease rendering time in a roughly linear way.
The lighting is all controlled by your camera. I recommend setting everything to manual. On my Nikon the trick to simple and fast configuration seems to be to set the camera first to 'auto' mode, then half press and allow the camera to focus. Then turn auto-focus off and switch the camera to 'manual'. At least on my camera the current settings are retained when I switch to manual mode (you'll have to test yours out). This give me a much more stable image, and each snapshot completes more quickly. Also, having more lighting and lower exposure seems to help as well.
If you wouldn't mind, maybe you could try to capture a timelapse from both your webcam and your DSLR at the same time? I'd like to know how that goes as well.
Thanks for your help thus far!
@jetsloth, I couldn't help myself and took a peek at the log. It's still reporting an error when downloading images, (seems to be reporting a password prompt) though I'm not sure if it's legit or not. Maybe you could paste in your script and just replace your password with random letters? It's possible there is some small error.
There were two definite errors though:
* Error
Canon EOS Half-Press failed (0x2019: PTP Device Busy)
ERROR: Could not capture image.
ERROR: Could not capture.
Error (-110: 'I/O in progress') *
Hmmm.. I wonder how this happened. It occurred two times, fyi.
No stress mate. The logitec already captured the video at the same time, that went to plan as normal. See here https://www.dropbox.com/s/ziupd59ovn60l9s/LogitechCamMount_20180809020633.mpg?dl=0.
The quality is crap for some reason. I think that's the normal Octo timelapse doing that as I had to edit the config file to get the higher res out of the C920. It was oringally set to like 600x800 from memory. So yeh ignore the quality. I always use Octolapse version and not the default Octoprint one.
FYI quality of the default timelapse is always like this, and when I changed the config file on the pi. It's not due to any Octolapse updates. Started happening when I got the C920.
As an example see another Octolapse VS default timelapse:
Octolapse: https://www.dropbox.com/s/do7gp27cmcvqxam/TRex_Ribs_Left_20180808121523.mp4?dl=0
Default: https://www.dropbox.com/s/sbjyqxlv68ucxjl/TRex_Ribs_Left_20180806142753.mpg?dl=0
Yeh I've got it on manual setting. Lens was on auto from memory but next run i'll set everything to manual so there's no auto functions at play to change per shot. Fix all the settings in.
No stress, happy to help, awesome project. I'll be signing up as a Patreon to say thanks!
@FormerLurker the script I used was from your example as is. Just updated my password.
That error may have been from me half pressing. I know I did that a couple of times during the print. To get focus as I changed angels on the camera. SO that is more likely me.
Next print I'll do I'll leave it and not touch it so I dont become a variable hahahah.
Sorry I'm no good at markdown!
SNAPSHOT_NUMBER=$1
DELAY_SECONDS=$2
DATA_DIRECTORY=$3
SNAPSHOT_DIRECTORY=$4
SNAPSHOT_FILENAME=$5
SNAPSHOT_FULL_PATH=$6
if [ ! -d "${SNAPSHOT_DIRECTORY}" ];
then
echo "Creating directory: ${SNAPSHOT_DIRECTORY}"
mkdir -p "${SNAPSHOT_DIRECTORY}"
fi
echo "I_love_sloths_lol_but_seriously" | sudo -S gphoto2 --capture-image-and-download --filename "${SNAPSHOT_FULL_PATH}"
if [ ! -f "${SNAPSHOT_FULL_PATH}" ];
then
echo "The snapshot was not found in the expected directory: '${SNAPSHOT_FULL_PATH}'." >&2
exit 1
fi
@SmartnPrint, It's been a while since we've talked, and I am wondering if you ever got things straightened out. If not, please try upgrading Octolapse inside the plugin manager with this URL: https://github.com/FormerLurker/Octolapse/archive/fd2ab947061ea2d1e8c36fd978039b89eb04754c.zip
My guess is that your browser was caching the old javascript, so be sure to press ctrl+f5 to reload your javascript after you restart. You should now see the new options in the camera profile.
@FormerLurker Dude this is looking sexy as $^*$^&!!!!! Ok so got late last night, was up till 4am working/playing with it hahahaha.
This morning setup another dry run.
Default OctoPrint timelapse
https://www.dropbox.com/s/gzm1sn8ixqc2wgc/Benchy-CR10_20180809103700.mpg?dl=0
C920 Octolapse timelapse
https://www.dropbox.com/s/55mhb779pu7lcxo/Benchy-CR10_20180809124801.mp4?dl=0
Cannon70D Octolapse timelapse
https://www.dropbox.com/s/d9zjf5jxfi1oed8/Benchy-CR10_20180809124801_1.mp4?dl=0
Going to try a real print now. Will post results.
@jetsloth, smooth as butter! I appreciated the comparison with a regular timelapse too, that does provide a nice contrast. Is there any way to get your DSLR video in 4k? 720p was the best quality I could view on YouTube. Can't wait to see a longer print!
Na the only camera I have in 4k is the gopro...I wonder if that's on the cards next hahahah.
I'll try 1080p?
@FormerLurker OK have increased image resolution to around 3500x2500 for each image. Says each image will be around 8MB. Over a 5-7 hour print that's some serious rendering. See how it goes. Works fine on lower res.
Your intention to try support 4k?
Ah, yes. I misread your resolution. I don't think GoPros (at least not all) support direct capture, but it's worth a shot!
@jetsloth, I know it is possible. I've seen some posted, but no idea how long it will take to process on a pi. I'm thinking about adding a progress bar. I'm definitely going to add a thread count option.
@FormerLurker Yeh progress bar would be good, first print failed (bad first layer) and the video is still rendering out the 2 shots at that higher pixel count.
The quality of the 3 frame video is great tho! I might stick with it - prob take an hour to render tho.
@FormerLurker If this live print test goes ok, might try 2 Cannon cameras connected at once.....
@FormerLurker Great results mate. The original print I started would of been great but failed early on (extruder jam). Defaulted to a quick benchy for a test.
The possibilities are endless now. It's more like a photography shoot, lighting, backdrop, zoom, lens choice, multipale angels etc. I'm excited to see how I can step up the quality of the timelapses from a creative point from here on in.
Results below.
Default
https://www.dropbox.com/s/wo7kxllo5q9oei0/Timelapse3DBenchy_20180809165317.mpg?dl=0
Octolapse webcam
https://www.dropbox.com/s/8y3irnwhz0d6zvh/Timelapse3DBenchy_20180809191133.mp4?dl=0
Octolapse Cannon70D (sorry moved the camera a couple times)
The original quality version in zip here https://www.dropbox.com/s/dur18hvegm6ptmb/Timelapse3DBenchy_20180809191133_1.mp4.zip?dl=0
Notes
Questions
Thanks, and I'll keep playing!
@jetsloth, you don't want to turn down the timeout. This is just the maximum amount of time Octolapse will wait to acquire an image from your camera. If the timeout is too low, the snapshot script will be cancelled, and your print will continue without taking a picture.
The key will be to reduce the time it takes to actually take the photo via GPhoto2. I've been playing around with it and haven't yet figured out a way to do it, but I DO notice that it takes a lot longer to initiate the snapshot than I think it should. There may be some initialization step that can be made manual. I'll let you know what I find.
Regarding a timelapse track (as in your examples), there may be a way to do this with the snapshot script. You're not the first person to suggest this, so I'll think about the easiest way to implement it.
I'm also thinking about adding libgphoto2 to my project, and using python to interact with a DSLR. This would allow for much more flexibility (and no fumbling with scripts). I'll play with it a bit and see if it can't be worked in.
Also, your timelapses are looking good! You will have problems if you try to use two connected DSLRs with the sample script (take-snapshot.sh) you are using. It autodetects the camera, and you'd need to specify which camera you are using. You probably would be better off creating two scripts and using GPhoto2 to specify which DSLR to use in each script. I can look up the option for you if you want.
Email me at [email protected] and I'll hook you up with access to my discord server. That's probably a better place to chat about various tweaks. @Shadowen, feel free to email me also and I'll send you a link for discord as well.
@jetsloth, I added a setting to control the number of rendering threads. It's in the 'advanced' section of the rendering profile. I also redid a bunch of the validation, so let me know if you have any problems.
You can try it out by installing from this URL: https://github.com/FormerLurker/Octolapse/archive/7280a1a28785ea18356cb5737bdec4c848cd442c.zip
@FormerLurker Legend, I've just got a print going ATM so will give that a whirl when it's done.
The print itself is a bit meh in quality, but the lapse is looking very dramatic indeed. I'll post results again when done.
Tried the 2 camera setup last night, but lucked out, my second cannon camera has USB issue so wouldn't auto-detect. Will try again once I've got my camera repaired or access to another. So might email and hit you up for that second bash script if that's cool?
So re the threads, what does this control? Quality?
Small print captured with my Nikon D40 works very well
Turning the number of threads up to the number of CPUs (cores really)
should improve your rendering speed :)
On Thu, Aug 9, 2018, 8:46 PM jetsloth notifications@github.com wrote:
@FormerLurker https://github.com/FormerLurker Legend, I've just got a
print going ATM so will give that a whirl when it's done.
The print itself is a bit meh in quality, but the lapse is looking very
dramatic indeed. I'll post results again when done.Tried the 2 camera setup last night, but lucked out, my second cannon
camera has USB issue so wouldn't auto-detect. Will try again once I've got
my camera repaired or access to another. So might email and hit you up for
that second bash script if that's cool?So re the threads, what does this control? Quality?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/FormerLurker/Octolapse/issues/187#issuecomment-411941600,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIJ8Nz28iEfZ-sH5XtM68gKMNKkN_1FRks5uPNgDgaJpZM4VGzJ3
.
@FormerLurker OK installing update, will try an updated print with higher quality on camera.
Latest print. Camera battery ran out at the end! Doh! 12 hour print.
Webcam
https://www.dropbox.com/s/1tcmvkdscltrjq8/NEW_Elephant_20180810121708.mp4?dl=0
I have no idea how I got the panning effect on the webcam ahahah, something must have been moving it. Looks cool tho, and plays on the other idea we spoke about yesterday.
DLSR
https://www.dropbox.com/s/jqb0zvun5sovsyk/NEW_Elephant_20180810121708_1.mp4.zip?dl=0
@Xenomorphdelombre, your fan is wiggly! Thanks for trying it out!
@jetsloth, that is some HQ video. Did that print finish? It looks like it was going to just fall off the bed, but in superb quality. Looks like you're going to need an adapter for your camera. I had to get one too.
Worked great for me on a Canon EOS T3i!
@FormerLurker
I'm not sure what's up. It seems weird to me people are able to get it working with a Canon 70D, T3i but I can't with a Canon 60D.
I tried bot the newest posted builds with the same result. The camera snaps photos either every layer or on the set intervals. However, the same error occurs every snapshot -
Error output was returned from the snapshot script: [sudo] password for pi: ERROR: Could not get image.
I did some more testing with manual command to gPhoto2 and found out captures triggered with either
gphoto2 --capture-image
or
gphoto2 --capture-image-and-download
never actually saved to my memory card.
So could that be why the snapshot script is erroring out with "Could not get image"?
The only way I've been able to get it to actually save to the memory card is using the following command before capturing an image:
gphoto2 --set-config capturetarget=1
Not sure if that could have anything to do with my problem or if I've just somehow misconfigured something...
I have a 7D at work I could try with.
@FormerLurker lol yeh the print finished but camera didn't last the distance. Yeh will need a power adapter. And yes very bad bed adhesion on that print! FML.
OK so I upped the threads to "10" and the camera res to 5472 × 3648
https://www.youtube.com/watch?v=X0UPoYJGm4g&feature=youtu.be
It's such high res my MacbookPro actually skips frames on playback and kills the RAM hahahaha.
Wow, that looks great! FYI, 10 threads probably won't give you optimal performance. If you're using a Pi3B+ you have 4 available cores, so 4 would be the max here. If you run with more threads than that you're going to probably lose performance due to thread switching overhead. However, I wouldn't print anything if you're rendering with all 4 cores :) I'm not sure if 3 or 4 would give you better performance, but that sounds like a fun test!
@jetsloth, I added a custom pre-render script option to the camera settings that should let us defer snapshot downloading until AFTER the print is complete, which should reduce the delay caused by camera saving to SD, then copying via usb to the pi. I have NOT had a chance to write a script that actually does the download yet, but I will try that as soon as I have time.
I also added a camera specific initialization script we could use to send settings to the camera at the beginning of each print, but I haven't written a script for that either :) One thing at a time.
@jetsloth, I forgot to mention, but I also added a new camera type that could be used to do what you suggested here:
More of an idea really. In addition to the DLSR I wonder if you could send another gCode which triggers the rotation of another stepper motor E1 or E2 for example. On the sending of M240 to trigger camera, send the stepper a signal to rotate X revolutions (user defined). The idea behind this is that the camera is mounted to the stepper, and the stepper is pushing along a track. Thus, introducing 180,360 timelapse or paning timlapse - examples here and here Somthing to ponder nontheless!
You can now send any arbitrary gcode via a custom camera gcode script (multiline should work too). If you can get it to work by sending gcode to the printer, I think this should cover it.
@FormerLurker sweet awesome thanks.
You can now send any arbitrary gcode via a custom camera gcode script (multiline should work too). If you can get it to work by sending gcode to the printer, I think this should cover it.
Is there a dev version I need to update to?
I've got a question. I have a Nikon 5300, I'm trying to setup via USB to pi 3b.
I have the latest Octoprint and lapse running; I've installed gphoto2 and the script. However, my camera will not display in Control webcam streaming or in Octoprint, so I'm not sure what I'm doing wrong. I do have the green gear in Octoprint, but no display of video.

In the script do we leave the parameters as $1, $2, etc, or change them?
@Lavarus,
However, my camera will not display in Control webcam streaming or in Octoprint
You won't get any streaming from your DSLR. Also, the 'Welcome to Octolapse' image is a placeholder until a snapshot is taken. Have you tried running a print with Octolapse enabled? Once your camera takes a picture the 'Welcome to Octolapse' image should change to the latest DSLR capture thumbnail. I'm planning on changing that placeholder to something a bit more reasonable so as not to confuse anyone.
Also, have you gotten your webcam to work with Octolapse at all? If not I suggest starting there and running a few test prints. Let me know if you need any help with that.
If you HAVE gotten your webcam working and know how to run a test print, please use the Test Mode Full Diagnostic profile, run a very small print (smaller the better else the log file will be huge), and if you don't get any snapshots send me your log file.
Thanks for posting your issue!
@Lavarus, oh, and you won't need to change the $1, $2 etc.. those are arguments passed into the script by octolapse (argument 1, argument 2, etc) copied into a variable for convenience and legibility.
I don't have a webcam unfortunately.
I tried a test print, with no luck. Octoprint says waiting to take a photo, and fails to render.

Does this look right?

@Lavarus , Can you post your plugin_octolapse.log file for me? You can download it from the 'Log' settings page within the Octoprint settings. Also, it looks like your nikon is setup to deliver raw (.nef) images. Switch to jpeg within your camera, since that's the only source image format Octolapse currently supports. Start out with a lower resolution and quality since you have to do some special things to get huge image files to work in a reasonable amount of time.
Also, you are running the script without any parameters, so it won't know where to put the resulting image or what to name it. You don't really need to do that anyway.
Also, while a print is running (test mode is fine) and after a few layers, take a snapshot of the 'Position State' info panel (I see you have it enabled). There could be other reasons (start gcode) that Octolapse is not triggering a snapshot.
Newb mistake by not switching camera to Jpeg. Done and lowered the resolution. Still not working.

Sorry, I need plugin_octolapse.log not octoprint.log. It looks like your start gcode is correct though, so that's great!
Okay
plugin_octolapse.log
That's the right file, but it doesn't look like you were using the 'Full Diagnostic - Test Mode' debug profile in Octolapse, so the log is mostly empty. Go ahead and change your debug profile, print a few layers, then cancel and send me the result (it will be MUCH MUCH bigger). Be sure to switch back to 'Test Mode' when you are finished. No reason to create more logs than necessary!
I wish the debug process wasn't as tedious for everybody. I'm investigating ways of delivering better error messages, but I suspect your problem is within the .sh file, and I'm still working on proper logging here.
Also, can you let me know when you installed the plugin and from what URL? This could be helpful info.
I just got the Pi, and Octoprint yesterday; Octoprint plugin from the repository. I got the Octolapse plugin from the zip you linked far above.
Here is full diagnostic:
plugin_octolapse (1).log
Can you try installing from this URL and trying again: https://github.com/FormerLurker/Octolapse/archive/eae5c49afe88ed2c3a4d490a92746b0f6b761e45.zip
It looks like the snapshot worked by looking at the logs, but there were some problems with error logging that (I think) have been fixed in the above build. You should see camera errors display in a popup window if they occur. Let me know the results of your next test, and post your log after it's complete.
I think we're getting close!
@Lavarus, I forgot to mention that you need to reboot and clear your browser cache (usually ctrl+f5) before the new version is completely installed and ready to use. Otherwise the javascript may be stale, and we don't want that!

Can't install without pip?
@FormerLurker Wondering if you had a chance to check out my last post?
https://github.com/FormerLurker/Octolapse/issues/187#issuecomment-412121794
Thanks
Yes, I rebooted and Ctrl +F5. Did it twice, same thing.
Uninstalling, and installing new worked.
@SrgntBallistic, sorry it's getting crowded in here, lol! I saw your original comment but forgot to reply.
gphoto2 --set-config capturetarget=1
Sets the capture target to SD for your camera apparently. The default is 'RAM' for mine, so no image ever gets put on the camera. This shouldn't matter for the 'download and capture' command since it will be downloaded either from RAM or from SD memory (but ram is faster).
Are you sure your password is correct and that it is surrounded in double quotes?
Try running this command (assuming your script is at /home/pi/scripts/ and is called take-snapshot.sh):
/home/pi/scripts/take-snapshot.sh 0 0.0 /home/pi/.octoprint/data/octolapse /home/pi/.octoprint/data/octolapse/snapshots/test test_image.jpg /home/pi/.octoprint/data/octolapse/snapshots/test/test_image.jpg
That should capture and download an image to /home/pi/.octorpint/data/octolapse/snapshots/test
Let me know if that works. You might also want to try installing from the link I sent to @Lavarus just a few minutes ago and check the 'Timeout' setting in the camera profile. Turn this up to like 10000 (10 seconds). There is no error message for a timeout yet in the logs (whoops...)
@Lavarus, you could try running that command too to double check your script.
It still isn't working in Octolapse. The camera does not take a single shot.
All the tests in the SSH console work fine, The script test above works and the camera takes a photo. Maybe it's my camera profile?

I found this cool way of taking snap shots:
https://www.youtube.com/watch?v=SvZjNSLXAJc
But then I got this error:

@Lavarus, is this line at the top of your script:
#!/bin/sh
if so, delete it (press backspace several times, there might be a hidden character) and re-add the line, being extra sure that you are ONLY adding the text above.
If this doesn't fix your issue, maybe please post it your sh file somewhere (Please replace your sudo password with nonsense characters, but leave the surrounding quotes please). It's best that you upload the file itself and do not copy/paste so as not to accidentally exclude hidden characters, though that works in a pinch.
Regarding the video, I've seen it and love it! However, using the pause gcode is totally not necessary since camera delay is built in, and the command will be suppressed by Octolapse anyway (if all is working as it should). If you want to use the gcode trigger just use the regular 'snap' command. You shouldn't need any camera delay for a DSLR unless you are using the trigger-capture command in gphoto2 (which I think you are not).
Remember to check that the sudo password doesn't contain any escape
characters :) That would be... awkward.
On Wed, Aug 15, 2018 at 6:19 AM FormerLurker notifications@github.com
wrote:
@Lavarus https://github.com/Lavarus, is this line at the top of your
script:!/bin/sh
if so, delete it (press backspace several times, there might be a hidden
character) and re-add the line, being extra sure that you are ONLY adding
the text above.If this doesn't fix your issue, maybe please post it your sh file
somewhere (Please replace your sudo password with nonsense characters, but
leave the surrounding quotes please). It's best that you upload the file
itself and do not copy/paste so as not to accidentally exclude hidden
characters, though that works in a pinch.Regarding the video, I've seen it and love it! However, using the pause
gcode is totally not necessary since camera delay is built in, and the
command will be suppressed by Octolapse anyway (if all is working as it
should). If you want to use the gcode trigger just use the regular 'snap'
command. You shouldn't need any camera delay for a DSLR unless you are
using the trigger-capture command in gphoto2 (which I think you are not).—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/FormerLurker/Octolapse/issues/187#issuecomment-413194391,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIJ8N9L2QfjP9Ayl_Jw2IvG9GnVsd7SXks5uRB_fgaJpZM4VGzJ3
.
Yes! That was it, somehow I was missing the # char. It's working!
One more problem though. The printer pauses for about 3 seconds while the camera is taking a shot. This seems excessive. I tried to change to custom image preferences and use manual focus, but I get an error:

Yeah, you won't be able to use the custom image settings with your DLSR. They interface with mjpegstreamer's control.htm page, which doesn't exist on your camera. I think I need to disable that for DSLRs right away (I thought I had actually, thanks for posting it). I am working on some auto-detection that would also have taken care of it, but it will be a bit before that is working properly.
You'll need to configure your camera manually, or you can create an initialization script (there is an option for that in the camera settings) and use gphoto2 to change the settings. I'm in the process of creating a guide for just this, and will post it to the wiki when complete (along with a few other guides).
Regarding the delay, it's probably due to gphoto2 taking a while. If you think it is slow now try cranking the resolution to the max. Download over slow USB definitely doesn't help.
However, there IS a way to defer downloading and to leave the images on the camera until right before rendering. There is a 'trigger-capture' command that returns as soon as the shutter closes and before the image is written to internal RAM/SD (I think...) I've created a script to download all of the images at the end of the print to the proper location and rename them to work with ffmpeg, which saves a ton of time and made capturing 6000x4000 images actually work for my slow camera. It still takes way longer than my webcam (just a few 100MS), but is MUCH faster than the capture-image-and-download method. Once you get your camera working well let me know and I'll walk you through the process of deferring download until right before rendering. You'll lose the snapshot preview, but it's worth it in my opinion for faster snapshots/prints.
@Shadowen, good thinking. I need to add this to the guide because 100% someone will do this. I'm trying to figure out a way to make gphoto2 --capture-image-and-download work without sudo so I can just package the scripts with Octolapse (though I guess I would need to run chmod on them) without requiring any user edits. I'm thinking maybe I could create a script that adds gphoto2 to the NOPASSWORD list somehow. I'm really paying for not learning Linux like I should have way back in the day.... Better late than never!
@FormerLurker Another successful test https://youtu.be/jhvMrc7CyOs (bar the camera battery running out right at the end - as usual)
Also tried the gCode sender script - worked perfectly. Just tested on existing extruder motor as I haven't done any custom work yet, but worked a charm.
I'll post more results of the 360 project as I progress.
@jetsloth, I'm glad the gcode worked. That's not been tested except through the virtual printer!
Nice quality.. thanks for testing it out!
These are some really cool improvements to octolapse! I am planning on using the external script to control the ws2812b LED strip in my printer cabinet, so that it can play colorful animations during printing but flash bright white each time octolapse grabs a frame :)
@ssvenn, I may need to add an 'On Before Snapshot' and 'On After Snapshot' to make this work unless you are using a DSLR. Since the snapshots are threaded and executed in parallel, it's possible that your flash will trigger after all or some of your snapshots are taken unless your delay is just right. Also, you'll want a way to turn the flash off after a snapshot is completed I'm guessing. I'll think about this.
Hi @FormerLurker thank you for all the hard work you have been putting in this thread. I am a total newbie, installed Raspberry Pi 3+ and Octoprint with octolapse. But I was following directions like an ikea furniture. I am trying to follow you tips, first question is so in order to work I have to have a beta version of octoprint installed (the one I probably installed is no good)? Second, how do I install the GPhoto2? Do I take the SD card from raspberry and plug in the computer then run my Mac terminal to type the commands you instructed?
I have a Prusa MK3 with raspberry pi 3+ (installed the main available version yesterday), octoprint and octolapse, both also installed yesterday. I am trying to connect a Canon 500D that I have laying around (i checked and it is compatible with GPhoto2).
I found a script that updates gphoto2 to the latest version for raspberry (That I need for my Canon M50)
So if you need a newer version just run follow the instructions on this page:
https://github.com/gonzalo/gphoto2-updater
Excellent, thank you.
From: tellblom notifications@github.com
Sent: Thursday, October 4, 2018 12:45:17 AM
To: FormerLurker/Octolapse
Cc: Lavarus; Mention
Subject: Re: [FormerLurker/Octolapse] [Request] DSLR/External Camera Triggering (#187)
I found a script that updates gphoto2 to the latest version for raspberry (That I need for my Canon M50)
So if you need a newer version just run follow the instructions on this page:
https://github.com/gonzalo/gphoto2-updater
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/FormerLurker/Octolapse/issues/187#issuecomment-426903640, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Aoa0GemdwjCBimDMyisqNFdSYD6FBIATks5uha59gaJpZM4VGzJ3.
@tellblom and @Lavarus, if you are running a newer version of Octopi, a change was made to Git that might break the gphoto2-updater script. If you run into an error about git and sudo, edit the script and change
if (git clone $branch_gphoto https://github.com/gphoto/gphoto2.git)
to
if (/usr/bin/git clone $branch_gphoto https://github.com/gphoto/gphoto2.git)
@zenomsn, I seem to have missed your comment! Sometimes I get overwhelmed and miss some, sorry. Check this video out for a detailed walk through, including installation of the latest pre-release.
Let me know if that helps!
@tellblom and @Lavarus, if you are running a newer version of Octopi, a change was made to Git that might break the gphoto2-updater script. If you run into an error about git and sudo, edit the script and change
if (git clone $branch_gphoto https://github.com/gphoto/gphoto2.git)to
if (/usr/bin/git clone $branch_gphoto https://github.com/gphoto/gphoto2.git)
It' worked for me :) But I change it anyway
Thank you @FormerLurker for all the time and effort to create this awesome tool, and for supporting the growing community!
Not sure if this thread is the right place, but I wanted to re-share a solution to a problem I encountered while getting OctoLapse + DSLR working. Hopefully it will help someone else.
I had a problem where my interface didn't match what was shown in the tutorials / guides. I couldn't find the 'Camera Dropdown' where you should add the DSLR Camera Profile, nor the Slicer Settings that were described for matching your print settings. The simple solution was that I was running an old version of OctoLapse - which I had installed through the OctoPrint Plugin Manager and assumed was the latest version - and all I had to do to fix the problem was to manually upgrade! I did it through the command line. The correct Camera Profile and Slicer Profile UI showed up right away and I was up and running.
Here's my first OctoLapse after getting DSLR triggering working
https://twitter.com/kpimmel/status/1050567112584904704
Hey @kimpimmel, thanks for your post! I've been having a lot of trouble rolling out the new version, but I am making steady progress. Thanks for sharing your video too! That is a difficult print to pull off with no artifacts. You might consider trying the 'high quality' snapshot trigger (I need testers). Here is a video explaining setup if you are interested: https://youtu.be/sDyg9lMqMG8
I spent some time a trying to do this myself a while ago and just didn't have the time! Thanks @FormerLurker for EVERYTHING to do with this!!
I've just got this working on a virtual printer whilst I am in the middle of a rebuild, however I would love to hear how to defer the download until the end of the print. Once I get the printer back into a single piece I will give the "high quality" a go as this would also be a real benifit!
Thanks again!!
@peterpetiesmith - I have a partially finished guide available here. Some of the guide is not finished, but it mostly involves testing the scripts. I will be reviewing and tweaking this guide for the next week or so, so let me know if you find any issues or comments. Let me know if it works too, and good luck with your printer rebuild! Also, I think you'll like the high quality mode. With that mode so long as your current slicer settings are entered into Octolapse and are exact, it should be pretty hard to tell which prints were made with Octolapse enabled and which without. Of course your mileage may vary :)
For anyone interested in learning how to use a DSLR with NO image download (best if you want to manually render your video), check out this draft guide. Again, this is a draft so some parts aren't finished, but it should be enough for the technically inclined.
@FormerLurker Thanks for the reply!
Funny you should mention the separate processing of the images in "post" as I think this is actually more in line with what I would like to achieve. I know my way around an edit so it probably makes more sense for me. All seems to work fine "your end", my 7D seems to only take every other photo when I CMD line trigger it which causes it to fail on time-lapse after the first photo with:
snapshot_script_error: The snapshot script failed with the following error message:
* Error *
PTP I/O Error
Hopefully it isn't too painful a fix for me.
Otherwise I noticed:
I noticed you create a file call initialize_camera_save_to_sd.sh and try to give permissions to initialize-camera-save-to-sd.sh in that no image download instruction.
Once again thanks for your implementation of this!!
@peterpetiesmith, regarding the IO error, my guess would be that your camera is still saving an image to SD, and can't be called to capture another snapshot until the first one is finished saving. Try manually calling gphoto2 --trigger-capture, wait 30 seconds and try again. If that fails, try again after 60 seconds, etc. If it doesn't start working after some period of time there is probably another issue.
Also, thanks for catching that file name error. I believe I have fixed it. I did a lot of copy/paste for that guide and knew I'd miss something :)
Also, if you develop any cool pre/post render scripts (or any others) that are useful, send them my way if you don't mind! Eventually I would like to have a library of pre-written scripts for users to play with. Also, let me know if you need any additional parameters to be sent to the scripts. There's a ton I COULD include, but I'm not sure what else could be useful.
So, this is an old issue that I'm going to close, but I wanted to first mention that the DSLR guides have been updated over the last 9 months, and a lot of the problems you encountered have been fixed. There are, of course, some problems for particular cameras still, but it's working now more and more. I recommend updating GPhoto2 to the latest version if possible, since lots of new cameras are being supported all the time.
If you continue to have issues, please open a new ticket and I will take a look.
Thanks for your participation!!!
Most helpful comment
I should have a dev build with external camera script capability soon. I've gotten it to work on Windows and now have to test the pi. I'm currently installing gphoto2, and next will be writing a bash script to take the image and save it to the snapshot folder. Let me know if you have any pointers, or if you'd be interested in testing the development version.