Raspberry Pi_Eng_03.2 Body Case

3.2 Body Case

The size of Raspberry Pi body is very small. The main board is provided with four holes for fixing the main board, so that it can be fixed to another machine or equipment. However, since there is no part to protect the board itself, it can be damaged from external contact or impact. Therefore, we need a case that physically protects the board and protects the board from dust and pollutants from the outside.

Raspberry Pi_Eng_03.10 External Interface

.10 External Interface

Raspberry Pi can communicate with and control devices outside the system through a bidirectional interface with external devices. It can receive input or output through an external device, or adjust an external device. A key device for this is the GPIO (General Purpose Input Output) port. Here, I will briefly mention the preparations required to use this GPIO. For details, refer to [Chapter 25 External Interface]:

Raspberry Pi_Eng_03.1 Selection of Raspberry Pi Model

3.1 Selection of Raspberry Pi Model

When purchasing Raspberry Pi, you should clarify the purpose of use. If you want to use it only for a limited purpose, you can use a lower model that has a relatively low processing power. However, if you want to use it as a general purpose just like general PC, you will have to use the latest upper model that have various advanced features and high level processing.

Raspberry Pi_Eng_03.0 Chapter 3 Buying & Installing Device/Part

Chapter 3 Buying & Installing Device/Part

Chapter’s Main Topics

Here this chapter will find out what devices are needed to operate Raspberry Pi and how to connect them to Raspberry Pi.

It includes descriptions on the following topics:
■ Selection of Raspberry Pi model

■ Body case and heat sink

■ Storage device

■ Power supply device

■ Network device

■ Input device

■ Video output

■ Camera

■ External interface device

Raspberry Pi_Eng_20.3.5 Automatic Run regardless of Run Level at Booting

20.3.5 Automatic Run regardless of Run Level at Booting

If you want the command or script to always run regardless of run level, you register it in the “/etc/rc.local” file. The script registered here is executed only in run level “2” ~ “5” which is a normal operation status of the system.

Here is an example for the contents of the file “/etc/rc.local”.

Raspberry Pi_Eng_20.3.4 Automatic Execution by Run Level at Booting

20.3.4 Automatic Execution by Run Level at Booting

20.3.4.1 Principles of Registering Init Script

After you have created an init script and saved it in “/etc/init.d”, you need to register it on the system so that it runs automatically according to the run level. If we systematically look into registering on the system, you can see that it is creating a link to the original script file. In other words, running the link will run the original script file.

Raspberry Pi_Eng_20.3.3 Creating Init Script

20.3.3 Creating Init Script

20.3.3.1 Meaning of Init Script

The script that is used when the system boots or shuts down is called “init script”. All init scripts basically should be put under “/etc/init.d/” directory.

There are several types of init scripts as follows according to their usage:

Raspberry Pi_Eng_20.3.2 Booting Sequence

20.3.2 Booting Sequence

When the system first starts up, it executes certain defined tasks in a certain order. This sequence is called “booting sequence”. Next, we will explain the basic framework of booting sequence and how to use it to automatically execute the necessary tasks in booting.

20.3.2.1 Booting Framework

Raspberry Pi_Eng_20.3.1 Run Level

20.3 Automatic Run with Init Script

20.3.1 Run Level

20.3.1.1 Definition of Run Level

On Linux, you need to process all pre-specified tasks when the system first starts or shuts down, or sometimes need to prevent others from using it when performing system recovery tasks. A tool called “run level” is used to limit who can use the system in a certain step or to identify the types of commands or programs that can run in a particular environment.

Raspberry Pi_Eng_20.2.6 Running Script

20.2.6 Running Script

20.2.6.1 Preparing to Run Script File

A script is not a binary executable like a normal executable program, but it must be executable as a program itself. Therefore, the execute permission must be granted to the script file. You can use “chmod” command to grant the desired permission. For the permissions of a file, see the description of [13.2 Changing Permission on File].