Building custom automated test and measurement or data acquisition systems no longer requires spending days studying equipment manuals or writing hundreds of lines of code manually. With AI as a development assistant, turning an idea into a working test setup has become surprisingly fast.
If you prefer watching a video instead of reading, click here:
YouTube: Test & Measurement Automation With AI
The challenge
For a recent engineering project, I needed to investigate some erratic behaviours of a DC gearbox motor operating frequently under stall conditions.
The motor was controlled by an H-bridge driver and equipped with a magnetic absolute encoder to monitor its rotation. A bidirectional current sensor provided information about the motor current.

The objective was to execute multiple predefined motion sequences, such as CW-CCW-CW-CCW or CW-GAP-CW, at different supply voltages while capturing the motor’s electrical and mechanical responses.
Doing this manually would have been tedious, time-consuming, and difficult to reproduce consistently. So I decided to automate the entire process.
The hardware setup
The system was assembled using readily available laboratory equipment.
- Rigol DS1104Z Plus oscilloscope – monitoring the encoder and motor current signals and capturing screenshots.
- OWON SPM6103 programmable power supply – providing an adjustable motor supply voltage from 9 to 24 V.
- Second DC power supply – providing a fixed supply voltage for the sensors
- Arduino Nano (clone) – generating the predefined motor control sequences through the H-bridge driver.
- Windows laptop with a USB hub – connecting the instruments and running the Python automation software.
The Arduino used digital outputs to command three states: clockwise (CW), counterclockwise (CCW), and stop. In either direction the motor ran at full drive, equivalent to 100% PWM duty cycle. The firmware timed the direction changes and stops using fixed digital levels. Python acted as the central controller, coordinating the instruments, test sequences, data acquisition, and file storage.

How the automation works
The complete automated procedure consisted of seven different motor control sequences, each executed at 16 different supply voltages, from 9 to 24 V in 1 V increments.
The Python program followed the same steps for each measurement.
- Set the required motor voltage on the OWON power supply using SCPI commands.
- Armed the Rigol oscilloscope for single-shot acquisition.
- Sent a command over USB serial to the Arduino to execute one of the seven predefined motion sequences.
- Waited for the sequence to complete and the oscilloscope to capture the event.
- Retrieved the oscilloscope screenshot and saved it with a descriptive filename.
- Proceeded automatically to the next sequence or voltage level.
This resulted in 112 measurements per complete run. The entire campaign was repeated four times, producing 448 oscilloscope captures.
Afterwards, a second Python script combined the captured screenshots into a large image canvas. This made it possible to inspect and compare the waveforms across different sequences, voltages, and repeated runs at a glance.

Developed with ChatGPT
Both the Arduino firmware and the Python application were developed through an iterative conversation with ChatGPT. I described the required behaviour, tested the generated code on the bench, reported problems, and used those results to refine the code.
Bench testing uncovered communication timeouts, synchronization problems, serial communication quirks, and difficulties retrieving binary screenshot data from the oscilloscope.
However, each issue could be investigated and resolved with AI assistance, without having to manually develop the software or study every detail of the instruments’ programming manuals.
The final test automation consisted of approximately 390 lines of Python and 99 lines of Arduino code, followed by an additional Python script for image processing.
The takeaway
What previously required considerable time studying programming documentation, SCPI command references, and instrument communication protocols can now be developed largely through a conversation with AI.
Engineering knowledge is still essential for defining the test procedure, integrating the hardware, troubleshooting, and validating the results. But the actual implementation becomes significantly faster and more accessible.
The real advantage of AI isn’t just writing code faster. It’s enabling engineers to create and troubleshoot their own custom test and automation systems without having to become software developers first.
And for those who still would rather outsource the entire process, do not hesitate to reach out to MandE Services & Solutions and inquire about your project.
