Log two Multimeters with single serial port

Update – new version :
Logger for Android @ http://ficara.altervista.org/?p=3208

As promised in my previous post, here is the program to log the data coming from two multimeters. I opened the Rs232 box of one multimeter (we are talking about the DT4000-ZC model) and discovered that there is no GND reference ! Look at the picture :

rs232-ifAt left side, you can see the “circuit” that’s in the rs232 connector box ; at right, what I suppose it’s inside the multimeter. The GND reference isn’t needed ‘cause the pin 2 of DB9 connector is normally polarized at -5V, that is the voltage level coming from the pin 3 (Txd) via 10K resistor. When the DTR signal (pin 4) goes high, the PNP transistor acts like a switch, commutating the pin 2 level from -5V to +5V depending on serial signal captured by the PNP phototransistor. In this case, the GND reference is inside the PC serial port and therefore there is no need to insulate the two multimeters one respect to the other.

But… I just want to use a single rs232 port on my PC to log both the multimeters, as channel #1 and #2. Ok, if the circuit inside the multimeter is like I supposed it to be, I can simply make an ‘OR’ of the outputs, powering via RTS one channel, and via DTR the other, once at a time. The schematic for this mixer is here:

That's not CAD, but MAD (Manually Aided Design)

That’s not CAD, but MAD (Manually Aided Design)

In the next picture you can see the prototype I built to test the program.

mixer-detailsNow, all is ready to test. I used a USB battery charger (very simple circuit, look on my previous articles for details) and two multimeters to measure the battery voltage and the charging current.

IMG_20130818_180318 Ok, the multimeters are running. Now I can launch my new application, having set the com port as in the previous program. Starting the log, I can see on the screen the samples, alternatively taken from the multimeter #1 and the #2. At the start of each line, I added a time stamp, for successive data elaboration, may be in graphical form.

dos2x2The application has been written in FreeBasic (look at the right column of this page for the link to the free, open source compiler) and doesn’t need for installation. Please, look at the previous post for more details on starting from batch. The new program acts exactly as the previous, only has enhanced data stream verification and, obviously, double channel capabilities 🙂

Note: this article was cited on “Hack-a-day” on Aug 26 2013.

Disclaimer: this application is provided with no explicit or implicit warranties of operation. I do not assume any responsibility for problems that may arise on the device where the application is installed. The program is a “demonstration” and no support of any kind is provided. By downloading and installing the program, you implicitly accept my terms of not taking responsibility. If you do not agree, do not download and / or install the file !

I have read and understood the note, accept the terms and want to download the file DT4000x2.zip (42.204 bytes)

Note: the zip file has a password. Check the hash of the zipped file, then extract it and you will have your executable ready to run. If you don’t have a tool for computing the hash, I suggest HashTab, free for personal use.
Note: DO NOT extract or use the downloaded file if MD5 doesn’t match with the following code : MD5 = 0EEA13D48A3E915B2C4E53CC54663679
The password is: eficara

Logger for DT-4000ZC digital multimeter

Update 31 Dec 2016:
Look at the end of this article for new version of EXE
Log 2 multimeters with one serial port @ http://ficara.altervista.org/?p=1602
Logger for Android @ http://ficara.altervista.org/?p=3208

I recently purchased a digital multimeter with RS232 serial output. If interested to, search ebay for “IN06158” and you will find the item from UK seller al reasonable low price.

The device measures actual temperature. Uh, it's hot :)

The device measures actual temperature.
Uh, it’s hot 🙂

The reason for this was that I’m going to design my own LiFePO4 battery charger and want to create a test diagram for Voltage and Current while battery is charging. The Multimeter is shipped with software that has graphical style and logging capabilities, but I always choose to write my own application ‘cause it will be certainly “tailored” for my needs.

So, a quick search on Google pointed me to the serial protocol, that’s very simple (read about the protocol at this link). All the infos are sent via 14 bytes frames, with the digits and icons bitmapped on various bytes. I used the FreeBasic compiler to create an executable that shows on screen (in console mode) the decoded frames and also saves the data on a text file. The executable (actually tested under Win7, but I’m pretty sure that will work on XP) doesn’t need for installation, it can be run directly clicking on the .exe icon. The first step is to supply the com port that must be used for communication, as you can see in the picture below.

Type in the com port you want to use

Type in the com port you want to use

After the com port is open, the program stands for an UP-arrow to start communicating with the Multimeter ; a DOWN-arrow will pause the communication, while the ESC key will terminate the program (saving the log file). Every row shown on the screen is also saved on disk. The digits are enclosed in brackets [ ] just for “cosmetic” reasons. You can see an example of records in next picture.

A frame error message is shown if first byte is wrong

A frame error message is shown if first byte is wrong

The protocol isn’t very “sure”, ‘cause there is no check on the full string or on single bytes, but you can filter it easy if some “strange” value appears on decoded segments or if the sequence of high nibbles (they start with 0x1n and end with 0xEn) is non-continuous. The serial cable is short (about 1 m), so errors would be rare.

The executable (zipped) can be downloaded from the link supplied at end of this page, after the disclaimer. Please, note that the zip file also contains a batch file .bat that can be modified to start the program without the need for typing the com port. In fact, if you modify the .bat file, substituting the com port value (on my PC is com22), you can simply start the executable, using the selected port, just clicking on .bat file icon.

I’m also planning to create a new version of this file for logging two multimeters simultaneously,  ‘cause I need for Voltage and Current sampled at same time. Obviously I would use two multimeters with different com ports and probably I would apply some interface for isolating the serial ports of the Amp and Volt meters. Ok, stay tuned for improvements 🙂

Disclaimer: this application is provided with no explicit or implicit warranties of operation. I do not assume any responsibility for problems that may arise on the device where the application is installed. The program is a “demonstration” and no support of any kind is provided. By downloading and installing the program, you implicitly accept my terms of not taking responsibility. If you do not agree, do not download and / or install the file !

I have read and understood the note, accept the terms and want to download the file DT4000.zip – updated 2016/12/31

Note: the zip file has a password. Check the hash of the zipped file, then extract it and you will have your executable ready to run. If you don’t have a tool for computing the hash, I suggest HashTab, free for personal use.
Note: DO NOT extract or use the downloaded file if MD5 doesn’t match with the following code : MD5 = BC558E8F4A118548BAB949535087FEC0
The password is: eficara

2016/12/31: I modified the executable after a request from a reader. Now you can add in the command line a flag to autostart the log and on every line of the log you can read the timestamp of the sample in the format hh:mm:ss.

The screenshot of the new version of the program

The screenshot of the new version of the program

The program running with autostart flag set in the command batch file

The program running with autostart flag set in the command batch file

The downloadable zip file also contains an example of batch file to automatically start the logging on port Com3.

Note that some USB -> RS232 interfaces can’t control the DTR / RTS lines (due to missing commands in the drivers), so… such interfaces cannot work. I tried with an original Prolific PL2303 interface and it works. There are some non-original PL2303 chips that can have problems. The control of DTR / RTS lines is MANDATORY for this program to work.

Well, that’s all (for now)…