Skip navigation

Introduction

After a forced pause the Essential Raspberry Pi Peripherals articles series finally restarts with a new proposal. The Pi-Scope lab tool is the first of a series of tools to empower the electronic lab based on the Raspberry PI 2Raspberry PI 2 , Raspberry PI lcdRaspberry PI lcd and Bitscope microBitscope micro

There is already an interesting Ben Heck episode, Episode 223: Ben Heck’s Raspberry Pi Bitscope Mod Episode modding these three devices creating an oscilloscope. It is my opinion that this proposed version has some limitations, so I have searched how to develop a device architecture based on the Raspberry Pi integrating different features to support in the best way the daily lab activity.

First of all I aimed to make a robust support for the components keeping in the same time all the expansions ports open to any possible integration and development. It is not the first time that I try to box in a elegant way the Raspberry PI together with other parts like in this case, but this always means limiting some features of the device. The container has been based on the model presented on Instructables Raspberry PI Touch Screen Frame and Case Assembly Guide with some changes and adaptions.

IMG_20160402_152213.jpg

Project goals

  • Bitscope micro has a form-factor useful for usage as a probe with status LEDs that should remain exposed for the best use
  • The touch screen should be easily accessible and visible while the oscilloscope probe can be easily used nearby to the tested parts
  • The Raspberry PI ports should be easily accessible, for some kind of usages also while the oscilloscope is connected (e.g. an external keyboard)
  • All the case components should be 3D printable and easy to assemble to simplify the creation of the system
  • A "Super Interface" should be provided to control the different working modes of the Bit Scope software and other future tools
  • The device should be able to access the Internet when needed
  • The entire system should be open for future developments and enhancements

 

The 3D model

The images below shows the assembled model of the components (the stl files are available in attach to this article).

3D View Front.png

The front view of the model

3D View Back.png

The back view of the model

3D View cut01.png

The section view of the parts

Pi-Scope in use

IMG_20160402_154135.jpg IMG_20160402_154142.jpg

The following short video shows the Pi-Scope usage while testing the state of a stepper motor PWM signals

 

Next setps

As the Bitscope mini software is a suite of several applications it is needed a startup interface, specifically designed for the Raspberry touch screen as the main launcher when the system starts. The same interface will host software to control other tools connected to the device.

Introduction

In this fourth article of the series Essential Raspberry Pi Peripherals we will see how to install the Pi CameraPi Camera and the 2.4" Touch Panel2.4" Touch Panel on the Raspberry PI 2Raspberry PI 2. In the next article we will use this base setup to make a PI Camera where the PiFace CAD LCD display is be replaced by the 2.4" Touch Panel.

The components we are using are shown in the image below including a small and almost inexpensive (about 5$) LinkSys WiFi USBLinkSys WiFi USB dongle and a class 10 8Gb Micro SD card.

 

Note: if you have only one of the two devices you can follow this guide excluding the parts that refers to the other (the camera or the touch panel) alternatively.

 

IMG_20151115_173250.jpg

But it's not all! As we are trying to modernise the PiFace CAD based Raspberry Camera, why not starting with Jessiehttps://www.raspberrypi.org/downloads/raspbian/, the new, updated Debian Linux distribution for the Raspberry PI 2?

 

Raspbian Jessie installation

Jessie is the latest updated distribution of the Raspian version, a Debian distro for the Raspberry PI. This new version in my opinion it is the worth to use it because the new 4.x Linux kernel and a series of improvements specific for the Raspberry PI platforms gives the clear impression to be a mature version than the previous. After creating the bootable image on a microSD card you should just insert it in the board and power it on. There is plenty of tutorials online on how to prepare the Raspbian bootable microSD card but the better way, covering all the desktop platforms is on the raspberrypi.org site from where you can also download the last updated Jessie image file.

 

Just from the first boot you immediately see that process is extremely fast. Better if you have done this with the previous Linux versions to see the difference.

The most notable feature is the new version of the Raspberry setup directly accessible from the setup. All the options available in the raspi-config command are now accessible through a more comfortable user interface.

Screen Shot 2015-11-17 at 10.33.46.png Screen Shot 2015-11-17 at 10.33.56.png

Screen Shot 2015-11-17 at 10.34.05.png Screen Shot 2015-11-17 at 10.34.20.png

The four images above shows the four sections of the Graphical User Interface version of the Raspberry PI settings with the suggested settings for the setup we need.

 

Note: as far as I know it is not mentioned anywhere but confirming every panel you are asked for reboot despite the changes you apply. I suggest to follow this method (that means four reboot if you change at least one parameter on every panel to be sure that changes are saved permanently. For those who has problems with the previous wheezy version on the locale and keyboard settings, this issue has been solved. After setting the parameters in the fourth panel Localisation the settings are correct and the terminal warning of a wrong locale never appear.

 

Camera setup

After the linux installation, power off the Raspberry PI and connect the camera cable to the camera plug as shown in the following images. Pay attention to the side of the flat cable else the camera is not recognized by the system. If your Raspberry PI does not recognises the camera, the most probable issue depends on the incorrect cable orientation.

IMG_20151117_085538.jpg IMG_20151117_085546.jpg

The camera software installation is easy. The most complete and simple tutorial to follow is in the Element14 Pi Camera introductory guide.

After the installation and testing as shown in the tutorial, it is not needed you go ahead, we will step back to this device when all the parts are set correctly.

 

Two words before the touch panel installation...

I think that the 2.4 inches HAT component from 4D and Element14 is really a great device. For the project we aim to make it sounds simply perfect! It is true that this small screen, despite the small size and the resolution limits is able to show the Raspberry PI desktop acting as primary screen. The following video gives an idea of what you can see after the setup.

As a matter of fact, what we need is something more specific for this kind os screen.

 

Last tip before the touch panel installation

The last couple of things you should do before proceeding to the next step installing the touch panel is to be sure that the network is connected and check your Raspberry PI IP address. You can use the ifconfig command from the terminal and write down the assigned IP address: maybe on the eth0 or wlan0 interface, depending on how you have connected the Raspberry PI to your network.

 

It is also strongly recommended that you enable the Raspberry PI for remote access before starting the setting of the touch panel. In my case I have used the SSH connection from Mac but any other method to access the PI remotely is good. This will be very useful for any further setup and programming.

 

Installing the touch panel

At this point our system is ready for the last step, the touch panel setup and installation. It is not needed that you insert the device in the Raspberry PI GPIO pin array for first. You can do it at the end of the installation, as you prefer it's up to you.

 

There is a very good tutorial for the basic setup of this device accessible from the introductory document of the product page 2.4" HAT Primary Display for the Raspberry Pi  (the same pdf document can also be downloaded from the bottom of this post).

 

Follow the installation instructions until you are asked for the last reboot after inserting the touch panel in the Raspberry PI. After the reboot we see the desktop running on the touch panel.

 

Note: There is an easy-to solve issue in the installation manual: you are asked to set the sudo su before the installation commands; this means that all the further commands are sent as super user. The last command in the manual is preceded by sudo again: write the command without the sudo word because you are already in a super-user environment. That's all.

 

Using the Raspberry PI with the 2.4" HAT Touch Panel

IMG_20151117_135001.jpg

Nice eh? Yes but almost unusable. This is the reason that we do somethings to make it better...

 

Touch Panel post-install notes

The installation of the touch panel replace some components of the original Jessie Linux Kernel with custom ones. This means that some features you have set in the kernel maybe lost. In particular, the Raspberry PI Consiguration settings (the four panels explained above) should be reviewed and applied again (depends on the settings you have used before).

 

When also this operation has been completed and the last reboot has been executed we are ready to move to the next step.

 

Forget Kivy (for now

The Kivy installation has been already explained in the previous article of this series Essential Raspberry Pi Peripherals #3: The kivy framework for small display and touch screens Just to avoid difficulties due the limitations of the 2.4" Touch Pane, Not only but the Raspbian Jessie kivy installation has been updated, extremely simplified and optimised: it can be done in few stepsSo, why not? Unfortunately the 4D Touch Panel is connected to the GPIO and can't be managed by the fast video channel used by Kivy (that means no hardware acceleration). If you try installing this framework, running the provided examples everything seems working but the screen does not change. We should find a different way to solve the User Interface design for a more comfortable use of the screen.

 

The PyGame Framework for UI design

The reason we can use the PyGae Framework depends on the possibility to address the UI design in Python without the graphic acceleration.

Again, if we try to launch one of the games examples we find in the Python Games folder of the Raspbian installation we see nothing.

 

As a matter of fact we have missed to address the graphic interface to the display on /dev/fb1 framebutter. To have the Python graphic framework working properly we should add on top of every program the following two lines:

 

import os
os.environ["SDL_FBDEV"] = "/dev/fb1"


In the next post we will see in detail how to create a touch user interface to manage the Raspberry PI camera to shoot images.

Introduction

Available for the Raspberry PI at the actual date the market offers a number of touch screen displays; the recent launched Raspberry PI 7" LCD touch screen displayRaspberry PI 7" LCD touch screen display and the 2.4" HAT display2.4" HAT display are the top accessories in their range. These devices can be used as primary display including the touch screen they can replace the standard HDMI display, USB keyboard and mouse.

 

It is almost obvious that the 2.4 inches screens are less useful than larger screen (i.e. 15 inches or more): but represent a great solution for a large number of projects and applications.

A common UI design is difficult to manage and more difficult to interact with when the user should manage a 2.4 inches (or less) small screen or trying to use complex interactive interfaces also on a 7 inches screen.

 

Take a look to the following video.

If you like this kind of interface you are in the right place. Full colour graphics, multi-touch management, easy and visible interaction widgets also on small screen sizes, reasonably fast and responsive interfaces and more. The features shown in the video above are only some of what can be achieved with the Kivy python framework.


Note: the frame assembly of the Raspberry PI LCD Touch Screen display shown in the images of this post is available on the Drobott site. Don't forget to apply the Element14 discount code W0E49MYQ (10% off) reserved to the community users!

 

The framework

The adoption of this framework for the User Interface with the Raspberry PI is the better solution when the touch screen is the main tool to interact with the application. For the developers this framework is simple to manage, entirely developed in Python and very well documented with plenty of examples.

 

Wikipedia reports the definition of the Kivy framework as

Kivy is an open source Python library for developing mobile apps and other multitouch application software with a natural user interface (NUI). It can run on Android, iOS, Linux, OS X, and Windows. Distributed under the terms of the MIT license, Kivy is free and open source software.

but the term library is reductive; kivy is a set of libraries integrating features of many different environments. The recent porting available for the Raspberry PI Raspbian makes kivy one of the best solution for the UI design on touch screens and small displays.

 

The X desktop (the Raspbian desktop is an example) has never been though to be controlled by a touch-screen or an on-screen keyboard. In fact the kivy framework works perfectly just in these cases, so it's time to move on the Raspberry PI terminal and start the installation.

 

Installing Kivy on Raspberry PI

The main reference site is kivy.org On the site - not reported in the documentation index - there is a short page with a tutorial on Installing kivy on Raspberry PI. Unfortunately this is the only page I have found and is a bit outdated. The actual available version of the framework runs perfectly on all the Raspberry PI models including the PI 2, despite that the documentation report as untested.

 

Installation options

Two installation options are possible: the manual installation under Raspbian and the Kivy distribution image for the Raspberry PI.

I have tested both. The special PI distribution (derived by Raspbian) can be downloaded from the site KivyPie - Kivy on RaspberryPI but seems not well working so we will exclude this option and take in consideration just the manual installation.

 

Manual installation

The first thing to do is adding the repository http://vontaene.de/raspbian-updates/ to the list. From the terminal launch the editor

 

$>sudo nano /etc/apt/sources.list












 

and add the following line: deb http://vontaene.de/raspbian-updates/ . main

The resulting file will show like in the image below.

Screen Shot 2015-10-01 at 23.09.03.png

Save the file then launch the next commands:

 

$>sudo apt-get update
$>sudo apt-get upgrade












 

Before installing the framework you should install the dependencies of the packages:

 

sudo apt-get update
sudo apt-get install pkg-config libgl1-mesa-dev libgles2-mesa-dev \
  python-pygame python-setuptools libgstreamer1.0-dev git-core \
  gstreamer1.0-plugins-{bad,base,good,ugly} \
  gstreamer1.0-{omx,alsa} python-dev












 

Note: you will receive a warning for some uncertified packages. Ignore this message and confirm when required to proceed.

 

The next step needs to install pip from the sources. Pip, aka Pipi is the Python Package Index; It is a specific python packages repository working in a similar way of the apt-get (the aptitude Debian package manager). A full detailed list of the available packages in pip is available on the pipi-python site.

 

wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
sudo python get-pip.py








 

Installing and compiling the pip package manager on the Raspberry PI may require 10 minutes or more. Don't worry and wait ... During the installation you will get some error messages due the wheel command is not found; don't stop the process and ignore these messages. Wheel is a package image builder not intended for use in our case. The error message you get is shown in the image below.

Screen Shot 2015-10-01 at 14.21.33.png

Cythonhttp://cython.org/ is the c-extension for python and is used by some components of kivy. For a detailed description see the cython wiky.

At the end of the process described above cython should be installed in your system. We use the pip repository to acquire the last updated version, avoiding the eventually outdated version available in the Debian packages.

 

sudo pip install cython






 

At this point, we are are ready to clone kivy from GitHub and compile it locally

 

git clone https://github.com/kivy/kivy
cd kivy






 

Fine! We have completed the most boring part. The kivy sources now are in the user home directory, for example the user pi. It is also possible to install kivy only in the user folder but this way creates many issues when developing applications that will rung accessing other folders so we install the framework globally.

 

python setup.py build
sudo python setup.py install





 

The two commands above should be launched from inside the kivy directory in the user folders. You should already be there when the step ends. This operation requires 5-15 minutes or more, depending on the hardware model and processor speed of your Raspberry PI board.

A couple of other steps and our newly installed framework is ready for the first run.

 

Post-install settings

There are some features of the kivy framework requiring some external components to be installed afte the framework installation is complete.

 

sudo pip install pyglet docutils
sudo pip install pygments



 

The last operation is to edit the user kivy configuration file to set the raspberry PI touch screen replacing the mouse. Edit the kivy configuration file with the command

 

nano ~/.kivy/config.ini



 

and add the following lines in the [input] section (other similar lines should be replaced)

 

[input]
mouse = mouse
mtdev_%(name)s = probesysfs,provider=mtdev
hid_%(name)s = probesysfs,provider=hidinput



 

Save the file and reboot the system. Now you are ready to launch your application or run the examples in the folders you find in ~/kivy/examples

Introduction

IMG_20151001_133535_1.jpg

There is a considerable number of places on the Internet, including the Element14 site, showing useful information on the installation and settings of this brand new device; in the meantime a number of doubts and questions has raised about the touch screen settings, the on-screen keyboard installation and more. The goal of these notes is to depict a setup scenario as much complete as possible. The Raspberry PI 7" LCD Touch Screen displayRaspberry PI 7" LCD Touch Screen display is the perfect replacement of a dedicated screen, with the plus of the optional on-screen keyboard.

 

To use this device in a Raspberry PIRaspberry PI project requiring User Interaction it sounds almost difficult in applications like robotics, machines control, informative point, web access, sensors gauges etc.

A reliable solution exists and its name is Kivy: open source, not too difficult to install and is based on Python.

 

Note: the frame assembly of the Raspberry PI LCD Touch Screen display shown in the images of this post is available on the Drobott site. Don't forget to apply the Element14 discount code W0E49MYQ (10% off) reserved to the community users!

 

What raspbian release?

IMG_20150930_153150.jpg

The first thing to do it to decide what raspbian image should be installed on the PI. If you have already a Raspberry PI with an existing raspbian version on it, you should install the hardware then power on the system and proceed with the software.

 

If you should start from scratch instead, I suggest to download the last raspbian updated image (2015-05-05-raspbian-wheezy.img at the date) from the raspberry.org site to create a bootable microSD card; you  can choose between two different flavours: raspbian based on Debian wheezy or Debian jessie; this choice is up to you. At the actual date it seems that the Raspberry PI porting of the Jessie distribution has again some issues.

 

In both cases, the next step is an update/upgrade of the system.

 

$sudo apt-get update
$sudo apt-get upgrade











 

You should have noted that the system, also on first-boot will recognise the new display device without any special setting or display drivers to be installed.

 

Showing full HD videos on the screen

If you plan to use the screen to show full HD videos (1080x1920 pix) the better performances can be obtained reserving 128 Mb of shared memory to the video card. The amount of shared memory (64 Mb by default) can be changed with the raspi-config command and selecting the menu options shown below.

Screen Shot 2015-08-29 at 16.34.05.png

Select Advanced Options from the main menu.

Screen Shot 2015-08-29 at 16.34.19.png

Select Memory Split from the next screen.

Screen Shot 2015-08-29 at 16.34.32.png

Then, write 128 instead of 64 (the default settings). Confirm and exit, reboot.

 

On-Screen keyboard

Installing the on-screen keyboard is not the solution to develop software or write long text documents on the Raspberry PI, but it is a must-to-have to make complete the user interaction options. Installing the keyboard is a very simple operation that can be done with a single command from the terminal:

 

sudo apt-get install matchbox-keyboard








 

just as it is explained in the product document page on Element14. The documentation says that the keyboard (after installation and reboot) is accessible on-screen from the Menu->Accessories->Keyboard. Doing several installations I have verified that the keyboard is not always listed as a new menu option; one of the reasons depends on the previous presence of a physical keyboard connected to the Raspberry or not. To be sure that the on-screen keyboard is added to the desktop menu after installation the better choice is to manage the Raspberry PI from remote via SSH.

 

The on-screen keyboard can be shown by your applications or bash scripts with the command

 

matchbox-keyboard







 

Enabling the touch-screen

Depending on the current status of the linux settings, maybe you don't see the mouse pointer on the screen and the touch screen is unresponsive; the touch screen uses SPI to communicate with the Raspberry PI so it should be enabled, while by default the SPI kernel modules are not loaded.

 

From the terminal launch the command

 

sudo raspi-config






 

then from the character graphic menu follow the steps shown below.

Raspi-config-advanced-settings.png

Select Advanced Options from the main menu.

Raspi-config-enable-spi.png

Select the SPI menu option.

Enable-SPI.png

Confirm to enable the SPI module and the next screen to load the SPI kernel modules on boot by default. Then, exit and reboot the system.

 

Congratulations!

Now your system is ready to use the full features of the 7 inches LCD display and touch screen.

Introduction

This post and few other will appear as annex to the Essential Raspberry Pi Peripherals #2. The reason is that when it was planned this series of tutorials the 7" touch-LCD created for the PI was not yet on the market. When the first unit has been received, I started immediately to study the hardware and software; in these #2 annexes we explore some mods and installation that can be helpful for the users to get the best from this incredible accessory inside their projects.

 

Taking advices and suggestions here and there and seeing some issues that may occur with the 7" touch screen display for the Raspberry PI I have done a prototype of a frame to secure the display when mounted with the control board and the Raspberry PI. My actual usage is for an Info-Point based on the Raspberry PI 2 Mod B.

 

Note that this blog post will show the prototype building of a full working frame for the display while the "commercial" version will be done with white plastic laser-cut based on the same design. The second part will show the building of the back side enclosure to cover the electronic parts. Until now I have not yet found a protective frame of the display also for the front side including the back parts.


Where to find it

You can find the product at Drobott.com Don't forget to apply the Element14 discount code W0E49MYQ (10% off) reserved to the community users!


How the product appears

IMG_20150930_153223.jpg IMG_20150930_153150.jpg IMG_20150930_151106.jpg

The full description by images can be found on the following Google Album.

 

Creating the frames

Measuring the display on both sides I have created three different frames: one front-frame and two back frames.

 

Front frame

IMG_20150924_192652.jpg

Front view of the front-frame; the two extra-area corresponding to the top and bottom sides are used to keep the front and back frames together. This model is so shaped because these are also the supports that keep the display inside the info-pointsupport. A further version with a full thick border will be producer with the same characteristics.

 

IMG_20150924_192620.jpg IMG_20150924_192635.jpg

Back of the front-frame. The two elements that are part of the structure will also help to keep correctly positioned the touch surface over the LCD surface.

 

Back frames

There are two frames on the back side of the screen. The first is locked with four allen screws with the front-frame while the second frame protect the remaining part and offers the base for the back cover of the electronic parts (cables, dipslay control board and Raspberry PI). The opacity in the frames of the images below depends on the prototype manual refining. In this prototype I have used a 2.5 mm thick acrylic but the right final material should be opaque, white 3 mm thick.

 

IMG_20150924_192607.jpg

First back-frame, the nearest to the screen surface.

 

IMG_20150924_194723.jpg

Second back-frame.

 

Assembling

After the pieces are done, the assembly phase is very easy:

 

IMG_20150924_192719.jpg

1) Put the front-frame on a flat surface and the screen device on it (the Raspberry PI should not yet be fixed with screws on the display controller board) remember to remove the protective label from the front side of the screen.

IMG_20150924_193543.jpg

2) Place the first back-frame on the screen and insert the four allen screws. Then close firmly the four nuts.

IMG_20150924_201353.jpg

3) place the second back-frame and fix it to the aluminium display four holes with screws. Last, fix with the four screws the Raspberry PI over the display control board.

In the image above the top frame is locked with two black pieces of plastic, that can be replaced with a 3D printed cover to protect all the electronic parts.

 

Ready to use

The following image shows the finished frame.

IMG_20150924_205738.jpg

The first peripheral we'll take a look at is the HDMI monitor, connected to the Raspberry Pi. As connecting an HDMI monitor to the board is extremely simple it's surprisingly difficult to find information on the Internet about how to solve issues and setup the monitor visualisation that best reflects our needs, so this is actually a great starting place for us.

 

What Your Need for HDMI on Raspberry Pi

As the Raspberry Pi includes a standard, full-size HDMI connector (as opposed to the smaller, micro-HDMI connectors that are starting to appear on similar devices) the only thing you need is a cable like the one shown below.

HDMI_TypeA_to_TypeC_cable_6ft.jpg

Ok, so there's nothing easier than connecting the monitor to the Raspberry PI, yes? Well, almost.

 

Standard Screen Configuration on Raspberry Pi

There's no standard, default configuration that relates to a Raspberry Pi's screen, and this can confuse new users. As a matter of fact, there are two important factors that influence the screen characteristics.

 

The first is the display memory. In the Raspberry Pi (all models) the video memory is a part of the system memory (the RAM) that's shared to manage the graphical display. This means that any memory space we reserve for the display means the less system RAM we have (and vice-versa). This is a parameter to take in account when obtaining the best results we need from the user interface; keeping sufficient memory to run the system and the applications.

 

Note: As almost all the same things run well on the Raspberry Pi 2 and the previous models with only the half of the memory available (the Pi 2 has 1GB of RAM against the 512MB of the other models) on the Pi 2 we are free to be more tolerant when reserving video memory.

 

My suggestion for a better optimisation is to start reserving an initial amount of 64MB for the GPU memory (the Graphic Processing Unit) and eventually increasing this value if we need higher resolution images. The tests done in several working conditions show better graphic results without compromising the processor speed and capabilities suggests that it's possible to share up to 128MB of RAM for the GPU on a Raspberry PI 2 (1/4 of the entire RAM in the previous models!).

 

The easiest way to configure the GPU memory is through th raspi-config utility. The images below shows the menu sequence to set the desired GPU memory in the system.

 

Note: It is possible to set any amount of memory but it is the worth testing the suggestions of the script screen, selecting multiples of 16MB of RAM for the better management of the GPU.

 

From a terminal, launch the command:

sudo raspi-config




































 

From the main menu select Advanced Options.

Screen Shot 2015-08-29 at 16.34.05.png

Then select Memory Split.

Screen Shot 2015-08-29 at 16.34.19.png

Finally, select the desired amount of memory and confirm with the <Ok> button.

Screen Shot 2015-08-29 at 16.34.32.png

 

HDMI Audio on Raspberry Pi

The Raspberry Pi includes a good quality stereo audio Jack (output only). Due to several potential issues, most depending on the other peripherals connected to the board, it's not unusual that the audio quality decreases at times, producing a worse sound than expected.


However, from the Advanced Options menu it's possible to configure the audio output, forcing the sound sent to via the HDMI output instead of the 3.5mm Jack.

Screen Shot 2015-08-29 at 16.52.54.png

Also in the case where the display is not needed (which occurs in lot of portable projects) or, for example, we are using the PiFace CADPiFace CAD or the 2.4" Raspberry Pi Touch Panel2.4" Raspberry Pi Touch Panel, we can still take advantage of the quality of the HDMI audio using a specific HDMI audio cable, as shown in the example below.

Best-Selling-1-5m-1080P-HDMI-Male-to-3-RCA-Audio-Video-Component-Cable-Adapter-For.jpg

 

Fine-tuning the Screen Resolution

We have at least two reasons to fine-tune the screen resolution in the Raspberry Pi settings; the first is that there are HDMI screens with different aspect-ratios, and the second is that we need to change the screen resolution depending on the kind of use, the display size etc.

 

Those who are used to working with the PC know that these parameters are set up and/or detected when the system starts, and in most cases part of the settings are done by changing some BIOS parameters. Other settings - inside a predefined range - can be changed further with proper screen configuration programs like those in Ubuntu desktop and Windows.

 

As the Raspberry Pi does not have a conventional BIOS, most of the configuration parameters, including the screen settings, are loaded by the GPU before the kernel starts from a simple text file named config.txt stored in the system folder /boot

 

Note: the raspi-config utility script we have used above to set the audio channel or the GPU's dedicated RAM make automatic changes to this configuration file, but we can also edit the file directly.

 

The /boot/config.txt file doesn't just contain the graphic display and screen settings, but a lot of other useful information to tailor the behaviour of our system when it starts; in particular for the screen, we can set the resolution, size, aspect ratio, and scan frequency.

 

Take a look at the following group of settings from the config.txt file (some settings are generated automatically by the NOOBS while installing the operating system):

 

# NOOBS Auto-generated Settings:
hdmi_force_hotplug=1
config_hdmi_boost=4
overscan_left=24
overscan_right=24
overscan_top=16
overscan_bottom=16
disable_overscan=0
start_x=0
gpu_mem=128
core_freq=250
sdram_freq=400
over_voltage=0
dtparam=spi=on
dtparam=i2c0=on
dtparam=i2c_arm=on





 

The format of the file is really simple to read and with a minimum of experience, and also to change without damaging the Raspberry Pi's performance. The character '#' is used for a comment line while every parameter is set in the format; <parameter>=<value>

 

Yes, just as in the unbelievable Windows .ini files and some other settings in the Linux environment. So, the only thing we should know is what is the exact meaning of these parameters to set the values in a consistent way. Some parameters are numeric (with a range of accepted values) and some parameters are boolean (can assume only the value yes or no).

 

Before Changing the config.txt Settings

First of all, temporarily disable the automatic graphic desktop when the system starts with the raspi-config configuration script as shown in the following images:

Screen Shot 2015-08-29 at 19.41.52.png

Screen Shot 2015-08-29 at 19.42.17.png

After setting the text console at start up, the system needs to reboot.

 

This operation is for preserving the automatic desktop start up if we see that any settings have gone wrong and the display is unreadable. In this configuration after the system boots we only see the Login prompt; after logging in to launch the graphic desktop we should launch the command startx

 

After every change to the display settings, we reboot and if, after launching the startx command the desktop is unreadable, we can simply roll back the settings to the last correct value.

 

Display Setup Parameters

To correctly manage the display settings we should know the exact aspect ratio and scan frequency of the monitor we will use. The following settings shows an example of the standard PAL settings for Europe on a 1024x768 resolution monitor.

 

# Set sdtv mode to PAL (as used in Europe)
sdtv_mode=2
# Force the monitor to HDMI mode so that sound will be sent over HDMI cable
hdmi_drive=2
# Set monitor mode to DMT
hdmi_group=2
# Set monitor resolution to 1024x768 XGA 60 Hz (HDMI_DMT_XGA_60)
hdmi_mode=16
# Make display smaller to stop text spilling off the screen
overscan_left=20
overscan_right=12
overscan_top=10
overscan_bottom=10












 

A full, comprehensive and detailed look at all the parameters we can set for the best screen performance is described in the attached document RpiConfig, from elinux.org

 

An Overview on the Next Posts

What you will see soon in this series:

 

#3 Kivy: an open source solution for the User Interaction

How to install and use Kivy, a powerful python framework on the Raspberry PI for the best User Interaction on small touch screen devices..

 

#4 An introductory approach to wired and wireless networking

There are more options than simply plugging the LAN cable in the Ethernet port of the Raspberry PI. In this post we'll see how the Raspberry Pi can be a flexible networking device, acting as bridge, access point, wireless device and more.

 

#5 The Raspberry Pi camera beyond the webcam limits

Thanks to the power of Python and the specific characteristics of the Pi Camera it's possible to specialise the Raspberry Pi as a video/photo station: shooting, filming, image processing for a lot of possible applications; from photography to security, from stop-motion to the time-lapse filming.

 

#6 Lirc and IR controller: extending the limits of keyboard and mouse

With a very simple hardware approach we introduce the first non-conventional peripheral connection. Thanks to the Linux lirc library we can use a simplified HID (Human Interface Device) - a TV infrared control - to manage programs, device behaviour, and more.

 

#7 Enhancing our Pi projects with the Pi touchscreen

We will see how we can setup and integrate in our projects the Raspberry Pi 2.4" touch screen device.

 

#8 Enhancing our Pi projects with the PiFaceCAD LCD display

When a simple message is sufficient to control the Raspberry Pi behaviour but some control buttons would be useful, the PiFaceCAD (Control and Display) is the ideal device, which can be stacked on our Raspberry Pi for mobile, battery-powered applications.

 

#8 A multi-sensor system with the Raspberry PI Sense HAT

Coming soon ...

With this first post we start off on something of an adventure, experimenting and experiencing one of the most fascinating aspects of this SBC (Single Board Computer): connecting the device with the real world.

(note: here we consider working with a Raspberry PI 2 but almost all the mentioned features and possibilities will apply to the previous models).

 

Connecting the Raspberry PI to Something Else

One of the most interesting features of the Raspberry Pi is that it includes most of the features we need to interact with the real world. Firstly we have the GPIO, which is the array of pins giving the option to interact with the world through many sensors, communication protocols, motors, LEDs and so on.

 

But that's not all. There is more, and the possibilities go beyond what we can imagine.

 

Just as a reminder, take a look to the following image:

PI2.jpg

Seems incredible, the connector we find in this credit-card sized device:

 

  • 40 Pin GPIO (General I/O ports): can be used for powering low consumption devices, connect I2C protocol external components, Input/Output digital signals, SPI (CLK, MISO, MOSI) protocol, TTL Serial TX/RX pins.
  • 4 USB2 ports: that means, on a Linux-based system, the possibility to connect a very wide range of USB devices.
  • 1 HDMI video and audio output: the HDMI video and audio output supporting full 1080P HD format gives the possibility to manage any display ratio (software configurable) with high quality audio. This feature makes the Raspberry PI a good base machine to make a good quality media center, game device and more.
  • 1 combined 4-pole 3.5 mm Jack connector for stereo output and composite video output: ideal when an HDMI monitor is not available.
  • 1 10/100 Ethernet RJ45 connector: for LAN connection as an alternative to the wireless WiFi when using a USB WiFi dongle
  • 1 camera connector: this connector is ready to work for the Raspberry PI camera that opens the door to an entire world of possibilities, from image shooting up to video capture, streaming, image processing and more.
  • 1 display connector: for small projects the use of a full sized external monitor may not be necessary, so a small screen (better if it's a touchscreeb) directly connected to the Raspberry Pi can be a better solution.

 

When the device is in your hands you have got the keys that open the door to an incredible new world.

 

All that glitters is not gold

In fact, this board can't do all that much on its own, solve ANY problems, or replace all your computers. But it can do a lot for sure. Looking in-depth at the Raspberry Pi connectors and functions it seems that some "advanced" features are missing. For example, it'd be better if the Ethernet was 1Gb instead 10/100 only, better if the boot was from something different than an SD card, better if there was also an audio input, great if the GPIO also included some manner of analog input, and so forth.

 

It's true, but the Pi does have the great advantage of stability: many of the apparently missing features are compensated by its extreme versatility and - why not? - our ability to create great projects, including those parts expected but not present. In my personal opinion this SBC remains one of the most complete, versatile and well equipped low-cost devices supporting Linux.

 

An overview on the next posts

To close this introductory first post on the Raspberry Pi peripherals the following is a list of what you can expect in the forthcoming series.

 

#2 Setting up the HDMI monitor

Despite the HDMI connector, not all the monitors support the same resolution. And the Raspberry Pi shares its video memory with the rest of the available RAM, so it's useful if you can totally control the display parameters (frequency, resolution, aspect ratio, video memory) simply by changing the operating system display configuration file.

 

#3 An introductory approach to wired and wireless networking

There are more options than simply plugging the LAN cable in the Ethernet port of the Raspberry PI. In this post we'll see how the Raspberry Pi can be a flexible networking device, acting as bridge, access point, wireless device and more.

 

#4 The Raspberry Pi camera beyond the webcam limits

Thanks to the power of Python and the specific characteristics of the Pi Camera it's possible to specialise the Raspberry Pi as a video/photo station: shooting, filming, image processing for a lot of possible applications; from photography to security, from stop-motion to the time-lapse filming.

 

#5 Lirc and IR controller: extending the limits of keyboard and mouse

With a very simple hardware approach we introduce the first non-conventional peripheral connection. Thanks to the Linux lirc library we can use a simplified HID (Human Interface Device) - a TV infrared control - to manage programs, device behaviour, and more.

 

#6 Enhancing our Pi projects with the Pi touchscreen

We will see how we can setup and integrate in our projects the Raspberry Pi 2.4" touch screen device.

 

#7 Enhancing our Pi projects with the PiFaceCAD LCD display

When a simple message is sufficient to control the Raspberry Pi behaviour but some control buttons would be useful, the PiFaceCAD (Control and Display) is the ideal device, which can be stacked on our Raspberry Pi for mobile, battery-powered applications.

 

Bookmark this page and the Ultimate Guide to Getting Started with a Raspberry Pi page to stay tuned to this essential guide to Raspberry Pi peripherals, folks!