loading

Rui Deng Power Supply Automator, by Steve M. Potter, PhD
Last update: April 19, 2017 potterlab.gatech.edu

Are you looking for a way to automate the flow of small or large DC currents? Are you building a LiPo battery charger? A remote-controlled robot? Some industrial process or gadget that uses big motors or heaters? High-powered LED lighting? A transcranial brain stimulator? This Instructable shows how to hack the nice digital power supply modules from Rui Deng, the DPS5015 and DP50V5A, to do your bidding. Instead of just pushing buttons on their front panels, you can take the human out of the loop! I explain how to hook them up to an Arduino-compatible board and control them with your code, adapted from the sketch I wrote, “RD Automat”. Your Arduino will spoof button presses, in any sequence you can dream up. You can then make things turn on and off by remote control using your smartphone, ramp up power according to some tricky formula, have the power controlled by sensors in your system, perform repetitive or boring tasks like electrical testing, or control things automatically while you are asleep or away via a real-time clock (RTC).

Rui Deng did not provide any hooks or advice on how to interface these devices to an Arduino, so I did that research for you. It is fairly straightforward if you have some experience with soldering and electronics. That describes most people who would be wanting to control high-powered devices. I trust you will ask for advice from me or other hackers if this is beyond your comfort level. And of course, watch out for the danger of electrocution, burns, fires and destroyed equipment that comes with any power-electronics hacking.

What I like about the Rui Deng power supply modules:

• Generally well designed and reliable (except when they catch on fire; see warning below).
• Nice colour LCD that includes a display of output power in Watts, and various aspects of the state of the device.
• Several protection settings to prevent damage to whatever you are powering: Over-Voltage Protection, Over-Current Protection, and Over-Power Protection.
• Several preset configurations that can be stored and switched between.
• LCD is adjustable to be used with dark-adapted eyes at night, or in daylight.
• Fairly efficient, and don’t overheat easily.
• Manual is quite detailed and reasonably well written, in English and Chinese. (see pdf scans of these I have attached)
• AFAIK, there is nothing else nearly as cheap and full-functioned for building a digital power supply with a switching regulator.
• Very small and lightweight, compared to a linear benchtop regulated power supply with transformers.
• Front panel can be locked to prevent accidental adjustments.

I have used these power supply modules, enhanced by the hacks I will describe below, with great success to control high-powered LEDs. But there are MANY, MANY uses for a programmatically controlled DC power supply that can source up to 15A and 50V. And once you have hacked and automated one digitally controlled gadget, you will notice lots of others you could also hack. Tell us about your project in the comments at the bottom!

Be sure to see the notes and captions I put on the images. If you are viewing this on the phone app, you might not realise they are there. Click on the little pencil icon at the upper right of a picture. Then click on a rectangle in the image to show the corresponding notes. (Why does Autodesk make captions so difficult here??)

I created a YouTube video demonstrating this system, which can be found here:

https://youtu.be/daaEE2jyANY

My YouTube channel: https://www.youtube.com/user/professorstevepotter

Step 1: Hacking Into the Rui Deng Power Supply Modules

I have the 2-part 15 Amp DPS5015 and the 1-part 5 Amp DP50V5A power supply modules. I used the DPS5015 module to first figure things out, because its front panel is separated from the circuit board by two ribbon cables that are easy to cut and probe with an oscilloscope. One ribbon is labelled LCD on the boards and you only need to cut one wire, the 3.3V supply line. The other ribbon cable, "KEY", is marked like so:

Rui Deng KEY cable on my DBS5015:

My cable :Their cable : Function

_______________________________

Bk : x x x : GND

W : solid pink : REB

Gy : solid white #1 : REA

V : ___ x ___ x : RE switch

Blu : _ _ _ _ : On/Off switch

Gn : __ . __ . : up arrow, M1, V-adj

Y : ___ ___ ___ : SET button

O : solid white #2 : down arrow, M2, A-adj

LCD cable:

R : Solid white #1 : Vcc +3.3V (on LCD cable)

“RE” means Rotary Encoder, the aluminium knob you rotate to increment (CW) or decrement (CCW) values or push to select things.

Cut the KEY cable in half and solder on your own ribbon cable or set of wires, colour-coded preferably (see photo). So now each wire not only goes where it was originally going, but also to your Arduino (with some resistors in between, to be discussed below). If you have the proper pitch crimp connectors for these cables, you may be able to tap into the cable without doing any cutting and soldering at all. I added some 0.1” male header pins to the end of my rainbow ribbon so that it was easy to plug it into a breadboard or the connector cable with resistors (see photo). Keep track of which end of the cable is which, as the plugs on the Keypad are a mirror image of those on the Main Board. If you plug it in backwards, your own lines will not be what you thought they were. The red wire is getting 3.3V from the LCD cable, by tapping into the third wire which is solid white. You could use this to power your 3.3V Arduino, like the Teensy or the one I used here, SIMBLEE.

Add resistors in series between the Rui Deng switch lines (but NOT to the GND and Vcc lines) and the Arduino pins which will be set to pinMode(pin#, OUTPUT). Otherwise, one device may be grounding the line while the other is trying to make it HIGH, which would cause enough current to flow to ruin something instantly. I used ~5k resistors for most of the switch lines. (See photo. The ribbon cable header plugs into the female header in the foreground.) For the REA and REB lines, I used 1k resistors. These have to respond faster, so a stiffer pull-up/pull-down is needed. Because the Rui Deng has very weak pull-up (through 42k), a 5k resistor easily allows the Arduino to pull the line down to logic LOW when the Rui Deng is HIGH. On the converse, pushing a physical button on the front panel grounds it through 0 ohms, easily pulling down to logic LOW when your Arduino line is HIGH.

Step 2: Tricky Rotary Encoder (RE) Details

There is another wire on my connector cable (orange, see photo) that is connected to either the REA or REB line directly, before the resistor. This goes to an INPUT line on the Arduino, to sense what state the rotary encoder is physically in.

The RE they chose to use has 30 detents per revolution, but only 15 full quadrature pulses/rev. That means that, unlike most mechanical rotary encoders, these have both REA and REB sitting grounded at every other detent. Most REs will ground those lines only momentarily as the knob passes between two adjacent detents. If the RE is grounded, you CAN NOT control the REA & REB lines with the Arduino.

This caused me a lot of hell. The hardware/software solution I came up with works, but requires you to be diligent in leaving the knob in a non-grounded state if you want to be able to control it virtually. I have red and green LEDs to tell me what state the knob is in, and the orange wire is what senses that, and controls the LEDs. Because both REA and REB sit HIGH (or LOW) together at a detent, you only need to sense one of them. I used a low resistance (470 ohms) to power the red LED so it would be very bright to indicate that I need to move one or the other knob by one click. I switch it using an FET (IRF3205), so as not to load the Arduino with its current draw (7 mA). The green LED has a 22k resistor (0.15 mA) and can be switched and powered directly by the Arduino. Because I have two devices, I have the green LED indicating that at least one device is OK, and the red LED indicates that at least one device is grounded. You could use more GPIO lines to have LEDs dedicated to each device.

The MCU in the power supply module senses which way the knob is being turned by whether the REA or the REB line has a transition first. Clockwise: A first. CCW: B first. This device increments or decrements one unit per _pulse transition_ (per detent click) which is only _half_ a quadrature pulse. Again, there is one complete pulse (HIGH-LOW-HIGH) per two clicks. I know, that’s probably more than you wanted to know about rotary encoders, but it was a lot of investigating I did that was needed for this automation to work at all. Maybe you have a more elegant solution?

Step 3: Tapping Into the 1-Unit DP50V5A

The lower-current (5A) power supply modules from Rui Deng fit all their electronics into the front panel, so there are no cables and no external PCB. This is nice if you want a small package and only need 5A or less. Armed with the confidence of having hacked into the DPS5015, I successfully tapped into the DP50V5A, too. This requires you to solder wires to each of the panel switches. The cover is easily removed with some prying but try to preserve the little tabs that hold it on. The front cover with button labels then comes right off after just pulling off the knob. Don’t lose the little plastic spacer ring inside the knob.

Get a nice temperature-controlled soldering iron with a fine tip to solder the wires. Tin the wire tips before trying to solder them to a switch. Use a multimeter to probe which side of each switch is grounded and solder your wire to the other side. The switches momentarily pull the lines to ground when pushed, called “negative logic” and they are normally pulled high through 42k internal to the device. Watch out for any SMT components near where you are soldering, especially the down-arrow button (see photo, orange wire). You can see some melting of the LCD frame from my careless soldering, but this did not hurt its function. Route the wires beneath the LCD and out near the green connector, so that the cover slides back in place and clips in. BTW, the green connector can be unplugged as a unit, which is handy if you have screwed four thick wires into it already. Be sure to add the 5k and 1k resistors in series with the switch and the RE lines at the other ends of the wires, respectively, as above. Include the RE sense wire with no resistor. I could not locate a 3.3V line that was easy to solder to, and that could source tens of mA on the DP50V5A, but did find a regulated 5V line with a nice solder blob, near the diode marked D5 (see photo, red wire). This needs to be attached to Vin (or 5V) to get regulated to 3.3V by your Arduino. Don’t connect it straight to the 3.3V pin. If you are using both the DPS5015 and DP50V5A at the same time, as I did, you only need one or the other to power your Arduino, but make sure both have their ground lines connected to the Arduino’s ground line.

Step 4: Oops, I Let the Magic Smoke Out!

WARNING: The DP50V5A has a small aluminium heatsink on some FETS, and it is dangerously close to other SMT components, with no insulation between them other than the sticky adhesive. One of mine shorted out rather spectacularly and actually caught fire (see photos). Out came the magic smoke that makes it work . Banggood is sending me a replacement, the DPS version. I suggest you remove the heatsink, cover the SMT components with silicone rubber or another high-temp insulator, and put it back.

Step 5: Powering Your Power Supplies

The Rui Deng power supply modules can accept a supply anywhere from 6-55 VDC (DP50V5A) or 6-60 VDC (DPS5015) but keep in mind that these are buck converters, meaning they can only output less than their input. The input has to be 1.1x more than the max output you need. So if you need 32V to power a 100W LED, you will need at least 35.2 VDC as a supply. I hooked two 24VDC power supplies (part numbers listed below) together in series to get 48V to power mine. Pay attention to cooling and ventilation for any high-current applications.

Step 6: Programming Your Rui Deng Devices for TRUE AUTOMATION

It is misleading that Rui Deng calls these power supply modules “programmable” because they are not really. I would call them “smart” or “digitally controlled” because you can set up some saved pre-set configurations. I would not call those programs, though. But by following the instructions here and adapting the Arduino code I wrote, you should be able to do pretty much anything you can dream up in terms of supplying power to your devices, with or without human intervention.

I used the SIMBLEE breakout board from Sparkfun, which has Bluetooth Low Energy functionality, as well as a nice Arduino-compatible microprocessor. The cool thing about SIMBLEE is that it is both an Arduino and BLE in one tiny chip. The smartphone (or tablet, etc.) user interface is created entirely inside the Arduino sketch so you don't need to create an app from scratch using java etc., and you have both IOS and Android devices covered with a single sketch. That said, the user interface options are limited and somewhat rudimentary compared to java app programming. I found programming the SIMBLEE to be a little better and easier to use than MIT App Inventor. The SIMBLEE chip is very small, helpful if you are making something that you want to fit in a small enclosure, and has good power (I get >30m range from its BLE to my phone). But if you don't want or need remote control, just omit all the Simblee code in my sketch and have a hard-wired system using your favourite Arduino. The Teensy 3.6 has an RTC built in and is very small and powerful.

Step 7: The RD Automat Sketch

I created a general purpose sketch (see PottersRuiDengAutomator.ino) to control both the DPS5015 and DP50V5A simultaneously. The sketch has four screens on the smartphone: a Home Screen, a Time Set screen to set the RTC, a System Monitor Screen that can be used to show debugging info, and a Remote Control screen that has virtual versions of all the physical front panel buttons and knobs on it. The menus and buttons of the two models are slightly different, so pay attention to the one that you will be using, if you are only using one type. The DPS devices can jump right to the 10mV setting for Voltage by hitting the up arrow, or the 10mA setting for Current by hitting the down arrow. The older DP devices don’t have these arrow button shortcuts, and also don’t have the option to be ON when powered up. When things are automated, this convenience makes virtually no difference, so either one is fine to use.

My sketch is long, but a lot of it is overhead required for creating the user interface for Simblee, that allows remote control via both Android and IOS devices. Simblee connects nearly instantly, with seemingly no pairing or handshaking hassles that I have had with other bluetooth solutions. To give you an idea of how to automate a slightly complex process, I included a button on the System Monitor Screen that switches between the brightest and dimmest LCD settings on both devices. Here is the function in my sketch that does this, in a fraction of a second, a process that takes me 23 seconds to do by hand for two devices!

void LCDbright(boolean LCDmax) 
{
// Turn the LCDs to max or min brightness.
// There are 6 steps (0-5) so I could use a selector instead. 0 is dim, not off.
Serial.println("Changing LCD brightness. ");

// DP50V5A:
DP50V5A_Set(2);
DP50V5A_DownArrow(5);
DP50V5A_REpush(1);
if (LCDmax) DP50V5A_REclockwise(6);
else DP50V5A_REccw(6);
DP50V5A_Set(2);
DP50V5A_REstate = digitalRead(DP50V5A_RESTATEIN); // put the knobs in HIGH state if need be.
if (DP50V5A_REstate == LOW)
{
digitalWrite(DP50V5A_REB, HIGH);
digitalWrite(DP50V5A_REA, HIGH);
}

// DPS5015:
DPS5015_Set(1);
DPS5015_DownArrow(5);
DPS5015_REpush(1);
if (LCDmax) DPS5015_REclockwise(6);
else DPS5015_REccw(6);
DPS5015_Set(2);
DPS5015_REstate = digitalRead(DPS5015_RESTATEIN); // put the knobs in HIGH state if need be.
if (DPS5015_REstate == LOW)
{
digitalWrite(DPS5015_REB, HIGH);
digitalWrite(DPS5015_REA, HIGH);
}
} // end LCDbright()

The sketch has lots of Serial.print() statements here and there, useful for debugging with the serial monitor on your computer, when connected via a USB. But you can also display variables and parameters on the System Monitor screen on your phone, to work untethered to a computer.

The sliders in the Remote Control screen can be used to quickly change the output voltage of each device, without pushing any other buttons. They are most reliable when tapped, not slid, because of all the SIMBLEE overhead taking a while to process. I am sure my code could be optimized to make them work more smoothly.

I tried to put most of the SIMBLEE stuff in the second half of the sketch, so you could more easily comment it out if you are not using SIMBLEE as your Arduino.

Of course, whatever board you use, be sure to plug your switching and RE sensing wires into the right GPIO pins, and then to adjust the pin assignments and pinMode settings in the sketch to match what you plugged them into. If you are using SIMBLEE, be sure to read the SimbleeForMobile Getting Started guide and other literature available at Sparkfun or Simblee.com. I tried to put lots of comments in the code, especially in cases where I spent some time trying to debug a problem, like with object ID variables getting re-used.

Step 8: Tricky Timing Issues

In order to successfully spoof button presses and knob turning, I tested a lot of different timings until things worked reliably. It seems you must hold a virtual “button” down (LOW) for at least 6 ms, and also wait at least 6 ms after digitalWrite(button, HIGH) before hitting another virtual button. That includes the RE’s momentary switch. But the RE’s rotation virtual “clicks” can be executed very rapidly, with only 50 microseconds between virtual clicks. So your code can quickly zoom to a certain voltage much faster than you could turn the knob with your fingers.

If the SET menu screen on the LCD has to be created, you must wait half a second for that to finish before making a selection on it.

There should be enough RTC code in there for you to figure out how to have things start and end at certain times while you are sleeping or away. Right now, the Real-Time Clock is just triggering the updating of the current screen every second.

Step 9: Some Possible Improvements and Additions You Could Try

1. Figure out how to read the state of the device, e.g., by understanding the LCD panel signals.

2. Read and keep track of all physical button presses with GPIO lines. Simblee did not really have enough lines to do that.

3. Add a current-sensing resistor (or tap into the one on the device) and have the Arduino calculate current, power, etc.

4. Replace the rotary encoder with one that only grounds A and B momentarily between detents and leaves both HIGH at all detents. Rui Deng's MCU may not interpret it correctly.

5. Actually re-programming the firmware inside the Rui Deng device instead of using an Arduino. (serious reverse engineering!)

6. Add Wifi or ethernet functionality to allow controlling the gadgets over the internet: VERY remote control.

7. Your own ideas?

Step 10: Links to Parts I Used

These excellent digital switching power regulator modules are made by Hangzhou Ruideng Technologies Co. Ltd. and can be bought very inexpensively at Banggood.com.

DPS5015 (50V, 15A DC-DC buck regulator, electronics board and front panel separate)

http://www.banggood.com/DP50V15A-DPS5015-Programmable-Supply-Power-Module-With-Integrated-Voltmeter-Ammeter-Color-Display-p-1072236.html?rmmds=search

DP50V5A (50V, 5A DC-DC buck regulator, 1-unit: all electronics in front panel)

http://www.banggood.com/DP50V5A-Buck-Adjustable-DC-Power-Supply-Module-With-Integrated-Voltmeter-Ammeter-Color-Display-p-1050061.html

The latter has been replaced with a DPS version, slightly improved:

DPS5005 (50V, 5A DC-DC buck regulator, 1-unit: all electronics in front panel)

http://www.banggood.com/DPS5005-50V-5A-Buck-Adjustable-DC-Constant-Voltage-Power-Supply-Module-Integrated-Voltmeter-Ammeter-p-1062473.html

These buck converters can be powered by two 24V power supplies connected in series (48VDC Uin). I am in Ireland, with 220VAC mains. I used two of these power supplies from Banggood, ~13 euro each:

http://www.banggood.com/IP20-AC220V-To-DC24V-200W-Switching-Power-Supply-Driver-Adapter-p-1057695.html

These might be inadequate for higher-current purposes, but two in series have no problem supplying 300W total, with good ventilation. Surplus computer power supplies with fans might be a good option. You might need a DC-DC boost converter or you might have to connect several computer supplies in series, depending on what output voltages you need.

SIMBLEE processor is the ARM Cortex M0 processor with 29 GPIOs and with 128KB of Flash and 24KB of RAM, no EEPROM, running at 16MHz.

SIMBLEE breakout board from Sparkfun (BLE and Arduino functionality):

https://www.sparkfun.com/products/13632

To program the SIMBLEE from the Arduino IDE via USB, I used the Sparkfun FT231X breakout board,

https://www.sparkfun.com/products/13263

It is possible to program it over the air (OTA) but I did not get into that.

Simblee.com distributes their own boards and programmers via Mouser, Digikey, etc., that are fine but slightly less functional than the Sparkfun versions. (e.g., extra buttons and programming headers).

My favourite Arduino-compatible board (as of now, April 2017), is Teensy 3.6, with a micro-SD slot, micro-USB, and RTC on board. 62 IO lines, 32 bit 180 MHz ARM Cortex-M4 processor with floating point unit, 1M Flash, 256K RAM, 4K EEPROM. In sum, Teensy is WAY more high-powered and versatile than SIMBLEE, but lacking any wireless connectivity. https://www.pjrc.com/store/teensy36.html

If your Arduino does not have an RTC onboard, here is a good one I used:

DS3231 RTC AT24C32 I2C Precision RTC module:

http://www.ebay.co.uk/itm/400902900013

Let me know if you have any suggestions or corrections for this Instructable.


Happy hacking! Let us all know in the comments what you are doing with your Automated Rui Deng power supply module!

About This Instructable

2,075views

61favorites

License:

Bio: AI consultant and semi-retired brain scientist and former professor at Georgia Tech.
More by stevempotter:Power Supply Automation: DPS5015, DP50V5A Controlled by Arduino -- Professor Potter Very STURDY and flat 4'x8' workbench table Window-like lamp from old computer monitors 
Add instructable to: