Тёмный

Lab Instrument Automation with Python 

Psychogenic Technologies
Подписаться 12 тыс.
Просмотров 12 тыс.
50% 1

Remote control and automation of test instruments helps you save time, minimize errors, and increase productivity. Streamline your lab’s workflow, and focus on what matters: research and development.
Here I'll show you how I optimize test and data collection from electronics lab instrumentation, using Python libraries from low-level basic access to the psytestbench instrument driver library I've been building and using internally.
The testbench/instrumentation library is now open-sourced, released under the GPL and available at github.com/psy...
It includes some documentation and many of examples. This library allows for code completion and a unified interface and support a few families of different instruments including oscilloscopes, signal generators, power supplies and multimeters. And thanks to VISA/pyVISA, SCPI, and the existing codebase, adding support for new instruments is very straightforward.
Realized I forgot to show that there's a good deal of documentation in the code itself, so with an object, say, "dso" you can just do
help(dso)
or
help(dso.channel1)
etc should give you some good clues as to what's available as well as show all the methods and params.
I did a short "live" demo, and discussed the circuit tested here in greater depth, on the last ‪@TheMakerCast‬ which also featured some cool robot action, tech talk and even a quiz--you can see here:
• Makercast - Episode 48
Links of interest:
pyvisa: pyvisa.readthe...
easy-scpi: pypi.org/proje...
psytestbench: github.com/psy...
makercast: / @themakercast

Опубликовано:

 

28 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 54   
@BBRR442
@BBRR442 2 месяца назад
You are the best! So great to see this complex work being executed so effortlessly and flawlessly. I hope to inspire to have the knowledge and tools that you do someday!
@PsychogenicTechnologies
@PsychogenicTechnologies 2 месяца назад
With enthusiasm like that, I'm certain you can match or surpass! Expect to get frustrated sometimes (I sure have been) but if you keep playing and exploring, you'll get wherever you want to go. Many thanks for the comment, cheers!
@andrew2004sydney
@andrew2004sydney Год назад
Awesome! Thanks for this video. My PSU and DSO both support this.
@PsychogenicTechnologies
@PsychogenicTechnologies Год назад
Nice! An idea how different they are from current implementations in the library? Assuming it isn't exactly the same hardware, let me know if you try stuff out and get anything working as-is and can be re-used or how different the command sets are.
@ErmaTurner-d6i
@ErmaTurner-d6i 6 минут назад
Rodriguez Jessica Anderson Timothy Walker David
@jstro-hobbytech
@jstro-hobbytech 9 месяцев назад
Our setup is way too similar haha. Youre much more learned ill add.
@PsychogenicTechnologies
@PsychogenicTechnologies 9 месяцев назад
hah, awesome--I was hoping that would be true, at least for a few (the cool kids, of course, lol). I think wisdom of the crowd (maybe just laziness!) lets us find and settle on solutions that are great quality/feature/price compromises for the particular expert-but-not-big-corp-budget niche, so we wind up with similar installations. And once that happens, we can leverage the community further, to extend and improve our common toolset--and that's why I put out the libraries, even though they are specific to my particular kit. So: thanks for the comment, means my impressions above might even be a little founded. And hey, even if it's just the two of us: hope you can get some use from the libs or even just the ideas. Cheers!
@daniellehoggarth9642
@daniellehoggarth9642 9 дней назад
Williams Richard Rodriguez Amy Martinez Paul
@tuqe
@tuqe Год назад
Great video again! I’d suggest something like “I taught my Oscilloscope to speak python!” Or “Building a team of robot lab partners” , really juice the algorithm
@PsychogenicTechnologies
@PsychogenicTechnologies Год назад
Thanks! And damn: I need to hire you to massage these into something The Algorithm will "surface"! :)
@tuqe
@tuqe Год назад
@@PsychogenicTechnologies Im cursed with this site being my main source of news/content/noise to make thoughts go away, you get real used to what the sidebar is trying to push this month
@PsychogenicTechnologies
@PsychogenicTechnologies Год назад
@@tuqe Yeah... I was prepping a trip to Paris and started getting news from twitter beforehand (things were looking a bit chaotic, lets say) and it diverted me into a few weird and not necessarily healthy sidetracks. Trip is done, and I'm feeling much better now ;-) Also, Paris was awesome, the vibe was great.
@eddietheengineer
@eddietheengineer Год назад
Really great video and thanks for sharing! I've been doing my best to learn python and have been slowly automating data collection with my Siglent oscilloscope for a stepper motor dyno/characterization test bench. It's so satisfying to have all the data collection and processing automated! I wish I had known about easy-scpi when I got started, that would have been helpful.
@PsychogenicTechnologies
@PsychogenicTechnologies Год назад
Thanks a lot! I know, it's such a great feeling to just "throw a switch" and have the system handle everything :) It's not just that I'm lazy (though there is that) but it's less error prone and it's given me more opportunity to try different stuff and see the impact. I've also had cases where some pretty sensitive analog ASICs wanted a slow ramp on, rather than an abrupt power-up (mostly they were fine anyway, but we had a very limited supply of these things), and being able to ramp up the PSU as part of the scripts was pretty useful. With SCPI and that library, it's been pretty simple to add in support for various devices. Which scope is it? I'd love to see just how different it is from the Rigol and am kind of itching to get more devices supported in there--if you'd be willing to try it out for me, I'd give it a go...
@HerbertBeau-z4r
@HerbertBeau-z4r 3 дня назад
Hall Karen Hernandez Dorothy Wilson Jeffrey
@BarbaraLovejoy-u6s
@BarbaraLovejoy-u6s 7 дней назад
Jackson Edward Jones Sarah Wilson Timothy
@CathyJordan-g2y
@CathyJordan-g2y 8 дней назад
Smith Elizabeth Perez Sarah Young Donald
@BeadellPadaraju
@BeadellPadaraju 7 дней назад
Davis Sharon Moore George Thompson Edward
@GlendaPhillips-f8r
@GlendaPhillips-f8r 9 дней назад
Robinson Joseph Anderson Cynthia Anderson Sharon
@HodgsonBroderick-e2z
@HodgsonBroderick-e2z 8 дней назад
Lee Michelle Johnson Nancy Brown Cynthia
@alejandroserranocapote7690
@alejandroserranocapote7690 11 месяцев назад
Hello, Im trying to figure out how to use easy-scpi for RIGOL 831 DC power supply. In the easy-scpi documentation it says that, for example, to set the voltage to 1V you have to write the following command: "inst.measure.voltage.dc( 1 )" that cames from [MEASure:VOLTage:DC 1]. Now im trying toadapt the command of the DC supply ":APPL CH1,5,1" that set the voltage and current of CH1 to 5V and 1A to easy.scipy code line. How can I do this? Sorry if something is not correctly explained but its my first time using PyVisa controllers and Im still learning how to use this stuff. PD: Great video.
@PsychogenicTechnologies
@PsychogenicTechnologies 11 месяцев назад
Hello Alejandro! Happy you liked the video 😀 So, the thing is, the actual commands are super instrument-dependent. Thankfully, Rigol is pretty good at providing documentation. I think, to set the voltage with your instrument, it'd be something like: inst.source1.voltage.level.immediate(1) to set it. I'm not certain. However I did find this: www.batronix.com/pdf/Rigol/ProgrammingGuide/DP800_ProgrammingGuide_EN.pdf Now you know why I wrap it up in higher level python abstractions, hah! So, I'd go through that, and try out some basic queries first, e.g. without the parameter: inst.source1.voltage.level.immediate() and see what comes back. Let me know if that gives you better results
@PsychogenicTechnologies
@PsychogenicTechnologies 11 месяцев назад
Note: am assuming your instrument is a DP800 series, in above--not certain that's the case. But if you can find the appropriate doc/command set, you should be good.
@rverm1000
@rverm1000 Год назад
been watching youtube videos on python for a couple years now. its the first time ive seen your video. thats cool you could automate like that. i heard of a guy in the army whenever he got a new piece of equipment he would connect to it with python. i was thinking it had to be very low level programming. had no idea there was even a library to use with those pieces of equipment. im an unemployed electronic tech at the moment. i got to test this out. i havent been to one job yet where they used python. the jobs ive been to they had programs from the 80's and 90's very hard to use. thats what prompted me to start learning python. the good thing about python is its so versatile. i have written lots of stock scanning programs and a few bots. the lastest program is working really well ,im able to find stocks at the right time and make money off of them.
@PsychogenicTechnologies
@PsychogenicTechnologies Год назад
Hello Robin, thanks for your comments. I didn't start out loving Python (I was coming from C/C++ and Perl--which tells you how long ago this was) but the "pythonic" way has grown on me and the language gets a lot of play around here now. One thing that I think will give you a leg up in your explorations is how low the barrier to entry is: it's easy to get setup and then, with REPL shells and no compile step, its really quick to experiment and get things right. I tweaked and debugged a huge chunk of a library of pick&place machine scripts just by loading up a shell and trying stuff out with live objects--that's really useful. And that's without mentioning the documentation and extra code and libraries floating around, which are both plentiful and excellent. You can easily do high level things of course but the language can be used in interesting ways to do very low level stuff too without it being a major pain. E.g. You want to play with the bits of network packets? Have a look at Scapy ( scapy.net/ )--nuts how easy it is to do some really fiddly stuff. Finally, if you don't know about them and you have lots of data to manipulate, visualize, process or share, look up "Jupyter notebook" and "Jupyterlab"--they are like interactive, living document-script-shell hybrids and allow for a lot of interesting python play. Data science people use them a lot... might be overkill for you now, really depends on where you're headed and might be interesting. Enjoy the exploration and learning! Cheers.
@vjyothsnapriya
@vjyothsnapriya 3 месяца назад
sir waveform generator connect to pc via LAN cable steps please help me sir
@PsychogenicTechnologies
@PsychogenicTechnologies 2 месяца назад
Hello. This really depends a whole lot on the specifics of the hardware. If it has a LAN port, you should be good with the tools described but the actual commands will depend on the device. If you figure it out, and maybe extend my library, let me know
@NNNILabs
@NNNILabs 7 месяцев назад
Automation is super cool till you realize you have nothing fun to do while a 15 hour experiment is running off of a Frankenstein Python script with elements copied from previous automation scripts...😵‍💫
@PsychogenicTechnologies
@PsychogenicTechnologies 7 месяцев назад
What? That right there is your excuse for... MORE EQUIPMENT! It's winwin!!1!
@bleeptrack
@bleeptrack Год назад
Super cool!
@PsychogenicTechnologies
@PsychogenicTechnologies Год назад
Thanks! Might be useful when you're doing bring-up/testing a batch of the next project (hinthint... still hoping for a new run of bleeptrack.de/projects/picoplanet/ btw, heh)
@marcinelektronik3005
@marcinelektronik3005 Год назад
Gooood video 🙂 thanks from IC maker
@PsychogenicTechnologies
@PsychogenicTechnologies Год назад
Thanks! I hope the techniques, the device driver library or even just the idea helps investigate/improve/invent cool things :)
@zdenkostanec1622
@zdenkostanec1622 Год назад
Cheers Pat! Super nice work! 😎
@PsychogenicTechnologies
@PsychogenicTechnologies Год назад
Gracias! Let me know if you end up using any bits of it and, especially, if you have any problems.
@jackhowardbourne
@jackhowardbourne Год назад
Awesome, thanks for sharing
@PsychogenicTechnologies
@PsychogenicTechnologies Год назад
Thank you Jack for the feedback! Hope it's useful: I'd love to hear if you use the lib, have the same or compatible equipment or anything. Cheers
@sg6610
@sg6610 6 месяцев назад
Reminds me of testing avionic equipment with FAPA that was pre-built, but similar concept - computer ran pretty much everything and the technician only did adjustments and part replacement.
@PsychogenicTechnologies
@PsychogenicTechnologies 6 месяцев назад
I use it a ton, mostly for data gathering and this kind of repetitive/automateable test sequence. Think I'm going to need to upgrade my DMM, tough--it works fine, the precision is fine, but the weird, non-SCPI uart type protocol and the reading refresh are a bit on the slow side. Couldn't figure out what FAPA is... "Future & Active Pilot Advisors" ?
@sg6610
@sg6610 6 месяцев назад
@@PsychogenicTechnologies F-15 Adapted and I can't call the rest...not out there, that's surprising...probably is, just need to be specific. Also, what is the cheapest DMM or meter or scope device you can buy to start learning this stuff? I know many coding languages, but this could be useful...I'm learning python, but had been focused on assembly and embedded systems. THANK YOU again for the video.
@PsychogenicTechnologies
@PsychogenicTechnologies 6 месяцев назад
​@@sg6610 Hi! DMM: I have a friend, went out a got himself a used fluke, 'cause he wanted dashit but you know it's crazy expensive, so he wound up with... a non-functional DMM. Honestly, just go for a unitrend/uni-t model, they make really decent stuff... once you want something high performance that'll last years, you can do some shopping, get a bigger name, faster, more automation, etc. Scope wise: I started with an old analog 20MHz o'scope back in the day and it rocked my world. But now... depends what you want to play with, lots of options. If it isn't too high freq, and you want to just see how far you get, go for a USB/computer scope. I still have a bitscope around, good for carrying with, get 2 analog channels and a handful of logic probes, it's ok. Otherwise, an entry level Rigol is hard to beat. Hope that helps, have fun!
@stewartmackenzieindaba
@stewartmackenzieindaba Год назад
v.good!
@PsychogenicTechnologies
@PsychogenicTechnologies Год назад
t.you! :D
@spehropefhany
@spehropefhany Год назад
Cool, Pat! What would you recommend for creating test instruments with LXI/SCPI interface?
@PsychogenicTechnologies
@PsychogenicTechnologies Год назад
Oooh, creating the instrument side is a pretty interesting challenge. Getting the LAN/Ethernet interface isn't a big deal, but even if you're not going to join the consortium and go for compliance/cert and you only want to implement the minimum interface ("functional class C", which I think implies LAN and web interfaces, discovery and basic driver), your first step is going to be a whole lot of reading. Thankfully, it looks like the specs are pretty easy to access and you begin by having a look at www.lxistandard.org/Documents/Specifications/LXI_Revision_1_0.pdf and, I sure haven't gone through all of these but this does look like a very interesting resource www.ivifoundation.org/specifications/default.aspx
@PsychogenicTechnologies
@PsychogenicTechnologies Год назад
Addendum: you may be able to get a head start with some open source instrument implementation library--I don't know, haven't checked what might be available... but you'll still want some good knowledge of what needs to be implemented and why, so... yeah: lotta reading :)
@spehropefhany
@spehropefhany Год назад
@@PsychogenicTechnologiesThanks, I’ll go do some reading!
@obeygiantrobot
@obeygiantrobot Год назад
Nice rigup
@PsychogenicTechnologies
@PsychogenicTechnologies Год назад
Thanks! Took me some time to get this all together, now it's fun to use and everything's pretty well integrated (mostly... the DMM is a weirdo, and RF stuff is still on its own).
@cessromer7078
@cessromer7078 8 месяцев назад
You should write a python. Script to show the plot in real time . Vere usefull stuff. Also have you measure the output voltage of a pressure sensor when released at the ms ti.e?
@PsychogenicTechnologies
@PsychogenicTechnologies 8 месяцев назад
Hello Cess! Hm, realtime: you're right, I usually just collect lots of data then make plots, but it would be nice to see things as they happen. I'm not all that good with the GUI stuff, but I think a little something would be very useful. As for the pressure sensor, I haven't had occasion to use much of that nature (unless you count load cells). What are you using, which sensor, and what are you doing with it?
@cessromer7078
@cessromer7078 8 месяцев назад
Actually using a vba code to sampling every second the output voltage of a pressure sensor from a pressure controller it is very useful to check the transducer response and plot in a chart in real time. Thanks for aslking.@@PsychogenicTechnologies
@PsychogenicTechnologies
@PsychogenicTechnologies 8 месяцев назад
@@cessromer7078 ah, cool. Funny you should write today, I just had to write some new code in there, for another 'scope and to do some characterization of photovoltaic cells... scripting this stuff sure saves a lot of work! Cheers
@odieadog4086
@odieadog4086 7 месяцев назад
Here's one of many tutorials how to do simple real time plotting with matplotlib.pyplot if anyone is looking for it: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Ercd-Ip5PfQ.html
Далее
The most important Python script I ever wrote
19:58
Просмотров 199 тыс.
Главное рыба есть, а воды нет..
00:54
Qalpoq - Amakivachcha (hajviy ko'rsatuv)
41:44
Просмотров 240 тыс.
Flawless PCB design: RF rules of thumb - Part 1
15:45
Fastest Coding Assistant and it's FREE
9:44
Просмотров 42 тыс.
PythonAutomationSeries 1 Intro
5:17
Просмотров 34 тыс.
Open Source Analog ASIC design: Entire Process
40:11
Просмотров 44 тыс.
Главное рыба есть, а воды нет..
00:54