Python Programming for PC CPU monitoring

Programming CPU Computer Monitoring Using Python 2.7.3 and Python Graph

Step :

1.Download Python 2.7.3 from http://www.Python.org ,choose Download Python 2.7.3 windows Installer
 
2.Download Vpython for Windows at http://www.vpython.org
 
3.Download PSUTIL
 
4.Download WMI






 

5.Download Pywin for python 2.7.3
 





Source Code :

import wmi
import psutil
import os
from visual.graph import *
from datetime import date
from visual.controls import *


graph1 = gdisplay(x=0,y=0 ,width=400, height=300,
xtitle='Interval', ytitle='Bytes',
foreground=color.green, background=color.black)
label(display=graph1.display, pos=(50000,100000000000), text="Network Monitoring")
graph1.display.visible = False # make the display invisible
now=date.today()
now.strftime("%m-%d-%y. %d %b %Y is a %A on the %d day of %B.")
f1 = gcurve(color=color.cyan)
f2 = gcurve(color=color.red)
f3 = gcurve(color=color.blue)
f4 = gcurve(color=color.green)
       
graph2 = gdisplay(x=0,y=0, width=400, height=300,xtitle='Interval', ytitle='Percentage',
foreground=color.green, background=color.black)
label(display=graph2.display, pos=(50000,100), text="CPU and Temp Processor")
graph2.display.visible = False # make the display invisible
f5 = gcurve(color=color.red)
f6 = gcurve(color=color.yellow)

graph3 = gdisplay(x=0,y=0, width=400, height=300,xtitle='Interval', ytitle='Bytes',
foreground=color.green, background=color.black)
label(display=graph3.display, pos=(50000,100000000000), text="Bytes Memory Usage")
graph3.display.visible = False # make the display invisible
f7=gcurve(color=color.yellow)
f8=gcurve(color=color.red)

graph4 = gdisplay(x=0,y=0, width=400, height=300,xtitle='Interval', ytitle='Count',
foreground=color.green, background=color.black)
label(display=graph4.display, pos=(50000,100000000000), text="Read Count")
graph4.display.visible = False # make the display invisible
f9=gcurve(color=color.blue)
f10=gcurve(color=color.orange)

graph5 = gdisplay(x=0,y=0, width=400, height=300,xtitle='Interval', ytitle='Time',
foreground=color.green, background=color.black)
label(display=graph5.display, pos=(50000,10000000000), text="Read Time")
graph5.display.visible = False # make the display invisible
f11=gcurve(color=color.red)
f12=gcurve(color=color.yellow)

graph6 = gdisplay(x=0,y=0, width=400, height=300,xtitle='Interval', ytitle='Time',
foreground=color.green, background=color.black)
label(display=graph6.display, pos=(50000,10000000000), text="Read Time")
graph6.display.visible = False # make the display invisible
f13=gcurve(color=color.red)
f14=gcurve(color=color.yellow)
f15=gcurve(color=color.blue)
f16=gcurve(color=color.magenta)
f17=gcurve(color=color.green)

graph7 = gdisplay(x=0,y=0, width=400, height=300,xtitle='Interval', ytitle='Time',
foreground=color.green, background=color.black)
label(display=graph7.display, pos=(50000,10000000000), text="Read Time")
graph7.display.visible = False # make the display invisible
f18=gcurve(color=color.blue)
f19=gcurve(color=color.orange)
f20=gcurve(color=color.red)
f21=gcurve(color=color.magenta)
f22=gcurve(color=color.green)
f23=gcurve(color=color.cyan)

graph8 = gdisplay(x=0,y=0, width=400, height=300,xtitle='Interval', ytitle='Time',
foreground=color.green, background=color.black)
label(display=graph8.display, pos=(50000,10000000000), text="Read Time")
graph8.display.visible = False # make the display invisible
f24=gcurve(color=color.yellow)
f25=gcurve(color=color.blue)
f26=gcurve(color=color.red)
f27=gcurve(color=color.orange)

graph9 = gdisplay(x=0,y=0, width=400, height=300,xtitle='Interval', ytitle='Time',
foreground=color.green, background=color.black)
label(display=graph9.display, pos=(50000,10000000000), text="Read Time")
graph9.display.visible = False # make the display invisible
f28 = gcurve(color=color.cyan)
f29 = gcurve(color=color.red)
f30 = gcurve(color=color.blue)
f31 = gcurve(color=color.green)
f32=gcurve(color=color.yellow)
f33=gcurve(color=color.blue)
f34=gcurve(color=color.red)
f35=gcurve(color=color.orange)
f36 = gcurve(color=color.red)
f37 = gcurve(color=color.yellow)
f38=gcurve(color=color.yellow)
f39=gcurve(color=color.red)
f40=gcurve(color=color.blue)
f41=gcurve(color=color.orange)
f42=gcurve(color=color.red)
f43=gcurve(color=color.yellow)
f44=gcurve(color=color.red)
f45=gcurve(color=color.yellow)
f46=gcurve(color=color.blue)
f47=gcurve(color=color.magenta)
f48=gcurve(color=color.green)
f49=gcurve(color=color.blue)
f50=gcurve(color=color.orange)
f51=gcurve(color=color.red)
f52=gcurve(color=color.magenta)
f53=gcurve(color=color.green)
f54=gcurve(color=color.cyan)


for x in range(100000000):
  e=psutil.network_io_counters()
  d=e.bytes_sent
  f=e.bytes_recv
  g=e.packets_sent
  h=e.packets_recv
  dd=str(d)
  print d
  ff=str(f)
  print f
  gg=str(g)
  print g
  hh=str(h)
  print h
  p = psutil.Process(os.getpid())
  b = p.get_cpu_percent(interval=0.1)
  w=wmi.WMI(namespace="root\wmi")
  temperature_info=w.MSAcpi_ThermalZoneTemperature()[0]
  a=(temperature_info.CurrentTemperature/10)-273
  i=psutil.disk_io_counters()
  j=i.read_count
  k=i.write_count
  l=i.read_bytes
  m=i.write_bytes
  n=i.read_time
  o=i.write_time
  q=psutil.avail_phymem()
  r=psutil.used_phymem()
  s=psutil.total_virtmem()
  t=psutil.avail_virtmem()
  u=psutil.used_virtmem()
  v=psutil.disk_io_counters(perdisk=False)
  z=v.read_count
  z1=v.write_count
  z2=v.read_bytes
  z3=v.write_bytes
  z4=v.read_time
  z5=v.write_time
  z6=psutil.network_io_counters(pernic=False)
  z7=z6.bytes_sent
  z8=z6.bytes_recv
  z9=z6.packets_sent
  z10=z6.packets_recv
  f1.plot(pos=(x,d))
  dd=str(d)
  print d
  f2.plot(pos=(x,f))
  f3.plot(pos=(x,g))
  f4.plot(pos=(x,h))
  f5.plot(pos=(x,b))
  f6.plot(pos=(x,a))
  f7.plot(pos=(x,l))
  f8.plot(pos=(x,m))
  f9.plot(pos=(x,j))
  f10.plot(pos=(x,k))
  f11.plot(pos=(x,n))
  f12.plot(pos=(x,o))
  f13.plot(pos=(x,q))
  f14.plot(pos=(x,r))
  f15.plot(pos=(x,s))
  f16.plot(pos=(x,t))
  f17.plot(pos=(x,u))
  f18.plot(pos=(x,z))
  f19.plot(pos=(x,z1))
  f20.plot(pos=(x,z2))
  f21.plot(pos=(x,z3))
  f22.plot(pos=(x,z4))
  f23.plot(pos=(x,z5))
  f24.plot(pos=(x,z7))
  f25.plot(pos=(x,z8))
  f26.plot(pos=(x,z9))
  f27.plot(pos=(x,z10))
  f28.plot(pos=(x,d))
  dd=str(d)
  print d
  f29.plot(pos=(x,f))
  f30.plot(pos=(x,g))
  f31.plot(pos=(x,h))
  f32.plot(pos=(x,b))
  f33.plot(pos=(x,a))
  f34.plot(pos=(x,l))
  f35.plot(pos=(x,m))
  f36.plot(pos=(x,j))
  f37.plot(pos=(x,k))
  f38.plot(pos=(x,n))
  f39.plot(pos=(x,o))
  f40.plot(pos=(x,q))
  f41.plot(pos=(x,r))
  f42.plot(pos=(x,s))
  f43.plot(pos=(x,t))
  f44.plot(pos=(x,u))
  f45.plot(pos=(x,z))
  f46.plot(pos=(x,z1))
  f47.plot(pos=(x,z2))
  f48.plot(pos=(x,z3))
  f49.plot(pos=(x,z4))
  f50.plot(pos=(x,z5))
  f51.plot(pos=(x,z7))
  f52.plot(pos=(x,z8))
  f53.plot(pos=(x,z9))
  f54.plot(pos=(x,z10))
 
Result :
CPU Memory, Temperature,Data Bit Monitoring using Python 2.7.3 and Python Graph


Bandpass filter for uhf television 470-800MHZ

For good reception of uhf tv and digital tv, bandpass filter is a choice for avoiding another signal beside uhf tv channel signal. there are 3 type of bandpass filter that be known , Butterworth, Chebyshev and Bessel filter design.
As shown in this design ,   I am using  http://www.wa4dsy.net/filter/filterdesign.html software online design, or can also using Chebyshev design from http://www.changpuak.ch/electronics/chebyshev_bandpass.php 

Input frequency center for 470-800 MHz, 635 MHz , select bandpass filter or bandstop filter design as menu shown.


after input frequency center, bandwidth of the filter 330 mhz, and the impedance input/output 50 ohms, than select compute parts and the result of filter design will be shown as below.



Build This Digital TV Indoor Antenna 470-800 MHz

I get this idea after searching and studying literature from ARRL handbook, other sources and by experimenting several times. Although my design not perfectly design, but it shows several Channel TV in digital reception with good quality. And several of channels not in good quality. I think the future design of this antenna will give good performance for digital indoor TV antenna.

As mention in ARRL handbook, for high frequency , the equation for finding element length is :

L = 468 / Fo ( in Feet)

Where Fo = Center Frequency

If We design for 470 - 800 MHz , the center frequency will be Fo = 635 MHz, substitute to the equation :

L = 468 / 635 =  0.737 feet , convert to cm . 1 feet = 30.48 cm , so for 0.737 feet equals to :

L = 0.737 feet x 30.48 cm/feet  = 22.46 cm , this is 1/2 lambda for UHF signal in 635 MHZ.

1/4 lambda will be 11.23 cm

As I read in one of literature from S.W. Su and F.S. Chang from Lite On Technology Corporation , Taiwan and Department of Electronics Cheng Shiu University Taiwan. Wideband Rod Dipole Antenna with a modified feed for DTV Signal Reception.
From that literature we can have the design of PCB , feed gap, and dipole design.





I use experiment PCB, and cut the corresponding to the design.The result of antenna as shown .




My design not exactly the same as the design from S.W. Su , i use 1/4 lambda for both arms.