PySerial and a Mastech MAS-345

Joined
Jun 1, 2008
Messages
1
Reaction score
0
Hey, this is my first post here, and I am hoping someone might be able to give me a hand.

I found this topic here: http://www.velocityreviews.com/forums/t354766-pyserial.html

which wasn't all that helpful but it looks like some people here might know a thing or two that could help me.

This is all for a college year one project I am doing. The idea is to use the multimeter to read amperage on a device, transmit it to a database, then to a website, in order to show power usage statistics. I am handling the meter and readings end of things.

I have a Mastech MAS-345 Digital Multimeter, connected to COM1 on my desktop. It is currently reading the draw from an external hard drive of mine. The meter is set to: 400mA and AC.

I have a program called MASView, which shows me the incoming data. I am mainly using this to confirm the connection and the presence of data.

I am (attempting) to write a small and simple program to read the data from the meter, but I am having issues. I'm not very good at coding, so bare with me please. I tried Java, but I'm horrid with java and a great prof of mine suggested I try Python. So I have it all set up and I just cannot read any data.

There is VERY little info ont he MAS-345's settings, so I am going on little snippets I have picked up here and there.

Here is the code I am using so far:

import serial
ser = serial.Serial()
ser.port = 0
ser.baudrate = 2400
ser.bytesize = 7
ser.open()

This works just fine, however, due to lack of information I do not know if I have the baudrate or bytesize settings wrong. I am sure the defaults for the other settings are correct as is, but again, I cannot be sure.

When I do this:

ser.read()

I get a "box" for a return character. like this: [] but connected.

x = ser.readline()
print x

Gets me nothing. And

ser.inWaiting()

gets me: 0L

I am at a loss as to what is going on.

I have also tried to send a newline to the device to trigger a return of data, but that did not work. (I got that from an article called Electrickery, where this exact meter is used with Perl (blech) to read data from it. We are NOT using perl for this.)

It is not clear to me, from the pyserial docs, if I can query the meter for its settings, or whether calling the connection using the defaults will use the defaults according to the meter or according to pyserial.

Does anyone have some thoughts on this?

Mainly I need to know

if I have the correct com settings, or if I can check them somehow.

how to get data from the device.

Cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

pySerial help? 0
Pyserial 4
Pyserial and pyQt 4
The state of pySerial 3
pyserial 5
AttributeError in pygame code 4
Logging data from Arduino using PySerial 5
Remote SSH and Configuring code help 0

Members online

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,805
Latest member
ClydeHeld1

Latest Threads

Top