rhg Posted February 11, 2006 Posted February 11, 2006 (edited) CPU Voltage Monitor v0.3This was requested by a friend overseas that has to deal with very bad voltage fluctuations.Updated 2006-02-11 05:06Ok, v0.2 was ok, but not enough for me. Also lacked somefunctionality I wanted so I added it. Goals/Features1) Auto Detect's current voltage and --- Automaticaly applies +-0.1 tolerance range--- Displays MsgBox with Current Voltage and Applied Ranges2) HotKey parameters now displayed in MsgBox on Startup--- SHIFT+ALT+S = Emergency Shutdown Dialog--- SHIFT+ALT+V = Current Voltage Dialog--- SHIFT+ESC = Exit Dialog3) Alert Dialog when out of tolerance with Sound--- Alert Dialog offers Emergency Shutdown ( Shutdown(13) )4) Detects if it is already running and--- notifys user then terminatesTest Platform(s):Compiled Using AutoIt v3.1.1.107 BetaOS: Windows XP ProfesisonalPC1: AMD+GigaByte Desktop Clone (32-bit)PC2: Intel Centrino 1.8/533 Laptop (HP)ToDo:1) Add support for more CPU's -- Auto Detect's Voltage Now1a) CPU Detection -- Not needed, but plan to add as feature1b) Load tolerance specs from INI -- 86'edKnown Limitations:Voltage readings using WMI only return readings in1/10 increments versus manfacturer specs which are typically1/1000 increments. So technicaly this is not accurate at all.Maybe in a future version I will try to access BIOS readingswith WMI instead of using Win32_Processor readings.Update: I think this *is* the only way to detectCPU voltage with WMI. Any feedback/criticism welcome. expandcollapse popupGlobal $Title = "CPU Voltage Monitor v0.3" If WinExists("CPU Voltage Monitor v0.3") Then $sdnow=10 Bye() EndIf AutoItWinSetTitle($Title) #Include <Constants.au3> #NoTrayIcon Opt("TrayIconHide",1) HotKeySet("+{ESC}", "Bye") HotKeySet("+!s", "EShutDown") HotKeySet("+!v", "Voltage") Global $Output, $sdnow=0 Global $current_voltage = GetVoltage() Global $min = $current_voltage - 0.1 Global $max = $current_voltage + 0.1 Alert(0) $Title = "Auto Settings" $Output="" $Output = $Output & "Based on the detected voltage the settings"&b() $Output = $Output & "below will be used for Tolerance Range:"&b()&b() $Output = $Output & " Detected: "&$current_voltage&" V"&b()&b() $Output = $Output & " Mininmum Tolerance: "&$min&"00 V"&b() $Output = $Output & " Maximum Tolerance : "&$max&"00 V"&b() MsgBox(64,$Title,$Output,10) $Title = "Controls" $Output="" $Output = $Output & "Here is a list of controls for use with CVM:"&b()&b() $Output = $Output & "Exit Program"&t()&"SHIFT+ESC"&b()&b() $Output = $Output & "Emergency"&t()&"SHIFT+ALT+S"&b() $Output = $Output & "Shutdown"&b()&b() $Output = $Output & "Current Voltage"&t()&"SHIFT+ALT+V"&b()&b() MsgBox(64,$Title,$Output,10) While 1 $current_voltage = GetVoltage() Select Case $current_voltage<$min Alert(1) Case $current_voltage>$max Alert(2) Case Else Sleep(1000) EndSelect Wend Func Bye() Exit EndFunc Func OnAutoItExit() Select Case $sdnow=1 Shutdown(13) Case $sdnow=0 $Title = "CPU Voltage Monitor v0.3 - Exit" $Output = "" $Output = $Output & " Hope you enjoyed this version."&b()&b() $Output = $Output & "Please POST/PM/IM/EMAIL Any and All"&b() $Output = $Output & " Feedback and Criticism :)"&b() MsgBox(64,$Title,$Output,10) Case $sdnow=10 $Title = "CPU Voltage Monitor v0.3" $Output = "" $Output = $Output & " An instance of CPU Voltage Monitor"&b() $Output = $Output & " is already running." MsgBox(64,$Title,$Output,10) EndSelect EndFunc Func Voltage() $Title = "CPU Voltage Monitor v0.3" $Output = "" $Output = $Output & "Current Voltage Detected : "&GetVoltage()&" V" MsgBox(64,$Title,$Output,30) EndFunc Func EShutDown() $Title = "Emergency Shutdown" $Output="" $Output = $Output & " Do you want to ShutDown your computer"&b()&b() $Output = $Output & " IMMEDIATELY?"&b()&b() $Output = $Output & "If you click Yes All Programs will be forced to Close"&b() $Output = $Output & " and this computer will ShutDown Immediately."&b() $Output = $Output & " Continue with Emergency ShutDown?"&b() If ShowMe($Title,$Output,120)=6 Then $Title = "Emergency Shutdown" $Output="" $Output = $Output & "Are you Sure?"&b()&b() If ShowMe($Title,$Output,30)=6 Then $sdnow=1 Bye() Else Return EndIf EndIf EndFunc Func b() Return @CRLF EndFunc Func t() Return @TAB EndFunc Func ShowMe($T,$O,$to=10) SoundPlay(@WindowsDir & "\media\chord.wav",0) Return Msgbox(4096+4,$T,$O,$to) EndFunc Func Alert($lvl) Select Case $lvl = 0;welcome message $Title = "CPU Voltage Monitor v0.3" $Output = $Output & "CPU Voltage Monitor will alert you if your" & b() $Output = $Output & "CPU Voltage rises above or drops below" & b() $Output = $Output & "1/10th of your Current Voltage Detected." & b()&b() $Output = $Output & " Want to Continue?"& b()& b() $Output = $Output & "Click Yes to Continue or Click No to Abort." & b() If ShowMe($Title,$Output,100)=7 Then Bye() Else Return EndIf Case $lvl = 1;below tolerance $Title = "CPU Voltage Alert" $Output="" $Output = $Output & "Your CPU Voltage is below tolerance."&b()&b() $Output = $Output & " Minimum Voltage : "&$min&" V"&b() $Output = $Output & " Detected Voltage : "&$current_voltage&" V"&b()&b() $Output = $Output & " Do Emergency Shutdown?"&b() If ShowMe($Title,$Output)=6 Then $sdnow=1 Bye() Else Return EndIf Case $lvl = 2;above tolerance $Title = "CPU Voltage Alert" $Output="" $Output = $Output & "Your CPU Voltage is above tolerance."&b()&b() $Output = $Output & " Maximum Voltage : "&$max&" V"&b() $Output = $Output & " Detected Voltage : "&$current_voltage&" V"&b()&b() $Output = $Output & " Do Emergency Shutdown?"&b() If ShowMe($Title,$Output)=6 Then $sdnow=1 Bye() Else Return EndIf Case Else Return EndSelect EndFunc Func GetVoltage() Local $objWMIService, $strComputer = ".", $objItem, $colItems Local $voltage $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2") $colItems = $objWMIService.ExecQuery("Select * from Win32_Processor") If IsObj($colItems) then For $objItem In $colItems $voltage=$objItem.CurrentVoltage Next EndIf $voltage = StringLeft($voltage,1)&"."&StringRight($voltage,Stringlen($voltage)-1)&"00" Return $voltage EndFunccpu_voltage_monitor.au3 Edited February 11, 2006 by rhg
mikeytown2 Posted February 11, 2006 Posted February 11, 2006 Wow awesome idea! i tried it out but i have a AMD on a syntax board (cheap) so it gives me a zero reading. Speedfan 4.xx does give the correct voltage though... either way. cool program! Email: POP3 & SMTP using SSL/TLS (OpenSSL)Email: IMAPEmail: Base64 & SMTP login & Send email direct to MX Server (thanks blindwig)Win: Hook Registry ChangesWin: Read/Write to Alternate Data Streams (ini example)Utility: GPS Distance Calculations, Vincenty and Haversine formulas; angles and elevationUtility: Dell Laser Printer (3000-5100) - Print LoggerUtility: Reset Router when Wireless Link FailsUtility: ImageMagick Batch jpg ProcessorVideo HCenc Batch FrontendVideo: *DEAD* YouTube Video Encoder (avs/avi to flv)Software On CD's I Like<<back|track3 Ultimate Boot CD for Windows SpinRite Ubuntu ophcrack
rhg Posted February 11, 2006 Author Posted February 11, 2006 (edited) It's been updated...*alot*. Try the new one although not sure it will make a diff if the v0.2 returned 0. I have no idea what platforms this will work on HW/SW wise as not many have tried it yet. Hm..and speedfan works but this doesn't...did you run this with sppedfan disabled? Also, does speedfan return 1/10 or 1/100 or 1/1000 readings? Like does it give you 1.023V--like that? or like 1.1V ...? Thanks for the feedback..wasn't my idea actually. Just trying to help out a freind. Edited February 11, 2006 by rhg
PerryRaptor Posted February 11, 2006 Posted February 11, 2006 Works...AMD 2600+ Asus Motherboard and AMD FX-57 Asus Motherboard.
mikeytown2 Posted February 11, 2006 Posted February 11, 2006 Speedfan gives me 1.65v for my core. I closed it and i still get 0.0 in this program. like i said i have a cheap board, speedfan is actually the only program that gave me any readout at all, so I'm not surprised it didn't work. Email: POP3 & SMTP using SSL/TLS (OpenSSL)Email: IMAPEmail: Base64 & SMTP login & Send email direct to MX Server (thanks blindwig)Win: Hook Registry ChangesWin: Read/Write to Alternate Data Streams (ini example)Utility: GPS Distance Calculations, Vincenty and Haversine formulas; angles and elevationUtility: Dell Laser Printer (3000-5100) - Print LoggerUtility: Reset Router when Wireless Link FailsUtility: ImageMagick Batch jpg ProcessorVideo HCenc Batch FrontendVideo: *DEAD* YouTube Video Encoder (avs/avi to flv)Software On CD's I Like<<back|track3 Ultimate Boot CD for Windows SpinRite Ubuntu ophcrack
rhg Posted February 12, 2006 Author Posted February 12, 2006 @PerryRaptor Awesome....are you running 64-bit XP on that 64-bit computer? Just curious. Thanks for trying it out and leaving some feedback. @mikeytown2 No problem...there were some additional requests after v0.2 so I just added them along with some things I wanted to try, and learn some new things. Thanks for trying it both times and letting me know your config and stuff. Is inspiring me to find more about accessing device I/O directly...I might have to try some ASM maybe or some existing COM. All the same thanks.
PerryRaptor Posted February 12, 2006 Posted February 12, 2006 Rhq, It's a dual-boot 32 or 64-bit WinXP Pro box...A number of times though I have to run AutoIT in 32-bit mode to get the desired results. I'll try it on the Dual Opteron 246 server tomorrow.
rhg Posted February 12, 2006 Author Posted February 12, 2006 Aweome...let me know how that turns out. -rhg
GaryFrost Posted February 12, 2006 Posted February 12, 2006 (edited) Works ok with WIN XP Pro 2 and an old: Processor x86 Family 6 Model 4 Stepping 4 AuthenticAMD ~1332 Mhz BIOS Version/Date Award Software International, Inc. 6.00 PG, 2/20/2002 SMBIOS Version 2.3 VIA motherboard Edited February 12, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
PerryRaptor Posted February 12, 2006 Posted February 12, 2006 Doesn't work on the Tyan board with two Opteron 246 CPUs. Then again, possible that the board doesn't provide WMI connections. OS Windows Server 2003 with all patches and service pak.
rhg Posted February 12, 2006 Author Posted February 12, 2006 Ok, so now we have hit some limitations...this is good. Cheap Syntax boards (just quoting) and Dual Opteron Tyan boards are out of the question but from the few handful of people that have tried says it works. Also tested an IA-64 w/XP 64-bit and another PIII Mobile and both worked as well. @PerryRaptor - I tested on a dual MP 1800+ on Tyan w/2003 and also this failed...came back 0. Maybe coincedence...then again maybe not? I wonder though if I can access device I/O directly with au3? Specificaly motherboard sensors similar in the way that SpeedFan does. I guess the big thing there is that they actually catalog the different motherboard's and the respective BIOS/Specs. To be honest I am not interested in such an undertaking but I am always curious. Thanks guys for the feedback and checking this thing out for me. Guess now we wait and see if it actually works; like a real scenario where it detects something out of tolerance and returns an alert....something to hope for at least. -rhg
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now