Tuesday, January 6, 2015

Convert your car –rear view screen to a monitor for Pi

If you wanted to make your cute ,credit card sized computer to something more adorable all you need is a small display like the one in the picture above. So from today’s post ‘m going to share with you about how I did that.
Things you are going to need:
  • A Raspberry Pi computer.(I’m using a model B one)
  • Car –rear view monitor which has PAL/NTSC connection
  • A RCA coupler male to male
  • 12V power supply for the monitor.(1A output  will be all right but check the monitor specification first)
Car-view monitor

RCA male to male adapter


 You can buy the monitor in the above picture for 26 US dollars by Ali express web site.  It’s the cheapest one could find and it worth for it’s price and also shipping is free but if you want a monitor with HD facilities and if you can afford around 80 US dollars or more then check out the Adafriut official site. They got some really good monitors for the job.
You can buy the RCA male to male adapters in Ebay ,I bought that by core electronics and it cost me only around 2 US dollars excluding shipping. I could complete the project under small budget around 30 US dollars since I had a suitable power supply .If you have any electronic device which uses a power adapter you might be able use that as the power supply for the monitor. The adapter I’m using is a power supply to an unwanted router.
In this tutorial I assume you already have a working pi and you are familiar with using terminal or any other text editor to edit text files.
First connect the monitor to the yellow RCA jack using the RCA male to male coupler. Connect the power  adapter to the monitor and turn on the pi. If the display is not showing anything try to switch to NTSC /PAL mode by pressing 3 or 4 in the keyboard. if you can get a signal to the monitor then it should be very small and hard to read. We need to change the resolution for  a better view and  it can be done by editing a file called config.txt .My display is compatible with 800*480 and 480 *272 resolution and try to choose the smaller one since it will display the text more clearly. But you can use other values for these if they are agree with your screen ratio. For example if your screen ratio is 16:9 and your width is 520 pixels then you can calculate the number of pixels for  height  (520*9)/16 = 293   pixels. You can find the optimized resolution for the display by trying few values like these.

In order to change the settings type the following command in the terminal .

Sudo vi /boot/config.txt

This command will open the config.txt file to edit . In the file find the following lines. Before you edit anything I recommend to keep a backup of the file.

#framebuffer_width=1280
#framebuffer_height=720

  These settings force the display to set the resolution to the given values and to activate them remove the comments and amend the value to the values you want for example like the following,
framebuffer_width=480
framebuffer_height=272
After editing these lines save (Shift+z and wq) and reboot the pi (sudo  /sbin/shutdown –r now).You can see the display is bigger and more readable than last time.but most of the time there will be some unused space(pixels) in the display and we can stretch the window until the unused space is gone. You can optimize the display by this. To do this open the same file(config.txt) and find the following lines ;

# overscan_left=26
# overscan_right=26
# overscan_top=16
# overscan_bottom=16

Remove the comment sign and change the values to negative values in order to expand the display. You can use values up to -30 , values beyond that didn't work for me .After that save and reboot the  pi. You might have to repeat the above steps few times in order to get the best output. It’s all about trial and error. Besides these settings you can do more configurations using this file. Read the file carefully to know what you can do with it, try to play around. If everything went well you will get a nice display like in the pictures.