[RaspberryPI] How to turn off HDMI from Raspberry pi

Raspberry pi Linux image does not come with sleep mode after timeout. Though it has kind of sleepmode which does blacken screen, bout monitor does not go to sleep or switch off.

To prevent HDMI TV/monitor on constantly switched on , i would recommend to switch off programmatically via ssh service.

use videocore GPU command Β to switch off or on HDMI service thus saving valuable watts πŸ™‚

Switch on
“/opt/vc/bin/tvservice -p”

Switch off
“/opt/vc/bin/tvservice -o”Β 

Update:
I have create small application which take care of HDMI off in-case there is no activity for some time (30 sec).
please download source code & binary from github. [ https://github.com/glframebuffer/raspberrypi ]
Please check README

—————————————————————————————————————–

Kindle Fire HD 7″, Dolby Audio, Dual-Band Wi-Fi, 16 GB

 

————————————————————-

About glframebuffer

just another guy.
This entry was posted in RaspberryPI and tagged , . Bookmark the permalink.

27 Responses to [RaspberryPI] How to turn off HDMI from Raspberry pi

  1. Zim says:

    My screen remained blank after trying this.

    • Thanks for finding bug πŸ™‚ I could reproduce problem with another setup.

      Check Readme file on github you need “x11-xserver-utils” package before trying new code.

      Try updated version and let me know.

  2. EQ says:

    I currently have a touchscreen attached to my RPi that I’m using for a home theater touchscreen remote. By default the screen is blanked after 10 minutes or so.

    Will this completely turn off the display? And will tapping the screen get it to come back on?

    • Currently events are mapped to mouse. you need to change in code to work with touch screen.

      Let me know what is device node touchscreen is mapped? I will make configuration file to ease.

      • EQ says:

        How can I find which node the touchscreen is mapped to?

        And I mispoke earlier about it blanking after 10 minutes. When I’m running my program (a Python script) it stays on the entire time.

      • 1) on terminal (lxterminal)

        ls /dev/input

        you should see list of input nodes like event1 , event2
        , mice, etc.
        Now you can check which node is mapped for touchscreen. using simple test with cat command as below

        $ cat /dev/event1

        for event1 which is mapped to keyboard similarly find which node is used for touchscreen

        try using keyboard you will see some garbage vale on terminal.
        To exit use Ctrl + C.

        Regarding Python script i will check and update you.

  3. EQ says:

    When I type ls /dev/input I get:
    event0 mice mouse0

    • Now Try using ‘cat’ command with nodes you have listed
      cat /dev/event0
      and use touchscreen; one of node is mapped to touchscreen
      on touch event you should see some values;

      let me know which is node; (i Guess mouse0)

  4. EQ says:

    cat: /dev/event0: No such file or directory
    cat: /dev/mice: No such file or directory
    cat: /dev/mouse0: No such file or directory

  5. EQ says:

    cat: /dev/input/mouse0 works.

  6. EQ says:

    After the screen shuts off, if I tap it, it looks how it does when the screen is blanked. No matter how many times I tap it, it won’t display the desktop.

    I do have x11-server-utils installed.

  7. Ian Barlow says:

    Is there any chance of updating this for Raspbian Jessie please? Jessie has no ‘/dev/input’ folder so I don’t know where to point your app to detect mouse movement or keyboard presses. TIA.

    • Okay no problem, I will update in coin week, stay tuned, if you need more feature feel free to ask πŸ™‚

    • Hello Ian,
      I did check with ”
      RASPBIAN JESSIE LITE” today and it does have “/dev/input/mice”. are you sure you are using right image ?
      try command ” ls /dev/input” on terminal to list connected input devices one of this could be “mice” or “mouse0” ..

      • Ian Barlow says:

        Hi gl,
        I do apologise. You’re perfectly correct. I’m a little rusty with Raspbian as I hadn’t used it for nearly a year before a very recent return to the Pi, and the change to Jessie has kind of knocked me off balance a little, if you get my meaning. Thanks for your efforts. I will try this out during the week. πŸ™‚

  8. Damn iPhone auto-correct. pls read “coming week” instead of “coin week”

  9. John Madsen says:

    Hi glframbuffer,
    Thanks for the great information! Although I normally program in C, I just got a RP3 and am trying my hand at Python 3. I am writing a program to run a digital frame, and want to shut off the display after some time. I am using “subprocess.call(“sudo /opt/vc/bin/tvservice -o”)” to do that. It works fine for a while, then at random times the monitor turns on for a second with a “Check your connection” message. I noticed that the monitor power button lights up when I run the command, but blinks when I shut down. I am using a DVI adaptor to connect the HDMI cable to my monitor.

    Any thoughts would be greatly appreciated!

    Joh

    • Hello John,

      I strongly suspect HDMI/DVI adaptor. Since i am using direct HDMI display(NO DVI adaptor) and i do not see this issue.
      Another point i dont have RPI3 i am still using RPI2.

      If you coule send me video explaing issue, i may be able to suide you.

      Cheers!
      GLFramebuffer

  10. Harold Zable says:

    On my Raspberry Pi 3, with an HDMI to VGA adapter, I’m having the old issue that “tvservice -p” doesn’t bring back the video signal. Changing the virtual terminal back and forth does seem to bring it back, though. E.g.:

    # Starting in X, i.e, vt 7

    tvservice -o
    # Ooh… now it’s black!

    sleep 5

    tvservice -p
    # Still black.

    sudo chvt 1
    sudo chvt 7
    # Back again!

Leave a comment