Friday, 30 October 2015

Raspberry Pi - HDMI / LCD TV configuration & setup (Part 2)

The current version used in consumer electronic gear for the HDMI interface is Enhanced EDID (E-EDID) 1.3 which is based on CEA-861E and incorporated into the HDMI 1.4 specification. The EDID 1.3 specification was released in 2000. The current version used for PCs with the DisplayPort interface is EDID 1.4, released in March 2007.

Here is a description lifted from Open Tech Guides.

Picture doesn't fill the entire size of the screen and you can see black borders on left, right, top, bottom or all sides.

This is possibly because Pi is adding overscan to the signal. Modern TVs and monitors don't need overscan and hence disabling overscan altogether can make the Pi graphics fill the entire screen.
Check the settings on the TV or monitor first. Eg: On a Sony Bravia TV these settings are under Screen Format (Normal, Zoom, Wide Zoom etc.,). If this doesn't remove the black borders, then try disabling overscan on the Pi. This can be done by setting the parameter disable_overscan to 1 in /boot/config.txt and commenting other parameters related to overscan.
  1. Take a backup of /boot/config.txt
    sudo cp /boot/config.txt /boot/config.txt.backup
    
  2. Open config.txt for editing
    sudo nano /boot/config.txt
    
  3. Uncomment the #disable_overscan=1 (Remove the #)
  4. Comment all other overscan parameters
    #overscan_left=10
    #overscan_right=10
    #overscan_top=15
    #overscan_bottom=15
    
  5. Save and exit. ( CTRL+X followed by Y to save)
  6. Reboot
    sudo reboot
    
On most monitors / TVs this would remove the black borders and make the desktop fill the whole screen. However, if your display still has some overscan you may need to keep the overscan parameters in config.txt file but adjust the values:
overscan_left=-10
overscan_right=-10
overscan_top=-30
overscan_bottom=-30
More negative values mean less black borders. Centre the display by trying different values for left, right, top, bottom.

Picture spills off the size of the screen and some parts of the picture are outside the screen

This means you need positive overscan values.
overscan_left=10
overscan_right=10
overscan_top=30
overscan_bottom=30

The resolution and HDMI modes are not the best values for your screen

Try to change monitor settings from Preferences → Monitor settings
However, if it says "Unable to get monitor information", find out the modes supported by your monitor by running tvservice command and set the correct mode in /boot/config.txt as below
  1. Run the tvservice command to output the result to a file.
    $ tvservice -d edid.dat
    Written 256 bytes to edid.dat
    
  2. Pipe the file to edidparser to generate a readable text file.
    $ edidparser edid.dat > edid.txt
    
  3. Grep the desired resolution to check if it is available. For example if you are checking for 1080p resolution
    $ cat edid.txt | grep 1080p
      HDMI:EDID found preferred CEA detail timing format: 1920x1080p @ 60 Hz (16)
      HDMI:EDID found CEA detail timing format: 1920x1080p @ 50 Hz (31)
      HDMI:EDID found CEA format: code 31, 1920x1080p @ 50Hz 
      HDMI:EDID found CEA format: code 16, 1920x1080p @ 60Hz 
      HDMI:EDID found CEA format: code 32, 1920x1080p @ 24Hz 
      HDMI:EDID found CEA format: code 34, 1920x1080p @ 30Hz 
      HDMI:EDID best score mode is now CEA (16) 1920x1080p @ 60 Hz with pixel clock 148 MHz (score 5398248)
      HDMI:EDID CEA mode (31) 1920x1080p @ 50 Hz with pixel clock 148 MHz has a score of 4232360
      HDMI:EDID CEA mode (32) 1920x1080p @ 24 Hz with pixel clock 74 MHz has a score of 124532
      HDMI:EDID CEA mode (34) 1920x1080p @ 30 Hz with pixel clock 74 MHz has a score of 149416
      HDMI:EDID preferred mode remained as CEA (16) 1920x1080p @ 60 Hz with pixel clock 148 MHz
    
      HDMI:EDID best score mode is now CEA (16) 1920x1080p @ 60 Hz with pixel clock 148 MHz (score 5398248)
    "CEA" corresponds to hdmi_group=1
    "DMT" corresponds to hdmi_group=2
    The value inside () corresponds to hdmi_mode.
    From the above result:
    hdmi_group=1
    hdmi_mode=16
  4. Take a backup of /boot/config.txt
     sudo cp /boot/config.txt /boot/config.txt.backup
  5. Edit /boot/config.txt
     sudo nano /boot/config.txt 
  6. Uncomment hdmi_group and hdmi_mode and set the right values
     hdmi_group=1
     hdmi_mode=16 
  7. Save and exit; Ctrl+X followed by Y to save
  8. Reboot
    $ sudo reboot 

You can find more information at eLinux.org.

Here is a description lifted from Raspberry Pi.org.

CEA (Consumer Electronics Association) and DMT (Display Monitor Timings) are two logical groups of configuration settings. Here follows a list of all CEA and DMT formats (as of CEA-861 E and DMT V1 r12 respectively). If you want to use any of these modes explicitly, set hdmi_group and hdmi_mode to the correct values in the config file. Note that not all modes are supported by the Raspberry Pi hardware (mainly the high resolution / high frame rate modes) and all explicit modes are subject to EDID support from the monitor / TV you are using.


CEA (hdmi_group = 1)

HDMI_CEA_VGA = 1
HDMI_CEA_480p60 = 2
HDMI_CEA_480p60H = 3
HDMI_CEA_720p60 = 4
HDMI_CEA_1080i60 = 5
HDMI_CEA_480i60 = 6
HDMI_CEA_480i60H = 7
HDMI_CEA_240p60 = 8
HDMI_CEA_240p60H = 9
HDMI_CEA_480i60_4x = 10
HDMI_CEA_480i60_4xH = 11
HDMI_CEA_240p60_4x = 12
HDMI_CEA_240p60_4xH = 13
HDMI_CEA_480p60_2x = 14
HDMI_CEA_480p60_2xH = 15
HDMI_CEA_1080p60 = 16
HDMI_CEA_576p50 = 17
HDMI_CEA_576p50H = 18
HDMI_CEA_720p50 = 19
HDMI_CEA_1080i50 = 20
HDMI_CEA_576i50 = 21
HDMI_CEA_576i50H = 22
HDMI_CEA_288p50 = 23
HDMI_CEA_288p50H = 24
HDMI_CEA_576i50_4x = 25
HDMI_CEA_576i50_4xH = 26
HDMI_CEA_288p50_4x = 27
HDMI_CEA_288p50_4xH = 28
HDMI_CEA_576p50_2x = 29
HDMI_CEA_576p50_2xH = 30
HDMI_CEA_1080p50 = 31
HDMI_CEA_1080p24 = 32
HDMI_CEA_1080p25 = 33
HDMI_CEA_1080p30 = 34
HDMI_CEA_480p60_4x = 35
HDMI_CEA_480p60_4xH = 36
HDMI_CEA_576p50_4x = 37
HDMI_CEA_576p50_4xH = 38
HDMI_CEA_1080i50_rb = 39
HDMI_CEA_1080i100 = 40
HDMI_CEA_720p100 = 41
HDMI_CEA_576p100 = 42
HDMI_CEA_576p100H = 43
HDMI_CEA_576i100 = 44
HDMI_CEA_576i100H = 45
HDMI_CEA_1080i120 = 46
HDMI_CEA_720p120 = 47
HDMI_CEA_480p120 = 48
HDMI_CEA_480p120H = 49
HDMI_CEA_480i120 = 50
HDMI_CEA_480i120H = 51
HDMI_CEA_576p200 = 52
HDMI_CEA_576p200H = 53
HDMI_CEA_576i200 = 54
HDMI_CEA_576i200H = 55
HDMI_CEA_480p240 = 56
HDMI_CEA_480p240H = 57
HDMI_CEA_480i240 = 58
HDMI_CEA_480i240H = 59
HDMI_CEA_720p24 = 60
HDMI_CEA_720p25 = 61
HDMI_CEA_720p30 = 62
HDMI_CEA_1080p120 = 63
HDMI_CEA_1080p100 = 64

DMT (hdmi_group = 2)

HDMI_DMT_640x350_85 = 0x1, /**<640x350 */
HDMI_DMT_640x400_85 = 0x2, /**<640x400 */
HDMI_DMT_IBM_VGA_85 = 0x3, /**<720x400 */
HDMI_DMT_VGA_60 = 0x4, /**<640x480 (60Hz is same as VGA in CEA above) */
HDMI_DMT_VGA_72 = 0x5
HDMI_DMT_VGA_75 = 0x6
HDMI_DMT_VGA_85 = 0x7
HDMI_DMT_SVGA_56 = 0x8, /**<800x600 */
HDMI_DMT_SVGA_60 = 0x9
HDMI_DMT_SVGA_72 = 0xA
HDMI_DMT_SVGA_75 = 0xB
HDMI_DMT_SVGA_85 = 0xC
HDMI_DMT_SVGA_120 = 0xD
HDMI_DMT_848x480_60 = 0xE, /**<848x480 */
HDMI_DMT_XGA_43 = 0xF, /**<1024x768 – interlaced, DO NOT USE */
HDMI_DMT_XGA_60 = 0x10, /**<1024x768 */
HDMI_DMT_XGA_70 = 0x11
HDMI_DMT_XGA_75 = 0x12
HDMI_DMT_XGA_85 = 0x13
HDMI_DMT_XGA_120 = 0x14
HDMI_DMT_XGAP_75 = 0x15, /**<1152x864 */
HDMI_DMT_WXGA_RB = 0x16, /**<1280x768 reduced blanking */
HDMI_DMT_WXGA_60 = 0x17
HDMI_DMT_WXGA_75 = 0x18
HDMI_DMT_WXGA_85 = 0x19
HDMI_DMT_WXGA_120 = 0x1A, /**<120Hz with reduced blanking */
HDMI_DMT_1280x800_RB = 0x1B, /**<1280x800 reduced blanking */
HDMI_DMT_1280x800_60 = 0x1C
HDMI_DMT_1280x800_75 = 0x1D
HDMI_DMT_1280x800_85 = 0x1E
HDMI_DMT_1280x800_120 = 0x1F, /** reduced blanking */
HDMI_DMT_1280x960_60 = 0x20, /**<1280x960 */
HDMI_DMT_1280x960_85 = 0x21
HDMI_DMT_1280x960_120 = 0x22, /** reduced blanking */
HDMI_DMT_SXGA_60 = 0x23, /**<1280x1024 */
HDMI_DMT_SXGA_75 = 0x24
HDMI_DMT_SXGA_85 = 0x25
HDMI_DMT_SXGA_120 = 0x26, /** reduced blanking */
HDMI_DMT_1360x768_60 = 0x27, /**<1360x768 */
HDMI_DMT_1360x768_120 = 0x28, /**<120 Hz with reduced blanking */
HDMI_DMT_SXGAP_RB = 0x29, /**<1400x1050 reduced blanking */
HDMI_DMT_SXGAP_60 = 0x2A
HDMI_DMT_SXGAP_75 = 0x2B
HDMI_DMT_SXGAP_85 = 0x2C
HDMI_DMT_SXGAP_120 = 0x2D, /** reduced blanking */
HDMI_DMT_1440x900_RB = 0x2E, /**<1440x900 reduced blanking */
HDMI_DMT_1440x900_60 = 0x2F
HDMI_DMT_1440x900_75 = 0x30
HDMI_DMT_1440x900_85 = 0x31
HDMI_DMT_1440x900_120 = 0x32, /** reduced blanking */
HDMI_DMT_UXGA_60 = 0x33, /**<1600x1200 60Hz */
HDMI_DMT_UXGA_65 = 0x34
HDMI_DMT_UXGA_70 = 0x35
HDMI_DMT_UXGA_75 = 0x36
HDMI_DMT_UXGA_85 = 0x37
HDMI_DMT_UXGA_120 = 0x38, /** reduced blanking */
HDMI_DMT_SWXGAP_RB = 0x39, /**<1680x1050 reduced blanking */
HDMI_DMT_SWXGAP_60 = 0x3A, /**<1680x1050 60Hz */
HDMI_DMT_SWXGAP_75 = 0x3B
HDMI_DMT_SWXGAP_85 = 0x3C
HDMI_DMT_SWXGAP_120 = 0x3D, /** reduced blanking */
HDMI_DMT_1792x1344_60 = 0x3E, /**<1792x1344 60Hz */
HDMI_DMT_1792x1344_75 = 0x3F, /**<1792x1344 75Hz */
HDMI_DMT_1792x1344_120 = 0x40, /** reduced blanking */
HDMI_DMT_1856x1392_60 = 0x41, /**<1856x1392 60Hz */
HDMI_DMT_1856x1392_75 = 0x42, /**<1856x1392 75Hz */
HDMI_DMT_1856x1392_120 = 0x43, /** reduced blanking */
HDMI_DMT_WUXGA_RB = 0x44, /**<1920x1200 reduced blanking */
HDMI_DMT_WUXGA_60 = 0x45, /**<1920x1200 60Hz */
HDMI_DMT_WUXGA_75 = 0x46, /**<1920x1200 75Hz */
HDMI_DMT_WUXGA_85 = 0x47, /**<1920x1200 85Hz */
HDMI_DMT_WUXGA_120 = 0x48, /** reduced blanking */
HDMI_DMT_1920x1440_60 = 0x49, /**<1920x1440 60Hz */
HDMI_DMT_1920x1440_75 = 0x4A, /**<1920x1440 75Hz */
HDMI_DMT_1920x1440_120 = 0x4B, /** reduced blanking */
HDMI_DMT_2560x1600_RB = 0x4C, /**<2560x1600 reduced blanking */
HDMI_DMT_2560x1600_60 = 0x4D, /**<2560x1600 60 Hz */
HDMI_DMT_2560x1600_75 = 0x4E, /**<2560x1600 75 Hz */
HDMI_DMT_2560x1600_85 = 0x4E, /**<2560x1600 85 Hz */
HDMI_DMT_2560x1600_120 = 0x50, /** reduced blanking */
HDMI_DMT_1366x768_60 = 0x51, /**<1366x768 60Hz */
HDMI_DMT_1080p_60 = 0x52, /**<Same as 1080p60 in CEA above */
HDMI_DMT_1600x900_RB = 0x53, /**<1600x900 reduced blanking */
HDMI_DMT_2048x1152_RB = 0x54, /**<2048x1152 reduced blanking */
HDMI_DMT_720p_60 = 0x55, /**<Same as 720p60 in CEA above */
HDMI_DMT_1366x768_RB = 0x56, /**<1366x768 reduced blanking */

If the file config.txt is not present or the output format is not set explicitly, the default output format is chosen as follows:

1. If the preferred format in EDID is supported, this will be chosen.
2. If the preferred format is not supported, then all the formats supported will be ranked according to some heuristics. The format with the highest score will be chosen.

If the chosen format is a DMT format, the default driven mode will be DVI. The user will need to set driving mode to 2 explicitly if HDMI output is desired. In DVI mode there will be no sound!

This is how to override the default format in config.txt:
1. Set hdmi_group = 1 (for CEA formats) or hdmi_group = 2 (for DMT formats)
2. Set hdmi_mode = x (where x is the code of the format of the respective group; see the list of CEA/DMT formats for details.)
3. If the chosen format is DMT, set hdmi_drive = 2 to enable HDMI output. (CEA modes are output as HDMI by default).

If you are unsure what formats are supported, set the output format to VGA 60Hz and then follow the instructions below to parse the EDID to find out what formats are supported. All executables are found under /opt/vc/bin.

1. Run “tvservice –m CEA” to give a list of CEA supported modes.
2. Run “tvservice –m DMT” to give a list of DMT supported modes.
3. Run “tvservice -s” to give you the current state.

Alternatively you can do the following:
1. Run “tvservice –d <file>” to capture a monitor’s EDID.
2. Pass this file to edidparser. Run “edidparser <file>”.

At this point, edidparser outputs the list of formats supported in EDID including formats not supported in Raspberry Pi, and it will show you which formats are filtered out. At the end of the output it will show which format is chosen as default. Note that edidparser is the internal EDID parsing code of Raspberry Pi with a command line front end.

Users are encouraged to post the EDID of their monitors (and the output for the parser), if Raspberry Pi chooses a default resolution which is not expected (or strange). Please include make and model number when you post EDID online.

VideoCore is a low-power mobile multimedia processor architecture originally developed by Alphamosaic Ltd. and now owned by Broadcom. The main specification points for a fully configured system at 250 MHz are:

  • 25M rendered triangles/s.
  • 1G pixels/s with single bilinear texturing, simple shading, 4x multisampling.
  • Supports 16x coverage mask antialiasing for 2D rendering at full pixel rate.
  • 720p standard resolution with 4x multisampling.
  • Supports 16-bit HDR rendering.
  • Fully supports OpenGL-ES 1.1/2.0 and OpenVG 1.1.

The VideoCore IV 3D hardware is self-contained and highly automated, requiring little processing bandwidth or real-time intervention from software drivers.

On the 2nd anniversary (28 February 2014) of the Raspberry Pi, Broadcom and Raspberry Pi Foundation, announced the release of full documentation for the VideoCore IV's 3D subsystem and a release of the graphics stack under a 3-clause BSD license.

root@raspberrypi:~# vcgencmd commands 
commands="vcos, ap_output_control, ap_output_post_processing, vchi_test_init, vchi_test_exit,
pm_set_policy, pm_get_status, pm_show_stats, pm_start_logging, pm_stop_logging, version, commands, set_vll_dir, led_control, set_backlight, set_logging, get_lcd_info, set_bus_arbiter_mode,
cache_flush, otp_dump, codec_enabled, measure_clock, measure_volts, measure_temp, get_config,
hdmi_ntsc_freqs, render_bar, disk_notify, inuse_notify, sus_suspend, sus_status, sus_is_enabled,
sus_stop_test_thread, egl_platform_switch, mem_validate, mem_oom, mem_reloc_stats, file,
vctest_memmap, vctest_start, vctest_stop, vctest_set, vctest_get"

Happy try-out!  Hope you enjoy your Raspberry Pi experience!

CAUTION: Your circumstances, connections, interfaces, options and versions may differ and needs to be re-evaluated for your specific application.

Tuesday, 27 October 2015

Raspberry Pi - HDMI / LCD TV configuration & setup (Part 1)

In the article Raspberry Pi for Kiosk application & Raspberry Pi vs PC / Windows - a comparison, Green School Campaign Phase 3, 2014 replaced PC / Windows running Google Chrome with Raspberry Pi / Raspbian running Google Chromium.

The Green School Campaign Phase 2, 2012 to 2014 had slightly different hardware choices - 1) standard / full tower desktops or 2) small form factor desktops (Dell Optiplex). Both were based on PC / Windows (Windows Vista) running Google Chrome. However, both the PC / Windows desktops were using VGA interface.

The VGA (Video Graphics Array) is an analog signal, video only, RGB video, 15 pins, NOT hot pluggable and male connectors at each end that has been with us for more than 20 years. While the transmission bandwidth of VGA is high enough to support resolutions of 1080p and higher, there can be picture quality degradation depending on cable quality and length. A short VGA cable can manage 1920x1080 without trouble. A long VGA cable (up to 5m) may top-out at 1024x768. VGA cables are more susceptible to electrical disturbances and noise compared to DVI or HDMI. Always use high quality cables that provide good, thick insulation. High-end VGA cables with adapters, boosters and / or repeaters can reach 50m in single cable length.

HDMI (High-Definition Multimedia Interface) is a proprietary audio/video interface for transferring uncompressed video data and compressed or uncompressed digital audio data from an HDMI-compliant source device, such as a display controller, to a compatible computer monitor, video projector, digital television or digital audio device. HDMI is a digital replacement for analog video standards. HDMI implements the EIA/CEA-861 (Consumer Electronics Association) standards, which define video formats and waveforms, transport of compressed, uncompressed and LPCM (Linear Pulse Code Modulation) audio, auxiliary data and implementations of the VESA (Video Electronics Standards Association) EDID (Extended Display Identification Data). The HDMI standard is capable of providing high-definition (HD) video at resolutions of 1,920 x 1,200 pixels and 8 audio channels simultaneously. HDMI 1.4 is limited to 4K resolution at 30 FPS and while HDMI 2.0 supports 4K up to 60 FPS. HDMI cables are less sensitive to crosstalk but can suffer interference from electromagnetic fields.


We did our shopping at LowYat Plaza - beware of wide variance in quality! A lot of time (and money) was wasted at work-site due to these DUDS - the packaging LIES!

We selected HDMI V1.4 for all HDMI cables and extenders - these had the best compatibility and quality. HDMI cables of different brands or from different manufacturers show-up in quality and reliability for anything more than 5m.

The HDMI Extender allows you to transmit a Full HD 1080p HDMI signal over Cat6 up to 60m. It includes a sender on one end and a receiver on the other end. Again, HDMI Extenders of different brands or from different manufacturers show-up in quality and reliability when the Ethernet cable length gets more than 30m (just half of the claimed 60m)!


We selected Cat6 / RJ45 for Ethernet cables, up to 50m run and 4 Twisted Pairs i.e. CONNECTING ALL 8 WIRES! Again, Ethernet pre-fabricated cables of different brands or from different manufacturers show-up in quality and reliability in use. We actually got caught with a "Cat6" pre-fabricated cable with only 2 pairs / 4-wires connected, another "Cat6" pre-fabricated cable with only 6-wires connected and yet another another "Cat6" pre-fabricated cable which was more like 30AWG (thin as hair)! The pre-fabricated patch cables were all duds! In the end, we bought cables (PROLINK 24AWG) and RJ45 (Dintek) connectors and crimped the cables ourselves.

Differences Between Categories of Cables : Design, Characteristics

CAT3
CAT5
CAT5e
CAT6
CAT6e
Maximum Data Rate (1 Twisted Pair)
10 Mbps
100 Mbps
1000 Mbps
10 Gbps
10 Gbps
Maximum Frequency
16 Mhz
100 Mhz
350 Mhz
250 Mhz
750 Mhz
Typical Distance
100 m
100 m
100 m
100 m
100 m
Maximum Distance at Maximum Data Transfer Rate
50 m
55 m



We used an el-cheapo (RM23) Cable / LAN tester to check our cable and connector crimping.  This Cable / LAN tester works on continuity test - it just confirms that your crimping is correct.

We were free issued 42" LCD TVs as our monitor. These were either Haier or Sharp brand and came with 2 x HDMI inputs. The settings below allowed us to align the display and fine-tune the borders. It was different for each brand and it was also different when the lengths of the HDMI cable changed!



Since the 1) standard / full tower desktops or 2) small form factor desktops (Dell Optiplex) were installed in Malaysian weather without any air-conditioning, the max setting I used was "config_hdmi_boost=5". I was cautious to NOT overuse the "config_hdmi_boost" parameter as this would cause HIGHER operating temperatures.

Only in 1 site (school), did I set "hdmi_mode=4" (720p, 60 Hz). At this site / school, we were using the HDMI Extender and the Ethernet cable length was ~45m.

In this project, I used commands for ON/OFF of the LCD TVs article as cron scheduled tasks (see Raspberry Pi for Kiosk application). I used the command "sudo tvservice -o" to OFF the LCD TV (the LCD TV goes into standby mode).  However, I could NOT ON the LCD TV with the command "sudo tvservice -p". It's a known bug. For now, the workaround is "sudo tvservice -p && fbset -depth 8 && fbset -depth 16 && xrefresh" to re-enable the frame buffer and then force an X11 redraw. Another recommendation was "sudo xset dpms force on". Yet another recommendation was "sudo tvservice -p && chvt 1 && chvt 7" but I have NOT tried any of above.

Extended Display Identification Data (EDIDs) are data structures that reside in a display device - commonly referred to as “sinks” in HDMI and DisplayPort standards documents - such as an HDTV or a computer monitor. They are intended to be read by a “source” device (e.g. set top boxes, DVD players, PC graphic cards) in order to simplify user operation and to ensure that the user’s viewing experience is optimal. EDIDs are stored in an EPROM of an audio or video rendering device. EDIDs were created by Video Electronics Standards Association (VESA) to support “plug and play” on PCs when VGA monitors supported multiple video resolutions. They were then incorporated into consumer electronic devices by the Consumer Electronics Association (CEA). The VESA EDID standard has been updated to support digital PC monitors and HDTVs using DVI, HDMI and more recently DisplayPort. Both VESA and CEA are involved in setting standards for EDIDs. 

You can find more information at eLinux.org.

If you want to see all the tvservice command options, just type "tvservice" in Terminal.

Usage: tvservice [OPTION]...
  -p, --preferred                  Power on HDMI with preferred settings
  -e, --explicit="GROUP MODE DRIVE" Power on HDMI with explicit
                                           GROUP (CEA, DMT, CEA_3D_SBS, CEA_3D_TB)
                                           MODE (see --modes) and DRIVE (HDMI, DVI)
  -c, --sdtvon="MODE ASPECT"        Power on SDTV with
                                           MODE (PAL or NTSC) and
                                           ASPECT (4:3 14:9 or 16:9)
  -o, --off                            Power off the display
  -m, --modes=GROUP     Get supported modes for GROUP (CEA, DMT)
  -M, --monitor                  Monitor HDMI events
  -s, --status                        Get HDMI status
  -a, --audio                        Get supported audio information
  -d, --dumpedid <filename>         Dump EDID information to file
  -j, --json                           Use JSON format for --modes output
  -n, --name                        Print the device ID from EDID
  -h, --help                          Print this information

After my project was completed, I found these VideoCore commands for ON/OFF of the LCD TVs which are more efficient (doesn't require the frame-buffer re-initialization and doesn't change the resolution). Furthermore, it is said to be quicker than tvservice.

vcgencmd display_power 0
vcgencmd display_power 1
Happy try-out!  Hope you enjoy your Raspberry Pi experience!

CAUTION: Your circumstances, connections, interfaces, options and versions may differ and needs to be re-evaluated for your specific application.

Wednesday, 21 October 2015

Raspberry Pi vs PC / Windows - a comparison

Was the Raspberry Pi the best choice for our Kiosk application (non-interactive)?

Short answer: YES!

Long answer: Raspberry Pi is a tiny, featherweight, cool-running, quiet-running and power sipping (everything static, no moving parts) device!

Some time ago, I worked on a company project that utilized the Raspberry Pi / Raspbian running Google Chromium for a solar power project for Malaysian schools (Green School Campaign Phase 3, 2014).



The PenjanaBebas-KeTTHA Green Schools Campaign (GSC) is a public-private partnership CSR (Corporate Social Responsibility) program that brings renewable energy into Malaysian schools, supported by Kementerian Pendidikan, JKR, TNB, SEDA, Suruhanjaya Tenaga, etc. You may also view PenjanaBebas-KeTTHA Green Schools Campaign portal for live information.

The Hardware and Software choices were by others and free issued for my work.

The Green School Campaign Phase 2, 2012 to 2014 had slightly different configuration or hardware choices - 1) standard / full tower desktops or 2) small form factor desktops (Dell Optiplex). Both were based on PC / Windows (Windows Vista) running Google Chrome. The cost of purchase was similar. However, the Total Cost of Ownership or supply was exorbitant!

Whether the 1) standard / full tower desktops or 2) small form factor desktops (Dell Optiplex) both required big metal cabinets which were able to carry the weight, withstand the heat and provide the cooling or ventilation (without any air-conditioning) while mounted on the wall outside of the classroom, school office, school hall or school canteen. In fact, the metal cabinets which housed the standard / full tower desktops had a ventilation fan to aid cooling.

Needless to say, big metal cabinets need big mounting spaces.  In a few schools, we actually placed the PC in the school office and ran extended length (up to 40m) VGA cables.

Transportation and storage issues not-with-standing, mounting these cabinets on the wall required great strength of 2 able-bodied workmen, each balancing on a 2.5m ladder, wall anchor bolts and double the installation time.



Look at the table above. The tale of tape as they say - it's a STARK contrast!

Of course, the PC desktop architecture came with HDD (Hard Disk Drive), whereas the Raspberry Pi used micro-SD for storage. SSD (Solid State Drive) for PCs are still expensive (~RM250 / 120GB), at least compared to a 16GB Class 4, micro-SD card (~RM25 / pcs).

Additionally, the PC's HDD replacement is rather more complicated than the Raspberry Pi's micro-SD card replacement. If it was required, it is far easier and quicker to make a micro-SD card image than a HDD image.  The micro-SD card could be carried in your shirt pocket, as could be a Raspberry Pi - very important when you have to climb a 2.5m ladder to reach the metal cabinet that houses it all. Also the micro-SD card could be swapped by a technician so easily unlike swapping the HDD.

Therefore, our choice was correct for our application - display Kiosk (non-interactive).

The above setup is working seamlessly and without trouble at our sites.

Happy try-out!  Hope you enjoy your Raspberry Pi experience!

CAUTION: Your circumstances, connections, interfaces, options and versions may differ and needs to be re-evaluated for your specific application.

Monday, 19 October 2015

Raspberry Pi for Kiosk application

Some time ago, I worked on a company project that utilized the Raspberry Pi / Raspbian running Google Chromium for a solar power project for Malaysian schools (Green School Campaign Phase 3, 2014).



The PenjanaBebas-KeTTHA Green Schools Campaign (GSC) is a public-private partnership CSR (Corporate Social Responsibility) programme that brings renewable energy into Malaysian schools, supported by Kementrian Pendidikan, JKR, TNB, SEDA, Suruhanjaya Tenaga, etc. You may also view PenjanaBebas-KeTTHA Green Schools Campaign portal for live information.






Green School Campaign Phase 3, 2014 replaced PC / Windows running Google Chrome with Raspberry Pi / Raspbian running Google Chromium. Whether PC / Windows running Google Chrome (Phase 2, 2012 to 2014) or Raspberry Pi / Raspbian running Google Chromium it was a Kiosk application (non-interactive).

The Hardware and Software choices was by others and free issued for my work.

Hereby I am listing the configuration and setup of Raspberry Pi / Raspbian used in this project:

The hardware utilized was the Raspberry Pi Model B+ V1.2.


Here is a description lifted from Raspberry Pi.org.
The Model B+ is the final revision of the original Raspberry Pi. It replaced the Model B in July 2014 and was superseded by the Raspberry Pi 2 Model B in February 2015. Compared to the Model B it has:
  • More GPIO. The GPIO header has grown to 40 pins, while retaining the same pinout for the first 26 pins as the Model A and B.
  • More USB. We now have 4 USB 2.0 ports, compared to 2 on the Model B, and better hotplug and overcurrent behaviour.
  • Micro SD. The old friction-fit SD card socket has been replaced with a much nicer push-push micro SD version.
  • Lower power consumption. By replacing linear regulators with switching ones we’ve reduced power consumption by between 0.5W and 1W.
  • Better audio. The audio circuit incorporates a dedicated low-noise power supply.
  • Neater form factor. We’ve aligned the USB connectors with the board edge, moved composite video onto the 3.5mm jack, and added four squarely-placed mounting holes.
The Model B+ is perfectly suitable for use in schools: it offers more flexibility for learners than the leaner Model A or A+, which are more useful for embedded projects and projects which require very low power, and has more USB ports than the Model B.
The software (Operating System) utilized was Raspbian.

Raspbian - is the Raspberry Pi Foundation’s official supported operating system.

One may install Raspbian directly or using NOOBS (New Out Of Box Software).

Here is a description lifted from Raspberry Pi.org.
NOOBS is an easy operating system installer which contains Raspbian. It also provides a selection of alternative operating systems which are then downloaded from the internet and installed.

I chose NOOBS. At the time of the project, it was NOOBS V1.4.1.


Additional software and / or tools were needed for this project:

  1. 7-Zip (V9.20) 
  2. SD Card Formatter (V4.0) 
  3. Win32 Disk Imager (V0.9.5) 
  4. PuTTY: A Free Telnet/SSH Client (V0.65) 

My work computer is an Asus A53S series running Windows 7 Professional 64-bit. In this case, the software tools utilized for this work were all Windows based software (blush). Of course, you can complete this project with Linux based tools as well.

Normally, I use 7-Zip for zip-file extraction.  7-zip is very efficient, fast and multi-function. 7-Zip is a utility program to help you extract compressed files and create your own compressed files in several different formats. 7-Zip can handle multiple compression formats. It can package files into 7z, ZIP, GZIP, BZIP2, and TAR formats, and it can unpack all those, in addition to ARJ, CAB, CHM, CPIO, DEB, DMG, and more.


However, in this instance I used the "Extract All..." function built-into File Explorer...

Let's begin...

Downloaded NOOBS_v1_4_1.zip (750MB) to my default Download location (Downloads folder).


The files were extracted to it's own directory.


Copy the entire directory and it's contents to the micro-SD card. I used a Kingston 16GB Class 4, micro-SD card. I also tried with a Kingston 16GB Class 10, micro-SD card and it worked fine.


The Raspberry Pi should be prepared for OS installation i.e. connected to keyboard (USB), mouse (USB) and monitor (HDMI) and connected to Internet (Ethernet / RJ45) interface).

DO NOT POWER-UP YET!

Eject the micro-SD card (with NOOBS) and insert into the Raspberry Pi.

NOW POWER-UP!

NOTE: I tried to connect Microsoft Wireless Desktop 3000 (keyboard and mouse combo) - NOT SUCCESSFUL! This happens because only standard drivers are packaged or rather hardware specific drivers not NOT packaged with Raspbian. Use only HID Keyboard Device and / or HID-compliant mouse - Microsoft-speak for "Generic Keyboard and Mouse" or hardware specific drivers NOT required. The Logitech Wireless Combo MK220 & Logitech Wireless Combo MK240 models are "No software installation" type. When I connected the MK220 - SUCCESSFUL, MK240 - SUCCESSFUL!



I chose Raspbian [RECOMMENDED]. Click Install.


If you see the following screen, Raspbian was installed SUCCESSFULLY.


After successful installation, the Raspberry Pi booted into the CLI (Command Line Interface) or bash.  bash is a Unix shell written for the GNU Project used by most Linux distributions and Debian in particular. Login using the default Username and Password.

You are immediately taken to raspi-config. If you want to do this later, you can comeback to this anytime by typing "sudo raspi-config" at the command line or in Terminal. 


If you need to change your language and keyboard settings in the configuration program (raspi-config), you will find them under Internationalization Options.

Change your language under Internationalization Options → Change Locale

Change your Timezone under Internationalization Options → Change Timezone

Change your keyboard settings under Internationalization Options → Change Keyboard Layout

As with any Linux installation, it is ALWAYS a good idea to run the OS update.

It's a good idea to install any anti-virus software now. I did NOT install any, though I normally install RKHunter and ClamAV in all my Linux installations.


This tool (ARP-TOOLS) may come-in handy for maintenance and troubleshooting later on.


This tool (xrdp) may come-in handy for maintenance and troubleshooting later on.


This tool (avahi) may come-in handy for maintenance and troubleshooting later on.


A Javascript browser was the project requirement.  We chose Google Chrome / Chromium as it's full screen feature was useful for our project.  You may install any other browser according to your requirements.


To give a more elegant look, we installed additional fonts.

 We didn't make any changes here.

Please note that "nano" is a built-in editor for the Raspbian.  Nano is archaic and cryptic but efficient and useful. Another built-in editor is "leafpad". Leafpad is the default text editor for the LXDE Desktop environment. We shall be using Leafpad soon.


We set-up Raspbian to run the Desktop automatically / by default every time it boots.


As we are running a Kiosk application (non-interactive), we DISABLE the screensaver.

We also HIDE the cursor as our Kiosk application is display only, we do NOT require user input. Unclutter hides your X mouse cursor when you do NOT need it, to prevent it from getting in the way. You have only to move the mouse to restore the mouse cursor.


We set-up Raspbian to auto-login automatically / by default every time it boots.


We used 42" LCD TVs as our monitor. These were either Haier or Sharp and came with 2 x HDMI inputs. The above settings allowed us to align the display and fine-tune the borders. It was different for each brand and it was also different when the lengths of the HDMI cable changed.




There was some changes between NOOBS_v1_4 and NOOBS_v1_4_1 resulting in dual configuration as above. The above works for our project.









In the school environment, we wanted to switch OFF the LCD TVs during the night - this shall save energy consumption and also the LCD lifespan. Another fact of life outside of Kuala Lumpur is the erratic utility / TNB supply. The schools face power cuts once or twice every week. During the installation phase, we were trying out many different software, configuration and setup to find the best one and the Raspberry Pi did crash or hang.  We realized that most times a reboot would set right the Raspberry Pi. In this case, I used cron set-up the LCD TV to switch OFF at 2000h at night and REBOOT every morning at 0700h.


The Raspberry Pi does NOT have a hardware / real-time clock. Therefore, we have to utilize software for accurate date and time. NTP (Network Time Protocol) is packaged with every Linux distribution including Debian.  However, it has to be manually set-up. Obviously, with cron running schedules, it is critical to set the accurate time and date.  I ran tzselect - the tzselect program asks the user for information about the current location and outputs the resulting timezone description to standard output. The output is suitable as a value for the TZ environment variable.

After the installation at the 1st school was finalized, we were satisfied with the software, configuration and setup, we were ready to roll-out to other schools / sites. We used the Win32 Disk Imager utility to make an image of the Raspberry Pi's micro-SD card ONTO my HDD.


From then on, we just reversed the process and used Win32 Disk Imager utility to make an image of the Raspberry Pi's micro-SD card FROM my HDD. Minimal changes were required for LCD TV settings and URL reference.

We rarely used the SD Card Formatter utility. Since the micro-SD cards were pre-formatted.


However, it was useful during the 1st installation as were trying out many different software, configuration and setup to find the best one, we more than once had to re-format the micro-SD card and begin from scratch.

I have a separate article to compare the Raspberry Pi and PC / Windows.

The above setup is working seamlessly and without trouble at our sites.

Happy try-out!  Hope you enjoy your Raspberry Pi experience!

CAUTION: Your circumstances, connections, interfaces, options and versions may differ and needs to be re-evaluated for your specific application.