2024-11-15 –, Auditorium
In this talk you will learn how to control and monitor physical hardware to automate repetitive work in electronics, X-ray or any other research laboratory using Python.
This is also the story about how we decided to replace traditional expensive industrial and lab control solutions such as PLC:s and LabView with Raspberry Pi:s and Python programs. It all started in the R&D lab, then we continued to automate our production using the same tool chain.
I will talk about some common communications protocols and show sample code for using them with open-source Python packages. Many of those protocols can be used even with cheap instruments found in hobby workshops. Why not automate your beer brewing or your green house?
The audience for this talk is not only those who work at research labs or industries. The same libraries and methods can be used in your hobby workshop.
Background
The story about how we automated our X-ray R&D lab with Python and cheap hardware, such as Raspberry Pi and IO-cards. And how we later built a small factory for X-ray tubes and reused the same framework of Python programs and Raspberry PI to automate key ingredients in the production line.
Our use case
Description of how we use a modular distributed system of Raspberry Pi:s for interfacing with various types of hardware. Then a central UI application running on Mac or Windows for user interaction, plotting, automation.
Some examples on how to connect hardware using open-source python libraries:
• Connect to analogue equipment with Raspberry Pi and a cheap IO-card. Code sample for using cards from Pi-plates for monitoring analogue and digital signals.
• 1-wire – this simple protocol for temperature measurements. Code samples for using cheap parallel connected temperature sensor to monitor temperature in several points.
• Use PyVisa for Power Supplies and Measurement Instruments. I will show code sample for measuring current using a network connected multimeter.
• Use serial ports for vacuum pumps, X-ray sources and almost any type of industrial equipment. PyModbus for industrial equipment. Serial or aioserial to implement support for proprietary protocols.
Challenges when testing software driving physical hardware:
• Don’t expect exact values as response
• The hardware is not always available – create simulators
• Timing problems
Don’t forget safety! Some hints on how to mitigate safety problems:
• Use interlocks to monitor doors.
• Warning lights
• Safety breakers
• Use multiple layers. Implement safety systems in both hardware and software
Ulrik solves odd problems by using broad knowledge on software, electronics and image processing via his own consulting company called OddTech. He has worked for clients such as IKEA, Hasselblad and Öresundsbron. He is currently helping Luxbright to automate their X-ray tube factory and research labs.
Python is his favourite programming language – after to many years with Java, C and PHP.
Ulrik used to write for DatorMagazin and he also has a background as professional photographer and educator in photography.