Arduino LabPSU2

I searched the Internet for a computer (Arduino) controlled PSU. The most suitable schematic I found at Links #1. But instead of a DAC I liked to control voltage and current limit with a digital potentiometer.

It should be a low cost solution, build with modules from the market, as much as possible. The data are:

As a benefit of the software, it allows a Remote Control with GUI (Graphic User Interface, TK) via either USB port, or WiFi (telnet connection, please see WiFi2AT-ESP8266).

This power supply is not suited for a plus/minus supply (e.g. operational amplifier), or very sensitive electronics, e.g. audio.




Remote Control

Note: Click on the images to enlarge.


Modules from market

Control and Measurement


For the connection board, see the schematic to the right. A printable version of the schematic can be downloaded.

Switching Regulator


On Ebay you could buy switching regulator modules for a low price.

In my case it must be a module with current limit adjustment. It is of benefit, if a schematic is supplied, as in my case.

Please see the schematic of the modified switching regulator on the right.

The original schematic was not 100% correct, but it was sufficient to adopt to the connection board, see the schematic to the right.

An 11 pin header was used to make a cable less connection to the connection board. The numbers of pins was selected, in order to be soldered easily to the 0V and Vout terminals. The other pins in between on the bottom side are bent 90 degree, as you can see on the picture.



The connections on the bottom side should be obvious when looking at the schematic. On the upper side are connected:


At that junction the wire for voltage control is connected.

Another modification is the addition of a 33 nF SMD ceramic capacitor (CFF) parallel to the potentiometer 10k. This is a recommendation from the XL4005 data sheet, page 6.

A modification for the Remote Control is the connection of the Disable / Enable signal. This is on pin 4 of the XL4005 chip. This signal is routed to a solder point on the board. A 8.2 - 12 kOhm SMD resistor can be soldered to that point, and the other side wired to pin 5 of the connector (ENA_PSU).



When switching ON, the voltage is set to minimum 0.5 V, the current limit to 0.23 A.

The voltage is set by the digital encoder (black knob). The selection of the channel 1 or 2 is done via the push button of the 5-way switch (below encoder), and shown on the LCD via a '*'. If there is a current limit condition, the '*' marker is replaced by a 'L'.

The current limit value is tuned by holding either the left or right switch of the 5-way switch and turning the digital encoder. The LCD shows the current limit value in Ampere.

If you push the switch of the digital encoder, the decimal value of the selected digital potentiometer setting is shown. If you are in Remote Control Mode, the Push will switch back to Local mode.

If you connect a PC to the USB port, and run the Remote Control software, it will be signaled with a R in the upper right corner of the LCD. The initialization of the USB port will force via the DTR line a Reset to the Arduino CPU. Therefore a 5 second Start delay is needed. In case of a WiFi connection this delay is not needed.



The software library for the LCD-key-encoder together with a schematic can be found at Links #2 or 3.

The software library for the MCP4461 digital potentiometer can be downloaded from Links #6.

The Arduino software LabPSU2R.ino is here for viewing and download. For pretty print the file extension was renamed from .ino to .cpp. Please rename after download the file to LabPU2R.ino, and copy it to the folder Arduino/LabPSU2R/LabPSU2R.ino.

The software Libraries you need, are linked in the source code comment area.

There are 10 constants (conversion factor) to be adjusted by a maximum of about 7%, to compensate for the part tolerances:

Compare the measured values from a Ampere/Volt meter with the LCD values, and calculate the offset in %. Then change the conversion factors by the same amount, considering the % sign (see at the factor description).

The current limit circuit is not very accurate, so there is no need to adjust the two circuits separate.

A remote control via USB is added, see ArduinoLabPSU2#Remote_control.

The Remote Control constants are found with the help of a spreadsheet, LibreOffice ver.

Hardware wiring

The +5 V supply was build up with a switching regulator module, the potentiometer was replaced by a resistor for better long term stability, see the pictures below.

The DC input from the laptop power supply is filtered by a LC circuit. A schottky diode prevents an undershoot of the voltage, because the switching regulator IC XL4005 is very sensitive in that aspect.


The Arduino Nano 3 is mounted such a way, that it is easy to access the mini USB plug for programming, and in future remote control. Because the current limit output of the switching regulators does just rise to 2.5 V, it is not enough to give a logic "1" (minimum 2.7 V) at the Arduino Nano 3 input. The minimum effort to fix that, was a silicon diode (1N4148) in series of that signal, rising the high level to 2.9V. In the software it needs the declaration of INPUT_PULLUP at the two current limit inputs.

The LCD-key-encoder board just fits in place of the red transparent front plate. The wall of the upper front notch must be cut down a little, in order to avoid squeezing off the back light transistor (SMD). I know from own experience, that it can happen ;-) if you do not cut.

The output connectors (4 mm plugs) are mounted in the red transparent front panel, which is cut in the width to 68 mm to fit into the front space. The spacing of the plugs are 15 mm. The center line is 12 mm from the bottom.

The front parts and the connection board (70 mm behind front) are fixed with hot glue.



In order to build your own unit, I will attach the Eagle 6.5 files for making a Printed Circuit Board.

Power Dissipation

I wanted to know, how much power dissipation gets lost, and if the switching regulator module needs a heat sink.

First have a look at some power data:

Uin [V] Iin [A] Uout [V] Iout [A] Pin [W] Pout [W] Pdis. [W] Efficiency [%]
24 0.14 0.5 0.62 3.4 0.3 3.1 9
24 0.20 1.0 1.13 4.8 1.1 3.7 24
24 0.44 3.1 2.00 10.6 6.2 4.4 59
24 1.04 6.5 3.00 25.0 19.5 5.5 78
24 1.50 8.5 3.50 36.0 29.8 6.3 83
24 0.20 3.7 0.50 4.8 1.9 3.0 39
24 0.45 7.4 1.00 10.8 7.4 3.4 69
24 1.40 14.7 2.00 33.6 29.4 4.2 88
24 1.95 17.8 2.40 46.8 42.7 4.1 91
24 0.25 5.5 0.50 6.0 2.8 3.3 46
24 0.60 11.0 1.00 14.4 11.0 3.4 76
24 2.00 22.0 2.00 48.0 44.0 4.0 92

For a temperature check I used a Infrared Temperature Meter UT300A from Uni-Trend.

Measured temperature data after 15 minutes heating up (room temperature = 20°C):

Part Cin Regulator Diode Coil Cout
Value 470uF XL4005 SK86 33uH 470uF
Temp.[°C] 29 55 37 32 72

It impressed me very much, that the highest temperature I measured, was at the output capacitor with 72°C. A good low ESR capacitor, like the Panasonic Series VFC / VFK can stand a maximum temperature of 105°C.

The good thing is, that the switching regulator module can withstand 5.5 W power dissipation at 20°C room temperature, which should contain most of the load cases.

Remote control

For the Remote Control of the Power Supply, an excerpt of the SCPI protocol from the Agilent E364XA Dual Output DC Power Supplies was used. Just the Identification String query was from the IEEE-488 command set. The software can be used with either connection:

The baud rate is in all cases 9600 baud.


In order to test the command set, a Python3 program was written with a tkinter GUI, see the picture on the right. For viewing and download see

The program was tested under Ubuntu 14.04, Mac OS Yosemite 10.10.2 and Windows 7-32Bit (COM5:). The serial default port names, may be adjusted to your own system. The GUI mask was developed with the free program Page. The program development was done with the program IDLE3. The program also works in the VirtualBox version 4.3.22.

Note: At the time the screen shot was taken, the second power regulator was not installed.

The fields to enter a value have a bisque background color, see X11 color names.

If the Current Limit is active, you can see that at the yellow background color in the Ampere field.

With the ON|OFF radio buttons the voltage output of both PSU's can be switched ON|OFF.

The Remote mode means, that the PSU local digital encoder is locked for tuning. It is signalled with the letter R in the upper right corner of the LCD display. When you finish the Python3 program, you can switch back to Local mode by pushing the digital encoder knob.

All commands must be send to the Power-Supply-Unit via USB with a newline terminator.

The lower case letters from the command words must not be send.


*IDN?   Send Identification string

SCPI 1997

Command separator ":"
Parameter separator: " "
  CURRent {<current>}
  CURRent? [MIN|MAX]
  VOLTage {<voltage>}
  VOLTage? [MIN|MAX]

INSTrument:NSELect {1|2}
*STB?    Query Status Byte, ASCII 0=OK, 1=CL1, 2=CL2, 4=intRemote

Some command line options are provided, not all are already in function:



WiFi ESP-01

In order to have a WLAN connection for Remote Control I found a low cost ($3) module ESP-01 (Chip ESP8266) from China, and software to archive a transparent bridge for the serial link. There are several tested software implementations available. Lets look at the benefits and drawbacks of the different implementations.

  1. I started with the Transparent Bridge of beckdac. It works, but you have to hard code the Access Point credentials in the Flash ROM of the ESP8266 module. The comfortable Arduino IDE can not be used, which would also allow an easy update of the ESP8266 firmware.

  2. Next try for a Transparent Bridge was esp-link. It allows to enter the credentials via web page of the ESP8266 module. To do so with a smartphone is not so easy. The comfortable Arduino IDE can not be used, which would also allow an easy update of the ESP8266 firmware.

  3. Third try was with ESP-bridge (Sep. 2016). This is a fork of the beckdac software, and allows to enter the credentials with ++ prefix commands from the serial port of the ESP8266 module. This software works well, but has one drawback concerning the security. The info command shows useful informations, but also the Access Point password in clear text. That should be fixed in the next program version. The comfortable Arduino IDE can not be used, which would also allow an easy update of the ESP8266 firmware.

  4. Then I wrote a forth implementation of the Transparent Bridge, see WiFiTelnetToSerialWPS. It is a combination of 3 pieces of existing software, developed in the Arduino IDE (version 1.6.12). The benefit compared to the previous mentioned solutions is, that the credentials are set via the WPS (WiFi Protected Setup) protocol, via Push Button switch and a LED for indication. That works also for the smallest ESP8266 module ESP-01.

The application software ( for remote control needed a while to integrate hardware and software, but now it works under the previous mentioned operating systems.

The specialty in the remote control software was, that I had to read with the call read_some() of the Python library telnetlib and assemble the received data packets until a newline character is seen.

The IP address of the ESP8266 WiFi module is coded in the software, but can be overwritten by a command line option (e.g.: -w For more details please have look at WiFi2AT-ESP8266#WPS.

In the application software, the WiFi link has priority, if an USB connection also exists.

From the hardware side is to mention, that the module needs 3.3 V supply voltage only. So, a little voltage regulator module from +5 V to 3.3 V was added.

The serial TX data line from the Arduino Nano3 was connected with a resistor voltage divider, 1 KOhm in series, and 2 KOhm to 0V.

The serial RX data line from the Arduino Nano3 was connected with a shottky diode (cathode connected to the ESP-01 module), to allow also USB operation without a switch. Please see the Connect diagram for details.


WPS (WiFi Protected Setup) allows to connect to a new WiFi Access Point via push button switch, instead of entering the credentials manually.

If you power up the PSU, and the red LED at the back side of the housing lits (ON), it signals, that the WiFi module has lost the connection to the known Access Point, or the credentials of the Access Point had changed.

In case of changed credentials, it is possible to connect to the Access Point via WPS. The procedure is:

  1. Push the WLAN/WPS button at your Access Point, until it is signallsing the WPS mode. You have a 2 minute timeout.

  2. Push the WPS button switch at the back of the PSU housing. The WPS module is now trying to connect to the Access Point.

  3. If the connect was successful, the LED goes OFF.
  4. Check the WiFi connection via ping command in a terminal, or the application program, or the WiFi Access Point status web page.

Debug Serial Port

To debug the serial port, I used the tool Bus Pirate 3. Start a serial terminal like (Mac OS), or PuTTY (win32). The baud rate is 115000, no handshake, Terminal->Enter key emulation: CR only.

Use of Bus Pirate 3:

# get firmware info
HiZ> i
# get mode info
HiZ> m
1. HiZ
2. 1-WIRE
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. LCD
x. exit(without change)

HiZ> m3
Set serial port speed: (bps)
 1. 300
 2. 1200
 3. 2400
 4. 4800
 5. 9600
 6. 19200
 7. 38400
 8. 57600
 9. 115200
10. BRG raw value

Data bits and parity:
 1. 8, NONE *default 
 2. 8, EVEN 
 3. 8, ODD 
 4. 9, NONE
Stop bits:
 1. 1 *default
 2. 2
Receive polarity:
 1. Idle 1 *default
 2. Idle 0
Select output type:
 1. Open drain (H=Hi-Z, L=GND)
 2. Normal (H=3.3V, L=GND)

Raw UART input
Any key to exit

  1. - Computer controlled PSU, from wvdv2002

  2. elecfreaks - Arduino LCD key shield

  3. wiki - Arduino_LCD_KeyPad_Shield

  4. - Arduino LCD key shield

  5. 2PCS Step down 5A 5V-32V to 0.8V-30V Lithium Charger power supply module, #400576098311

  6. Arduino MCP4461 software library

  7. X11 color names

  8. Software Library SerialCommand, version 3.6 (Stafan Rado)

  9. Digital Encoder & LCD software library download

List of pages in this category:

-- RudolfReuter 2015-02-20 17:19:29

Go back to CategoryAVR or StartSeite ; KontaktEmail (ContactEmail)

ArduinoLabPSU2 (last edited 2016-10-18 08:58:27 by RudolfReuter)