A digital DC power supply -- part 3: command control from
the PC
ArticleCategory: [Choose a category, do not translate
this]
Hardware
AuthorImage:[Here we need a little image from you]
TranslationInfo:[Author + translation history. mailto: or
http://homepage]
original in en Guido
Socher
AboutTheAuthor:[A small biography about the author]
Guido likes Linux because it is a really good system to
develop your own hardware.
Abstract:[Here you write a little summary]
This is the third part in the series about the digital power
supply. You might want to read the first part and also the second part.
A kit with the board and parts for this article is available
from shop.tuxgraphics.org.
ArticleIllustration:[This is the title picture for your
article]
ArticleBody:[The article body]
Introduction
The power supply circuit and software as described in the last
two articles (part I and part II) was a stand alone power
supply operated with a few push buttons on the front.
In this article we will add a feature which is normally only
available in really expensive high-end devices: You can control
the power supply not only locally via the push buttons but also
via commands from your computer.
All this is possible with software updates only since the
hardware was already prepared for this "command control"
feature.
To remotely control the power supply via commands we will use
again I2C communication (see also A digital thermometer or talk I2C
to your atmel microcontroller). I2C communication is a bit
slow but we do not send long commands anyhow. A command to set the
voltage could e.g be as short as "u=12". This is still human
readable and understandable but only a few bytes long.
The software to do this remote control has by now been ported
to Linux, Windows, Mac OS X and Solaris. It is probably
quite easy to port this code to even more operating systems.
How it works
I2C is a protocol over a two wire bus. One line on the bus
carries the clock (SCL) and the other the data (SDA). This has the big
advantage that you do not need a precise synchronous clock
signal. The timing is not so important for I2C therefore it is very
easy to implement in a simple user space program (no special
kernel module). For the physical interface we use again the
rs232 modem control lines. USB is also possible to use via a
USB to serial converter. The new Apple Macs have e.g no rs232
but because I2C is not sensitive to timing it is
possible to use adapter cables such as the Prolific PL-2303
(there are some links to USB adapters in the software for this
article under other_OS/macOSX/README.txt, see download at the
end of this article).
The program to send commands to our DC power supply is a
simple command line based program called i2ctalk. It is
available in source code and as precompiled binary for Linux, Solaris,
Mac OSX and Windows. You use it like this:
I2C commands for the DC power supply:
=====================================
# set Imax to 0.20A:
i2ctalk i=20
# get current I value:
i2ctalk i
# store current settings
i2ctalk s
# set Umax to 2.1V:
i2ctalk u=21
# get current voltage value:
i2ctalk u
You can enhance the program and build a fancy graphical
application if you want. I have just tired to keep it as simple
as possible to make it easy to understand.
The electrical part
The voltage levels on the physical rs232 interface are +/- 10V.
The atmega8 works with 0-5V. One could use a Z-diode to limit
the voltage levels but it turns out that this is actually not
needed. The atmega8 has internally already over and under
voltage protection. We just need to make sure that the current is low
enough to not "burn" this protection. All that is needed hardware wise are two 4.7K
resistors. Very easy, very convenient.
I have decided that an electrical insulation (via opto-couples)
to the PC is not needed for me (you can add them if you want). This has however some
implication for some special cases and you should be aware of
those limitations. Most desktop computers (and some laptops) have their GND
lines (0V) connected to earth. This means that the DC power
supply is no longer earth free on the output when connected to
the PC. This is because GND of the PC is connected to GND of
our power supply.
In most cases this will not be a problem. However you have to
be careful if the circuit to which you connect the power supply
to has also some connection to earth. Specifically the circuit
must not have a direct earth connection on the wire which you
intend to connect to the positive output of the power supply.
This would cause a short circuit via earth of your PC. It can
e.g happen if you cascade two power supplies in order to have
positive and negative voltages. In other words you can not use
the remote control feature if you plan to cascade several power
supplies.
Conclusion
There is not much more to say here. The main purpose of
this article is to make the new software available. The tar file is caleld
digitaldcpower-0.4.X.
I will use the X for any corrections. The
technology, I2C communication, is nothing new as it was already
used for the digital thermometer.
I and many others have now been using this power supply for
several month without any problem. It is very ridged, easy to
use and I really enjoy using it.
References/Download