Skip to content

Instantly share code, notes, and snippets.

@Elwell
Created August 28, 2017 14:17
Show Gist options
  • Save Elwell/841c5f92536a25258676e322c03cc51f to your computer and use it in GitHub Desktop.
Save Elwell/841c5f92536a25258676e322c03cc51f to your computer and use it in GitHub Desktop.
Arduino PSU control
/* Arduino control for (ex) server PSU
* Andrew Elwell <[email protected]> August 2016
* Released under BSD licence
*/
/* Controls / Pins based on data sheet available at
* https://belfuse.com/resources/PowerSolutions/SFP1050/bcd20031_ab_sfp1050-12bg.pdf
*
* A6/B4/C4/D4 +3.3 standby (power to arduino)
* A3/B1/B3/C1/C3/D3 Return
* B5(SDA) / C5(SCL) I2C
* B6 Bring low for PS ON
* C6 AC OK (if high)
* D6 PWR OK (if high)
*
*/
#include <Wire.h>
int ACOK = 2;
int PSON = 3;
int PWROK = 4;
int LED = 13;
void setup() {
// put your setup code here, to run once:
Wire.begin(); // join i2c bus (address optional for master)
pinMode(ACOK, INPUT);
pinMode(PSON, OUTPUT);
pinMode(PWROK, INPUT);
pinMode(LED, INPUT);
digitalWrite(PSON,HIGH) ; // Stay off until ready
}
void loop() {
if (digitalRead(ACOK) == HIGH) {
digitalWrite(PSON,LOW) ;
}
if (digitalRead(PWROK) == HIGH) {
digitalWrite(LED,HIGH) ;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment