0 ratings0% found this document useful (0 votes) 6 views11 pagesRaspberry Pi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
yeepe
cena
4.2.1 Raspberry-Pi Architecture
‘What is a Raspberry Pi? Raspberry pi is the name of the “credit card-sized computer boar
developed by the Raspberry pi foundation, based in the U.K. It gets plugged in a TV or monitor and
provides a fully functional computer capability. It is aimed at imparting knowledge about computing
to even younger students at the cheapest possible price. Although it is aimed at teaching computing
to kids, but can be used by everyone willing to lear programming, thebasics of computing, and
building different projects by utilizing its versatility.
Raspberry Pi is developed by Raspberry Pi Foundation in the United Kingdom. The Raspberry Piis a
series of powerful, small single board computer
Raspberry Pi is launched in 2012 and there have been several iterations and variations released
since then. Various versions of Raspberry Pi have been out till date. All versions consist of a Broadcom
system on a chip (SoC) with an integrated ARM-compatible CPU and on-chip graphics processing
unit (GPU).
The original device had a single-core Processor speed of device ranges from 700 MHZ to 1.2 GHz and
a memory range from 256 MB to 1 GB RAM.To store the operating system and program memory
Secure Digital (SD) cards are used. Raspbian OS which is a Linux operating system is recommended
OS by Raspberry Pi Foundation. Some other third party operating systems like RISC OS Pi. Diet Pi,
Kali, Linux can also be run on Raspberry Pi.
Used:
It also provides a set of general purpose input/output pins allowing you to control electronic
components for physical computing and explore the Internet of Things (IOT),
Raspberry pi Model
There have been many generations of raspberry Pi from Pi | to Pi 4. There is generally a modelA
and model B. Model A is a less expensive variant and it trends to have reduced RAM and dualcores
such as USB and Ethernet.
List of Raspberry pi models and releases year:
pi | model B- 2012
pi | model A — 2013
pi | model B+ -2014
pi 1 model A+ ~ 2014
Pi 2 Model B— 2015
Pi 3 Model B- 2016
Pi 3 Model B+ -2018,
Pi 3 Model At -2019
Pi4 Model A ~ 2019
peerrcer or]Raspberry pi Diagram:
Camera
module i
Wp GPIO Camera
Dual
use.
stor
a2; Ram | [ROM | | Mokoprwceseor
slot >>
Hello world
>>>
opensource.co
3. Ruby/Sonic Pi
Ruby is another powerful language that’s friendly for beginners. Sonic Pi, the live coding
musicsynth, is built on top of Ruby, so what users actually type is a form of Ruby.
1. Open Sonie Pi from the main menu.
2. Enter the following code:
puts "Hello world
3. Press Run.
1aBe
ae
E> Starting run 1]
{run: 1, time: 0.0
L “Hello world
SET
STE
> Pausing Supercollider
Unfortunately, "hello world” does not do Sonic Pi justice in the slightest
Alternatively, to using the Sonic Pi application for this example, you can write Ruby code
in atext editor and run it in the terminal:
Open Text Editor from the main menu
Enter the following code:
puts "Hello world
Save the file as hello.rb in the home directory
Open Terminal from the main menu.
Run the following command:
ruby hello.r
it Tabs Help
4. JavaScript
This is a bit of a cheat as I just make use of client-side JavaScript within the web browser
usingthe Web Inspector console, but it still counts!
Open Chromium Web Browser from the main menu
Right-click the empty web page and select Inspect from the context menu
Click the Console tab.
Enter the following code:
iaconsole.log("Hello world" )
5. Press Enter to run
[R 1] | Elements Console Sources Network Performance » 1; x
8 | ¥ Defaultievels ¥
© Failed to load resource: net::ERR_FAILED
console. log("Hello world")
Hello world miza:)
You can also install NodeJS on the Raspberry Pi, and write server
not available in the standard Raspbian image.
ide JavaScript, but that’s
5. Bash
Bash (Bourne Again Shell) is the default Unix shell command language in most Linux
distributions, including Raspbian, You can enter Bash commands directly into a terminal
indow, or script them into a file and execute the file like a programming script.
1. Open Text Editor from the main menu
2. Enter the following code:
echo "Hello world
3. Save the file as hello.sh in the home directory
|. Open Terminal from the main menu.
5. Run the following command:
ash
Note you'd usually see a "hashbang" at the top of the script (#1/bin/bash), but because I'm calling
this script directly using the bash command, it's not necessary (and I'm trying to keep all these
examples as short as possible),
You'd also usually make the file executable with chmod +x, but again, this is not necessary as
I'm executing with bash.6. Java
Java is a popular language in industry, and is commonly taught to undergraduates studying
computer science. I learned it at university and have tried to avoid touching it since then.
Apparently, now I do (very small amounts of) it for fun.
1. Open Text Editor from the main menu.
2. Enter the following code:
3. public class
Hello {
4. public statie void main(String{}
args) {
5. System.out.printin("Hello world");
6}
a
8
9. Save the file as Hello,java in the home directory
10. Open Terminal from the main menu.
11. Run the following commands:
12. javac Hello.java
java Hello
I could almost remember the "hello world" for Java off the top of my head, but not quite.Talways forget where the String[] args bit goes, but it's obvious when you think about it.
7.€
C is a fundamental low-level programming language. It's what many programming languages
arewritten in, I's what operating systems are written in, See for yourself&mdash:take a look at
the source for Python and the Linux kernel, If that looks a bit hazy, get started with "hello
world”
Open Text Editor from the main menu
Enter the following code:
inelude
int main() {
printf("Hello world\n");
}
Save the file as hello.¢ in the home directory
Open Terminal from the main menu
Run the following commands:
9 gcc-ohello
hello.
-Jhelo
Note that in the previous examples, only one command was required to run the code
(eg., python3 hello.py or ruby hello.rb) because these languages are interpreted rather than
compiled. (Actually Python is compiled at runtime but that’s a minor detail.) C code is compiled
into byte code and the byte code is executed.
If you're interested in learning C, the Raspberry Pi Foundation publishes a book Learning to
codewith C written by one of its engineers. You can buy it in print or download for free.
8.CHE
C's younger bother, C++ (that’s C incremented by one...) is another fundamental low-level
language, with more advanced language features included, such as classes. It's popular in arangeof uses, includi
inC+
+ too.
me development, and chunks of your operating system will be written
Open Text Editor from the main menu.Enter the following code:
#include using namespace std;int main( {
cout << "Hello world)
Save the file as hello.epp in the home directory.Open ‘Terminal from the main menu.
Run the following commands:
1 g++-ohellopp
hello.cpp
Jhellocg
Readers familiar with C/C++ will notice I have not included the main fun:
ion return values inmy
examples. This is intentional as to remove boilerplate, which is not strictly necessary.