Jump to content
Ultimaker Community of 3D Printing Experts
starbuck

Ultimaker 3 Octolapse-Style Timelapse

Recommended Posts

Hey everyone! I was inspired by a Facebook post to fork unlimitedbacon's Ultimaker 3 timelapse Python code to create an Octolapse-style timelapse. The Facebook post had printed hardware, a bluetooth shutter and a smartphone mount to do it. I used their idea and made it work by using the position that the UM3 parks in when switching nozzles. 

 

Octolapse is a piece of software that links into Octoprint to move the print head and/or bed out of the way to systematically take a series of pictures to make a timelapse. If you don't know what Octolapse timelapses look like, here are a few examples! https://www.instagram.com/adamsprints/  https://www.instagram.com/wildrosebuilds/

 

Check out the GitHub repository to see how to set it up. I don't go into too much detail about installing, but this thread might help more. If you have questions, I'd love to help out.

 

 

Here's a video of how well it works! I think this was the 2nd iteration of the script after I forked it. It's a little bit more refined now.

 

 

 

Feel free to clone the repository, submit pull-requests and check out the timelapses!

 

https://github.com/starbuck93/um3timelapse

 

Thanks for reading!

  • Like 1

Share this post


Link to post
Share on other sites

I like the timelapse script of unlimitedbacon and ported it to python 2.x because most of my devices uses python 2.x out of the box and there are only very few lines to change.

 

I also like the idea behind your fork, but I am not sure if it is really practical. I am not sure if it is good for the nozzle to heat up without filament or without flow, so could happen, that the nozzle will clog sometime. (ok could be fixed with a lower temp setting for head 2 in Cura).

And I assume the print time will increase drastically due the print core switch in each layer. But on the other hand, to use the switch position is great, print head is out of sight and the video looks great. 

 

Maybe only for some special prints, where time is not a factor. But very useful for prints where you use both cores anyway - there should be no additional increase in print time.

 

Thanks a lot, will definitely install it (after porting to 2.x) and use if for dual prints.

Share this post


Link to post
Share on other sites

The print time is increased by the nozzle switching. I increased an 8.5 hour print to 9 hours by adding the ghost tower for extruder 2 in the corner. I feel that is an acceptable amount of time for the reward. 

 

I haven't had any nozzle clogs yet but I've only done this a handful of times already. I suspect you're correct and that the 2nd nozzle will clog after a little bit of time doing this.

 

Also, I've added support for the Ultimaker S5 as well and I'm testing that right now with the print I mentioned above!

  • Like 1

Share this post


Link to post
Share on other sites

@cloakfiend yep! It uses the built-in API to access the required information including the camera. The original code just has a time delay for when it takes pictures to build the timelapse, but I wanted the head to move out of the way too. So I looked at the X and Y position when the printer changes printcores and does its thing and told my forked code to watch for that exact position. Therefore whenever the printcores change, we take a picture and build a timelapse!

 

Setting it up to work on any given computer should be fairly easy. I'm using a Linux server (Raspberry Pi) so it was not hard for me to set up. All you need to do is install Python 3 (latest) and install ffmpeg for your system. Then run the script on the command line with the IP address of the printer, the number of seconds of postroll you want (probably 1) and the output file like `timelapse_1.mkv` or something.

Share this post


Link to post
Share on other sites
1 hour ago, starbuck said:

All you need to do is install Python 3 (latest) and install ffmpeg for your system. Then run the script on the command line with the IP address of the printer

 

where do i run the script? where do the frames/video get saved?

 

p.s. your z screw looks like it could do with a clean!

Edited by cloakfiend

Share this post


Link to post
Share on other sites
3 hours ago, cloakfiend said:

 

where do i run the script? where do the frames/video get saved?

 

p.s. your z screw looks like it could do with a clean!

The latest code is on GitHub here https://github.com/starbuck93/um3timelapse. Use the "Clone or Download" green button and then click "Download ZIP". Or "Clone" it if you're so inclined! Go ahead and unzip it where you downloaded it, probably in the Downloads folder, or your Desktop or wherever. After that, go to the unzipped folder, and at this point it depends on your operating system. For Windows I'd say to run `cmd` and then all you'd do is `cd` to the unzipped folder and run `python3 timelapse.py 0.0.0.0 1 video.mkv` and let it run! It handles the frames automatically so you'll never see a folder full of pictures and the video is saved in the same folder you run the python script in.

 

3 hours ago, geert_2 said:

This concept should be integrated in the standard firmware, I think. Maybe best as an option?

  

That would be really cool. I suspect there would have to be support for saving to the USB stick as there is not much onboard storage for these types of things!

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for the info, your video inspired me so much I just went and ordered myself a gopro7 hero black!

 

I wanna give this a go badly!, been meaning to do time-lapses for a while but was too lazy, now I'm better I'm super motivated, just finishing up a sculpt first though!

 

 

Share this post


Link to post
Share on other sites

hi all,

 

i'm just trying to use this application.

 

i've installed python 3.7, downloaded both the GitHub files and ffmpeg, when i try to runt he command as stated in the installation guide i get this error message:

 

B:\timelapse\um3timelapse-master>timelapse.py 192.168.140.189 1 test.mkv
Traceback (most recent call last):
  File "B:\timelapse\um3timelapse-master\timelapse.py", line 4, in <module>
    from requests import exceptions
ModuleNotFoundError: No module named 'requests'

 

 

am i using the command wrong?

can you please help?

 

thanks. 

Share this post


Link to post
Share on other sites

Hey @PaulMiles! Here's the information in your error message that's important: ModuleNotFoundError: No module named 'requests'

 

To fix that, I'd use python-pip to install the package called requests like this

 

pip install requests

or "pip3" if just plain "pip" doesn't work for some reason. pip3 is the python3 specific version.

Share this post


Link to post
Share on other sites
16 hours ago, starbuck said:

Hey @PaulMiles! Here's the information in your error message that's important: ModuleNotFoundError: No module named 'requests'

 

To fix that, I'd use python-pip to install the package called requests like this

 


pip install requests

or "pip3" if just plain "pip" doesn't work for some reason. pip3 is the python3 specific version.

 

hi Starbuck!

that's great it worked!

 

but now when creating the video i'm facing another error, i think it's failing to use ffmpeg for some reason, not sure why.

 

:: Encoding video
ffmpeg -r 30 -i C:\Users\<username>\AppData\Local\Temp\tmp9ifx3knq\%05d.jpg -vco
dec libx264 -preset veryslow -crf 18 -loglevel panic test.mkv
'ffmpeg' is not recognized as an internal or external command,
operable program or batch file.

 

does the .exe need to be in the same folder of the script or something?

 

thanks again for your help :)

 

Share this post


Link to post
Share on other sites
3 hours ago, PaulMiles said:

does the .exe need to be in the same folder of the script or something?

 

Yes, I believe it does. It sounds like you might be using windows? You can either

  • copy the ffmpeg.exe to the same folder as timelapse.py
  • you can edit timelapse.py to include the full path to ffmpeg around line 126 starting with ffmpegcmd
    • ffmpegcmd = "B😕path\to\ffmpeg.exe ...rest of the line stays the same"
  • Or you can add ffmpeg to your PATH. (something like this https://www.java.com/en/download/help/path.xml)

Share this post


Link to post
Share on other sites

Thanks Starbuck

 

I'm getting closer! it's now creating a video but it doesn't show the build.

 

I have checked the temp folder where the the captures are saved and it has one image from when the print starts with the buildplate lowered and 30 images from when the print has finished, again with the build plate lowered.

 

It doesn't seem to be taking any captures during the print.

I think I have my file set up as you describe, dual colour with printcore 2 doing a dummy model 1mm x 1mm the height of the main model.

 

Any ideas?

 

Thanks

Paul

timelapsetest.thumb.JPG.745c41d46ab588292be4d337c55edada.JPG

 

dual.thumb.JPG.6dfd0e4fbb781b2a72859840aed66475.JPG

dual.JPG

Share this post


Link to post
Share on other sites
13 hours ago, PaulMiles said:

Any ideas?

 

Yes, I think I know what's going on. It's the (x,y) position of the head in the corner there. I mean the physical position of where the Ultimaker head parks, not the tall 1x1mm dummy object. I wonder if the coordinates are exactly the same as mine or if something like firmware or Cura versions change it.

 

Here's how to test it,

 

During the first couple of layers of your print, run this python3 test.py:  https://github.com/starbuck93/um3timelapse/blob/master/test.py after editing IP_ADDRESS in the script to be the IP address of your printer. While the (benchy, calibration cube, whatever) print is running like you have set up in the screenshot, the test.py script will output X and Y coordinates of the head. When the head is parked in the corner waiting for PrintCore 1 or 2 to reach the correct temperature to resume printing, check what the X and Y coordinates are. When I was testing, I saw the same coordinate set around 3 times in a row.

 

After that, in timelapse.py, go edit the location_check function (link to github) to have the X and Y coordinates you discovered with the test.py script.

 

For UM3 I found test.py output x213 y189 and I also saw x209.375 y193.0 several times too. I ended up with 213,189 in mine, but yours could be different.

Share this post


Link to post
Share on other sites

@starbuck You could improve the script and check if x and y is within a range to compensate small differences. But be careful you also need to manage that you already took a photo for this layer, because when using a range, your script will fire more than once. I would check also the z position and if you already shoot a photo for this z layer, then don't trigger again.

Share this post


Link to post
Share on other sites
10 hours ago, Smithy said:

@starbuck You could improve the script and check if x and y is within a range to compensate small differences. But be careful you also need to manage that you already took a photo for this layer, because when using a range, your script will fire more than once. I would check also the z position and if you already shoot a photo for this z layer, then don't trigger again.

I like your thought process here! Checking the Z position would be very helpful. Perhaps I can make a second script to "run once" and double check the values during a test print (calibration cube type thing).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

Welcome to the Ultimaker Community of 3D printing experts. Visit the following links to read more about our Terms of Use or our Privacy Policy. Thank you!