loading
6 Comments

Tell us about yourself!

Complete Your Profile
  • ParisM2 commented on MrLeeh's instructable Raspberry Pi Shutdown Button2 months ago
    Raspberry Pi Shutdown Button

    I finally made it although I followed a slightly different approach. here is a draft of the circuit http://imgur.com/a/bpWJA and here is my arduino codeint inputPin = 2; //buttonint ledPin = 4; //indication ledint relayPin = 5; // relay for 5V supplyint shutdownPin = 6; // connected to pi via a transistorint powerPin = 7; // detects if pin 37 of Rpi is highint ras_on = 0; // 0 if pi is off 1 if pi is onint sensorPwr1 = 1;int sensor3 = 1;int i;void setup() { // put your setup code here, to run once: pinMode(inputPin, INPUT_PULLUP); pinMode(powerPin, INPUT_PULLUP); pinMode(ledPin, OUTPUT); pinMode(shutdownPin, OUTPUT); pinMode(relayPin, OUTPUT); Serial.begin(9600); digitalWrite(relayPin, HIGH);}void loop() { // put your main code here, to run repeatedly: sensorPwr1 = digitalRe...see more »I finally made it although I followed a slightly different approach. here is a draft of the circuit http://imgur.com/a/bpWJA and here is my arduino codeint inputPin = 2; //buttonint ledPin = 4; //indication ledint relayPin = 5; // relay for 5V supplyint shutdownPin = 6; // connected to pi via a transistorint powerPin = 7; // detects if pin 37 of Rpi is highint ras_on = 0; // 0 if pi is off 1 if pi is onint sensorPwr1 = 1;int sensor3 = 1;int i;void setup() { // put your setup code here, to run once: pinMode(inputPin, INPUT_PULLUP); pinMode(powerPin, INPUT_PULLUP); pinMode(ledPin, OUTPUT); pinMode(shutdownPin, OUTPUT); pinMode(relayPin, OUTPUT); Serial.begin(9600); digitalWrite(relayPin, HIGH);}void loop() { // put your main code here, to run repeatedly: sensorPwr1 = digitalRead(inputPin); sensor3 = digitalRead(powerPin); //print out the value of the pushbutton // Serial.println(sensorPwr1); if (sensorPwr1 == 1 && ras_on == 0 ) { ras_on = 1; digitalWrite(relayPin, LOW); Serial.println("power on"); sensorPwr1 = 0; for (int i = 0; i <= 60; i++) { digitalWrite(ledPin, LOW); delay(200); digitalWrite(ledPin, HIGH); delay(800); } } sensor3 = digitalRead(powerPin); if (sensorPwr1 == 1 && ras_on == 1 ) { digitalWrite(shutdownPin, HIGH); delay(500); digitalWrite(shutdownPin, LOW); digitalWrite(ledPin, LOW); ras_on = 0; Serial.println("power off"); for (int i = 0; i <= 80; i++) { digitalWrite(ledPin, LOW); delay(200); digitalWrite(ledPin, HIGH); delay(200); } digitalWrite(relayPin, HIGH); digitalWrite(ledPin, LOW); } sensor3 = digitalRead(powerPin); if (sensor3 == 1 && ras_on == 1 ) { digitalWrite(ledPin, LOW); ras_on = 0; Serial.println("power off"); for (int i = 0; i <= 80; i++) { digitalWrite(ledPin, LOW); delay(200); digitalWrite(ledPin, HIGH); delay(200); } digitalWrite(relayPin, HIGH); digitalWrite(ledPin, LOW); }}I still need to manage the reboots and adjust the timers better! but so far it works!

    View Instructable »
  • ParisM2 commented on MrLeeh's instructable Raspberry Pi Shutdown Button3 months ago
    Raspberry Pi Shutdown Button

    How can I upload the hex file to the attiny?I tried avrdude but it doesn't seem to work? Has anyone rewritten the program in arduino IDE instead of cpp?

    View Instructable »