PySerial and a Mastech MAS-345

Discussion in 'Python' started by Pejell, Jun 1, 2008.

  1. Pejell

    Pejell

    Joined:
    Jun 1, 2008
    Messages:
    1
    Likes Received:
    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
     
    Pejell, Jun 1, 2008
    #1
    1. Advertisements

  2. Pejell

    Mark Rages

    Joined:
    Mar 30, 2015
    Messages:
    1
    Likes Received:
    0
    Mark Rages, Mar 30, 2015
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Jonas Åkermark

    Server.HTMLDecode doesn't decode char 345

    Jonas Åkermark, Aug 2, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    1,089
    Joerg Jooss
    Aug 2, 2005
  2. news.hku.hk

    how to display 12345 as 12,345 ??

    news.hku.hk, Apr 26, 2004, in forum: C++
    Replies:
    23
    Views:
    1,161
    Siemel Naran
    Apr 30, 2004
  3. pembed2003

    how to display 12345 as 12,345 ??

    pembed2003, Apr 28, 2004, in forum: C++
    Replies:
    0
    Views:
    612
    pembed2003
    Apr 28, 2004
  4. jorjun
    Replies:
    1
    Views:
    855
    John P. Speno
    Jan 8, 2004
  5. engsol
    Replies:
    8
    Views:
    1,044
    Peter Hansen
    Jan 13, 2005
  6. googlinggoogler@hotmail.com

    Pylab and pyserial plot in real time

    googlinggoogler@hotmail.com, Nov 6, 2005, in forum: Python
    Replies:
    6
    Views:
    2,147
    googlinggoogler@hotmail.com
    Nov 8, 2005
  7. ttdevelop@gmail.com

    345 free programming books

    ttdevelop@gmail.com, Apr 26, 2006, in forum: Python
    Replies:
    4
    Views:
    500
  8. Ittay Dror
    Replies:
    1
    Views:
    399
    Nobuyoshi Nakada
    Dec 7, 2008
Loading...