While the Rohde & Schwarz HMP4040.04 can be used stand-alone, its true power lies when incorporated into an automated test system through the use of a computer controlling the power supply via SCPI commands.


Things to Note

If you have not read the unboxing chapter, it is important to note that this HMP4040.04 arrived in a damaged condition. Rather than delay releasing a RoadTest review significantly, I have decided to release this review of the damaged unit with an understanding that it would be updated once an undamaged unit has been supplied. As a result, testing has been performed with some limitations and some of the observed issues may not be a result of the unit’s design. Readers are asked to keep this in mind as they read the review.


In Ch3, I noted how the unit lost the ability to generate output on Channel 4. It was later discovered that further anomalies occurred with regards to PC-connected remote control.

HMP4040.04 LAN HangHMP4040.04 USB-TMC HangHMP4040.04 USB-TMC pyvisa Hang

When utilising the HO732 interface card in any mode, it was discovered that it was occasionally not possible to command the unit. While the interface would register on the USB bus or the LAN HTTP server would be available, no commands could be executed. A hard power cycle, sometimes multiple, were necessary to restore functionality at times. This could be a result of mechanical damage to the internals of the unit and is noted here.


Testing of the HMP4040.04 was undertaken with the current firmware at time of review, version 2.62. Upon testing, some performance anomalies were discovered that might require a firmware update. Close reading of the manual suggests that updates with the HO732 interface board are not presently possible, instead the HO720/HO740 boards are required. Upon contact with R&S, they have confirmed that they are looking into this as firmware updates may be necessary.


Testing occurred using NI-VISA 18.0 on a computer running Windows 10. Some remote-control operations were automated through the use of pyvisa running on WinPython, while others were performed using the respective tools from Rohde & Schwarz.


Interfaces and Support

Rohde & Schwarz offer a plethora of downloads for the HMP series which include various drivers and examples for different programming environments including IVI.NET, LabView, VXIpnp, C#, MATLAB and VBA to name a few. This seems to be much better supported than the majority which may have one or two instrument drivers available, although it pays to remember that the SCPI commands are also fully documented in the manual if you prefer to work directly with the instrument.


By default, the HMP4040.04 is supplied with an HO732 dual interface card, offering USB and Ethernet/LAN connection. Optional cards include the HO720 USB and RS-232 interface and HO740 GPIB interface. The HMP4040.04 does not offer any other forms of remote analog/digital control.


With the default HO732 interface, the USB connection can operate in one of two modes. USB-CDC emulates a serial port and is the default mode. USB-TMC is used with a VISA manager and can be selected through the configuration menus. Unfortunately, the USB connection mode is not memorised between reboots and must be manually selected each time (if you prefer USB-TMC that is). In both modes, the interface has a VID of 0x0AAD and PID of 0x0117.


The other option is to connect via the LAN interface, which supports DHCP configuration or manual configuration through the front panel using the integrated menus. Only port 80 (HTTP) and 5025 (SCPI Direct) are open in TCP mode. The selection of USB or LAN mode and the LAN configuration is memorised through power cycles.


Web Interface

When connected via the LAN interface, the instrument can be accessed through a web browser at its IP address.

HMP4040.04 LAN Home

The basic configuration details are listed at Instrument Home.

HMP4040.04 LAN ScreenshotHMP4040.04 LAN Screenshot BMP

The screenshot tab allows you to retrieve what is on the screen in .bmp format with a click to refresh system.

HMP4040.04 LAN SCPI Device Control

Finally, the SCPI Device Control page allows you to send SCPI commands manually and receive replies.


While the web interface is relatively useful for quick testing of the device without installing any software, it is practically the bare minimum that can be expected. Some other devices feature much more featureful interfaces including continually refreshing displays and emulated front-panels for remote control with password protection.



HMExplorer InstallHMExplorer Splash Screen

The main piece of software specifically intended for use with the HMP4040.04 is HMExplorer. This appears to be a multi-purpose software intended to work with a number of Rohde & Schwarz HM-series products (formerly Hameg Instruments). Installing it on Windows 10 proceeded without a hitch.

HMExplorer VISA IssueHMExplorer CDC COM

Unfortunately, it seems that HMExplorer wasn’t happy with my VISA set-up, thus USB-TMC device access was not possible. Luckily, the USB-CDC serial COM interface and LAN interfaces were both working just fine.

HMExplorer HomeHMExplorer HMP4040.04 Device Capabilities

While HMExplorer does have a number of tools available, the tools that can be used with the HMP4040.04 is more limited – SCPI Terminal, Screenshot and EasyArb.

HMExplorer SCPI TerminalHMExplorer Command Rate Test Script

The SCPI Terminal allows for testing and commanding of the instrument, along with a simple scripting language that allows for some level of automation and a command reference in the sidebar. From this, it was possible for me to write a short program to attempt to deduce the command rate achievable.

HMP4040.04 Command Rate LAN

Connected via LAN, it took 470ms to complete the loop which involved two setting commands and two query commands. If you count this as four commands, then the command execution time is 117.5ms, but if you count it as six commands (queries return values which need to be read) then the execution time is 78.3ms. Of course, this is not a highly scientific approach to determining command rate, as the overhead of the LAN interface and the software itself will also affect the result.

HMExplorer Screenshot

While HMExplorer does feature the ability to pull screenshots from the device, by default, it seems that privileges to the folder where they are to be saved were not granted by Windows resulting in errors. When the folder was changed to another folder, the program appeared to save screenshots, but they were always truncated and never appear in the program display window. As a result, I consider the functionality somewhat broken – but you can still get this through the web interface.

HMExplorer EasyArb MainHMP4040.04 EasyArb Basic Running

The most useful part of HMExplorer is the EasyArb feature which can be used to define the arbitrary function data more comfortably from a computer, visualise it in a graph, import it from a .csv file and send it to the power supply. Once sent to the supply, it can run on one or more channels (unsynchronised) for a fixed amount of repetitions or continuously.

HMExplorer EasyArb Import

The import dialog is rather flexible, although there is some German to be seen in the left – I think it stands for the delimiter and decimal point character. Nonetheless, upon opening a CSV, this is automatically detected. Each column can be assigned to either Voltage, Current, Duration or Interpolation (the latter is not supported by the HMP4040.04). Where the data is not in the CSV or you wish to set it to a fixed value, ticking the constant box allows you to set a fixed value.

HMExplorer EasyArb Sine 128HMP4040.04 EasyArb Sine 128 Running

To test out the limits of the ability of the power supply, I used Excel to calculate 128 points of a sine wave centred at 16V, swinging between 0 and 32V, saved it as a CSV and imported it into HMExplorer with the minimum 10ms dwell time between samples. I uploaded this to the power supply and discovered a bug which is already known to Rohde & Schwarz and is scheduled to be fixed in an upcoming firmware update.

HMP4040.04 EasyArb Truncated 126HMP4040.04 EasyArb Sine 126 Running

It seems that for EasyArb waveforms of 127 or 128 points, the unit will play them out only once. Once truncated to 126 points or less, the waveform can be reproduced continuously. A new sine wave with 126 points was calculated for demonstration purposes.


R&S Forum

R&S Forum InstallR&S Forum Main Screen

R&S Forum seems to be a program which is more geared towards offering a simple, easy-to-set-up, Python-based environment for automating your test equipment. It features a much more IDE-like interface, running its own installation of Python 2.7.10 and its own visa_pytron engine. In some sense, it seems to be an evolution of RSCommander, which is Python 2/pyvisa-based and can also work with the HMP4040.04. However, as I already had my own installation of Python 3.6 and pyvisa, I opted to use that instead.


Direct SCPI Control via WinPython and pyvisa

Using the HMP4040.04 in USB-TMC mode, I was able to send SCPI commands and receive responses using pyvisa running on Python 3.6. This made it possible to run automated test sequences, such as those necessary in the next chapter focusing on instrument testing. Basic instrument control, including cycling the channels, is demonstrated just fine based on the data within the user manual.

HMP4040.04 Pyvisa Automation

However, I did encounter some difficulties with the HMP4040.04 when it came to command synchronisation. This may be down to my naïve SCPI programming, but I noticed that programs which crash and leave a response in the buffer are not cleared when the device is re-opened which can wreak havoc or lead to out-of-sync responses to queries (e.g. an *IDN? returning a previous voltage reading). At times, reading a response will fail with an input protocol violation (extremely rare) which requires a command retry. While the manual suggests the use of *OPC? queries, I was not able to get this to synchronise my commands effectively as either it would randomly “hang” waiting for the response or it would get out of sync and the buffer would always have a response (although it was not the expected one).


The cause is not definitively understood at this time, but as a result, I fell back to “fixed” delays in the code to ensure command completion rather than through the use of polling the unit.


Other Programming Examples

Seeing as R&S put in the effort to provide a wide range of different examples for different environments, I decided to give the MATLAB and Excel/VBA examples a try. In order to use them, the supplied VXIpnp driver has to be installed first to provide the hmp4000_32.dll that is required.

HMP4040.04 MATLAB DirectSCPI Example

I had no problems running the MATLAB example using a LAN interface, noting that the Instrument Toolbox is not required for direct SCPI interfacing.

HMP4040.04 Excel VBA Example 1

Likewise, the example worksheet seemed to work in Microsoft Excel, albeit with some apparent data synchronisation problem where the reading values are taken at the wrong time (off by one).HMP4040.04 Excel VBA Example 2



The full power of the HMP4040.04 is realised when it is used in connection with computer remote-control for automated testing. To this end, Rohde and Schwarz provide a comprehensive support library of software drivers and examples for IVI.NET, LabView, VXIpnp, C#, MATLAB and VBA to name a few.


The HMP4040.04 comes with an HO732 USB and LAN interface board installed, providing either USB-CDC (COM port), USB-TMC (VISA) or LAN based connectivity. This can be exchanged for an HO720 for USB and RS-232 interface or HO740 for a GPIB interface, however, no other forms of analog/digital control interface appear to be available. Drivers for the HO732 are not required for CDC operation, with USB-TMC drivers covered by the installed VISA manager, making installation straightforward. It was discovered that the USB mode is not memorised through a power cycle, defaulting to USB-CDC operation at every boot-up.


The HO732 currently does have one disadvantage compared to the HO720/HO740, as this interface is not currently able to be used to update the firmware on the HMP4040.04. Rohde & Schwarz have indicated that this is a problem that they are looking towards resolving – which is important as another issue with the EasyArb functionality which requires a firmware rectification was identified.


The LAN interface offers a basic web interface offering the ability to read settings, take a screenshot and send SCPI commands. Unfortunately, the interface is as basic as it gets, without any password protection, front panel emulation or live screen updates, making it somewhat underwhelming. SCPI Direct connection allows for socket-based direct control, as is standard for most LAN-connected instruments.


HMExplorer is the software specifically intended for use with R&S HMP-series instruments (formerly Hameg). The software offers a scriptable SCPI terminal with command reference, screenshot tool and EasyArb configuration tool. The latter is the most useful, allowing for easy definition, visualisation, import and upload of arbitrary waveforms to the HMP4040.04. While the installation of HMExplorer was without difficulty, I was not able to get USB-TMC connectivity through my installed VISA manager to operate and the screenshot tool recorded only truncated screenshot files.


Through testing, it was determined that the EasyArb functionality does seem to have a limitation where waveforms are not replayed continuously if they have 127 or 128 points. Rohde & Schwarz have informed me that they are aware of this issue and it should be corrected in an upcoming firmware update.


R&S Forum is a more general piece of software intended for automating test equipment in general and appears to be a Python 2.7 based application that mimics an IDE in its design and uses its own visa_pytron engine for communication. More sophisticated than RSCommander, it offers fairly similar capabilities in automating a standalone install of Python and related tools so that users can automate their testing more easily.


It was possible to use the HMP4040.04 with my existing install of Python and pyvisa and direct SCPI command was achieved although I did find some anomalies with command synchronisation and buffer handling (which could be entirely my fault). Using fixed delays seemed to work just fine with an occasional retry necessary – although this could be due to the damage that the unit sustained during shipping which resulted in unresponsiveness of the interface altogether and necessitated power cycling.


The SCPI command-set for the instrument treats each of the channels as if it were a separate instrument, necessitating selecting the channel (INST:NSEL 1) before issuing commands that alter the state of the channel. The global output switch is controlled (OUTP:GEN 1) separately to the activation of the channel (OUTP:SEL 1). This took a little time to get used to. There were several cases where there was more than one command to achieve a certain outcome, with additional commands to step increment/decrement values being a nice touch.


Out of curiosity, I gave the included MATLAB and Excel/VBA examples a go and found them functional, albeit the Excel example did seem to show some command synchronisation issues as well.


You can download the data files and scripts used in this section in a .zip archive attached to this post, including the EasyArb data, the channel toggling scripts in Python using pyvisa and command rate test script for HMExplorer.



This blog is a part of the Rohde & Schwarz HMP4040.04 Programmable Power Supply RoadTest Review.