I recently came across a DPS3005 PSU Module with PC control option , i have used similar modules before in a
bench power supply
and was impressed with the results . With the launch of a new version that included PC control i decided to order one !
(Banggood.com)
A few weeks later it arrived …
in the box was a
DPS3005 Module
Manual
Usb serial Adaptor
Bluetooth Module
link lead (not pictured)
The PC / bluetooth was not mentioned in the supplied instructions and the pc software (windows 7+ only) was available from the sellers listing and also
Manufacturers Youtube
Channel. I decided not to install and see if i was able to control from a MCU such as an Arduino
Investigating The Interface
I started by investigating the interface by first connecting the Bluetooth and USB serial adapter to the unit and simply seeing if there was any data flowing on the com ports. This did not prove very successfully at all and wasn’t even able to pair the Bluetooth adapter with any device i tried. Though without a button on the bluetooth module i couldnt see a way of even putting it in pair mode !
Without giving up and i decided to look on the manufacture’s download link and found a interface datasheet, all in Chinese . Using google translate i was able to see the command set and the interface was basically listed as
Modbus Rtu, rs232,9600 baud and slave address 1
.
I have no experience with modbus at all and had to do a bit of research to understand this very basics .
The following functions were listed as supported in the datasheet
:
0x03
–
Read data from one or more registers
0x06
– Write a single register
0x10
–
Write
multiple registers
basic Functions extacted from datasheet , needed for examples below
Voltage set – Register
0x00
Current set – Register
0x01
Voltage measured – Register
0x02
Current measured – Register
0x03
power on –
Register
0x04
Loads more see manufactures datasheet for more info…
Luckly there are a wide range of software libraries available for different platforms to help communicate with Modbus Rtu devices. So i didn’t need to deal with the raw data on the serial port .
Python Testing
Rather than jumping straight in and connecting to an arduino i decided to use the supplied USB serial adaptor and python to see if i could work out the basics using the infomation exactracted above.
Below is a very simple example how i was able read the units measured voltage. One issue i did notice i had to increase the default timeout for it to work !
# DPS3005 MODBUS Example By Luke (www.ls-homeprojects.co.uk)
# Free to use this code how you like but please link my site
# Requires minimalmodbus library from: https://github.com/pyhys/minimalmodbus
import minimalmodbus
instrument = minimalmodbus.Instrument('COM4', 1) # port name, slave address (in decimal)
instrument.serial.port # this is the serial port name
instrument.serial.baudrate = 9600 # Baud rate 9600 as listed in doc
instrument.serial.bytesize = 8
instrument.serial.timeout = 0.5 # This had to be increased from the default setting else it did not work !
print instrument.read_register(2, 2) #read a range of 16-bit registers starting at register 2 to 3 (measured voltage and current)
Arduino Testing
After confirming it worked using python and the measured voltage was successfully displayed i decided to move onto arduino. I noticed that it used a 3.3v logic level and rather than using level shifter i opted just to try and use a ESP82266 running arduino. This made it really easy to hook up just three wires gnd, TX and RX. A software serial port was used to talk to the dps3005 psu module allowing the native (USB) serial port free to monitoring everything.
UPDATE: due to a few questions about the pinout, i have marked the pin out of my DPS3005 on the picture below
I would suggest a simple check with a multimeter across vcc (bluetooth pwr) and GND to prove are in the same place as my finding first !
Note , the supplied link lead wire colours did not match the PCB marking on my unit and was completely reversed
. I may have just had a defect cable in my case but can confirm the PCB Marking on the DPS3005 module and usb serial convertor were correct.
// DPS3005 MODBUS Example By Luke (www.ls-homeprojects.co.uk)
// Free to use this code how you like but please link my site
// Credit to Doc Walker of ModbusMaster for making a great Arduino Library https://github.com/4-20ma/ModbusMaster
#include <ESP8266WiFi.h>
#include <ModbusMaster.h>
#include <SoftwareSerial.h>
#define SERIAL_RX D5 // PIN Mapping for ESP8266 NODE MCU Only! pin for SoftwareSerial RX
#define SERIAL_TX D6 // PIN Mapping for ESP8266 NODE MCU Only! pin for SoftwareSerial TX
SoftwareSerial mySerial(SERIAL_RX, SERIAL_TX);
ModbusMaster node; // instantiate ModbusMaster object
float voltage = 0.0;
float current = 0.0;
void setup()
Serial.begin(9600);
mySerial.begin(9600); //start software serial connected to dps3005
pinMode(SERIAL_RX, INPUT);
pinMode(SERIAL_TX, OUTPUT);
// communicate with Modbus slave ID 1 over Serial (port 0)
node.begin(1,mySerial);
void loop()
uint8_t j, result;
//********Example of sending cmds***********
node.writeSingleRegister(0, 0x96); //set 1.5v
node.writeSingleRegister(1, 0x1F4); //set 500ma
node.writeSingleRegister(9, 1); //set power on !
delay(2000);
//*******Example of reading data*****************
result = node.readHoldingRegisters(2, 2); // slave: read a range of 16-bit registers starting at register 2 to 3 (measured voltage and current)
if (result == node.ku8MBSuccess) // only do something with data if read is successful
voltage = ((float)node.getResponseBuffer(0) / 100 ); // get voltage from response buffer and convert to float
current = ((float)node.getResponseBuffer(1) / 100 ); // get current from response buffer and convert to float
Im very pleased how easy it was to get control of these great psu modules. Next.. im planning to making a new bench psu with a web interface using a esp8266.
Related
Hi Luke,
Thank you for this info. I am looking forward to read more about your progress with this PSU. Unfortunately I do not get a connection using the Windows Software (DPS3005 V1.3). But I was able to pair the BT module from Windows 10 using the pin 1234. The device showed up as “RuiDengDPS” and i just needed to press the “pair” button and to enter the pin.
Good luck.
Hi Luke,
thank you for sharing your findings. Especially mentioning the datasheet and suggesting to use google translate was very helpful. I was amazed how well that works.
I was thinking about writing some kind of http based API instead of a web frontend for a start. Just enough to set voltage and current limits and to control the output. I would also like to control two supplies with one esp8266 so that one could build a +/-30V PS with it. It should also be no problem to have a small subroutine for charging single LiPo cells with different parameters. How about working together on this?
Raffaele
Hi Raffaele,
Sorry for the very long reply, good to hear you found my post uselful! Recently i havent had as much time to do projects as liked, but had been working on a web interface using web sockets. Like yourself i was planning to have the ability to control two DPS3005 psu modules and have it mostly working with a few bugs to iron out. Will look at adding a basic http based API as well.
How far have you got with your project ?
Hi Luke,
thanks for you answer. I was also quite busy because of my job lately and preferred spending leisure time family and friends. Hope to find some time during the upcoming winter season.
Raffaele
Raffaele ,
No worries kinda same here , il try and post my code up soon when i get a chance to finish it.
Thanks
“This made it really easy to hook up just three wires gnd, TX and RX. A software serial port was used to talk to the dps3005 psu module”
Really? What is the pin-outs?
Red is obvious 3.3V, the rest? Is green the ground or black? This is what happens when noobs write articles!
Hi Mai, if you read my post again you will notice that i have said that the colours of the wires we not right in my case but i used the labels (tx, rx, gnd) next to the socket on DPS3005 PCB or on the supplied usb to serial adaptor pcb. I had even highlight this in red text in quote marks underneath. Hope this helps . If your still stuck im happy to take some more pictures .
Luke,
I borrowed your python code messed around with it for a few weeks and came up with this
have a look here ‘https://github.com/lambcutlet/DPS5005_pyGUI’
Hi ,glad it gave you a start. Looks like you done a great job ! Will have download and try !
Hi , tolisn
The ESP8266 used was a board called “node MCU” a google search will easily find one or on ebay or Amazon.
On ebay
Hope that helps
Hi Luke,
I’m currently trying to setup wired communication between the device and my computer and I’m struggling with getting the computer to recognize the COM port. Basically, when i connect it, it recognizes it as a regular USB device and I can’t setup my serial communication code with it. I’ve installed that “CH341SER” file which seems to be the required driver. Did you experience this issue at all?
Thank you!
Hi Sam,
I cant remember having an issue with the usb serial adaptor but did not have any luck with the bluetooth adaptor .
What os are you using ?
Have you checked other Usb to serial adaptors such as an arduino load Com port drivers ?
Will have a look at mine when i get a chance .
Hope that helps
Hi Luke,
Thanks for your reply. It’s not clear which three wires gnd, TX and RX of DPS3005 you connect to ESP82266. Here is link to the picture of my UART to USB board. At the moment I am connecting a logic analyzer to it trying to capture the UART communication between DPS3005 and DPS PC Software.
https://drive.google.com/file/d/1pL4NFrPacQs0hbDBFB06mILWGqwBj34T/view?usp=sharing
Markel,
No worries thanks for taking a picture of USB to serial, i can confirm its the exact same as mine. Although I have just noticed that the pinout was only marked on the bluetooth adaptor and not the usb to serial so this explains why i had a lot of wiring questions ! I have just updated my post with a picture with the pinout. As i mentioned underneeth the picture i would suggest you first check the vcc and gnd are in the same place as mine to be totally sure its connected the same as mine. Please report back if its correct . Good luck with your project !
cheers Luke
Hi , Sorry It was a while ago I can’t remember what vcc is to be honest at a guess it would be 3.3v. Would suggest measuring to be sure. I never used it, I powered the esp separately as wasn’t sure of the current rating and as it was originally designed only for a Bluetooth adapter . Done a quick search on a similar Bluetooth adapter and it’s current rating is only 30ma so a lot less than esp8266 so maybe a safer option to power esp separately (remember to link Gnds ) . Hope that helps . Luke
No worries , you could always try it at the risk of damaging your DPS3005 but maybe better to play it safe like me . One other suggestion I had is if you searched web for schematic diagram or reverse engineered the circuit and see what 3.3v voltage regulator but these take time !
Good luck with your project
Thank you so much for this. A few years ago when this module came out I was thinking that this should be possible because they were selling Usb/serial adapter for it.
I am very happy because now I can attach some buttons to arduino and change voltage in less than a second.
Thank you again for your effort and publishing your findings.