Like everyone else we found ourselves working from home due to COVID-19. We had planned for the looming lockdown and had actually decided to close the office a few days before the Government started to enforce things.
Part of this planning was to get all the kit myself, Andy and the team needed to carry on working from home for a few weeks. At the time we were or would be working on extremely low power devices, powered by batteries or in the case of our new Sippr project solar panels so I decided to take one of the excellent Otii analysers home.
The Otii was working well but then my Dad got in touch asking if I would be willing to look at a broken board that had just stopped a bottling plant from working. This was an old school analog design that somebody else had made and it needed 24V (ish) to debug and fix. Unfortunately I had taken my bench supplies into the office ages ago for one thing or another which meant I was sans bench supply. A quick rummage though a box of old laptop and things power supplies led me to hacking up an old DVD drive supply which worked ok but was fixed at 20V (actually it was 26V as it was a cheap supply!).
So what I needed was to go into the office to get a supply, or order a shiny new one. As I like shiny things and wanted to avoid any non essential travel I decided to order one, but I wanted the cheapest I could find as we have lots of nice supplies already so it seemed like a waste to order something good. Soooo off to Amazon I went to see what I could find
The Amazon smorgasbord of supplies
A search on Amazon threw up a lot of cheap power supplies from household names such as “Top Power”, “Tech Lifer” and “IPSXP”. They all looked equally as good (or bad) as each other so I settled on the Hanmatek HM305P as it could provide 30V at 5A and was ‘Programmable’ with a Windows app via USB.
What turned up the next day was the beauty you can see here.
If the specs are to be believed it is supposed to have around 30mVrms ripple and +-5mV output regulation. Not great but it will do for the simple tasks I had planned for it.
What I wanted to do though was to be able to control it via USB so that I could hide it away in my make shift home office (the kitchen table) and keep it out of reach of my 2 year old daughter who likes to mess with anything and everything, especially something with flashy lights!
The Programmable Power supply - but only if you are running Windows
The power supply came with an 80cm cd which I assume contains Windows software, I only have my MacBook Pro Mini here with no CD drive so I cannot be certain what was actually sent. Luckily the Amazon seller had a link to the software which seems to support a wide range of power supplies, but only if you are running windows. Not wanting to control the supply in a VM I went on the hunt for some OSX software, which does not exist :(.
What I did find though was a post on another blog where the author had snooped on the comms traffic between the Windows code and the Power Supply and figured out that it was using Modbus and also what the registers were. We are no stranger to Modbus at Roedan so I cracked open Xcode and started to hack together a really simple app.
The hacky OSX App
What I needed was a quick and dirty app to allow me to set the output Voltage and Current limit and then allow me to switch the thing off and on. So armed with the info from the “Night Flyer Fireworks” blog I set about creating my hacky app.
Its not glamorous and it definitely wouldn’t pass through any of our code review processes but it works. Using libmodbus installed using brew and pulling in ORSSerialPort the app can read and write the 16-bit registers allowing full control of the Voltage, Current and output state. It will also allow the supply to be polled to get the actual state and keep the screen updated.
The application still needs some work, it was thrown together quickly with no real thought as paying work was getting in the way of giving it the time it really needs. However it works and since I could not find any other OSX app available for this supply I have pushed it to Bitbucket and made it public for anyone else to use.
So if you want a laugh at my OSX code or need something to control your new shiny Hanmatek HM305P power supply checkout the repo here: https://bitbucket.org/roedan/powersupply/src/master/