What is the Raspberry Pi
The Raspberry Pi is a small, affordable, and amazingly capable, credit card size computer.
It is developed by the Raspberry Pi Foundation, and it might be the most versatile tech ever created.
Creator Eben Upton’s goal was to create a low-cost device that would improve programming skills and hardware understanding.
Due to the small size and price of the device, it has become the center of a wide range of projects by tinkerers, makers, and electronics enthusiasts.
Need raspberry code
- Raspberry Pi computer
- MicroSD memory card (We recommend a class 10 with 16 GB or higher)
- MicroSD to SD memory card adapter (usually included with the MicroSD card)
- Micro USB power supply to power the Raspberry Pi (2.5A or greater recommended)
- WiFi/Ethernet Cable connection for the Raspberry Pi (Not needed for Raspberry Pi 3 as it has built in WiFi)
- A working computer with internet and SD memory card reader (used to get the OS (Operating System) for the Raspberry Pi onto the memory card). In our tutorial we use a Windows computer for this, but you can use a Mac or Linux computer if you prefer
- HDMI monitor, USB keyboard (we need these only temporarily for the first boot of the Raspberry Pi)
For later chapters in this tutorial we will use special sensors or devices that we connect to the Raspberry Pi. We will specify these as special requirements in the relevant chapters.
Set up Your Raspberry Pi
To get the Raspberry Pi ready to boot we need to:
- Insert the MicroSD memory card into the Raspberry Pi
- Connect the USB keyboard
- Connect the HDMI cable
- Connect the USB Wi-Fi adapter (or Ethernet cable). Skip this step if you are using a Raspberry Pi 3
- Connect the micro USB power supply
- The Raspberry Pi should now be booting up
When the Raspberry Pi is finished booting up, log in using username:
pi and password:
Set Up Network on the Raspberry Pi
If you will use a Ethernet cable to connect your Raspberry Pi to the internet, you can skip this step.
For this section we will assume you have a Raspberry Pi 3, with built in WiFi.
Start by scanning for wireless networks:
pi@raspberrypi:~ $ sudo iwlist wlan0 scan
This will list all of the available WiFi networks. (It also confirms that your WiFi is working)
Now we need to open the wpa-supplicant file, to add the network you want to connect to:
pi@raspberrypi:~ $ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
This will open the file in the Nano editor. Add the following to the bottom of the file (change
wifiPassword with the actual network name and password):
Ctrl+x" to save the code. Confirm with "
y", and confirm the name with "
And reboot the Raspberry Pi:
pi@raspberrypi:~ $ sudo reboot
After reboot, log in again, and confirm that the WiFi is connected and working:
pi@raspberrypi:~ $ ifconfig wlan0
If the WiFi is working propery, the information displayed should include an IP address, similar to this:
Write down that IP address, as we will use it to connect to the Raspberry Pi via SSH.
Install Raspberry Pi
With the Raspberry Pi properly set up, login in via SSH, and update your Raspberry Pi system packages to their latest versions.
Update your system package list:
pi@w3demopi:~ $ sudo apt-get update
Upgrade all your installed packages to their latest version:
pi@w3demopi:~ $ sudo apt-get dist-upgrade
Doing this regularly will keep your Raspberry Pi installation up to date.
To download and install newest version of Node.js, use the following command:
pi@w3demopi:~ $ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash–
Now install it by running:
pi@w3demopi:~ $ sudo apt-get install -y nodejs
Check that the installation was successful, and the version number of Node.js with:
pi@w3demopi:~ $ node -v