Sunday, April 21, 2019

The Code Bits: Getting started with Raspberry Pi and Python

Hello there!, So you just got a shiny new Raspberry Pi. Well done and congrats! In this tutorial, we are going to look at how we can set up your Raspberry Pi and get it up and running.

What you need to get started

First and foremost we have to ensure that we have all the required items to get started. Here is a short list of items that are absolutely required to get the ball rolling.

things_needed

Optional

You can also get these as a bundle (buy from Amazon) or if you have some of the components lying around, then you could selectively get them as needed.

Getting your OS ready

Raspberry Pi is a miniature computer and just like your laptop and desktop PC, it needs to run an Operating System. Since Raspberry Pi runs an ARM-based processor (If you haven’t heard of ARM processors, they are low power processors commonly found in your mobile phones and tablets), we need to use a supporting version of OS. Luckily both the Raspberry Pi foundation and many of the Linux community members have created many Operating Systems that you can choose from to run on your board! In this tutorial, we are going to use NOOBS distribution which you can find here.

Once you go to the above link, choose NOOBS, and you will be given two options, select NOOBS. This is a large file and it might take some time. Be patient!

In the meanwhile, we need another piece of software that helps us format and transfer our OS to our microSD card. You can find the software here.

Once the SDFormatter tool is installed, and the OS image is downloaded, we are ready to go!

The first step is to unzip the NOOBS file that you have downloaded. You will get a NOOBS_v3_0_0 folder or something similar depending on your OS version. Open up the SDFormatter tool and insert your microSD card onto your PC. You can either use a USB microSD adapter like this or use the one that’s in your laptop / PC.

On the SDFormatter tool select the drive that corresponds to your SD card. Make sure this is correct!.

SDFormatter

IMPORTANT: Please back up any data before formatting!

Once the formatting is complete, you can copy the contents of the NOOB folder which would be something similar to what is shown below onto your formatted SD card.

Noobs_contents

Connecting all pieces and booting up!

All right, we’re almost there! Now we need to connect our Raspberry Pi to our peripherals and boot it up for the first time.

Here, I have used a USB keyboard, a Wireless Logitech mouse that has a wireless USB adapter. I have plugged in a USB Wi-Fi adapter to connect to my network and an HDMI cable to connect to my monitor. The overall setup after setting up everything including power looks something like this.

fully_connected

Setting up the OS

Once we have the setup ready, let’s connect the board to the peripherals and power and boot it up. Initially, you will see a dialog box to select the operating system

Select Raspbian Full and click the install button. The installation dialog will follow afterward. It will copy the files and install the OS.

Once the OS is installed, the system will reboot and you will be welcomed with the new desktop!. Next, you will be prompted to set up your account password, keyboard profile, and timezone as well as connect to a Wi-Fi endpoint. That is pretty much it!

Hello world in Python

Fire up the terminal by going to the menu button on the top left and selecting the terminal. Open up a python shell by entering

python

This opens up a python shell, say hello world from your shiny new raspberry pi!

print "Hello world!"

Wrap up

So that’s it! We’ve made it to the end and we have a Raspberry Pi up and running! Woohoo! Now is the fun part, which is all the fun things we could do with it. I’ll be doing some interesting projects that you could follow along on this blog going forward. Make sure to subscribe to thecodebits.com to receive updates. See you all soon!



from Planet Python
via read more

No comments:

Post a Comment

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...