Turn Raspberry Pi ON w/ Remote Control

I'm loving using my Pi with Openelec for my media center, but the need to pull the cord to cut power was just keeping it below the WAF(Wife Acceptance Factor). So I sat down and came up with this. In the future, the arduino will be replaced with an ATTiny, but for now I already had this on hand.

First off, I will start with what does NOT work…

Step 1: What does NOT work

Rule #1 for my design was that the Pi should need NO software or modification for this to work. One should be able to hook up any Pi with an operating system on it and have it work. This eliminated almost every option out there right now.

In my researching, I learned that the UART TX pin goes high on bootup, and stays that way, until a shutdown is completed, and then it goes low. I spent some time going with that, but it ultimately was a dead end. The Pi knows it is high/low, but the arduino/microcontroller still just sees a floating pin, regardless of the configuration.Turn Raspberry Pi ON w Remote Control

Step 2: What DID work

In the end, I realized that using an arduino/microcontroller to sense a digital high/low on the Pi was not going to work, BUT it did lead me to the right path… When a pin on the Pi is high, it is outputting ~3.3v, but when it goes low, it drops to under 1v, so I just needed to connect a ground between them, and watch for the voltage to drop under 3v using an analog pin.

Step 3: The bad schematic

The schematic above was drawn to help, but it's pretty bad, so I will spell it out…

+5v to Arduino
+5v to Relay

Ground to Arduino

Ground to Relay

Arduino Ground to Raspberry Pi Ground

Arduino Ground to IR Receiver Ground

Arduino 5v to IR Receiver Vcc

Arduino pin 11 to IR Receiver OUT

Arduino pin 5 to Relay IN1

Arduino pin A0 to Raspberry Pi pin 8(UART TX)

Relay out inline with Raspberry Pi power inputTurn Raspberry Pi ON w Remote Control schematic

Step 4: The Arduino Code

First off, you will need to delete the IRRemoteRobot libraries that are built in to the Arduino software, and then install the IRRemote libraries included here. Then program your Arduino with the IR Decoder code. This will show you the HEX codes of the IR signals in Serial.print. Find the Hex code of the button you want to use to turn on your Pi.

Then edit the “PI Power.ino” code by changing the variable “const long StoredCode”. Leave the “0x” and change the Hex code after that. Then upload that to the Arduino.

This code is written so that it will stay off until the remote button is pushed. Once on, the arduino will ignore remote button presses, and will wait for a clean shutdown to be performed. On Kodi-based distros this is easily done also by remote. Once a clean shutdown is performed, it cuts power, and then goes back to watching for the remote button press.

 

For more detail: Turn Raspberry Pi ON w/ Remote Control


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top