Arduino based sleep status for motherboards in S3/S4 sleep mode

I have been a big fan of Asus and Gigabyte motherboards for a long time now.   They are both very capable brands... but one thing that I could never understand is why Gigabyte choose not to show when a system is in S3 or S4 sleep mode via the LED connected to the power pins.  The only status indication you get is running or off... 

Asus boards will at least blink the power LED to let you know the system is sleeping.   I know there are some who do not like any lights in sleep mode... but I have always wanted to know just by looking at the case.   I build all my systems to run with minimal noise... even underclocking the CPU to save on heat so the fan would not need to run at higher RPMs (making them louder).   There is no way to tell if the system is running just by listening.

So I decided to build a solution using an Arduino based circuit board.   The basics are as follows:

  • provide 5 volts to the Arduino board from a USB header that is always on even in sleep mode or off completely when the system is powered off. 
  • monitor power from the mainboard's power LED plugs
  • provide power to the case LED based on if the system is running, sleeping, or off.  Power will be full to the LED when the system is running, fade the LED in and out when sleeping


The off part should be easy... no power to the Arduino board = no LED light.   :)   However, on my board the USB is on even if the power is off to the system.    So as long as the power supply has power, the USB's are active.  I am looking for another route.   I could use a 12v case fan for input sensing since the Arduino circuit can sense up to 55 volts (according to the 'Arduino Digital Voltmeter' authors comments.)

The following details the circuit and parts used..

 

  • Arduino board.  I built one from Modern Device called the RBBK.  Any Arduino configuration will work but the small RBBK board was a spare I had laying around.
  • 1 - 220k resistor
  • 1 - 10k resistor
  • 1 - 100k resistor
  • Various connectors for the LED, USB header, and the power connection

Arduino sketch:

/* 
Status light for mainboards that do not show
sleep status when PC is in S3 sleep mode 
*/

// Analog ping setup
int analogInput = 0;
float vout = 0.0;
float vin = 0.0;
float R1 = 100000.0; // resistance of R1 (100K)
float R2 = 10000.0; // resistance of R2 (10K)
int value = 0;

//LED setup
int led = 6;
int brightness = 0;
int fadeAmount = 5;
int onset = 0;
int delaytime = 50;

void setup(){
  // Serial.begin(9600);
  pinMode(analogInput, INPUT);
  pinMode(led, OUTPUT);
  analogWrite(led,255);
}

void loop(){
  // read the value at analog input
  value = analogRead(analogInput);
  vout = (value * 5.0) / 1024.0;
  vin = vout / (R2/(R1+R2));
  if (vin<0.09) {
    
    // no voltage from the PC so pulsing the LED     
    if (onset == 1) {
      onset = 0;
      delaytime = 50;
      brightness = 0;   //reset LED
      fadeAmount = 5;      
    }
    
    analogWrite(led, brightness);    
    brightness = brightness + fadeAmount;
    if (brightness == 0 || brightness == 255) {
      fadeAmount = -fadeAmount; 
    }
        
  } else {
    
    if (onset == 0) {
      //has voltage so the PC is on...
      analogWrite(led,255);  
      onset = 1;
      delaytime = 1000;
    }
    
  }
  // Serial.println(vin);
  delay(delaytime);
}