Post pictures of your storagenode rig(s)

Are your disks properly ventilated ?

Great job on 3D printing the storage rack. I am sure our SNOs would like to know that too.

What’s the noise level of your setup ?

Yes, temperature never surpasses 35’C however I’m planning to integrate an additional fan attached to the RPi GPIO to further ventilate the 4 Seagate HDDs

1 Like

General scheme looks like this, but exact components may vary depends on what you have on hand, your network voltage, Arduino model, etc.

U1 and U2 are pc817 optocouplers.
R1 as I remember I used 100K (for 230V AC), if you have 110/120V you probably should use lower value.
I use “1500W” inverter for AliExpress. Of course, 1500W is far from it’s real power, it’s just peak power and you can divide it by 3.

Idea is:

  1. Inverter is always ON, but nothing is connected to it’s output because Relay in normal state connects Load directly to Wall Socket. In this mode Inverter consumes only ~10 Watts, which is much less than losses in standard UPS.
  2. Battery charger or power supply with 27.2 - 27.5V output is always on and compensates energy consumption by Inverter from Batteries.
  3. Arduino is powered from Batteries via DC-DC power converter to get 5V.
  4. When AC power from wall socket disappears - Arduino activate relay and it switches Load from wall socket to Inverter.
  5. When AC power is back - Arduino deactivates relay and switches Load back to wall socket. Battery charger starting charge batteries to prepare for the next blackout.

Arduino sketch
const int analogInPin = A6; 
const int relayPin = 3;
const int ledFailPin = 5;
const int ledOkPin = 7;

int sensorValue = 0; 
int outputValue = 0; 
unsigned long lastPowerSeen = 0;
unsigned long powerLossDetectionLag = 0;
bool currentState = 0;
bool ledOkState = 0;
unsigned int powerReturned = 0;

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(relayPin, OUTPUT);
  pinMode(ledOkPin, OUTPUT);
  pinMode(ledFailPin, OUTPUT);
  digitalWrite(relayPin, LOW);
  digitalWrite(ledOkPin, HIGH);
  digitalWrite(ledFailPin, LOW);
  digitalWrite(LED_BUILTIN, LOW);
  // initialize serial communications at 9600 bps:
  //Serial.begin(9600);
}

void loop() {
  // read the analog in value:
  sensorValue = analogRead(analogInPin);

  // print the results to the Serial Monitor:
  //Serial.print(millis());
  //Serial.print(" "); 
  //Serial.print("sensor = ");
  //Serial.println(sensorValue);

  if (sensorValue>=80)
  {
    lastPowerSeen=millis();

    if (powerReturned<10000)
    {
      powerReturned++;
    }

    if (currentState==1 && powerReturned>100 && powerReturned % 500 == 0)
    {
      if (ledOkState)
      {
          ledOkState=false;
          digitalWrite(ledOkPin, LOW);
      }
      else
      {
          ledOkState=true;
          digitalWrite(ledOkPin, HIGH);
      }
        
    }

    if (currentState==1 && powerReturned==10000)
    {
        currentState=0;
        powerLossDetectionLag=0;
        reserveOff();
    }

  }
  else
  {
    if (millis()-lastPowerSeen>=5)
    {
        powerReturned=0;

        if (powerLossDetectionLag==0)
        {
            powerLossDetectionLag=millis()-lastPowerSeen;
        }

        if (currentState==0)
        {
            currentState=1;
            reserveOn();
        }
        

        //Serial.print(millis());
        //Serial.print(" Power Lost = ");
        //Serial.println(powerLossDetectionLag);

    }
  }



  // wait 1 millisecond before the next loop for the analog-to-digital
  // converter to settle after the last reading:
  delay(1);
}


void reserveOn()
{
  digitalWrite(relayPin, HIGH);
  digitalWrite(LED_BUILTIN, HIGH);
  digitalWrite(ledOkPin, LOW);
  digitalWrite(ledFailPin, HIGH);
}

void reserveOff()
{
  digitalWrite(relayPin, LOW);
  digitalWrite(LED_BUILTIN, LOW); 
  digitalWrite(ledOkPin, HIGH);
  digitalWrite(ledFailPin, LOW);
}

In Arduino sketch you will probably have to find best for you values instead of 80 and 5 in lines
“if (sensorValue>=80)”
“if (millis()-lastPowerSeen>=5)”
to achieve the best compromise between fast reaction to power loss and avoiding false triggering.

P.S. I’m not professional in electronic devices development and sure this scheme and code are far from ideal :slightly_smiling_face:

5 Likes

If somebody want to print the same - this is model files Box-HDDx8.zip

Noise level is not high. Fans are working at half power and they are inaudible. Most of the noise coming from HDD’s heads moving, but this room is for home DC and 3D printing. Nobody lives there, so the noise level there doesn’t really bother me.

6 Likes

Which 3D printer do you use to print main?

Qidi Plus4 (has 305mm bed)

2 Likes

Will this even work? Is the switchover from wall source to battery source fast enough? To my eye I would say, that because of the long switchover time the computer will (or may) shut off unexpectedly cause power is missing for to long

Edit: Maybe a better way would be to use 230V switches an connect these to the power source. Then connects power to NO and COM. The backup power you connect to NC. So as long as the wall power is present the switch will activate and you use wall power. If it disappears, the switch deactivates and will automatically switch to backup. This will increase speed of changeover and decrease false switchovers. And you don’t need your Arduino anymore :slight_smile:
If you need, I can draw you a plan for it :slight_smile:

It works for me, but it may depends on relay. I measured time for my relay from the moment it get powered to the moment it switched. It’s just 4-4.5 milliseconds. Arduino adds another 5-10ms delay, so total delay is about 15ms or 1.5 cycles of missing power in 50Hz network that has 100 “cycles” per second. Capacitor in PSU can handle it.

I understand you idea about connecting normal power to NO and backup to NC, but I believe that electromagnetic force activating relay is much higher than spring tension that switch it back, so activation time will be less then deactivation. Deactivation time is not so important because relay switches from present backup power to present normal power, but when normal power is missing it’s important to switch to backup ASAP. That’s why I use that relay connection with Arduino to control it.

Or you mean to use ATS (Automatic Transfer Switch) like this https://a.aliexpress.com/_EuGzV60 instead of relay? I tried this initially. It has declared switching time up to 50ms which is 3 times higher than relay with Arduino. But worst of all is that this module doesn’t work correctly with inverter. It just burned “500W” Inverter when I connected it as backup power during my experiments.

But is this consistent? You just have room of about 1ms there to get to the 16ms

The best way would be a active ups. Cause Power supplies don’t like it if power gets cut off and back in a short time.

I have 50Hz power grid so one “full” cycle is 20ms and PSU should handle it. I believe on practice, good PSU, especially when it’s less than half loaded, really can handle even a few full cycles of power lack. Real blackout is a rare case in my building and may not happen for years, but as long as I played with switch this “UPS” was able to switch power to inverter fast enough that PSUs didn’t notice that.

4-4.5 ms is “hardware” delay of relay and we can do nothing with that, but for Arduino there is room for improvement.
The line I mentioned above “if (millis()-lastPowerSeen>=5)” makes Arduino trigger relay after 5ms of power lack. This number can be decreased for 60Hz grid and for higher sensitivity/faster switch. I guess whole algorithm can be improved for faster and more reliable switch, just i stopped at the moment when it was good enough for me.

Active UPS is better, of course. But it’s much more expensive than 35$ inverter + 10$ for Arduino, relay and DC converter + free old 24v (tuned to 27.5v) PSU to charge batteries.
Plus to do something with own hands is aways awesome :slightly_smiling_face:

1 Like

The problem is not the delay sure the ATX standard specific is 16ms of power loss is ok, but the problem is, that your power sources are not in phase. I can imagine it can be a huge stress factor for the power supply if the two are about 180° out of phase. Cause it would immediately jump from 325V to -325V. I am just an electrician for “big” stuff, but I don’t think small stuff likes it, even if big stuff don’t like it very much

Switching PSUs has bridge rectifier at the input and after it they deal with DC power smoothed with high voltage capacitor (they even can be connected to DC power instead of AC), so it doesn’t look phase should be a problem for them.

Modern power supplies have Power factor correction and more. Those are at my knowledge the biggest problem.
But at the same time it wouldn’t wonder me if the German school would teach old things :person_shrugging:

1 Like

I love this forum. It’s filled with all sorts of professionals, and they all share great insights to areas that to most are black magic :slight_smile:

8 Likes

You are thinking 3 phase PSUs, none of that applies here.

The power supply’s input is immediately at 0V as soon as the original power source is disconnected. Worst case is the PSU is immediately hit with the full voltage of the secondary source, which is nothing out of the ordinary. Whatever power you are still getting out of the PSU while switching over has nothing to do with the input, it’s all due to the PSU’s hold up time (=ie internal capacitors discharging).

Upgrading my setup

4 full tower with 10HDD each tower

Going into an open frame rack and 12HDD server case

First server almost done

10 Likes

Completely forgot to post here.

I rebuilt my VMhost (which is primary responsible for my StorJ VMs) a few months ago, in one of those awesome Sliger cases. Check it out. Or don’t, it’s up to you :slight_smile:

Sliger Case CX3150a Review: Homelab Minimalism

5 Likes

Nice case. What are you using for storage?

I’m using a heavily modified Synology rs3617xs (non plus, sadly), that’s serving 8x standalone 20TBdisks, as their own ISCSi datastore. In front of the drives is a RAID10 cache of 4x 2TB SSDs.

I’ve made a video going more in depth here:

https://youtu.be/IzgWv5gnXa4?si=FpVzakIfg2qchtCv

2 Likes