DesignSpark Electrical Logolinkedin
  • Brought to you by
  • RS Components
  • Allied Electronics

January 26, 2017 09:33


Learning Python with the Raspberry Pi Starter Kit.

Getting to grips with Linux and Python with the Pi starter kit

First off, Introductions. My name is Natasha and I’m as scared of coding in Python as I would be of an actual Python. I am in the process of completing my HND in Electronic and Electrical Engineering, I’m new to the world of electronics and like most Electronic Engineers I’m no programmer, and I’m not as fluent in any programming languages as I would like to be. I picked an Electrical engineering course as originally wanted to go into Medical engineering, not knowing that I would find the utilisation of electrical energy or PLCs as fascinating as I do. As I learned, I started to become aware of the technology around me that I take for granted every day. Suddenly I noticed the automatic doors, the cables connecting devices, the overhead power lines I drove past — everything. With that new found awareness of just how much goes into making the supermarket door open for me, my curiosity grew. Now here I am, blogging for you. Julie Andrews said “let’s all start at the very beginning, a very good place to start” and who am I to argue, so let’s start with the unboxing.

Everything you need to get started


The Raspberry Pi starter kit is, just like the box says “Everything you need to get started with Raspberry Pi”. Though the Pi itself can be picked up for around £30 on line, the starter kit comes with the protective case, a keyboard, mouse, HDMI cable, power cable, a pre-programmed micro SD packed with the software and a book to help you get started. All you need to do is find yourself a monitor and your set. If like I mentioned earlier, you opt for just the Pi, the SD card is usually included, if not, you can always get your own and download the new out of box software, cleverly named NOOBS, directly from website onto a laptop and drag and drop it onto an SD card that you can then use in your Pi.

The Ingredients

The Raspberry Pi itself is spectacular, it can do pretty much anything a laptop can, you can play games, go on the internet, play movies, and all on something the size of a credit card. The New Pi 3 has roughly twice the RAM and 10 times the CPU performance of the original. It comes with a micro-USB socket to power the Pi, a HDMI video port to connect to a screen, camera connector, an audio socket for headphones or speakers, an Ethernet connector and four USB ports, allowing for use of both the USB powered keyboard, mouse and a WI-FI adapter if the Ethernet is too old school for you. It easy enough to physically set up. Just plug in and play. Software wise, booting up is a doddle too.

Booting up

The first time you boot up, you’re presented with a list of operating systems. Raspbian is the recommended, but whichever you choose you just check the box and sit back while the pi does all the installing. If like me you opt for the recommended, you get a warning message that everything on the SD card will be erased and the install will begin. It lets you know when it’s finished, reboots and automatically configures, you might as well grab a cuppa, there’s not much to do yet. You do need to press enter twice, once when you select “enable boot to desktop/scratch” and then again after selecting “Desktop Log in as user Pi at the Graphical Desktop” but I’m sure you can manage that.

The first look at Linux

Now that were up and running, we get our first look at Linux. Linux is an open source operating system that uses the UNIX notions that came about in the early days of computing as an alternate choice to the duopoly of Mac and Windows. Once your desktop has loaded head to the top of the screen where you’ll find your menu, and from there you can access the internet, play games, find your programming options. Then just to the right of that you’ll find your Terminal button. If you’re a Mac or Windows user like me, you’re probably not familiar with it, but you’ll find that this is the place you go to find things, rather than relying on clicking icons to open files. For the minute, however, what we’re interested in is the dreaded Python.

The very basics of Python coding

The time has come to create some programs, and Python is the language to do that. To get started we need to go to our task bar, hit the Raspberry Pi icon and drop down into the programming option, then select Python 3 IDLE. This opens what we call a Shell. This is where the magic happens, it’s where you type your commands and see what they do. While the shell is the place to get creative, and you can write your programs in there, after a bit of playing around, I found it easier to write in the Text Editor. My first command was print(‘hello’). The Print part tells the Raspberry Pi that you want it to return you a value, the part inside the quotation marks is the value you want it to return. In this case it returns the word hello on the next line. We can do a little more here, and I think it’s easier to see the command of returning values in the following lines of code. First of all I gave the program a range of 1-10 by entering for x in range(1,10): then I asked it to return me all the values possible in that range by entering print (x). The program then returned me all the values between 1 and 10, listing them below for me. It really was that simple.

I was tasked with setting up Raspberry Pi and getting it to return the words hello world to me, and I must say, that python wasn’t half as scary as I thought it would be. I will have to get to get to grips with the world of case-sensitive typing, colons, brackets, and indentation in order to complete my next task — Interfacing hardware, turning on and controlling an LED using a switch — but if this is anything to go by, I look forward to it, and as cheesy as it sounds, people do mean it when they say “If I can do it then so can you” or at least I do anyway.

I Graduated from the University of Bradford with a degree in Chemistry and Forensic Science and currently I am studying towards a HND in Electronic and Electrical Engineering while interning at AB Open.

January 26, 2017 09:33



0 Votes
Graig Pearen

February 20, 2017 10:44

"in the early days of computing as an alternate choice to the duopoly of Mac and Windows." I got a good chuckle over that. Your youth is showing ;-) Not only were computers used in business decades before that, even I owned two "personal" computes for over a decade before either Windows or Mac arrived on the scene. Now my age is showing :-))

0 Votes

February 20, 2017 10:52

A well-written blog which should certainly help to allay any fears newcomers might have regarding things Pythonesque, [or perhaps that should now be Pithonesque :-) ]

0 Votes

January 31, 2017 12:09

Nice intro to the Pi starter kit. Hopefully, your post will encourage anyone who is a little hesitant about dipping their toes into the world of Pi to jump in!