Raspberry PI – Black Borders and Blank Screen in Raspbian with HDMI Monitor

Every time that I set up my Raspberry PI with a new version of the Raspbian operating system, I seem to have to use different settings for the HDMI screen — even though I am using the same hardware every time. I am not sure if this has to do with installing Raspbian using NOOBS versus using the Raspbian image file.

When I wrote the article on 10 things to do after buying a Raspberry PI, I only needed to change the disable_overscan parameter to  disable_overscan=1 in the /boot/config.txt file to remove the black border on the screen.

I recently installed a new version of Raspbian (2015-02-16-raspbian-wheezy.img) directly from the image file i.e. not using NOOBS. Nothing would display on the screen — the screen was just black / blank. I did discover that if I powered up the screen first, waited a few seconds and then powered up the PI, that the PI boot up and login prompt then displayed on the screen, although with wide black borders. At least this allowed me to configure Raspbian using the default configuration screen that appears after first boot of a new Raspbian install.

Below are the steps that I had to take to fix the blank screen and black border problems on my Raspberry PI.

Fixing the Blank Screen Problem

You may need to change different settings for your screen, depending on which screen you are using. The following is what worked for me, but this will show you where you can start changing settings to see what works for you.

Booting Up

I had to switch the screen on first with the PI power off, wait a few seconds and then plug the PI power in. The screen now worked. If the PI and screen were ever switched on at the same time, the screen went blank, even though the PI booted up.

If you can’t get anything to display on your screen, you may need to remove the SD card and access it from a PC to make changes to the config.txt file.

Changing the Settings

The config.txt file needs to be modified to make changes to the screen configuration. This file is found in the /boot directory on the SD card which is a separate partition as well. If you plug the SD card into a Windows PC, you will be prompted to open the boot folder of the SD card and you will find config.txt in this folder which you can then modify. Linux desktop operating systems will usually open both the boot partition and the contents of the SD card in two separate file managers.

In my case, I could modify the config.txt file on the PI without the need of a PC. This can be done from the command line using the nano text editor. It can also be done from the graphical desktop. In both cases the file must be opened using super user privileges or modifications will not be able to be saved.

To open the config.txt file as super user using the nano text editor from the command line, enter:

sudo nano /boot/config.txt

To open the config.txt file as super user from the PI desktop:

  1. Press Alt + F2 to bring up the Run box.
  2. Enter gksudo pcmanfm in the run box and press enter or click OK. This opens the file manager with super user privileges.
  3. You can click Close in the dialog box that pops up.
  4. Navigate to the boot folder by clicking the boot partition in the left pane of the file manager.
  5. You can now open config.txt in the main pane of the file manager by double-clicking it.
  6. It is best to close the file manager now, as it has been opened with super user privileges and can be used to modify or delete other files from the file system.
  7. Changes can now be made to config.txt and saved.

With the config.txt file now open with super user privileges, we can fix the blank screen problem. The problem may be fixed by uncommenting (i.e. removing the # sign in front of) the following line:

#config_hdmi_boost=4

NOOBS users be aware that the parameters that are changed usually appear at the top of the config.txt file commented out and then again at the bottom of the file uncommented. Make changes to the bottom uncommented parameters, unless you can’t find the parameter that you are looking for at the bottom of the file.

This did not solve the problem in my case. I had to do two things – uncomment the hdmi_force_hotplug line and uncomment and change the settings of hdmi_group and hdmi_mode.

Every time that a parameter is changed in config.txt, the system must be rebooted in order for the changes to be seen. You may need to change a parameter at a time and reboot to see the effect.

The settings that solved my problem are shown here:

# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
hdmi_group=1
hdmi_mode=4

The hdmi_group and hdmi_mode settings are obtained from the video mode options on the RPiconfig page. You will need to scroll down a bit to see the options. The settings that I used above mean the following:

hdmi_group=1   # define screen resolution in CEA format
hdmi_mode=4    # 720p   60 Hz

Rebooting after changing these settings fixed the blank screen problem and I could now switch the screen and PI on at the same time.

Fixing the Black Border Problem

The black border can be removed and adjusted by changing parameters in the config.txt file again. Open the config.txt file as super user again as described above.

Reminder: NOOBS users be aware that the parameters that are changed usually appear at the top of the config.txt file commented out and then again at the bottom of the file uncommented. Make changes to the bottom uncommented parameters, unless you can’t find the parameter that you are looking for at the bottom of the file.

Now uncomment the disable_overscan parameter and set it to 1:

disable_overscan=1

Reboot and see if the black borders have gone. If they are still there, you will need to adjust the size of the borders to remove them using the following parameters:

overscan_left=28
overscan_right=28
overscan_top=12
overscan_bottom=12

Increasing the number in these parameters decreases the size of the border.

With the above settings changed, my PI and screen were fully functional and looking good. Here is my complete config.txt file to for you to see all the changes together:

# For more options and information see 
# http://www.raspberrypi.org/documentation/configuration/config-txt.md
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
overscan_left=28
overscan_right=28
overscan_top=12
overscan_bottom=12

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
hdmi_group=1
hdmi_mode=4

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

Raspberry PI: Booting more than One Operating System

More than one operating system can be loaded to the same Raspberry PI SD card using the NOOBS installation files. This allows easy experimentation and evaluation with different operating systems.

In the article on booting multiple operating systems, Raspbian, RISC OS Pi and Arch Linux are loaded onto a single 16Mb SD card to show how easy it is to boot multiple operating systems on the RPI.

Website Not Displaying Properly on Raspberry PI / Midori Browser

If you have found that some websites do not display correctly when using the Midori browser on your Raspberry PI / Raspbian operating system, the problem could be that the fonts used by the browser do not exactly match the fonts used by the website designer.

The problem can quickly be fixed by installing some extra fonts as this article explains: Getting Websites to Display Correctly in Midori on Raspbian for the Raspberry PI

Ten Things to Do After Buying a Raspberry PI

This article on ten things to do after buying a Raspberry PI shows how to install the Raspbian operating system, change settings, play a video, clone your SD card and more.

The ten things to do are the following:

  1. Install the Raspbian Operating System — you need and operating system to use your Raspberry PI and Raspbian is the “standard” OS for the PI board.
  2. Set Language and Keyboard — the default settings for the Raspberry PI are for the UK, if you are located anywhere else, you will probably need to change these settings.
  3. Setup Timezone — if you are not located in the UK, you will need to change the timezone. The Raspberry PI gets the current time from the Internet.
  4. Start the Graphical Desktop — start and explore the graphical desktop that is installed with Raspbian.
  5. Change Screen Viewing Area — there is usually a black border around the HDMI screen after installing Raspbian – remove the border to make full use of the screen area.
  6. Update System Software — make sure that the Raspbian operating system and installed applications are updated to the latest versions.
  7. Login Automatically — if you want to automatically run an embedded application on the Raspberry PI at switch on, you will first need Raspbian to boot up without the need for you to log in.
  8. Play a Video — the Raspberry PI is capable of playing video up to full 1080p HD resolution.
  9. Automatically Run an Application — if you want to use your Raspberry PI for a dedicated purpose, you will need to run your application software at switch on.
  10. Clone Your SD Card — after installing an operating system, configuring it and then developing your own custom application, it is a good idea to back up your work by cloning your Raspberry PI SD card. This will also enable you to make multiple copies of your project.

Go to the ten things to do after buying a Raspberry PI article now.