multimeter_ut61c

Post Reply
Message
Author
mato
Posts: 46
Joined: Sun 18 Jan 2009, 12:50

multimeter_ut61c

#1 Post by mato »

Hallo Hunde,

nachdem mein guter alter Multimeter den Geist aufgegeben hat,
habe ich ein Geraet von UNI-T erworben und zwar das Modell
UT61c mit serieller Schnittstelle.

Hat irgend jemand einen Tip zur Messwerterfassung unter Puppy,
am liebsten mit der Version 4.3.

Ich suche etwas ganz primitives, ich moechte die
Messwerte nur auf der Konsole haben, den Rest baue ich selbst.
Ich brauche kein GUI und keinen SchnickSchnack.

Das UT61c soll baugleich mit dem VC840 von Conrad sein.

Ich bin fuer jeden Tip dankbar.

Gruss aus dem Schwarzen Wald,
Mato

User avatar
rhadon
Posts: 1292
Joined: Thu 27 Mar 2008, 11:05
Location: Germany

#2 Post by rhadon »

Hallo Mato,

habe etwas gewartet, in der Hoffnung, dass jemand mit mehr Ahnung hier antwortet.

Ich denke mal, in den meisten (allen?) Programmiersprachen gibt es die Möglichkeit, mit seriellen und parallelen Ports zu kommunizieren, bzw. in deinem Fall, Daten zu empfangen. Definitiv weiss ich es von Clipper und C, kann mich aber nicht mehr an Einzelheiten erinnern.

In Bash wäre vielleicht hier ein Anfang. Ansonsten, suche nach 'Sprache deiner Wahl' und 'seriell'. Da findest du bestimmt Beispiele. Hat erstmal nicht so viel mit Puppy selbst zu tun.

Ob allerdings dein Multimeter die Daten automatisch (ständig) sendet, oder eine Einladung dazu braucht, keine Ahnung.

Hoffe, das hilft erstmal weiter,

Rolf
Ich verwende "frugal", und das ist gut so. :wink:
Raspberry Pi without Puppy? No, thanks.

User avatar
Dave_G
Posts: 453
Joined: Thu 21 Jul 2011, 13:53

#3 Post by Dave_G »

Hello Mato

Sorry to reply in English but although I can understand a bit of German,
writing it is a different story.

I don't have the exact technical specifications to the multimeter you have,
which are important to getting it to "talk" to Puppy via the serial port.
The important parameters are:

1) The baud rate and the number of start, stop and data bits.

2) Does it use any form of handshaking? (this can normally be deduced
from the number of wires being used for the serial interface).

3) What is the format of the data being sent back?
(ascii, raw hex)

4) Does the meter send out data continuously or only a certain amount
after a request from the host?

5) If it only sends out data after a request, then the format of that request is important.

Once you have all that information, there are several ways to read in the data.

1) Compile a program in C which will send out the request (if applicable)
then read in and display the data.

2) If you don't want to start with compiling pgms, then a bit of scripting
can be used.

As a broad outline, the script would first set up the serial port to the right
baud rate and number of bits.
Set up a small buffer (simple variables or small array will suffice).
Then send out a "request" to the multimeter.
Read the bytes one by one and populate the variables/array.
Display the result keeping in mind that if the data is not in printable ascii,
the script will first have to modify the data to properly display on the console
or you will get some very weird results.

Hope it helps.

mato
Posts: 46
Joined: Sun 18 Jan 2009, 12:50

#4 Post by mato »

Hi rhadon, hi Dave_G,

don't worry it's okay.
Alle diese Dinge zu finden ist ein muehsames Brot.
Ich hole jetzt an Infos zusammen was ich bekommen
kann, denn ich bin nicht der grosse Schnittstellen-
programmierer. Zur Zeit versuche ich die einzelnen
Signalpegel mit einem alten LED-Pintester zu testen.
Es waere einfach toll gewesen, wenn jemand so etwas
schon einmal gemacht haette. Dieser UT61c soll doch
recht verbreitet sein.

Anyway, vielen Dank und
Gruss aus dem Schwarzen Wald,
Mato

User avatar
Dave_G
Posts: 453
Joined: Thu 21 Jul 2011, 13:53

#5 Post by Dave_G »

Ok I understand that it can be a hassle finding out all those things.
Have you tried a serial terminal app like minicom for Linux or even
Hyperterminal if you want to try it under XP?

This way you can easily try different parameters/options without having to write any code.

mato
Posts: 46
Joined: Sun 18 Jan 2009, 12:50

#6 Post by mato »

Hi Dave_G,

ueber den Datenempfang mit Hilfe von minicom oder
picocom habe ich schon einmal gelesen, allerdings ohne
Details. Kannst Du irgenwelche Tips geben?

An alle:
Das Programm QtDmm funktioniert, getestet mit einem
Debian Lenny. Waehrend das Programm dort lief habe ich
auf einer Konsole mit "stty -a" die Einstellungen ausgelesen
und auf dem Puppy PC wieder eingegeben. Mein LED-Tester
zeigt jedoch nicht an, was er soll, ganz zu schweigen von
einem "cat /dev/ttyS0"

Macht es Sinn diese Idee weiter zu verfolgen oder ist das voelliger
Schwachsinn?

Gruss aus dem Schwarzen Wald,
Mato

User avatar
Dave_G
Posts: 453
Joined: Thu 21 Jul 2011, 13:53

#7 Post by Dave_G »

Hello Mato

The use of /dev/ttyS0 makes perfect sense.
By all means experiment with this command.
You may have to use "setserial" before to get your serial port (ttyS0)
setup to the right baud rate and number of bits.

If you are getting wrong data or data that looks like junk, then the most
common reason for that is that the program you are using is set to the
wrong baud rate.

The most common baud rates are 9600 and 115200 and the most common
"protocol" is 1 start bit, 8 data bits, 1 stop bit and no parity.
All of the serial communication pgms I have seen allow one to easily change
these settings.

Experiment a bit more using the details I have given above and let me know
what further progress you make and based on that we can move on with a script.

Just keep in mind that the meter may expect you to send a command first before
it sends out any data.

mato
Posts: 46
Joined: Sun 18 Jan 2009, 12:50

#8 Post by mato »

Hi Puppies, hi Dave_G,

nach heftigem Rumprobieren bin ich nicht etwa schlauer
sondern verwirrter als je zuvor. Ich hoffe, ich kann meine
Versuche einigermassen beschreiben.

Es ist hauptsaechlich das, was ich auf meinem Pintester sehe.
Wenn der PC eingeschaltet wird, sind TD RD RTS CTS DSR DTR
gruen, also 0. Kein Pin steht auf 1

Wie ich schon geschrieben habe, versuche ich mit Qtdmm, was funktioniert,
die Einstellungen herauszubekommen. Also: Wenn Daten uebertragen werden, sind
DSR und DTR auf 1, TD RTS CTS auf 0, RD blinkt rot und gruen.
Bei einem "cat /dev/ttyS0" werden mir die Werte angezeigt.

Beende ich Qtdmm, werden mir die Werte weiter angezeigt. Beende ich dann
"cat /dev/ttyS0" sind alle Pins auf null. Bei einem Neustart, sind alle
LEDs wie gehabt, es wird aber kein Wert angezeigt.
Wenn ich zuerst "cat /dev/ttyS0" aufrufe, laesst sich Qtdmm nicht mehr
starten.

Bei bei meinem Suchen bin ich dann auf ein Programm "vc840.c" gestossen.
Achtung: es gibt 2 unterschiedliche Programme mit diesem Namen
(wie geschickt).Version 1 liess sich problemlos kompilieren. startete
ohne Fehlermeldung, zeigte aber nichts an. Der Pintester
zeigte exakt das gleiche an wie bei Qtdmm, was funktioniert.
Version 2 liess sich nicht kompilieren.

Und jetzt stehe ich da. Was soll ich machen?

Fuer das UT61c sind die Einstellungen: 2400 8 N 1

Gruss,
Mato

User avatar
Dave_G
Posts: 453
Joined: Thu 21 Jul 2011, 13:53

#9 Post by Dave_G »

Hello Mato

OK, I have found this very informative page here:
(it's for the UT60e which should be similar)

http://perfec.to/ut60e/

Take special note of what is mentioned about the RTS line.
Also look at the C pgm towards the bottom of the page and try and compile that.

If for some reason it does not work, then you could adapt the pgm to
your needs but first test like so:

stty -F /dev/ttyS0 2400

(To confirm type setserial with no extra parameters)

Now you can do a cat /dev/ttyS0 and see what you get back taking
into consideration the data format shown on that page.
Also keep in mind the warning about RTS which could also apply to your U61C.

Hope this helps.

mato
Posts: 46
Joined: Sun 18 Jan 2009, 12:50

#10 Post by mato »

Hi Dave_G, hi all,

ich habe mir die erwaehnte Seite angeschaut und parse-ut60e.c
runtergeladen und kompiliert, problemlos.
Das Programm startet ohne Fehler und wartet dann auf das
Christkind, desgleichen ein "cat /dev/ttyS0 2400".

Die RTS Leitung zeigt gruen, also 0, so wie sie sollte.
Alle Signale verhalten sich so wie bei Qtdmm, was funktioniert.

Mehr aus Verzeiflung habe ich alles noch einmal eingegeben und
dann die typische Userantwort: "Ich habe nichts gemacht" aber
es geht. Ein "cat /dev/ttyS0 2400" zeigt mir die Werte an, so,
wie ich es haben moechte.

Dann habe ich "cat /dev/ttyS0 2400" gestoppt und neu gestartet.
Ergebnis: Nichts mehr, so wie am Anfang.
Was tun?

Der Wahnsinn rueckt immer naeher,
trotzdem,
Gruss aus dem Schwarzen Wald,
Mato

User avatar
Dave_G
Posts: 453
Joined: Thu 21 Jul 2011, 13:53

#11 Post by Dave_G »

Hello Mato

If I understand you correctly, the cat /dev/ttyS0 method works but when
you try it again it does not.

If so, it could be that RTS line story, you may have to physically disconnect it.

Another thing that may be a problem is the fact that the UT61C sends raw data
and not ascii data which sometimes causes the console to go "mad".

Anyway, keep in mind that if the UT61c is the same as the UT60, then it
sends out 14 bytes every several seconds and if what ever it is measuring is not
changing, then you could be reading the same data over and over again
thinking it's not changing/working when infact it's correct as the meter
is getting and measuring a non-changing quantity.

Here are two more short scripts that you should try out.
In both cases, keep in mind these points:

i) The meter could be sending out 14 bytes
ii) The RTS line could be the problem
iii) If any of the scripts seem to "hang", use CONTROL+C (I'm sure you know that anyway).
iv) The raw data coming from the meter may cause the console to misbehave.

# ======== script 1 ==========================

#!/bin/bash

# First we set the port
stty -F /dev/ttyS0 raw speed 2400

# Now we loop
while [ 1 ]; do
READ=`dd if=/dev/ttyS0 count=1`
echo $READ
done

# note that you may have to change the count=1 as the meter
# could be sending out more then 1 byte every few seconds.

# ========= end of script 1 ======================


# ======== script 2 ===========================


#!/bin/bash

# First we set the port
stty -F /dev/ttyS0 raw speed 2400

# Now we loop
while [true]; do
cat /dev/ttyS0
done

# ========= end of script 2 ======================

Another nice app you might want to try is:
http://freecode.com/projects/serlook
but it needs KDE.

I am very intrigued by this UT61C meter, I am going to try
and buy one for myself as I need a new multimeter anyway so it may
as well be this one.

mato
Posts: 46
Joined: Sun 18 Jan 2009, 12:50

#12 Post by mato »

Hallo Dave_G,

Ich habe Deine Scripts getestet:
Script 2 sagt gar nichts.
Script 1 meint :
*******************************************
0+1 Datensätze ein
0+1 Datensätze aus
ein Byte kopiert, 0,0425102 s, 0,0 kB/s
********************************************
Ich kann damit nichts anfangen, sorry.

Aber: Ich habe jetzt wenigstens etwas, was reproduzierbar ist:
1. Die Schnittstelle initialisieren mit " /sbin/getty -L ttyS0 2400 vt100 "
2. sudo ./parse-ut60e -d -f /dev/ttyS0 eingeben

Ich erhalte dann:
raw: 2b 30 30 31 39 20 30 00 00 00 02 01 0d 0a
raw: 2b 30 30 31 39 20 30 00 00 00 02 01 0d 0a
raw: 2b 30 30 31 39 20 30 00 00 00 02 01 0d 0a
raw: 2b 30 30 31 39 20 30 00 00 00 02 01 0d 0a
raw: 2b 30 30 31 39 20 30 00 00 00 02 01 0d 0a
raw: 2b 30 30 31 39 20 30 00 00 00 02 01 0d 0a
raw: 2b 30 30 31 39 20 30 00 00 00 02 01 0d 0a
raw: 2b 30 30 31 39 20 30 00 00 00 02 01 0d 0a
raw: 2b 30 30 31 39 20 30 00 00 00 02 01 0d 0a
usw.
Das funktioniert aber nur mit der Debug (-d) Option.
Warum funktioniert es nicht ohne ? Ohne "-d" wird
gar nichts angezeigt.

################################################

Jetzt habe ich noch ein ganz anderes Problem: Ich werde am
Mittwoch auf eine Reise geschickt kann also nicht wie bisher
diesen Thread weiterverfolgen. 1 Tag geht noch, danach muss ich
sehen. Auf jeden Fall vielen Dank. Solltest Du Dir auch das UT61c
zulegen, berichte mal darueber.

Gruss aus dem Schwarzen Wald,
Mato

User avatar
Dave_G
Posts: 453
Joined: Thu 21 Jul 2011, 13:53

#13 Post by Dave_G »

Hello Mato

Glad to see you are making progress.

I suspect that the debug (-d) switch is required so that the data received
is displayed as it's hex value and not it's ascii interpretation of which some
are non printable and would mess with the console.

I also see that the meter does indeed send out 14 bytes.

I will be purchasing my UT61C shortly and experimenting with it.
The main factor driving my decision to purchase this meter is simply that
I find myself often building dedicated circuits to measure various analogue
quantities then digitizing them and feeding them to either the parallel or serial ports.

By using the UT61C, the interface is pretty much done and saves me a lot
of time and effort.
Plus of course I can use it as a "normal" multimeter.

I will keep you informed as to the experiments involving the UT61C.

mato
Posts: 46
Joined: Sun 18 Jan 2009, 12:50

#14 Post by mato »

Hallo Dave_G,

es geht mir mit den Aufgaben fuer den Multimeter ganz aehnlich.
Ich moechte Strom, Spannung und Temperatur aufzeichnen.
Ein aelteres Notebook mit Puppy ist dafuer top. Die Messwerte
sollen dann mit Gnuplot online und offline angezeigt werden.

Fuer meinen Debian PC habe ich ein perl-script gefunden.
************************************************************************************************
http://hps.ininter.net/content/index.php?cat=80_\
English&page=40_Uni-T-nbsp~UT61B-nbsp~Linux
************************************************************************************************
Es ist zwar fur das UT61B geschrieben, funktioniert mit dem UT61C genauso.

Leider bekomme ich die Perlmodule unter Puppy nicht ans Laufen. Und sich mit
dem seriellen Port etwas schlau machen ist auch kein Fehler.

Es waere toll, wenn Du Dich mit Erfahrungen noch einmal meldest.

Gruss aus dem Schwarzen Wald,
Mato

mato
Posts: 46
Joined: Sun 18 Jan 2009, 12:50

#15 Post by mato »

Hallo ihr Hunde,

nach laengerem Auslandsaufenthalt melde ich mich zurueck
und moechte den Thread wieder aufnehmen, den ich auf Grund
meiner Reise abbrechen musste.

Der Grund ist eigentlich mehr eine Info.
Da das UT61C wohl recht verbreitet ist, ist meine
Loesung vielleicht von allgemeinem Interesse.
Also: Das Problem ist geknackt. Es war jedoch etwas
Fummelei.

Aber das UT61C macht jetzt genau das, was ich will.
Ich verwende das Perl Script dmmut61b.

Dazu ist notwendig:
Eine Perl Installation. Ich habe perl-5.8.8 verwendet.
Der C-Compiler
Ein Programm Device-SerialPort-1.000002.tar.gz . Dieses Pro-
gramm findet man auf der Webseite von CPAN.

http://search.cpan.org/~cook/Device-Ser ... ialPort.pm

Danach funktioniert dmmut61b wie geschmiert.


Eine Frage an Dave_G, der wohl das gleiche Problem wie
ich hatte: Hast Du in der Zwischenzeit auch eine Loesung
finden koennen und wenn ja, was fuer eine?

Gruss aus dem Schwarzen Wald,
Mato
Attachments
Bildschirmfoto.jpg
(24.55 KiB) Downloaded 1064 times

Post Reply