The DPS5005 is a cheap adjustable power module, capable of outputting up to 5A at 50V. Its small size, wide input range and high output wattage make it a very versatile product.
The achilles heel of this unit, and the other units in the DPS range, is it’s UI. The amount of information squashed onto the small screen is diffcult to comprehend, not helped by the hideous colour scheme.
Luckily, Johan Kanflo has created replacement firmware called OpenDPS, the goal of which is to have the same functionality, a less cluttered user interface and be controllable remotely via wifi or a serial port. Johan has posted a great write-up, detailing the design of OpenDPS, and how he managed to hack the DPS module, which is worth a read.His website also includes a guide which guides you through the install process. Having recently acquired a DPS5005, I decided to give it a go.
Connecting the Module
To flash the board, you will need an STLink USB programmer. Clones can be cheaply obtained on eBay or Aliexpress. You will also need some wire to connect the programmer, with female 2.54mm female pins on one end.
The first step is to take the board out of it’s original case. This will give you access to the points on the board needed to flash the firmware. My board is the slightly newer variety, with the smaller 1.25mm SWO pins.
5 of these pins need to be connected to the STLink. The pinout of the DPS module is shown in the image below.
The fine pitch of the pins does make it tricky to solder wires to these points. If you are having trouble connecting to these points, it may be easier to solder wires to a fine-pitch pin header, which should be easier to solder to the board. The pinout of the STLink is indicated on its case, simply match each pin on the DPS to the corresponding pin on the STLink.
You will also need to provide a source of power to the DPS, through the green screw terminals. I used an old ATX power supply connected to a breakout board, to provide an input of 5V.
The last step is to plug the STLink into the device you are using as a programmer. In my case, I am using a Raspberry Pi.
Building OpenOCD and OpenDPS
In order to flash OpenDPS, you will first need to install OpenOCD. OpenOCD is used to communicate with the ARM processor on the STLink programmer. You will also need to install the ARM GCC toolchain onto the device you are using to program the DPS.
The following steps to install OpenOCD should work on any Linux-based platform. There are also a few extra steps which are required when using a Raspberry Pi.
To grab the latest version of OpenOCD, and run the bootstrapper, run the following commands:
git clone http://openocd.zylin.com/openocd
If you are using a Raspberry Pi, run:
./configure –enable-sysfsgpio –enable-bcm2835gpio
This allows OpenOCD to use the built-in hardware GPIO support on the Pi. Otherwise, run:
This will use the standard Python GPIO library. This has decent compatibility over a wide range of embedded devices. Once this is complete, run:
sudo make install
Assuming this completes with no errors, OpenOCD is now installed on the system.
Before building OpenDPS, make sure you have the ARM GCC toolchain installed on your system. If you are using an ARM based board, such as the Raspberry Pi, this will already be installed. This is needed as the DPS5005 uses an STM32 ARM CPU.
git clone –recursive https://github.com/kanflo/opendps.git
make -C libopencm3
make -C opendps
make -C dpsboot
OpenDPS is now compiled, and ready to be installed.
Before you can flash OpenDPS, the software currently installed needs to be wiped. To do this, run:
sudo openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg
If the connection is successful, you will see an output like the one below, ending in “Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints”.
In another terminal, run:
telnet localhost 4444
flash erase_address unlock 0x08000000 0x10000
This command will open telnet, and wipe the flash. Except the first time you run it, it probably wont…
Power cycle the DPS5005, and run the above sequence again. This time, you should see “erased address 0x08000000 (length 65536) in 0.094533s (677.012 KiB/s)”, which means the wipe was successful.
To flash the OpenDPS app and bootloader, run:
make -C opendps flash
make -C dpsboot flash
Once flashing is complete, the DPS will reboot. When it is booted, you should see something similar to the below.
You can now put the module back into its housing. I have chosen to keep the wires attached, to flash updates in the future.
More information on OpenDPS, including the original installation guide, a guide to its controls, and information about its features, can be found here.