Raspberry Pi Assembly Workshop
My workshop notes for a group of kids who assembled their Raspberry Pi with me and got it to a useful state. We start with Raspbian Lite, do some basic configuration on the command line, and then add the graphical user interface on-top.
There are three parts to this workshop: i) assembly of the hardware and configuring the operating system, ii) networking and web development, iii) to be defined.
Hardware
Find all your bits:
- Raspberry Pi board
- plastic case for the circuit board
- micro USB power supply
- heat sinks
- HDMI cable
- microSD card
- keyboard
- mouse
- screen
- network cable
Look at the circuit board and check what chip does what: find the CPU/GPU/RAM and the USB/Networking chips (answers).
Put the heat sinks on the CPU/GPU/RAM and USB/Networking chips (hint).
Put the microSD card into the Raspberry Pi board. Careful, it’s fragile. Check to see if you can figure out what is up and down first.
Put the Raspberry Pi into it’s box.
Connect the keyboard.
Connect the mouse.
Connect the network cable.
Connect the HDMI to the screen.
Connect the micro USB power cable.
Software
Starting point: a fully assembled Raspberry Pi with Raspbian Stretch Lite imaged to the SD Card.
Start your Raspberry Pi and login to the shell. Use the default username and password:
Username: pi
Password: raspberry
First, we need to adjust the keyboard – have the instructor help you.
sudo dpkg-reconfigure keyboard-configuration
You should choose the keyboard layout that matches your keyboard so that what you press on the keyboard is what shows up on the screen.
Clear up the screen:
clear
That’s better – now we have a clear screen. Let’s see where we are…
ls
to see a list of files. ls
stands for “list”…
But it’s empty! Is there truly nothing on this computer?
ls -a
to see a list of files. Its “list” again, but with a flag: “a” for “all”.
Is that all there is? Certainly not!
Try ls -R /
to see a list of all files.
Wow!
Press CTRL-C to make it stop.
Let’s create a file and write something into it.
vi somefile
i
to begin insert mode
Esc
to end insert mode
ZZ
to save and quit
Use ls
to list the file you just wrote.
Use more
to view the file:
more somefile
How big is you file?
du somefile
Huh – 4 somethings… but what somethings? Let’s see if we can try that again to make sense of it.
du -h somefile
The “h” as in “human readable”.
Let’s clean up and remove the file. Use rm
(as in, “remove”):
rm somefile
So that worked! Let’s try something dangerous – let’s try to break something important!
rm /etc/passwd
Doesn’t work, does it?
On most operating systems there different types of users – normal users and special ones. Not everyone gets to do everything.
Let’s change the name of the Raspberry Pi.
vi /etc/hostname
See how it says “raspberry” there? Change it… Use x
to delete letters. Use i
to start writing you own name. Use Esc
to quit writing mode. Try using ZZ
to save and quit.
Notice how the computer won’t let you?
Try harder.
Use :w!
This says “write the file, even if I’m not allowed, I command you”.
But it still fails!
Use :q!
to force it to quit (“I command you to quite no matter what!”).
Let’s try that again:
sudo vi /etc/hostname
Use x
to delete letters. Use i
to start writing your own name. Use Esc
to quit writing mode. Try using ZZ
to save and quit.
It worked!
What is this sudo
thing? It stands for “Super User: Do!” It means you’re doing things as the most powerful user on the system.
But the name has not changed! How come?
Let’s restart the Raspberry Pi – but how do we shut it down?
DON’T JUST PULL THE POWER!
Use: sudo halt
Now unplug the power of the Raspberry Pi, count to five, and plug it back in.
Notice how the prompt says: (the_thing_you_typed) login:
Login using the username and password.
(pi/raspberry)
Now, let’s update the system:
sudo apt-get update
Then:
sudo apt-get dist-upgrade
Answer “Y” to the question whether you want to update/upgrade.
Now, let’s have all that take effect by rebooting:
sudo reboot
Log back in.
This is all fine and well – but can we play games? Of course!
sudo apt-get install nsnake ninvaders bastet pacman4console
Try some of the games – type nsnake
or ninvaders
or bastet
or pacman4console
This is the command line way of using an Operating System. The only way you can tell the computer what you want it to do is with a keyboard.
Now, let’s try to get a graphical user interface going:
sudo apt-get install --no-install-recommends xserver-xorg
sudo apt-get install --no-install-recommends xinit
sudo apt-get install raspberrypi-ui-mods
Now reboot to start in graphical mode:
sudo reboot
Log back in on the graphical user interface.
We are now welcomed by a graphical user interface asking for a username and password.
(pi/raspberry)
But, can we play games?
Now let’s add some fun packages. Open a terminal window and:
sudo apt-get install scratch2 minecraft-pi alex4
Now go take a look at the menu and find these new games there.
Check if Minecraft works.
Notes
When using Mincraft, if the screen is off-set, use raspi-conf
in a terminal window to disable “overscan”:
“7 Advanced Options”, then “A2 Overscan” – “Disable” – “OK”
Parts List
- Raspberry Pi 3 Model B 1 GB
- Modular case for Raspberry Pi B+/2/3
- Micro USB 5V 2.5A power supply for Raspberry Pi
- Set of 2 Heat Sinks in black aluminium
- 1 meter HDMI cable
- SanDisk 16GB microSDHC Class 10
- USB Keyboard and Mouse
- HDMI screen