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.

 

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!

 

20 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

Leave a Comment

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

*
*