• Tags
  • Documentation
  • Order
  • Register
  • Login
Duet3D Logo Duet3D
  • Tags
  • Documentation
  • Order
  • Register
  • Login

Octolapse-Like Timelapses

Scheduled Pinned Locked Moved
General Discussion
9
29
6.0k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • undefined
    BeefyMcLargeHuge
    last edited by 5 Jun 2018, 20:25

    So I've seen a lot of people talk about Octoprint, a lot about cameras, a lot about time lapses...

    But I haven't been able to find anything that directly talks about getting an Octolapse type function on the DuetWifi- Octoprint or however.

    I am currently trying(not succeeding) to get a spare RPi I have to connect to my duet through USB, with a Logitech C920 for my camera. I'd imagine my problem has something to do with the fact that my Duet is trying to get power from the RPi or something- I don't know.

    1. Has anyone gotten Octoprint working on a Duet successfully? If so, how?
    2. Has anyone been able to achieve the quality time lapses that the Octolapse plugin his?

    As everyone in the previous threads relevant to this topic has pointed out, the DuetWifi is great and has everything I need- Besides timelapses. So if there was a way to do it without messing with the RPi, that'd be preferrable.

    1 Reply Last reply Reply Quote 0
    • undefined
      Phaedrux Moderator
      last edited by 5 Jun 2018, 20:31

      I would like to gain back timelapses as well. I haven't tried to run Octopi with the Duet. I use a Pi zero W running MotionEye as an IP camera that integrates into the DWC nicely, but there's no timelapse function.

      I haven't been able to find anything reasonable to get the functionality. One option that might work, but I haven't tried, is to use software that polls webcam streams and pulls a snap shot on an interval. I've found a few options, but they are fairly expensive.

      I would think that doing something like that would be rather easy on a Linux system like the RPi, I just haven't looked into doing it yet.

      Maybe I just haven't found the right Pi distro yet.

      I haven't used Octoprint in a while, can you tell me if the timelapse plugin can use an IP cam, or does it have to be a local USB device?

      Z-Bot CoreXY Build | Thingiverse Profile

      1 Reply Last reply Reply Quote 0
      • undefined
        resam
        last edited by 5 Jun 2018, 20:41

        I'm using a Cura PostProcessing plugin to inject the following on every new layer:
        M118 P4 S"LAYER CHANGE"

        Then I'm using a small Python script running on a Raspberry Pi that connects via Telnet to the Duet and listens (waits and reads) for exactly that string LAYER CHANGE. Now I can pull a snapshot image (mjpg-streamer for the webcam) and save it to a jpg file:

                r = requests.get('https://127.0.0.1/webcam/?action=snapshot', timeout=5, stream=True)
                if r.status_code == 200:
                    now = datetime.datetime.now()
                    with open(os.path.join('images', now.strftime("%Y%m%dT%H%M%S") + ".jpg"), 'wb') as f:
                        for chunk in r:
                            f.write(chunk)
        

        And at the end of the print, I use ffmpeg to render a timelapse movie:
        ffmpeg -r 30 -y -pattern_type glob -i '*.jpg' -c:v libx264 output.mp4

        Fairly simple if you know your way around a bit of Linux and Python programming.

        If you use firmware retracts and z-hops, one could avoid the M118, and simple pull a snapshot image on every Z coordinate change. YMMV.

        undefined undefined 2 Replies Last reply 5 Jun 2018, 23:41 Reply Quote 4
        • undefined
          Phaedrux Moderator @resam
          last edited by 5 Jun 2018, 23:41

          @resam That's great, that's exactly what I'm talking about. I suppose you could even duplicate the functionality of the OctoLapse plugin by adding a G1 to move the head out of the way before capturing the screenshot

          Z-Bot CoreXY Build | Thingiverse Profile

          1 Reply Last reply Reply Quote 0
          • undefined
            BeefyMcLargeHuge
            last edited by 9 Jun 2018, 14:11

            @resam I had the same idea using about using some sort of layer change to trigger a camera- Possibly through GPIO. I'm glad someone has done a lot of the footwork already- Thanks for sharing. I will try to do that this weekend! Would what you are describing be effectively identical to Simplify 3D's layer-change script field?

            @Phaedrux I was also thinking the same thing about using G1 to move it to the same spot out of the way for layer change. To me that was one of the major appeals of emulating the Octolapse plugin- they just look so cool. Next would be to figure out how to achieve the axis-animation effect

            I HOPE I can get to it this weekend. If I do I'll report back!

            undefined 1 Reply Last reply 9 Jun 2018, 14:30 Reply Quote 0
            • undefined
              resam @BeefyMcLargeHuge
              last edited by 9 Jun 2018, 14:30

              @beefymclargehuge said in Octolapse-Like Timelapses:

              @resam I had the same idea using about using some sort of layer change to trigger a camera- Possibly through GPIO.

              Yes, very similar approach. Instead of writing a message to the Telnet session with M118, you can use M42 to set a pin high & low (maybe with a G4 in between). The Duet and RPi are both 3.3V devices, so make sure you use the correct pins and voltage levels.

              Would what you are describing be effectively identical to Simplify 3D's layer-change script field?

              I never used this in S3D - but AFAIK the layer-change script sounds about right for this.

              1 Reply Last reply Reply Quote 0
              • undefined
                Railgunner13f @resam
                last edited by 10 Jul 2018, 04:52

                @resam I tried to use your example script but I do not know my way around python or Linux. I pasted what you have above in a .sh file, included the "#!/bin/bash" and ran the chmod to make it executable. But I get a syntax error.

                Can someone post an example script file that will create a jpeg every time I send a M118 S"snap" in my layer change script. If I see how that part works I think I can work out the rest.

                1 Reply Last reply Reply Quote 0
                • undefined
                  deckingman
                  last edited by 10 Jul 2018, 05:47

                  I'm by no means any sort of expert but if you are using python, can't you just search for "G1 Z" and by pass the insertion of "Layer change"? That's one way that I use to post process gcode files to insert colour change commands.

                  Ian
                  https://somei3deas.wordpress.com/
                  https://www.youtube.com/@deckingman

                  1 Reply Last reply Reply Quote 0
                  • undefined
                    resam
                    last edited by 10 Jul 2018, 05:51

                    @deckingman sure - but if you are using slicer-retract + zhops you might run into problems. And since I'm already doing post-processing, why not make it explicit?

                    But as far as I understand, the M118 insertion is not the problem @Railgunner13f has right now.

                    @Railgunner13f the code snippet I posted is a python script, so your shebang should be something like #!/usr/bin/env python3. You still need some glue code around that to open and read/write the Telnet connection (a simple TCP socket).

                    1 Reply Last reply Reply Quote 1
                    • undefined
                      deckingman
                      last edited by 10 Jul 2018, 05:59

                      Ahhhhh, that's true - forgot about Z hop ( don't use it myself).

                      Ian
                      https://somei3deas.wordpress.com/
                      https://www.youtube.com/@deckingman

                      1 Reply Last reply Reply Quote 0
                      • undefined
                        Railgunner13f
                        last edited by 10 Jul 2018, 06:29

                        Inserting the gcode is easy in S3d. my problem is the python script and telnet and glue? I am a mechanical engineer. I can modify some code but I cant write it outright.

                        1 Reply Last reply Reply Quote 0
                        • undefined
                          Railgunner13f
                          last edited by 11 Jul 2018, 00:33

                          I tried using telnet to connect to the duet. I can ping it fine. But the telnet fails. the Duet & the Pi are on the same wireless network.

                          --- 192.168.1.113 ping statistics ---
                          10 packets transmitted, 10 received, 0% packet loss, time 9007ms
                          rtt min/avg/max/mdev = 18.092/112.886/221.724/69.362 ms
                          pi@octopi:~ $ telnet 192.168.1.113 23
                          Trying 192.168.1.113...
                          telnet: Unable to connect to remote host: Connection refused

                          Danalundefined 1 Reply Last reply 11 Jul 2018, 02:03 Reply Quote 0
                          • Danalundefined
                            Danal @Railgunner13f
                            last edited by 11 Jul 2018, 02:03

                            @railgunner13f said in Octolapse-Like Timelapses:

                            I tried using telnet to connect to the duet. I can ping it fine. But the telnet fails. the Duet & the Pi are on the same wireless network.

                            --- 192.168.1.113 ping statistics ---
                            10 packets transmitted, 10 received, 0% packet loss, time 9007ms
                            rtt min/avg/max/mdev = 18.092/112.886/221.724/69.362 ms
                            pi@octopi:~ $ telnet 192.168.1.113 23
                            Trying 192.168.1.113...
                            telnet: Unable to connect to remote host: Connection refused

                            Do you have telnet turned on in your configuration?

                            M586 P2 S1

                            Or M586 with no parms to read current state.

                            Delta / Kossel printer fanatic

                            1 Reply Last reply Reply Quote 1
                            • undefined
                              Railgunner13f
                              last edited by 11 Jul 2018, 04:26

                              That was it! Thanks Danal. Now time for a crash course in python to figure out what to do with the telnet message.

                              1 Reply Last reply Reply Quote 0
                              • undefined
                                resam
                                last edited by 13 Jul 2018, 17:03

                                FYI: I created a tool to take timelapse snapshots on every layer change: https://forum.duet3d.com/topic/6058/timelapse-pictures-videos-with-duet-and-webcam-on-layer-change

                                1 Reply Last reply Reply Quote 1
                                • T3P3Tonyundefined
                                  T3P3Tony administrators
                                  last edited by 13 Jul 2018, 18:43

                                  Octolapse has now added a function to compare each picture and fire a warning if the difference is "too great"

                                  https://twitter.com/ppaukstelis/status/1017576602266370048?s=19

                                  www.duet3d.com

                                  1 Reply Last reply Reply Quote 0
                                  • undefined
                                    punamenon
                                    last edited by 10 Sept 2018, 08:43

                                    I'm working on similar. Instead of doing it every layer, I want to take the photos every 30 Seconds. Is there a way to trigger a macro to run based on a time interval?

                                    1 Reply Last reply Reply Quote 0
                                    • undefined
                                      resam
                                      last edited by 10 Sept 2018, 08:56

                                      If you want to make it every 30 seconds - what do you need a macro for? You don't even have to use a slicer plugin - just a simple script to take the picture on you webcam / Raspberry Pi:

                                      while True:
                                          takePicture()
                                          time.sleep(30)
                                      
                                      1 Reply Last reply Reply Quote 0
                                      • undefined
                                        punamenon
                                        last edited by 10 Sept 2018, 09:03

                                        Because I'm not using a Raspberry Pi, or a webcam. I'm trying to accomplish it all through the DUET.

                                        1 Reply Last reply Reply Quote 0
                                        • undefined
                                          AlexLin
                                          last edited by 10 Sept 2018, 12:10

                                          Use an mobile phone's audio jack (4 connections) and connect it to the Duet Wifi trhough an opto coupler. the pin connects the pin on the audio jack to ground (i think with 200ohm).Then the phone takes an image.
                                          The G-code is modified through a script that adds g-code on each layer that moves thehead to a fixed position toggles the pin.
                                          link text

                                          undefined 1 Reply Last reply 10 Sept 2018, 21:39 Reply Quote 0
                                          • First post
                                            Last post
                                          Unless otherwise noted, all forum content is licensed under CC-BY-SA