How to make a Power Module sing: Creating custom waveforms with a Quarch PPM

Pedro Cruz

Posted: 27th November 2020

Creating custom waveform patterns with the HD PPM

I find the HD PPM an amazing tool for a couple of reasons: The injection fixtures, and its programmability. 

There are interposers for all the major storage interfaces and computer buses out there and we keep adding to the list. In a matter of 5 minutes, an engineer can go from unboxing to running power margining tests in their system – without the need to source dodgy adapters or bodging together a frankenstein spider that will probably short-circuit your DUT (Device Under Test). 

At the same time, Quarch has a powerful Python API that allows you to create scripts and connect to a variety of other services: FIO, IOmeter, batch scripts… The Torridon commands that control the HD, paired with a scripting language, allows for endless applications. Like playing songs…

TestMonkey allows you to create waveforms as a list of data points while it shows you what it looks like. In this case, I want to create a waveform with a 50% duty cycle. The musicians out there can follow this tutorial and create their own discreet sine wave, but a square wave was good enough for my project! If you select “Interpolate”, you can easily get a saw wave. Please note: you do not need 10V to drive an audio amplifier (rather 100mV), but I chose these values to better visualize the waveform.

Square wave
Saw wave

All the points you add to the waveform will be listed as a command in the “Script Viewer”. That’s extremely useful for writing your own scripts, since you can just copy and paste those commands into our Python API, for instance.

Converting MIDI files to an array of frequencies and time

In a nutshell, MIDI files are just a list of instructions aimed to tell an instrument how to play a song. They do not sound like anything, they are like a music sheet; still require an instrument to interpret and execute the instructions. This is usually done connecting a MIDI player to an organ or a dedicated synthesizer. We are trying to use the HD as the instrument here. With basic analytical geometry, we can create a function that converts the pitch into the period of the sound wave and send appropriate Torridon commands to the HD, but before that, we need to convert the MIDI events into a list of frequencies and times. The script below aims to do that in a very simple way – it only works with one note at a time and does not register the duration of the note. You can easily modify it to store that data! It uses the package py_midicsv to handle the MIDI file. 

Programming the Quarch HD PPM to play songs

The HD PPM is a really versatile tool – you can control it with very sophisticated applications like QPS or with a bare bones REST API. Here I am using a batch script to quickly run a series of commands that will generate a sound with a determined pitch. You can use the same cURL tool to send your very own power margining commands, for instance and have a minimalistic setup without Python. In reality, any device (even your smartwatch) capable of sending a REST command will be able to talk to the HD. 

Here is the final result playing a Scottish Classic, Auld Lang Syne. Apologies for the composition, I always skipped the music classes to play with electronics 🙂

Register for a Quarch account

Stay up to date with the latest Technical Updates and News.

© 2023 Quarch Technology ltd SC307569
Web Design by: Purple Imp