6 Replies Latest reply on Oct 20, 2018 3:22 AM by kimaldis

    How to send lightroom data to arduino?

    niklassc Level 1

      Has anyone done this?

       

      I'm an industrial design student working on a project in school and I want a two way communication with lightroom. I want to have physical output (LED's, turning knobs) that sits on your desk next to your computer. Send commands from arduino is not a problem, i've done that already but i want output as well

      has anyone any advice where to begin, or anyone could help me out?

      I can program in arduino pretty good, and have some basics in python

       

       

      THANKS!

        • 1. Re: How to send lightroom data to arduino?
          johnrellis Most Valuable Participant

          (If you haven't already, download the LR 5 SDK, which includes complete documentation.)

           

          There are a few documented mechanisms for LR plugins to send data to external programs:

           

          - The LrHTTP module lets plugins invoke URLs with GET or POST commands.  Your external program could implement a local HTTP server to receive those GETs and POSTs from your LR plugin.

           

          - Your LR plugin could write to a log a file, which your external program could poll continuously for changes.  While this might offend those with more delicate architectural sensibilities, with a little tuning you can make this pretty responsive without costing too much in CPU.

           

          - Your plugin could invoke an external program via LrTasks.  If the external program is reasonably lightweight, you can do this perhaps several times a second without consuming excessive CPU.

           

          For receiving data into your LR plugin from an external program:

           

          - Your plugin can establish a URLHandler that will receive HTTP requests to "lightroom://" URLs made from local programs on your computer.

           

          - The plugin can poll the external program using LrHTTP using GET and POST commands.  The external program only responds when it has data to send, so the CPU overhead is low.

           

          - Your plugin could poll a log file written by the external program.  I haven't tried this direction, but it might be harder to tune such polling in this direction, given the limited capabilities of the LR SDK.

          1 person found this helpful
          • 2. Re: How to send lightroom data to arduino?
            johnrellis Most Valuable Participant

            Also, there is an undocument SDK module LrRemoteCommunication that appears to set up a simple two-way pipe with an external program, but no one has posted here how to use it.

            • 3. Re: How to send lightroom data to arduino?
              jarnoh Level 2

              If you are just prototyping, the easiest way might be to use separate layer for MIDI, since there is also easy solutions for using MIDI data on Arduino.  Several MIDI plugins and solutions exist for Lightroom, so you don't even need any Lua development skiils.

              • 4. Re: How to send lightroom data to arduino?
                Serhit Level 1

                Actually, while making LR module with Lua, you may use funcitons from io package, such as open a file and write to it.

                 

                Try it out - may be there is a way to associate file with a serial port and write into it, so Arduino catches these submissions and react as you want?

                • 5. Re: How to send lightroom data to arduino?
                  johnrellis Most Valuable Participant

                  LR 6 added LrSocket, which provides Unix-like sockets for communicating with local processes.

                  • 6. Re: How to send lightroom data to arduino?
                    kimaldis Level 1

                    The annoying thing about LrSocket is that it doesn't allow two way communication on a single port which makes question and answer communication messy. I ended up needing to  establish connections on 4 ports, two each for both "send" mode and "receive". And if you're sending a lot of packets over a short period of time - slider changes, for example - you have to figure out how to untangle the responses because there's no guarantee that the next data you get after a send is the actual response to the send.

                     

                    I'm no socket expert and there may be a good reason for this but LrSocket seems poorly considered to me. Getting popen pipes to work would have been better and simpler, surely.

                     

                    I believe, also, John that you can use LrSocket to communicate over a network. I'm pretty sure I had it running between an iPad and Lightroom running on a laptop.

                     

                    All that said, LrSocket is probably the fastest of all the methods, HTTP get & post probably the tidiest, if you can get an http server running in your process.

                    1 person found this helpful