LED Control based on Windows System Values

Hello,

I have a very specific hardware/software project that I want to accomplish on my Windows 7 Pro 64-bit system with an i7 CPU.

I have been searching for solutions for weeks but can't find any consumer electronics product that will do what I want, so I guess I'm going to have to build it and program it myself.

I want to install a bank of LEDs in my computer case and drive them under some sort of program control:

1) LED 1: Turn it on when the controlling program starts, then briefly turn it off and back on in a loop so that it "flickers". As the CPU load increases, increase the flicker rate. Throw a random element in to avoid the visual appearance of a repeating "script". 2) LED 2: Turn it on when the CPU temp exceeds a certain value. Turn it back off when it is ok. 3) LED 3: Turn it on when the power supply's various outputs are not within normal parameters. Turn it back off when it is ok. 4) LED 4: Turn it on when it senses that the computer has crashed (if this is possible).

My question is: Can I do the above (with maybe the exception of #4) with an Arduino unit? If so, which one?

I have 35 years of computer hardware, software, and programming experience, so I can handle these aspects with no problem as long as I have a programming language manual or documentation to guide me.

Another question: How much electronic fiddling will I have to do? If it involves more than basic resistors, LEDs and soldering, then I'm in trouble and will have to hire a friend who understands that aspect.

Thank you for your guidance.

My question is: Can I do the above (with maybe the exception of #4) with an Arduino unit? If so, which one?

yes can be made

make a program that monitors the values you want in your favo language (I think for some things you need C++ and kernal acces)
put the found values in a formatted string e.g. “<65%, 25C, 11.3V, 5.0V>”, clearly indicating begin of string and end of string and field separators.
send the string over serial to Arduino once per second.

The Arduino waits for a new string and adjusts the leds (intensity or RGB color or blinkrate) according to the values received.

If the Arduino does not get any string LED 4 starts to blink, indicating loss of connection with the mothership :wink:

does this make sense?

Another question: How much electronic fiddling will I have to do? If it involves more than basic resistors, LEDs and soldering, then I'm in trouble and will have to hire a friend who understands that aspect.

  • A serial USB cable
  • 4 LEDS and 4 220ohm resistors in series with it.
  • if RGB leds are used a few resistors more ...

That's all

My question is: Can I do the above (with maybe the exception of #4) with an Arduino unit? If so, which one?

Maybe. Any of them. Reading temperature, with the appropriate sensor, is easy. Turning an LED on and off is easy. Adding current sensors to the power supply lines isn't trivial, but it isn't that difficult, either. Reading several of them, and determining whether an LED should be on or off is easy.

"Turn it on when the controlling program starts" needs some clarification. If you have some application running on the PC that is monitoring the system, using the existing hardware, and sending data, via the serial port, to the Arduino, then you don't need to add the additional hardware mentioned above. The Arduino can not measure CPU usage. Only a program running on the PC can.

Increasing the flicker rate as CPU usage increases and random flickering don't go together. You need to decide which you want.

As for #4, I don't know how the LED would sense that the PC has crashed. So, I doubt that the LED would be turned on by a crash.

robtillaart and PaulS,

Yes, this all makes sense. Thank you for letting me know that this can most likely be done and also for some ideas on how to do it!

I plan to use Aida64 or Open Hardware Monitor which can output or "share" system information it collects, such as CPU and voltage info. I'm not sure where they store this data, but I know other programs are able to access it. That is a topic that I will need to research. It could be that the programming for the Arduino will allow it to access this memory block directly.

"Turning it on when the controlling program starts" means that when the Arduino's program starts, it turns the LED on.

When I said "random flickering", I meant to embed a random element in the flickering loop, like mathematically evaluating a rnd() function's return value to decide whether or not to omit an "off" cycle or something like that. However, I don't know anything about the Arduino's programming at this point so I'm just conjecturing.

Anyway, I am a complete newbie to Arduino. I know basically nothing about it. So, at this point, I need to know 1) what type/variant of Arduino I would need to buy and 2) where to find the unit's hardware and programming manuals - maybe a "Dummies" book, LOL? Can you help with these two items to help me get started?

Many thanks.

It could be that the programming for the Arduino will allow it to access this memory block directly.

It really seems unlikely that your Arduino will be able to read data stored on your PC, any more than it can read data stored on my PC.

So, at this point, I need to know 1) what type/variant of Arduino I would need to buy

Any Arduino will have the same issues. Start with a UNO, since they are the most stable/prevalent.

2) where to find the unit's hardware and programming manuals

The unit's hardware should come in the box with the unit...

The programming manuals are a lot harder to find. There is a reference page, http://arduino.cc/en/Reference/HomePage, for the Arduino-specific functions and libraries. Other than that, the Arduino is programmed using C++, so most any C or C++ function will work. Obvious exceptions, that deal specifically with hardware that the Arduino doesn't have, like a hard drive, or that deal specifically with software that the Arduino doesn't have, like an operating system, exist.

maybe a "Dummies" book, LOL?

This isn't a project for a Dummy, so a Dummies book would not be too helpful. There are a LOT of Arduino books, though. Google is even able to find one or two of them.

Thank you, PaulS.

robtillaart,

I’m going to use your suggested approach for programming and control.

Thanks.

I would use Autoit http://www.autoitscript.com/forum/ as it can "read" the text values from most windows programs such as SpeedFan for temps, cpu load and voltages.

Autoit can also monitor the running processes or if a particular program (window/taskbar icon) is running. There is a comms library for autoit that can send this data to the arduino for processing.

Detecting a computer crash - write a loop in your autoit program/script to send a serial byte in addition to the other values, when this stops being sent you know something is wrong (I would have a sounder here instead of an LED.

This all do-able, but take it step by step.

Get used to using autoit and reading values from a program (Speedfan or other) window first. Then write an Autoit program/scipt sending data using the Autoit Comms lib to test sending serial data to the arduino, something simple like a control byte to turn an LED on/OFF.

Once you have those working, you can work on the complete program sending monitored data to be processed by the arduino.

Search the Autoit forum for Arduino projects by others and if you get stuck ask, someone will help you out!. :)

Thank you, Lakes. Excellent suggestion. This will avoid having to write a separate C++ routine to feed the data to the Arduino.

Lakes,

I tried Autoit and the only function I could find that would read the content of windows was the function “WinGetText”, but only if the text in them is selectable (the equivalent of being able to do a CTRL-A in a window). Great for notepad or word, but not for Speedfan, Open Hardware Monitor, HWMonitor, etc., as they don’t produce selectable text in their windows; WinGetText returns unusable data or null. You can test it with AutoIt Window Info and see what I mean.

If you know of an AutoIt function that will read the text let me know.

Thanks.

http://www.autoitscript.com/forum/topic/131052-sysinfolog-v209/?hl=%2Btemperature#entry915106

http://www.autoitscript.com/forum/topic/90736-performance-counters-in-windows-measure-process-cpu-network-disk-usage/?hl=%20cpu%20%20id

http://www.autoitscript.com/forum/topic/130371-automate-qt-and-qwidgets/?hl=%2Bqt#entry1059968

http://www.autoitscript.com/forum/topic/89542-tesseract-screen-ocr-udf/

Or try another utility like the first one here http://www.mydigitallife.info/check-and-monitor-computer-cpu-and-gpu-temperature-voltage-or-fan-speed/ see if Autoit will read the text from that.

Lakes, thanks for the links!