element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
BeagleBoard
  • Products
  • Dev Tools
  • Single-Board Computers
  • BeagleBoard
  • More
  • Cancel
BeagleBoard
Forum New Python project using a BeagleBone Black
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join BeagleBoard to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 10 replies
  • Answers 5 answers
  • Subscribers 103 subscribers
  • Views 2072 views
  • Users 0 members are here
  • pi-visa
  • python
  • beaglebone_black
  • test instrumentation
  • BeagleBone
  • vna
  • bb_black
  • instrument
Related

New Python project using a BeagleBone Black

angellxp
angellxp over 6 years ago

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

Attachments:
image
  • Sign in to reply
  • Cancel

Top Replies

  • jomoenginer
    jomoenginer over 6 years ago in reply to angellxp +3 suggested
    Derek Molloy has some good examples of how to interface the GPIOs of the BB Black. Some of the example may be dated but they should still point you in the right direction. His source code that can be downloaded…
  • Jan Cumps
    Jan Cumps over 6 years ago in reply to shabaz +1 suggested
    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…
  • shabaz
    shabaz over 6 years ago in reply to angellxp +1 suggested
    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…
  • shabaz
    0 shabaz over 6 years ago

    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 Jan Cumps 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.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • jomoenginer
    0 jomoenginer over 6 years ago

    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?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • Jan Cumps
    0 Jan Cumps over 6 years ago in reply to shabaz

    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.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • angellxp
    0 angellxp over 6 years ago in reply to jomoenginer

    My Relay board has an on board relay driver per relay so all I need is logic H/L from the BB.  That part is easy enough.  Im just trying to figure out the Python side of things.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • angellxp
    0 angellxp over 6 years ago in reply to shabaz

    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.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • shabaz
    0 shabaz over 6 years ago in reply to Jan Cumps

    Hi Jan,

     

    I figured your code would be flexible enough : )

    It sounds like a perfect fit for Jon's requirements, with just a short exercise mapping from his relay board to the GPIO pin numbers, and inserting in the GPIO API above in place of SPI.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • shabaz
    0 shabaz over 6 years ago in reply to angellxp

    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.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • jomoenginer
    0 jomoenginer over 6 years ago in reply to angellxp

    Derek Molloy has some good examples of how to interface the GPIOs of the BB Black.  Some of the example may be dated but they should still point you in the right direction.  His source code that can be downloaded has some Python examples that might be of interest to you.

    http://exploringbeaglebone.com/chapter8/

     

    The Adafruit examples that were referenced previously are another good source of examples.

     

    What relay driver does the board use?  It is possible that you may find examples already created for the driver it uses.

     

    For a Python GUI, you could use wxPython or tkinter which would run directly on the BBB.  Or you could use something like Flask and Javascript and Python to publish a browser based application for remote control of the Relay board.  Then there is the whole NodeRed thing. 

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • Jan Cumps
    0 Jan Cumps over 6 years ago in reply to jomoenginer

    jomoenginer  wrote:

     

    Derek Molloy has some good examples of how to interface the GPIOs of the BB Black.  Some of the example may be dated but they should still point you in the right direction. ...

    His newly released Second Edition of the BB book should be up to date ...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • mp2100
    0 mp2100 over 6 years ago in reply to angellxp

    I just installed the adafruit_BBIO on a beaglebone black, the debian instructions work well.  The examples in that tutorial are very useful to get the python working.

     

    I'm also using raspberry pi examples, those are much easier to find, --> substituting BBB pin names of course (eg "P9_39").  It's working quite well.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube