22 June 2017

Controlling a Tekpower TP3005P power supply from Python

I bought the Tekpower TP3005P power supply recently.  This goes for around $100.  That's not bad for a 30V, 5A, power supply with a USB interface. I've been impressed by the performance as well.  The accuracy data below was collected by controlling both the power supply and a UT61E meter via Python code. See my separate blog post for python code to control a UT61E meter.






The copy I have is reasonably accurate. The graphs show less than 0.5% error though out the voltage range under low or no-load conditions.

When the TP3005P is plugged in to a USB port, it maps in as a standard Com port. The default Windows driver can be used.

The TP3005P.py code uses the PySerial module to manage the serial port.  This must be downloaded and installed under Python before the power supply code can be run.  Other than PySerial, TP3005P.py should run on its own.  Un-comment the call to test() to run a short demo. 

Like most lab power supplies, at no load it is in voltage regulation mode.  The voltage will go to the commanded level.  If the current exceeds its set point, then the power supply changes to current regulation mode.  The voltage will drop below its set point to whatever level is necessary to prevent the current from exceeding its set point.

The power supply has commands to set the voltage and current set points that it will regulate to.  It also has commands to read back the set points.  Additionally, the power supply can measure the actual voltage and current at its output terminals.  Finally, there is a command to turn the power supply output on or off.

The voltage can be set and read at a resolution of 0.01 VDC.  The current can be set and read at a resolution of 0.001 ADC.

** 2021.10.20 Updated link to Google Drive **

TP3005P Python Code


21 June 2017

UNI-T UT61E DMM with serial interface - Python code

The UT61E is a pretty nice meter for the money.  It has 22000 count resolution (4.5 digit) and a nice selection of ranges.  But the selling point for me was the computer interface.  The point of this post is to show an example of how to reliably get data from the computer interface.  As seemingly simple as it is, there are few tricks to it.

AC and DC Volts - 0.01 mV to 1000V
AC and DC Amps - 0.01 µA to 10A
Frequency - 0.01 Hz to at least 50 MHz
Capacitance - 1 pF to 0.22 F
Resistance - 0.01 Ω to 220 MΩ

The interface is optically isolated, and comes with a cable that ends with a DB9 RS-232 connector. The meter transmits data once every 0.5 seconds.  It accepts no commands. The data that it outputs is a little obscure, but thankfully someone else has created a Python module (es51922.py) to convert the responses from the meter to usable data. I'm using this module without modifications.

To connect to the meter, I'm using a very cheap USB to RS-232 cable purchased from Amazon. I'm using the default Windows (Win10) driver. I believe that really any USB to RS-232 converter should work with this code. The only trick to working with this meter is properly managing the RS-232 control signals.

I'm using PySerial to manage the Com port. You will need to obtain and install this module to use this code.  I've linked to a copy of ES51922.py file for reference.

The UT61E code is simple to use.  Call the init_comm() function with a string that represents the name of the comm port that the meter is connected to ("Com5:" for instance).  Call get_one_reading() to return a numeric result.  There is considerably more data that is available (range, overload, etc.).  This code was primarily meant to show how to manage the serial port.

To try the example code, first download and install PySerial.  Then, create a project for the UT61E module.  Drop the ES51922.py file in the same folder as UT61E.py.  Run it.

** 2021.10.20 Updated links to Google Drive **

UT61E Example Serial Comm Python Code

ES51922 Data Parsing Python Code 

30 January 2011

Christmas Light Controller

Shown below is a photo of the controller PCB.  The two RJ45 connectors at the top left are the input and output connectors.  The RJ12 connector at the top right is used to program the microcontroller using the Microchip ICD in-circuit debugger/programmer.  The two position terminal at the top edge of the board is for 120 VAC.  There is one two position terminal block at the bottom of the board for each output.  I've provided links to the Microchip project file, the assembly code file, and the hex file below.


Microchip Project File
Assembly Code File
HEX File

Christmas Light Dimable Controller (Renard)

Several years ago I designed a Christmas light controller for a friend who does a large display every year.  He had been using a system based on cards that plugged into a PC (ISA bus).  The cards created digital outputs that were used to control triacs that switched power to the lights.  This allowed for only two states: on and off.  He wanted to be able to modulate the brightness of each output.
I selected the Renard protocol for several reasons.  It was an existing "standard" and there was no reason to create another.  More importantly, there was a plugin available for Vixen.  Vixen is the free PC based software used to control the sequencing of the lights.  Renard defines the data that is sent from the PC to the controller boards.
Each board was designed to allow independent control of eight outputs. Each output has 255 levels of dimming control from full on to off.  I should note that the board was designed for incandescent lights.  I have not tested it with LED lights.  Using only LED lights may prevent the dimming range from working as expected.  One work-around may be to always use at least one string of incandescent lights on each output.
The boards are daisy chained using eight conductor Ethernet cable.  Each board has two RJ45 connectors: one input from the previous board or PC, and one output to the next board.  Power is carried over six of the wires (12 VDC). The other two are a differential pair for RS485 style data transmission.  To simplify connection to the PC, the data input connector is designed to accept an RS232 serial port signal directly.
Links to the design files are below, along with links to Vixen software, Renard protocol, and ExpressPCB.

Circumflex Dimmer Schematic PDF
Circumflex Dimmer PCB PDF
Circumflex Dimmer BOM
Circumflex Dimmer Express PCB Schematic File
Circumflex Dimmer Express PCB File
Vixen Software
Renard Protocol
ExpressPCB

Blog created.

Blog created.