10 Replies Latest reply on Feb 22, 2019 11:02 PM by mp2100

    New Python project using a BeagleBone Black

    angellxp

      I'm looking for directions/guidance for the best direction to take with this new project.

       

      I have a VNA that is controllable via Python/Pi-Visa and a network cable.  I also constructed a custom relay switching board so that I can test up to 32 connection points(using 16 relays) without reconnecting my VNA. The attached image is the 8Ch version I made.

      My question is if anyone has had experience with instrument control via Python and/or the BB Black, what direction should I take?

       

      Thanks

        • Re: New Python project using a BeagleBone Black
          shabaz

          Hi Jon,

           

          Is your Python program (that uses pyvisa) also running on the BBB, or on a different machine?

           

          If your board has one logic level input per relay then some general-purpose I/O library can be used to control it.

          If you wish to use Python, there is a BBB GPIO library that may help, I've not tried it but hopefully it should work.

          There is a GPIO API example here.

           

          The above assumes that your pyvisa based code runs on the same BBB that has the relay board connected. If you want to make your code general-purpose so it can work remotely too, then some client-server code can be used.

          There is a project by jancumps that you can use for that, called SCPI on a Linux Board. The code you write to control the I/O would be included at the instrument side of that project, and then it gets controlled in a similar way to your VNA.

          4 of 4 people found this helpful
            • Re: New Python project using a BeagleBone Black
              Jan Cumps

              My code i not hard to adapt to another relay board - even your home-grown - or a BBB.

              There's a limited piece of code that talks to the hardware. Where-ever you see a SPI call, replace it by the code to control your relays.

              Except for the SPI part, nothing is RPi or BBB specific. It's plain linux APIs.

              5 of 5 people found this helpful
              • Re: New Python project using a BeagleBone Black
                angellxp

                I'd love to be able to run this ALL from the BB with the only interaction being user input to tell it when to start. (push button for example)

                 

                At that point, the system could run in full auto stepping through each relay path one at a time. Switch, test, switch, test, and so-on until it finishes.

                 

                At each switching instance, I'd need to change the relay path and load the VNA with a new data file to test against.

                  • Re: New Python project using a BeagleBone Black
                    shabaz

                    Hi Jon,

                     

                    I think all of this can be achieved easily. First step would be to wire up the relay board to the BBB (using the GPIO API link earlier to see which pins are allowed - not all GPIO pins on the BBB are directly usable), and then use the examples there to prove that they can be switched on/off with the Python GPIO API. Next, take Jan's SCPI project, and include the GPIO API and swap in the GPIO commands in place of SPI that the code currently uses (or let us know if you need help with that, once you know the GPIO pin numbers mapping).

                    Now your relay board will be controllable just like the VNA. Then is straightforward to write code to wait for an input or cycle through connections.

                    4 of 4 people found this helpful
                • Re: New Python project using a BeagleBone Black
                  jomoenginer

                  Some instruments also have a serial interface and even a RESTful interface (although this does require a network connection) all of which can be controlled from Python. Some of new devices from Keysight require a Windows COM object to remotely control the instrument making it a bit interesting to using a non Windows system for connection.

                   

                  What interface does your Relay board use?

                  2 of 2 people found this helpful