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 update: is has been verified that OpenDPS can push 5A. Thanks @johannes!

 

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, an STLink clone and some wire. Either you solder the wire onto the DPS or you can use female-male dupont wires for flashing.

Teardown

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.

Teardown
Teardown

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.

Flashing

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. 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
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 172.16.3.203’, 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.

 

Todos

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!

 

48 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?

    Thanks!
    –Aaron

    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

  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!

        eg
        https://item.taobao.com/item.htm?id=539017902870
        (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!

Leave a Comment

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

*
*