Lapse-Pi Touch – A Touchscreen Timelapse Controller

Thread: Lapse-Pi Touch – A Touchscreen Timelapse Controller

  1. Teajunkie's Avatar

    Teajunkie said:

    Tech Lapse-Pi Touch – A Touchscreen Timelapse Controller

    Whilst Browsing the web i came across this amazing idea!
    If i had the time and patience i would make this project.



    The Latest Raspberry Pi project.
    It uses the PiTFT Mini Kit, which is a 320×240 2.8″ TFT display and Touchscreen from Adafruit Industries that fits neatly onto my Raspberry Pi, to control a user interface to drive the back-end time-lapse script I showed you in a previous blog article.


    In that article, [Only registered and activated users can see links. ], I showed you some simple python code to drive the time-lapse rail by running the script from a laptop or smartphone capable of ssh’ing into the Raspberry Pi. The PiTFT allows me to take the project up a notch, by putting the user interface right on the Raspberry Pi, so no external device or connectivity is needed. Here’s a picture of the setup.

    [Only registered and activated users can see links. ]

    Functionality

    The User interface allows you to:

    • position the dolly on the rail via the motor control buttons
    • change the motor pulse duration between shots
    • change the delay between shots
    • change the number of shots
    • see what time is left for the current sequence
    • start and stop the time-lapse


    And it’s all done using a few simple screens with a simplistic, easy-to-use touchscreen user interface. The following video shows it all in action.

    As you can see in the video, there’s now a motor controller circuit in the mix to allow me to change the direction of the motor from software, rather than having to use a switch.

    Controller Parts


    • $35 – Raspberry Pi
    • $35 – PiTFT
    • $2 – DC-DC converter
    • $8 – Motor Controller (Dual H-Bridge circuit)
    • $10 Misc Connectors, transistors, etc.
    • $10 – 2 cheap acrylic Pi cases from eBay


    Total for the controller – round about $100.


    There’s now a guide covering the hardware in more detail at learn.adafruit.com

    Originally I had a laptop connected to the Pi via Wifi, and later on I had a smartphone do the same, but then I got my hands on a PiTFT, a shield that sits neatly on top of the Raspberry Pi. When I saw it on the Adafruit website, I knew I had to be quick, so 5 minutes later I had one on order, and five minutes after that they were out of stock. Shipping took a while, the order went in before Christmas, and to be fair to Adafruit, the package shipped the next day, but it took over a month to get here from the States. Small packages are usually a lot quicker than that.
    Anyway, when it arrived I started researching the best method to develop a Time-lapse User Interface. I looked a TKinter, and did a few sample apps. This was more suited to Xwindows development, and the controls were all very small and difficult to use with just your finger. Limitations in the controls also meant it was difficult to size them up to be suitable for the 2.8″ display. So I came to the conclusion that TKinter was not a suitable development environment for my needs.

    Then I came across the excellent “[Only registered and activated users can see links. ]” tutorial on Adafruit’s website by Phil Burgess. It’s implemented using PyGame, and the GUI looked really slick and simple to use, so I got my hands on the software, installed it and got it up and running. And the amazing thing is that it was all done in about 647 lines of Python! So, I dove into the guts of the code and saw that it was a very elegant method using PyGame to display icons on the screen and allow actions to happen when those icons are touched. Ideal for a simple user interface of a couple of screens, which is what I’d planned for the time-lapse GUI. So I set about tearing it down and adapting it for my needs.

    One of the main challenges was doing a numeric keypad entry. That would require lots of icons, and a method of displaying what the user was typing. So I started on that one. Photoshop is great for throwing icons together, and putting fancy effects on fonts, so I used something similar to the Adafruit Camera’s font, a white font with a thick black stroke, and a checkered, semi-transparent background for the touchable icons.

    [Only registered and activated users can see links. ]

    Next was the screen for the main display, which is what’s shown to the user when the time-lapse is running. This allows the user to start/stop the time-lapse, with another button for settings. Everything else on the screen is just information on the current status of the time-lapse.

    [Only registered and activated users can see links. ]

    The final screen is where the use can change the settings. For this initial version of the GUI, there’s only four settings that can be changed:


    1. The length of the pulse we send to the motor
    2. The delay before the next shot
    3. The number of shots
    4. The direction of the motor



    [Only registered and activated users can see links. ]

    For each numeric setting, there’s a touchable button which brings the user to the numeric keypad entry, where they can change the value passed in.

    There’s also two buttons for motor control, one for motor direction, and one to drive the motor. This is used to get the camera dolly into the correct position at the start of the time-lapse.
    Once you start a time-lapse running, it runs in a background thread, so you can continue to move about the screens and change settings. If you change any of the settings, they will immediately be reflected in the running time-lapse. I’m not so sure this is a good idea, so I might change that. Also, the motor buttons can also affect the movement of the dolly, so I think I’ll disable those buttons while the time-lapse is running.
    The code is based on the Adafruit PiTFT Camera tutorial by Phil Burgess, and I’ve taken the user interface portions of his cam.py application and used them for my time-lapse controller GUI, which I call lapse.py. Fits nicely with the name of the project, don’t you think?

    The Code

    The code is available [Only registered and activated users can see links. ], with installation instructions and prerequisites. It also includes all the icons needed for the touch screen interface.
    Documentation is generated from the docs directory on Github, but [Only registered and activated users can see links. ]. This includes a [Only registered and activated users can see links. ].

    [Only registered and activated users can see links. ]
    My decal venture has taken over my dog tag business
    nice to be busy though.
    Instagram and twitter @mrteajunke.
     
  2. WRATH OF BOD's Avatar

    WRATH OF BOD said:

    Default Re: Lapse-Pi Touch – A Touchscreen Timelapse Controller

    that looks cool bit of kit to use with Pi and time laps..
     
  3. dimitri's Avatar

    dimitri said:

    Default Re: Lapse-Pi Touch – A Touchscreen Timelapse Controller

    really impressive
     
  4. Mystical_2K's Avatar

    Mystical_2K said:

    Default Re: Lapse-Pi Touch – A Touchscreen Timelapse Controller

    very cool going to see if our boss is interested in making one of these for our next project
    You know he grew up as a little shitspark from the old shitflint and then he turned into a shitbonfire and driven by the winds of his monumental ignorance he turned into a raging shitfirestorm. If I get to be married to Barb I'll have total control of Sunnyvale and then I can unleash the shitnami tidal wave that will engulf Ricky and extinguish his shitflames forever. And with any luck he'll drown in the undershit of that wave. Shitwaves.
     
  5. Lou_smorals's Avatar

    Lou_smorals said:

    Default Re: Lapse-Pi Touch – A Touchscreen Timelapse Controller

    Wow, great, would love to do this if I had the time!
    Dear Lord, please grant me the ability to punch people in the face over Standard TCP/IP