how to enable, disable and show HDMI output
If Raspberry Pi is started without the monitor connected, the HDMI output will remain off. You can subsequently use the HDMI output during operation. But you have to enter some commands via VNC on the command line or in an SSH session.

Solution: Turn the HDMI output on and off
If you are connected to Raspberry Pi via SSH, then you can switch the HDMI interface and thus the HDMI monitor on and off.
Turn off the HDMI monitor:
vcgencmd display_power 0
Turn on the HDMI monitor:
vcgencmd display_power 1
Solution: Switch on the HDMI output afterward
If Raspberry Pi is started without a connected monitor (without Plug and Play), the HDMI output will remain off. You can subsequently use the HDMI output during operation.
/opt/vc/bin/tvservice -p
It then goes to the monitor, but the picture remains black. But it should be displayed on the screen again something.
For the GUI display:
/opt/vc/bin/tvservice -p; sudo /bin/chvt 6; sudo/bin/chvt 7
For the console:
/opt/vc/bin/tvservice -p; sudo /bin/chvt 2; sudo /bin/chvt 1
Disable HDMI output:
/opt/vc/bin/tvservice -o
Show the status of the HDMI output:
/opt/vc/bin/tvservice -s
Raspberry Pi: Turn on plug-and-play on the HDMI output
When operating Raspberry Pi on a screen, it is important to note that the screen must first be connected to Raspberry Pi and turned on before operating Raspberry Pi with a power adapter. If you forget to connect it before turning on the screen, then you will not get an HDMI signal from Raspberry Pi.
The reason is simple. When Raspberry Pi goes into operation, it checks to see if a screen is connected. If not, it turns off the HDMI interface. During operation, it is then no longer checked whether a screen is connected. Therefore, a screen does not receive an HDMI signal when subsequently switching on and connecting. By default, Raspberry Pi does not have plug-and-play, as you would expect with a PC. However, you can turn it on later.
Turn on plug-and-play on the HDMI output
To do this, open the boot configuration:
sudo nano /boot/config.txt
Then insert the following line here:
hdmi_force_hotplug = 1
Save, close and restart.
Raspberry Pi: Turn off monitor standby on the HDMI output
Normally, when the user is inactive, the monitor will eventually be turned off or put into standby. Most operating systems are set by default to turn off the screen after a set amount of time. If you then move the mouse or operate the keyboard, the display will turn on again. But there are also situations where you do not want the screen to go out.
task
Turn off the standby function for the monitor or screen so that the screen always remains on.
solutions
To permanently activate a monitor there are many different solutions. Depending on the requirement, the system and the environment, one or the other solution will not work or will be completely eliminated. If necessary, you have to try several solutions.
- Temporarily switch off monitor standby in the desktop
- Switch off monitor standby in the desktop permanently
- Alternative with lightdm
- Alternative that works on the desktop and the command line
- Another alternative that works on the desktop and the command line
- Alternative for the command line
Note: “Desktop” means the LXDE or PIXEL desktop used by Raspbian.
Solution 1: Temporarily turn off monitor standby in the desktop
To control the power-saving features of the X server, you must first install a package.
sudo apt-get install x11-xserver-utils
The following commands are then entered directly on the command line. But only via screen and keyboard. That does not work over SSH.
xset s off
xset -dpms
xset s noblank
The problem here is that the next time you log in or restart, these settings will be lost.
Solution 2: Permanently turn off monitor standby in the LXDE desktop
To do this, we open the following configuration file, which is automatically executed when the current user logs in.
nano .config /lxsession/lxde-pi/autostart
Here we enter the following lines:
@ xset s noblank
@xset s off
@xset -dpms
Then restart, log in again and check if the settings have been applied.
xset q
The following information must be available:
Screen Saver:
prefer blanking: no ...
...
DPMS is disabled
Solution 3: Alternative with lightdm
Open a configuration file:
sudo nano /etc/lightdm/lightdm.conf
In the section “[SeatDefaults]” enter the following line:
xserver-command = X -s 0 dpms
Solution 4: Alternative that works on the desktop and the command line
To do this, add the following lines to the file “/etc/rc.local” before the “exit”:
xset s off
xset -dpms
Or:
# Disable console blanking
setterm -blank 0 -powerdown 0
Save and close the file and reboot the system for the setting to take effect.
Solution 5: Another alternative that works on the desktop and the command line
Note: It is likely that this boot parameter may eventually be discontinued.
Open a configuration file:
sudo nano /boot/cmdline.txt
Add the following parameter at the back:
console blank = 0
Solution 6: Alternative for the command line
Open a configuration file:
sudo nano /etc/kbd/config
Here we enter the following lines:
BLANK_TIME = 0
POWERDOWN_TIME = 0
Raspberry Pi: Set the screen resolution on the HDMI output
In general, the resolution (width and height) of Raspberry Pi’s screen display is based on the native resolution of the HDMI screen. And that usually automatically. That means, actually one does not have to adjust at the dissolution.
Unfortunately, the automatic resolution detection for the HDMI screen has the disadvantage that if no screen is connected at boot, then set a minimum resolution that can not be changed later. This is a problem if you later want to turn on the screen or start a VNC session on the current screen.
In such cases you have to set the resolution on the HDMI interface.
Note: The disadvantage is that if you later connect a screen that does not control this resolution, then the screen display may no longer work. That should be considered.
Task
- Determine which resolutions the monitor controls.
- Set the desired resolution.
Solution: Detect supported resolutions of the current screen
If you have decided on a screen that can be used later to ensure the screen display, check which resolutions this screen supports.
There are two operating modes: CEA and DMT. We are only interested in DMT.
Supported resolutions of the HDMI screen with CEA:
/opt/vc/bin/tvservice -m CEA
Supported resolutions of the HDMI screen with DMT:
/opt/vc/bin/tvservice -m DMT
And then let’s see the current resolution of the connected screen:
/opt/vc/bin/tvservice -s
As a rule, you will opt for this automatically set resolution.
Solution: Fix the resolution
The resolution can be set in the following configuration file:
sudo nano /boot/config.txt
First, let’s make a meaningful basic configuration. The following lines are simply added in the file below.
# HDMI without monitor in operation (optional)
hdmi_force_hotplug = 1
# Output audio via HDMI (optional)
hdmi_drive = 2
# Enable DMT operation mode
hdmi_group = 2
Then we set the resolution to DMT (only one of them):
# Resolution: 1024x768 / 60 Hz
hdmi_mode = 16
# Resolution: 1280x768 / 60 Hz
hdmi_mode = 23
# Resolution: 1366x768 / 60 Hz
hdmi_mode = 81
# Resolution: 1920x1080 / 60 Hz (1080p)
hdmi_mode = 82
These resolutions are examples that not every screen supports.
There are other resolutions for DMT. You can find a complete list here.
If possible, choose a resolution supported by the screen. The best one that automatically adjusts itself when connecting this screen.
solution: Set resolution with “raspi-config”
In the configuration tool “raspi-config” under “Advanced Options / Resolution” there is the possibility to set the resolution.
sudo raspi-config
Raspberry Pi: VGA projector or monitor with an HDMI adapter
For screen output, Raspberry Pi has an HDMI and a composite output. Typically, you will run Raspberry Pi with an HDMI screen. That’s the easiest. Unfortunately, one does not always have an HDMI screen available. Often there are still old VGA screens around, but are just as well suited for the image output. There is only one HDMI adapter needed, which has a VGA output. Such an HDMI adapter converts the digital image signal into an analog VGA signal and provides the necessary signal output at the VGA connection.
Unfortunately, this only works conditionally. An HDMI adapter is quickly purchased, but the VGA screen does not always work on it by “plug and play”. This is not the HDMI adapter or the VGA screen, but simply because Raspberry Pi does not provide the right signal.
Note: When operating a VGA monitor via the HDMI adapter, it is notable that the monitor and HDMI adapter must be connected when turning on Raspberry Pi. If the monitor and adapter are connected to Raspberry Pi during operation, the monitor reports “No Signal”. The HDMI adapter is probably initialized during booting, which is not possible during operation.
Task
- Set the boot configuration of Raspberry Pi so that you can operate a VGA monitor via an HDMI adapter on Raspberry Pi’s HDMI port.
Solution via SSH
First, open the configuration file that corresponds to the BIOS settings of a modern PC.
sudo nano /boot/config.txt
In the file, look for the following two settings, comment on them and set them to the following values.
hdmi_group = 2
hdmi_mode = 16
This sets HDMI to 1024 x 768 at 60 Hz.
Then save and exit with: Ctrl + O, Enter, Ctrl + X
Note: Depending on the manufacturer-specific screen resolution and the HDMI adapter, other values may be necessary ( further display values ).
Then a reboot is necessary.
sudo reboot
If after the restart the image representation is complete and flicker-free, then correct resolution for the screen was selected.
Solution on another computer
Insert the SD card into the memory card reader of any computer. Then open the file “config.txt” in the drive “BOOT” with a text editor.
In the file, look for the following two settings, remove the hash (‘#’) and set it to the following values.
hdmi_group = 2
hdmi_mode = 16
This sets HDMI to 1024 x 768 at 60 Hz. Depending on the manufacturer-defined resolution of the screen, other values may be necessary.
Then you take the SD card with a Raspberry Pi in operation and checks the image display on the VGA screen. If after the restart the image representation is complete and flicker-free, then correct resolution for the screen was selected.
Audio output for the adapter
Some VGA-HDMI adapters also have an audio output, which usually works only with an external power supply.
The following setting in the file “config.txt” has already made so many times that sound came from the adapter.
hdmi_drive = 2
Leave a Reply