Is there a way to turn on or off the power supply of up to seven hard drives with the help of an Arduino? Or maybe there is another way to ultimately - but restorable - prevent read/write access to the disks.
closed as too broad by Ignacio Vazquez-Abrams, Michel Keijzers, user31481, jose can u c, Avamander Sep 2 '17 at 16:22
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Switching power on and off to hard drives is not as simple as you may think.
First you have three voltages to control - 3.3V, 5V and 12V, and on top of that you have (ideally) pre-charging for the 5V and 12V pins. The power-on sequence would ideally be:
- Power up 5V and 12V pre-charge
- Power up 3.3V, 5V and 12V main power
That's 5 poles for one drive (although you can get away without the pre-charge).
So you would be switching at minimum 3 power signals per drive. For 7 drives that would be 21 power signals that need to be switched.
Switching off power to a hard drive using mechanisms that aren't directly under the control of the operating system can cause file-system corruption and data loss.
The operating system caches data internally and writes it to the hard drive when able to. If the hard drive is turned off while there is still data cached that data will never get written to the hard drive. Worse still, if you turn it off whilst it is writing the file-system could become irrevocably corrupted (depending on the file-system in use and the resilience of it).
Most hard drives have the ability to power themselves down at a command from the operating system. I suggest you use this mechanism instead, since it is more reliable that blindly shutting off the power. Chances are your hard drives are already doing this, since most operating systems enable it by default.
An Arduino have 13 digital I/O pins so theoretically you can control 13 devices without any additional additional circuits.
You will probably need some circuits for the devices you want to control.
If you want to control them externally, I suggest buying e.g. an 8 channel relay. This way you can easily control them with the Arduino, and using external power for the devices to switch on/off.
If you want extra protection (especially with motors or expecting spikes on signals), use relays with opto-couplers.