Watts Up? User Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Our new website is online!

Author Topic: User developed utility for Linux  (Read 4957 times)

Watts up?

  • Administrator
  • Adept Member
  • *****
  • Posts: 100
User developed utility for Linux
« on: October 02, 2007, 10:25:15 PM »

From: Patrick Mochel [mochel@digitalimplant.org]
Sent: Wednesday, April 05, 2006 6:27 PM
Subject: Re: Watts Up Feature Requests

On Wed, 5 Apr 2006, Patrick Mochel wrote:

> P.S. I am attaching the command line utility that I wrote for Linux to
> interact with the Watts Up. Please feel free to do with it what you like,
> though any improvements or fixes would be greatly appreciated.

Woops, here it is this time.

Thanks,


    Patrick
Logged

Dan Kidger

  • Newbie
  • Posts: 3
Re: User developed utility for Linux
« Reply #1 on: October 30, 2007, 05:36:16 AM »

I have downloaded and tested this tool

Excellent !

However note that I had to patch the source to get it to work.

I made several changes, but the key one was to change B9600 to B115200 in setup_serial_device()

My WattsUp Pro works at 119200 baud - did a previous model only support 9600 ?

Logged

Dan Kidger

  • Newbie
  • Posts: 3
Re: User developed utility for Linux
« Reply #2 on: October 30, 2007, 05:38:03 AM »


I also extended wu_num_fields from 16 to 18 since my Watts Up meter adds 2 extra fields at the right:  Hertz and VA

Daniel
Logged

yuvraj

  • Newbie
  • Posts: 3
Re: User developed utility for Linux
« Reply #3 on: October 26, 2008, 01:18:53 PM »

Good work on providing a utility!... although it seems that this utility ( looking at the C code) is meant for getting data using the Serial (over USB) port on the Watts Up meters... is that correct?

Does anyone know if there exists a similar utility to get data off a .Net meter using TCP/IP directly ?
I basically want to be able to query my .Net meter directly without going through the watts-up meter website ...

any help is appreciated..

--Yuvraj 
Logged

luke

  • Newbie
  • Posts: 2
Re: User developed utility for Linux
« Reply #4 on: November 14, 2008, 07:56:47 AM »

I have downloaded the Linux utility tool for Watts UP power meter. When I tried this tool, I always got the messages like following:

>./wattsup -a ttyUSB0 watts
wattsup: [error] Reading header strings: Timer expired
wattsup: [error] Reading header strings: Timer expired
wattsup: [error] Reading interval: Timer expired
wattsup: [error] Reaing device display mode: Timer expired
wattsup: [error] Reading user parameters: Timer expired
wattsup: [error] Reading final time stamp: Timer expired
wattsup: [error] Blech. Giving up on read: Timer expired
wattsup: [error] Reading final time stamp: Timer expired

I checked /dev directory and found /dev/ttyUSB0. It shows this meter has been connected. I am wondering whether I need the driver for this device but I couldn’t find one for Linux through the Watts Up website.

Thanks.
Logged

vuky

  • Newbie
  • Posts: 1
Re: User developed utility for Linux
« Reply #5 on: December 03, 2008, 08:41:53 PM »

I had the same problem. However thanks to the previous poster I was able to fix it :-). You need to apply following patch to your wattsup.c source

60c60
< #define wu_num_fields 18
---
> #define wu_num_fields 16
476,477c476,477
<       cfsetispeed(&t, B115200);
<       cfsetospeed(&t, B115200);
---
>       cfsetispeed(&t, B9600);
>       cfsetospeed(&t, B9600);




I have downloaded the Linux utility tool for Watts UP power meter. When I tried this tool, I always got the messages like following:

>./wattsup -a ttyUSB0 watts
wattsup: [error] Reading header strings: Timer expired
wattsup: [error] Reading header strings: Timer expired
wattsup: [error] Reading interval: Timer expired
wattsup: [error] Reaing device display mode: Timer expired
wattsup: [error] Reading user parameters: Timer expired
wattsup: [error] Reading final time stamp: Timer expired
wattsup: [error] Blech. Giving up on read: Timer expired
wattsup: [error] Reading final time stamp: Timer expired

I checked /dev directory and found /dev/ttyUSB0. It shows this meter has been connected. I am wondering whether I need the driver for this device but I couldn’t find one for Linux through the Watts Up website.

Thanks.

Logged

mailtovb

  • Newbie
  • Posts: 1
Re: User developed utility for Linux
« Reply #6 on: April 09, 2009, 03:27:44 AM »

thanks to the author for this wonderful tool..
i have a few questions regarding the data shown by this tool..
Is the output that we get the live output? I ask this question because the windows version of this similar tool samples at 1 second and when the memory in wattsup-pro is exhausted, it increases the sampling rate by 2. Hence as time progresses, the output becomes less accurate.. Does this tool work the same way or does it show the live output..
Also, is it possible to reduce the sampling rate from 1 sec to less than a sec.. i tried changing the wu_interval in the code to sleep for 100 millisecond but i got a segfault.. any help will be really appreciated.
Logged

billh

  • Newbie
  • Posts: 4
Re: User developed utility for Linux
« Reply #7 on: September 17, 2009, 07:01:34 AM »

I appreciate this utility, as I couldn't get the Windows tool to work under Wine.

Yet I'm new at connecting to USB devices in Linux.  I'm running Ubuntu Jaunty, and I see the following devices:

$ lsusb
Bus 002 Device 002: ID 064e:a110 Suyin Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 003: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 005: ID 046d:c50e Logitech, Inc. MX-1000 Cordless Mouse Receiver
Bus 001 Device 004: ID 0424:2504 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 003: ID 045e:000b Microsoft Corp. Natural Keyboard Elite
Bus 001 Device 002: ID 04cc:1521 Philips Semiconductors USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub


Bus 005 Device 003 is obviously the one I want, but


$ ll /dev/u*
crw-rw-rw- 1 root root   1,  9 2009-09-17 05:33 /dev/urandom
crw-rw---- 1 root root 252,  1 2009-09-16 22:33 /dev/usbdev1.1_ep00
crw-rw---- 1 root root 252,  0 2009-09-16 22:33 /dev/usbdev1.1_ep81
crw-rw---- 1 root root 252, 15 2009-09-16 22:33 /dev/usbdev1.2_ep00
crw-rw---- 1 root root 252, 14 2009-09-16 22:33 /dev/usbdev1.2_ep81
crw-rw---- 1 root root 252, 19 2009-09-16 22:33 /dev/usbdev1.3_ep00
crw-rw---- 1 root root 252, 18 2009-09-16 22:33 /dev/usbdev1.3_ep81
crw-rw---- 1 root root 252, 21 2009-09-16 22:33 /dev/usbdev1.4_ep00
crw-rw---- 1 root root 252, 20 2009-09-16 22:33 /dev/usbdev1.4_ep81
crw-rw---- 1 root root 252, 23 2009-09-16 22:33 /dev/usbdev1.5_ep00
crw-rw---- 1 root root 252, 22 2009-09-16 22:33 /dev/usbdev1.5_ep81
crw-rw---- 1 root root 252,  3 2009-09-16 22:33 /dev/usbdev2.1_ep00
crw-rw---- 1 root root 252,  2 2009-09-16 22:33 /dev/usbdev2.1_ep81
crw-rw---- 1 root root 252, 17 2009-09-16 22:33 /dev/usbdev2.2_ep00
crw-rw---- 1 root root 252, 16 2009-09-16 22:33 /dev/usbdev2.2_ep83
crw-rw---- 1 root root 252,  5 2009-09-16 22:33 /dev/usbdev3.1_ep00
crw-rw---- 1 root root 252,  4 2009-09-16 22:33 /dev/usbdev3.1_ep81
crw-rw---- 1 root root 252,  7 2009-09-16 22:33 /dev/usbdev4.1_ep00
crw-rw---- 1 root root 252,  6 2009-09-16 22:33 /dev/usbdev4.1_ep81
crw-rw---- 1 root root 252,  9 2009-09-16 22:33 /dev/usbdev5.1_ep00
crw-rw---- 1 root root 252,  8 2009-09-16 22:33 /dev/usbdev5.1_ep81
crw-rw---- 1 root root 252, 26 2009-09-17 06:38 /dev/usbdev5.3_ep00
crw-rw---- 1 root root 252, 25 2009-09-17 06:38 /dev/usbdev5.3_ep02
crw-rw---- 1 root root 252, 24 2009-09-17 06:38 /dev/usbdev5.3_ep81
crw-rw---- 1 root root 252, 11 2009-09-16 22:33 /dev/usbdev6.1_ep00
crw-rw---- 1 root root 252, 10 2009-09-16 22:33 /dev/usbdev6.1_ep81
crw-rw---- 1 root root 252, 13 2009-09-16 22:33 /dev/usbdev7.1_ep00
crw-rw---- 1 root root 252, 12 2009-09-16 22:33 /dev/usbdev7.1_ep81
crw-rw---- 1 root root 253,  0 2009-09-16 22:33 /dev/usbmon0
crw-rw---- 1 root root 253,  1 2009-09-16 22:33 /dev/usbmon1
crw-rw---- 1 root root 253,  2 2009-09-16 22:33 /dev/usbmon2
crw-rw---- 1 root root 253,  3 2009-09-16 22:33 /dev/usbmon3
crw-rw---- 1 root root 253,  4 2009-09-16 22:33 /dev/usbmon4
crw-rw---- 1 root root 253,  5 2009-09-16 22:33 /dev/usbmon5
crw-rw---- 1 root root 253,  6 2009-09-16 22:33 /dev/usbmon6
crw-rw---- 1 root root 253,  7 2009-09-16 22:33 /dev/usbmon7


I couldn't figure out what to put on the command line, though.  $ wattsup -c 10 /dev/usbdev5.3_ep81 watts messed up the terminal and did little else.
Logged

titanius

  • Newbie
  • Posts: 1
Re: User developed utility for Linux
« Reply #8 on: October 28, 2009, 02:22:54 PM »

to billh:

the arguments are always ttyUSB0 or something like that and not /dev/ttyUSB0 (/dev is removed). Also search whether the device comes up as a tty device, i dont think you can read from it as a u* device



BTW, this tool is great! thanks for sharing.
Logged

shallia

  • Newbie
  • Posts: 1
Re: User developed utility for Linux
« Reply #9 on: November 07, 2010, 04:01:05 PM »

Hello Patrick,

I am a new user of Watts up. Now, I want to test power consumption of my program under centos 5.4. Thank you for sharing your watts up linux utility. What I am trying to do is I want to clear the memory of the watts up meter and start to logging in the power consumption before my program starts, and finally collect all the data when my program finishs. However, if I add the ./wattsup ttyUSB0 command into my program, it will keep running this command which stops the execution of the rest of my program. I do not know how to solve this problem? Could you give me some suggestions? Thank you for your helps.

Shan
Logged

peterbailey

  • Newbie
  • Posts: 1
Re: User developed utility for Linux
« Reply #10 on: May 03, 2012, 05:32:52 PM »

I had the same problem. However thanks to the previous poster I was able to fix it :-). You need to apply following patch to your wattsup.c source

60c60
< #define wu_num_fields 18
---
> #define wu_num_fields 16
476,477c476,477
<       cfsetispeed(&t, B115200);
<       cfsetospeed(&t, B115200);
---
>       cfsetispeed(&t, B9600);
>       cfsetospeed(&t, B9600);



I modified the code to properly label the new data fields: https://github.com/pyrovski/watts-up.  I also added a makefile and forced flushing of stdout.  Now it is possible to use pipes, e.g. like this:

Code: [Select]
./wattsup ttyUSB0 -g -l | tr ',' '\n'
Logged

vksingh

  • Newbie
  • Posts: 1
Re: User developed utility for Linux
« Reply #11 on: November 14, 2012, 03:00:50 AM »

Hi All,

I am using this linux utility on Ubuntu 12.10. One problem i am facing is when i use the utility for some time, it start giving error for timer expiry for data read. I remove the USB cable and connect it again. I then get a new ttyUSB and the utility start again and it works fine.

wattsup: [error] Reading final time stamp: Timer expired
wattsup: [error] Blech. Giving up on read: Timer expired
wattsup: [error] Reading final time stamp: Timer expired


Any solution to this.
Logged

jack_kelly

  • Newbie
  • Posts: 1
Re: User developed utility for Linux
« Reply #12 on: December 17, 2013, 02:53:10 AM »

Many thanks to the original author of this tool, Patrick Mochel; and to Peter Bailey for providing a fork of this code on github.

Before stumbling across this forum, I had also tinkered with the code to make it usable with pipes, and in fact I came to this forum to see who I should contact about forking the code on github.  So I'm really glad that Peter has done this already!  But it would have been nice to have known about Peter's version before I spent time tinkering with the code.

So...

Dear WattsUp folks, please could you consider changing your "Support: Downloads" web page so it links to Peter Bailey's github version of this code rather than the old .zip file?
Logged