Upgrading your DPS5005

This is the third article about hacking the DPS5005. Part one covers the reverse engineering of the DPS5005 and part two covers the design of OpenDPS.

April 14th 2017 update: is has been verified that OpenDPS can push 5A. Thanks @johannes!

June 9th 2017 update: added a note on saving the STM32 peripheral settings before wiping the internal flash.

Although this guide is written for the ‘5005 it should work for the entire DPS family but I only have 5005s to test with. Before we begin I should mention that the stock firmware will be gone permanently. As readout protection is enabled on the STM32, the FW cannot be extracted and I have no source for it. Additionally, I take no responsibility if you destroy your DPS. That said, let the fun begin. You will need a DPS5005 (or similar), an STLink clone and some wire. Either you solder the wire onto the DPS or you can use female-male dupont wires for flashing.


First you need to remove the PCB from the (semi) housing. Use a small flat screwdriver to prey the PCB loose from the retaining flaps.


Be careful not to break the retaining flaps (not that they’re fragile, but still). They are very much needed for holding the front panel in place when you press the buttons.

Solder some AWG26 wire onto the SWO and UART ports. It is advisable not to solder pin headers as there is limited room inside the housing. I added dupont jumper housings at the end of the cables to aid in connecting them to the STLink clone and FTDI ditto. Hint: make the cables “strech” backwards, from the display.

SWO/UART pinout
Top: SWO, lower: UART

If you do not want to solder (and do not want any remote control) (and have steady hands) you could connect three female-male dupont cables to the STLink clone and hold them pressed against the DPS while flashing.

Debugger connected, UART cable at the top
Debugger connected, UART cable at the top

Building OpenDPS

With that in place you should install OpenOCD and an ARM GCC toolchain. For GCC, Launchpad is a good place to start. For OpenOCD, YMMW. If you are on macOS you can find OpenOCD here (it installs as /Applications/GNU ARM Eclipse/OpenOCD/0.10.0-201610281609-dev/bin/openocd). With the tools in place you’re ready for the next step.


Next you need to unlock the internal flash of the STM32 before flashing (which causes a complete erase). Start OpenOCD:

You will receive a few lines of output ending with “Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints” if the connection was successful.

Please note! Before you unlock and erase the STM32 flash, you should make a dump of the STM32 peripheral settings of your stock DPS firmware. The DPS hardware might change at any time and if you flash OpenDPS and it does not work because eg. the GPIO pin enabling output power was changed, things get difficult. The ocd-client.py script will assist you now that OpenOCD is running. Please note that OpenOCD might interfere with the stock firmware. When you connect, the stock FW might lock up. First, power on the DPS and make sure the power output is disabled but set to e.g. 5V, start OpenOCD and type:

If needed, restart the unit (and OpenOCD), enable power output @ 5V and type:

Rinse and repeat for one or two more voltage levels. Check the log files, there should be no lines saying “Parsing error”. If your OpenDPS does not work, these files will enable me (or someone else, remember this is open source you 😀 ) to pinpoint the problem.

Now let’s wipe that flash. In another terminal:

and type:

You will probably get the following, ending with an error:

Keep calm. Restart OpenOCD, toggle power on the DPS and try again. This time you should see:

Time to flash:

The last two lines should read:

and your DPS5005 is now an OpenDPS 5005.

OpenDPS, now with wifi

Congratulations! If things went south somwhere, feel free to ask for help in the comments below.

From here you can use the OpenDPS as a stand alone device, control it via a serial port or control it via wifi by connecting an ESP8266.

Short User Manual

When you power on your OpenDPS, the current voltage and current limit settings are displayed and the power output is always disabled. Pressing ON/OFF will enable power output and the display will now show the measured output voltage and the measured current draw. If the screen flashes once and goes back to displaying the voltage/current settings, the over current protection kicked in. Press ON/OFF again to disable the power output.

Press the SET button to go into editing mode. Press the V and A buttons to move between the voltage and current settings. Press the rotary knob to step sideways and turn the knob to change the values. Press SET again to exit editing mode.

Press and hold the knob for two seconds to lock the keys, long press again to unlock. A long press of the SET key will invert the display.

When your OpenDPS starts it will wait for a wifi connection from a connected ESP8266 and the wifi icon will flash at 1Hz. If it does not get a wifi connection, the wifi icon will be turned off after 10 seconds. If there was an error connecting to your wifi network, the wifi icon will flash at 4Hz.

Remote Serial Control

If you soldered wires to the UART port, connect an FTDI adapter and try the dpsctl.py tool:

The TFT should flash once as a visual indication. If you get ‘Error: timeout talking to device’, check if you swapped RX and TX and/or forgot to connect GND.

The port setting can be set in an environment variable

After setting the DPSIF variable, you can try setting the output voltage to 3.3V:

enable the output:

check the measurements:

If serial control is what you aimed for, you can get rid of the annoying flashing wifi icon by adding WIFI=0 when building OpenDPS

Remote Wifi Control

For wifi control, any good old ESP8266 board with the UART exposed will work. Connect GND, RX and TX, build and flash esp8266-proxy (don’t forget to set your wifi credentials) and you should be good to go.

Note that you currently cannot use the master branch on the main ESP Open RTOS repository as my PR for a function needed for multicast has not been merged yet.

When your OpenDPS has connected to your wifi network, try the ‘scan’ command to find out its IP number:

Next try pinging it:

The TFT should flash once as a visual indication. If you get ‘Error: timeout talking to device’, check if you swapped RX and TX. The dpsctl.py tool has the same functionality over wifi as well as the serial port.

Sadly, you cannot power your ESP8266 from your OpenDPS. The VDD pin next to the SWO port is connected to U4 (under the TFT), an MD7133H 3.3V regulator which only provides a measly 30mA (yes, thirty). Additionally, this regulator is powered by U3 (on the backside, next to the screw terminal) which is an XL7005A supplying 400mA @ 5V which could be a bit over the edge for a power hungry, cold booting ESP8266.



There are a few todos in the code but overall OpenDPS should be stable for everyday use.

That’s it, have fun hacking your DPS5005!


72 thoughts on “Upgrading your DPS5005

  1. Jon Raymond

    This has truly been an interesting series of articles to read. As I come from the hardware design side I often find what you software guys do seems like magic. Thanks for laying out clearly. I really enjoy reading your blog. Thanks for sharing it.

  2. Allen Derusha

    Fantastic effort! If I might make a suggestion – this would be even better if it could tie into sigrock: https://sigrok.org/wiki/Supported_hardware#Power_supplies

    Being able to remotely control and read values from a DC power supply is crazy handy when testing devices to optimize for power utilization. I have this very supply sitting on my desk, so I guess it’s time to crack it open and get to hacking! Thanks for sharing this work.

    1. Johan

      Thanks! I guess the PUSs all talk SCPI which would not be that difficult to get into OpenDPS. Besides the wifi/serial control there is a build option for command line support (make COMMANDLINE=1) which could serve as a starter for SCPI support.

  3. Aaron Dayton

    I am looking on ebay to buy one of these things now 🙂
    Can programming be done via the Bus Pirate? or Bus Blaster?


    I like the detailed write up.

  4. Leonard Pitzu

    do you still have the original firmware? i upgraded to your’s but forgot (got carried away) to back the original one up. I plan on extending your firmware to support most things the original FW had but in the mean time i need the thing to test my gadget 🙂
    Anyways great work!!!

    1. Jon Raymond

      Sadly the original firmware can’t currently backed up because the chip has the read out protection set. Johan mentioned this in his blog post

    1. SkinnyV

      One of the most obvious change is that the display is much cleaner with the custom firmware. Beside that, it appear that it will allow you to control it from serial and wifi (if you connect an esp8266). Most of the change can be found in part two of the article.

  5. Rainer

    Is it possible to add a compiled Hex file of the ESP8266-Proxy, in my case for a ESP8266-01, to your Github for those of us with limited software skills?

  6. Johannes

    Thank your for the excellent work 🙂

    I’ve just flashed my DPS5005 with OpenDPS. Testing with a 12 ohm power resistor, I can’t get it to output anything more than ~0.32A. If I set voltage to 6V and current limit to 0.7A, the output drops down to ~3.95V/0.32A once I turn it on. Is this expected?

    1. Johan

      Thanks! That seems like an unwanted feature. Could you try two things? First, check the voltage reading with open terminals? Second, verify the readings with a multimeter? I am thinking it could be an issue with the ADC readings.

      1. Johannes

        Hi, with open terminals the voltage reads 6V. The current reading looks correct when measured with a multimeter. Will check voltage reading later today with the resistor connected.

          1. Johan

            That is very strange indeed. The only time I have seen voltage drop is when shorting the terminals. You didn’t happen to test before reflashing your ‘5005? Oh, and what is the input voltage and what is the rating of your power supply?

          2. Johannes

            Unfortunately I never tried the thing before reflashing, so no idea if it’s caused by OpenDPS.
            Power supply is 12.4V (old PSU) rated at 18A/432W.
            Any debugging tips for troubleshooting further?

          3. Johan

            Wow, that ought to provide enough juice. Could you try with something drawing less current? An LED or an Arduino? Do any components on the ‘5005 feel warm when the resistor is connected?

          4. Johannes

            An LED seems to work fine – ‘5005 is stable at 6V with 0.013A current draw. Nothing seems to be running hot with the resistor connected.

          5. Johan

            Could you try with the resistor and vary the voltage from 1V to 6V? As you get 6V with the LED (and open terminals) the DAC conversion is working but somehow the ‘5005 is unable to provide enough juice when 500mA is drawn and chokes.

          6. Johannes

            1-4V seems to work:
            1V: 1V 0.08A
            2V: 2V 0.16A
            3V: 3V 0.24A
            4V: 4V 0.32A

            5-6V does not:
            5V: 4V 0.32A
            6V: 4V 0.32A

          7. Johan

            That is odd, it seems the output gets capped at 4V. What is the reported input voltage?

          8. Johannes

            Input voltage reported is still 12.4V. I guess the next step would be to probe around the circuit and try to find where the voltage is dropping… Did you produce any schematics when reverse engineering?

          9. Johannes

            So I did some more investigation with the scope. I had a look at the input pin of the LM5106 gate driver. I see a PWM waveform on this pin. Without the load connected, the duty cycle changes when I adjust the desired output voltage. However, with the load connected, the duty cycle remains constant. The PWM signal appears to originate from the controller board, which isn’t accessible without desoldering. I’m not too familiar with buck DC-DC converters, so can’t say for sure if this is expected.

            Out of curiosity, what kind of loads have you tested on your device? Are you able to drive several amps?

          10. Johan

            I got a 4.7ohm 10W resistor and I can reproduce your findings, voltage drops to 1.4V @ 256mA. So far I have been running a power hungry ESP8266 design at 5V/180mA. I did not produce any schematics per se, byt identified which pins of the STM32 was routed to which component. It’s all in ocdclient.py. I will update the docs with proper component identifiers. The LM5106 PWM is controlled by the STM32 DAC in pwrctl.c. I will do some measurements as I have a board with the STM32 exposed.

          11. Johan

            There is a fix on master that I will push 2A. The PSU I have does not deliver any more juice but I will scavenge the office lab for something more powerful.

  7. Olof Tångrot

    Hej Johan.
    It works (not tested with ESP8266 or any heavy load) for me. It looks like a suitable platform for a maximum power point tracker. May by someone has tried that all already?

    Anyway, nice of you to make the effort of writing up the instruction and sharing the source code. Kind of miss the indication of the computed output power though.

      1. 小杜

        I think doable, as you can attach an external antenna wire to the esp8266 and put outside the case without too much extra effort.

        Taobao actually has a whole bunch of options for casing for DPS5005 and other similar models, eg DPS3005. There appears to be a mini industry around it actually!

        (they’re doing some interesting things with UImeter too – https://github.com/xjtuecho/uimeter )

        More cases from the 100mhz store – https://100mhz.taobao.com/category-1289129232.htm?search=y&catName=DPS%CF%B5%C1%D0%CA%FD%BF%D8%B5%E7%D4%B4

        Some interesting stuff coming out of China!

  8. gojimmypi

    This is an awesome project! I was able to get your instructions to work with the DPS5015! Things were a little bumpy trying to compile on Windows though.


    The only thing a little annoying, is that the FAN is on all the time now. It was never on before, so I suspect there’s a temperature sensor. Is this a feature on the 5005? I suppose I will need to order another to try your register-debugging to see how that works, eh? That’s ok, I wanted a pair for positive and negative voltages anyhow 🙂

    1. Johan

      Aha, the ‘5005 does not have a fan. Using OpenOCD, see if you can find out how the fan is controlled (e.g. GPIO PWM, …). I’d be happy to add support for the ‘5015. Nice writeup btw!

      1. gojimmypi

        I’ve ordered another 5015… as there’s no way to tell if they did PWM to control speed since I reflashed. The good thing is that I determined the fan is on GPIO B-11

        on: ./ocd-client.py w 0x40010c0c 0x00005b30
        off: ./ocd-client.py w 0x40010c0c 0x00005330

        .. the bad thing is that somehow during this process, I toasted my 5015, as there’s no voltage on the output anymore. 🙁 even upon reflashing once again; no luck. Everything else is working – just no output voltage. I saved the port operations if you’d like to inspect to see what might have caused the problem.

        1. Johan

          Ouch, sorry to hear you toasted your ‘5015 although I cannot see how that could have happened. PB11 is PWM capable but it would be good to learn how the stock FW takes temperature measurements.

          1. gojimmypi

            actually – I’m not so sure my ‘5015 is toasted after all! 🙂 In anticipation of my new one arriving in a few weeks – I was browsing your source code recently – in particular I noticed the port used in pwrctl_enable_vout (in pwrctl.c) – it’s using GPIOB-11 !! (the same port I determined was used to control my fan on the ‘5015). So apparently the software is not directly compatible between different models. That seems really odd to use different software for hardware that is so similar… but if I can determine the port needed to turn the voltage on – we could add a simple conditional compile. I jumped in so quickly to investigate the fan issue – I’m not sure if I ever actually measured voltage on the output after the modification.

            oh – and I believe I recall reading somewhere that the fan on the stock 5015 is not controlled by temperature – rather current: it turns on at a specific level.

            In any case – warning to other readers that the 5015 may not actually work as-is. Stay tuned…

        2. tman


          The DPS5015 page mentions “When the current is more than 10A or the temperature is more than 45 °c , the fan will begin to work. when the temperature is more than 65°c, the module will stop working” so there must be a temperature sensor in there.

          1. gojimmypi

            @tman ah yes, I thought I read something like that. Thanks for the reminder on the specifics. I found that on one of the aliexpress pages, but is there more complete documentation somewhere? That info is not in the little pamphlet that ships with the unit

  9. tman

    There appears to be a newer/different DPS5005 design. I ordered one DPS5005 from Banggood and one direct from RD on Aliexpress and they’re slightly different. The Banggood one is exactly the same as Johan’s one. The RD one however has a much smaller UART and SWIM header and there appears to be a few extra components on the board. I’m wondering if this is a new revision of the DPS5005.

    See http://i.imgur.com/P2CgTjW.jpg for the connections on the new module. The UART header is on the top and the connections are VDD, RX, TX and GND. The SWIM header is on the bottom and has the same connection arrangement as the other DPS5005 with VDD, nRST, GND, SWDCLK and SWDIO.

    I uhh… had an accident with the RD module however and it doesn’t work now. I hadn’t gotten around to installing the OpenDPS firmware on it so I can’t confirm it is compatible but the boards look similar enough that I expect it is. The onboard 3.3V regulator has died and is a dead short now >< Splitting the two boards so I can get at the regulator is too much hassle at the moment so I've thrown it into my junk box for now.

  10. Leonard Pitzu

    do you still have a precompiled version released? i’m asking because my supply + programmer are in my office where i can’t really install all tools needed to compile the firmware.

  11. nico

    Mine does not really switch off the voltage.
    The screen shows the max values and the on/off icon disappers, yes, but the output is still active.

    Second problem, but this is not really bad… in windows, I dont get your python script running. I think, there is a module missing or something. I am not really fit in python and used a stock installation.

    1. Johan

      That’s odd. I know there are newer hardware revisions so pins could have changed. Does your DPS look like mine if you look at the SWD and UART pins on the back side?

          1. nico

            I think, the other things work so far besides the “current capping”. On overcurrent, the display toggles, but there is no voltage regulation. But I think, you have written somewhere, that you did not implement this so far. Also the color toggling can be confused when playing around a bit, eg setting a new value while on overcurrent.

Leave a Comment

Your email address will not be published. Required fields are marked *