You are on page 1of 102
Raspberry Pi For Beginners Jargon-free Step-by-step Clear Full w w w Tips & Advice Tutorials Colour Guides Over ART) - het asus urets : ; = / www.pclpublications.com nS Papercut 100% INDEPENDENT For Beginners Tech Guides Available on Readl U MacBook &macOs Ventura Photoshop For Beginners For a full list of titles available visit: Raspberry Pi For Beginners w Raspberry Pi For Beginners is the first and only choice if you want to learn everything about the Pi from the ground up - where the only limitation is your imagination. Learn how to build some amazing projects from a retro gaming console to a home entertainment system. The possibilities of the Raspberry Pi are endless and the best place to start is right here. Papercut www.pclpublications.com Contents 6 Raspberry Pi is Good For You! 8 cc) v3 14 cc 18 20 Pod ey e 30 7 oy cy 58 Cy) ey Soar kenico saa Caer ae nue nal Up Close with the Raspberry eee The Pi 400 - Up Close ALU ee eu) econ ciao Ayala ie Pico Power: the Tiny Microcomputer The Pico and MicroPython ede ee nek eeoceeear ed ET elec ci) Reee aetna ret nuke aU Scie a OS eee keke Using APT to Install and eure ics) 32 34 EG 38 cr ery ery cry 4 Cy 66 Other SBCs to Use eo Caen cal ine ai aoc Raspberry Pi in Numbers area ne) Raa) Sane ar) ens Pane eu mead ea Ricca What You Will Need Perera Ges ecus AS so) Get More from the aC) einen nce crea eom ake ad Contents 68 Python on the Pi 70 Starting Python for the First Time 72. Your First Code 74_ Saving and Executing Your Code 76 Executing Code from the Cee u NE EN ee eed 80 Using Comments 82 Working with Variables emecais Emenee 88 Conditions and Loops: Car eu ene) ee ie Omar ed 96 Glossary of Terms “Thanks to the Raspberry Pi’s unique setup, operating system and amazing community of imagineers, this little computer has become one ofthe mostimportantpieces of educational technology in the world. It’s helped people learn how computers, coding and electronics work, as well as helping science and engineering, astronauts and technicians, young and old, teachers and students. You will learn and discover how the Pi works, what you can do. with it and where to take your Pi adventures.” eee Raspberry Pi is Good For You! 5 Raspberry Pi is Good For You! Your journey with this amazing little computer begins here. Say hello to the Raspberry Pi; learn how it works, what kind of operating system it has, what you need to get it up and running and much more. This is your first step into the world of the Ce Ne In this section, you'll discover what makes the Raspberry Pi such a fabulous little computer and project board. There are in-depth guides to the hardware, operating system, what you'll need to begin with and enjoying the software the Pi has to offer from your computer's desktop. Now let's see what this amazing ee Cao ORC 8 Raspberry Pi is Good For You! eee ee tet Ben een erat eR en Cees ey eC et ee ea serine etree fee ee eee ota pice ori Rte a ear Tes Internati pa sree eer ts el B+ was launched on 14 March ey Such, all qe ereatenne carne pti erful world of che Raspberry this isthe ott ‘The Raspberry Pisa British built low cost ‘computer that enables everybody to learn ‘computing, start programming and explore basicelectronics. It’ the size ofa credit ‘ard but capable of running afull operating system and doing everything a desktop does. More importantly, with the Raspberry Piyou install your own operating system, connect ll your devices and create your own programs Using languages ike Scratch and Python. “There's no case so you can hook up electronic >>”.Now, enter the following: print (*Hello, world!) Users of Python will undoubtedly recognise the syntax, btif you've ‘never coded with Python before, then let's explain what's going on in this imple ne, ‘The print command, as you probably assume, is used to print, clsplay, something tothe screen forthe user to read. Ifyou want tosay something tothe user, then yout need to enclose your text Inside a par of brackets and quotation marks.In this example, we're isplaying the words Hele, wor! When the MicroPython interpreter reads the Print command it wil naturally assume that ‘something s being displayed, and look for a numberof acceptable ‘outcomes. The First bracket and opening quotation mark means there's going to be some text, sothe interpreter wil look Fora closing set of quotation marks and bracket Press Enter and the words Hele, wera will appear inthe Shell. section of Thonry. ou ok ‘what you've just done is communicate directly with the Pico, nd through MicroPython onthe Pico, i'srecognised the command you've ‘entered and acted nit. Justfor fun, enter the command again, but this time intentionally, miss out the last bracket. Youll notice that the Shell doesn't want tocontinue without the bracket, sotherefore it's an error. While Using MicroPython, or most other programming languages, you'll need to be careful what you type. The slightest mistake can have dire consequences to your code ~oF, more than likely, just stop itfrom working, Forthe next example, click the upper part of Thonny, where the number “1'ls Now enter the Hello, world code again. When you hit Enter this time, youl notice that instead of running the code through the Pico, ‘Thonny has created asecondlin and is wating For more input. ‘While using the Shellis great, t's not so good For creating multHine ‘ode. Thisis where the upper section comesin. To execute the code in the upper section yout need to do the following: Clckthe Run button; this opens a new window asking For asave location (This computer or the Raspberry Pi Pico). Ths s because any code that's been entered inthe upper section of Thonny needs tobe saved First, asap file, before t can be executed. SelectthePicoas the save location, then when asked, create aname for the py fileinthis case calit HelloWorldpy and clckthe OK button, ‘Assoonas you've saved the file, it will automatically run and you'lsee the output From the code displayed in the Shell box. ‘Alternatively, you can open. browser and navigate to https//woww. raspberrypi.org/documentation/pico/setting started. Scroll down ‘ntl you get tothe Getting started with MicroPython section, and follow the on-screen instructions, Click onthe Download UF2 File ‘button -at the bottom ofthe Getting Started info box. ‘Once the UF2filehas been downloaded, locate it in the Downloads folder on your computer, and click and drag itinto the Pico storage dive; as you would drag and drop a file From your computer to a standard USB flash drive. ‘After afew seconds, the Pico storage drive wil disappear -you may {geta warning stating thatthe device wasn’t unplugged correcty, bbutignore that. This process has now ‘lashed! the Pico withthe ‘MicroPython Firmware. The Pco disappearing From the File Manager ‘means that ithas rebooted and is nowin MicroPython mode. Thisis. essentially all you need todo For the moment. The Picois now ready tostart coding on to using MicroPython, Pico Examples and How To 8 BLINKING LEDS! ‘MicroPython, as with Python, uses modules to enhance the code you're writing. A modules simply Further code, but when called ‘upon by your code it ill operate to specific parameters. For ‘example, there are modules available that are designed to handle ‘graphics, while others handle complex mathematical operations. Using these modules saves you from having to invent the code and place t among the many lines you're typing in. Allyou need do is call ‘up the module, and pass any variables and parameters through the ‘module to getthe result you want. In MicroPython, and in the Pico’ case, there are modules that can bbe called upon that handle the physical hardware side of things. The Pico-specfic modules will handle input and output through the GPIO ports, or utilise some of the co's inherent sensors. For example, hhere's some code that will light up the builtin LED on the Pico: from machine import Pin Jed = Pin(25, Pin.our) ed.on() ‘Type t.into the upper section of Thonny, save it as LED py (for example) and run the code, The LED will light up. But, let's explain what's going on here, ‘Tobegin with we have, from machine import Pin. This means thatthe code is going to open the builtin module called Machine, of which certain class within itis called Pin. This particular set of external code isdesigned to talk’ to and handle the input and output ofthe Pico’s. PIO pins. ‘The next line, eal = Pin (25, Pin.OUT) . What we've done here is create variable called Led which we've told to hold the information regarding the Pin dass, in particular the number 25, as an Output. The CGPIO pin on the Pico is hardwired tothe LED, so essentially we've told “MicroPython that Pin25is going to have Output data sent toit, and It’s going to be called led ‘The Final ine, 1ee.on (is trigger that sets Pin 25 Output toa high value ~in ths case, On. The results that the LED onthe Pico willbe turned on, Try and ater the code, so the last ine reads: led. o££() ‘As you would expect, thie turns the IED off. Now try: led. toggle) 8 Raspberry Pi is Good For Yo! ‘Whattoggle() doesis every time the codes executed, the LED ison itil switch oF, and fit’ oF Fil switch on, Interesting stuf siti Let's expand our LED code Further and include aloop with another kind of module: (tmpix from machine import Pin Lea'= Pin(25, Pin.0UT) 5 Led. toggtec ‘from machine import Pin from utime import sleep Jed = Pin(25, Pin.cor) for 4 in range(5): ed. toggie() sleep (1) ed. toggle() sleep (1) When you execute this new code, itwill link the LED Five times based on whether the LED was previously on or off using the led. toggle() syntax we looked at a moment ago, Let's take a moment to break down the new elements ofthe code, though, ‘From! utiine import sleep, as you probably suspect, this is using ‘anew module called utime, From which we want to use the sleep class. Utime holds code that can be used For timing, and the sleep class ‘enables the code to pause For a specficnumber of seconds. For 4 in eange(S), is new line which sthe beginning of aloop, Basically, we've asked MicroPython to count to, and anything after the colonis repeated rive times. Providing what code we've entered in the loop is okay, i'l doe Five times before stopping. Note: The indent after the colon, Tis means thatthe code in the indent i directly ‘controlled by the for loop. Indents in Python are as important as spelling and getting the correct characte in order. ‘The inal new element is seep (4), which pauses the code forthe ‘count of one, or one second, Feel Fre to mess around withthe code you've created. Extend the number of seconds, use led.on and led off instead oF toggle, and extend the For loop to more than Five She fea! omni feet TEMPERATURE READINGS ‘The Pico also comes witha builtin temperature sensor, andis connected to one of the Pico's analogue pins. The analogue pins on the Pico are actually called ADC's or Analogue to Digital Converter whereas the GPIOs are dsital. The ifferenceisthat a digital pin, reads only two states: High or Low (or One and OFF), and an analogue pin can read. range of values from zero 65535 (through the use ‘of MicroPython, the Pico's ADC realy reads from zero to 4096). ‘This means that anything that's read through the analogue pins canbe from Oto the value of 65536, which makes it perFect fora temperature sensor. ‘The temperature on the Pico hardwired into ADC4~ or analogue pin 4, So we can extract the data from the temperature sensor using the following code: ‘from machine import ADC ‘eempsensor = ADC(4) eomperature = tenpsensor.read s16() Print (temperature) ‘There's alot going on here, and the displayed number that appears, inthe Shel probably won't make much sense, s0let's have alookat the code. First we'e using the machine module and fromit the ADC class. ‘Then we've created a tempsensor variable which wil pullthe data from ADC pin 4—which is the Pco's temperature sensor. The third line of the code creates a temperature variable, which stores the value of ADCS and applies a 16-bit data range toit so we can havea value from 0 to 65535. And finally, we're printing the currenty held value of temperature the Shel. Now here's the par that will make your head hurt. ‘The Pico's microcontroller runs.at 3.3 volts. So when there's full 3.3V being applied, the ADC will read a value of 65535, and when there'sno voltageit wil read zero, The temperature sensor on |ADC4 works by sending voltage to ADC4 thats proportional to the ‘environmental temperature. So ifthe environment the Picois nis 27 degree Celsius the Pico sends a voltage of 0.706V. So, using the 3.3V ‘maximum at the value of 65535 and the operational specifications (of 27 degrees Celsius as being a voltage of 0.706V, we can work ‘out code that wll convert the original value you got From the ‘temperature variable into degrees Celsius. Before our brains dribble out, here's the rest ofthe code: ‘from machine import ADC ‘tempsensor = ADC(4) ‘temperature = tempsensor. read u16() volts = 3.3 / 65535 ‘temperature = temperature * volts celsius = 27 - (tenperature - 0.706) / 0.001721 Print (celsius) Let's run through the code. We've created a volts variable which takes the maximum 3.3V and divides it by 65535, then we've taken The Pico and MicroPython 8 the already read temperature variable and multiplied that by the volts value. We've then created a Celsius variable, which we've used the above numbersto store the value of 27, minus the temperature value, minus 0.706 and divided by 0.001721. This wil give usa reasonably accurate conversion of volts to Celsius, which the code will then print Into the Shel section of Thonny. ‘Asyou cansee fromthe screenshot, the room we ran this code inwas a balmy 2049 degrees Celsius. When we looked at the temperature on the digital thermostat in the same room, it read21 degree Celsius, so only hala degree out, whichisn’ttoo bad. THE WORLD OF THE PICO AWAITS... ‘Thisis only asmall example ofthe type of projects and coding that ‘canbe achieved withthe Pico and MicroPython. There are numerous ‘extras, such as motors, sensors, LEDS and even LED screens that can be attached tothe Pico'sGPIO ports with some neat soldering and the use of ahandy electronics kt. \What we've looked at here is taster, and the Foundations on how to callup the Pic's GPIO pins and how to use MicroPython in Thonny. From here, we'd recommend you learn more about how the Raspberry Pi functions as wellas some more Python coding, which wil giveyoua better insight into how the Pico and MicroPython will work. Have Fun, and let us know what Pico projects you've created. BB Raspberry Pi is Good For You! Pico Projects & Ideas PICO POWER! Here areten ideas and project that you could look into achieving with your Raspberry Pi Pico. You may need to enhance your electronics skills, but there’ plenty of help online i you hunt around Fort. RIT cnspscenesrarpmeiniconiete DERRY naisinite abil aPaninweda ETERS OUSD Perce resorts PFET Wt retook upsone leds as bain ADC to convert analogue to use the Pio microcontroller asaset oF otal signals also has abuiintemperatre sensor soit’ possible traffic lghts Youcan even incrporatea burton that when pushed tov the Fico asa temperature gauge. willactas Wakbutton and stp the trafic for pedestrians Pico Projects and Ideas i MoD visiserourommetcn cancion” MAMAN yon tpn the sersoc Which meansyoucancreatea burgralam,orndude th Pe, togeter witha photoranstor sensor anda telescope, could therobotdes to alow some orm autonomy. be wed create a scope tet canrckthe passage ofthe Moon through the night sky. Petals eniiis) Using buttons and LEDs, youcan nc eneke antsy withthe infrared motion create a simple button push reaction ‘sensor, you could attach the ‘game, for multiple players. Perhaps you could attachabuzzerthat Pico toan outdoor camera ~ or camera withina weather proof signifies the winner or loser. container to activate when something passes the sensor, capturing that neighbours pesky cat inthe act! bic. al PETE) Mosttome automation tasks are RUNCSTPNNEEIN There are a numberof Pco-built RGB ‘un through microcontrollers, so LED displays available online. You can the Picois suitably placed for those who have setup some advanced _use one to display messages, create some form of interactive home automation devices. Elements such as turning the heating or game, or display data that's coming from one of the input GPIOs lights on, or opening the garage door, for instance. attached to a sensor. BB Raspberry Pi is Good For You! Other SBCs to Use ‘An SBC, oF Single-Board Computer, isa complete computer system that's built ona single piece of circuit board consisting of memory, storage and input and output ports. The Raspberry Pisa prime example of a modern SBC, and the one that has easily become the most popular. However, there area numberof other SBCs available that vary in size, capacity, performance, price and expandability, Some of them are x86-based, which means they'e basically very small PCs on which you can install Windows 10; others utilise different makes of processor or microprocessors and offer a varied number of operating systems that will work on them, such as Android or Linux. \While the Raspberry Pls the SBC that offers some ofthe best opportuniesin terms of project work, and flexibly, it's certainly not the only one ofits kind, We've lsted some of our favourite boards, that you may consider taking a look aif the Raspberry Piisrtfulfling your goals ‘The Udoo brand has been active since 2013, whenit launched its First SBC via Kickstarter. These days the company is atthe Forefront of developing some of the most powerful SACs on the marketn particular, the Udoo Bot ‘The Udoo Bolt measures 120mm x 120mm and Features anultra-powerful AMD Ryzen V1605B, quad-ore/eight thread CPU, running ata maximum of 3.6GHz ‘The builtin GPUs the AMD Radeon VEGA 8, and there's support for two dual channel SO-DIMM DDR4 memory units to a maximum oF 32GB. There's also a 32GBEMMC 5.0 Flash module installed, bout witha pair oF M.2 sockets for M2 SSDs, In terms of connectivity, there'sa gigabit Ethernet port, with Bluetooth and Wit USB3.0 ports, two USB-Cports,asingle USB 3.1 por, two full-sized HOM! ports and power input via USB-PD, ‘The VO For projects is Arduino Leonardo- compatible with 12 analogue ports, up to23 digital ports, and a single UART, 12 and SPL It’s a remarkably impressive board, that can ‘un Windows or Linux, But allthat power and 1Ocomesat price. The Bolt VB, the board we mentioned above, comesin at $418, roughly £300, Whichis pretty expensive compared to the Raspberry Pi but thstiny board is more powerfulthan most desktop computers. BANANA PI Launched in 2014, the Banana Plis a Raspberry Prompatible board that has seen many releases since its initial conception. These are [ARM based SBCs developed in China and sold viaa number oF international distributors. ‘The latest version ofthe Banana, the BPHMS, looks remarkably similar tothe Raspberry P38. It features an Amlogic $905K3 quad-core CCortex-ASS CPU running ata decent 2GHs, together witha Mali G31 (GPU. There's 4GB of LPDDR4 memory, 1668 of eMMC Rash storage on- bboardanda MicroSD slot with support Fr upto 25668 cards. Connectivity comes nthe orm ofa gigabit Ethernet port, ull sized HDMI, 3.5mm audio jack, Four USB 3.0 portsanda US8-C port For power input. The /O mimics the Raspberry P's 40-pin GPIO, but there's ‘no extra connectivity for cameras and such; as Found onthe RaspberryPi, ROCK PI Developed by Radxa, the Rock Pihas been a direct competitor to the Raspberry Pi For some years now; and t's certainly not looking Likes slowing down any time soon. ‘The latest versionis the Rock Pi 4 Model C, which sports ahexa- core CPUwitha dual-core Cortex-A72 at 1.8GHz anda quad core Cortex-AS3 at 1.4GHz together with a Mali TESOMP4 GPU. Models ‘Aand B feature 1GB, 2GB and 4GB memory options; but the Model, ‘Ccomes with only 4GB oF LPDDRS memory. There's an eMMC Flash module available, in 8GB, 16GB, 32GB, 64GB and 12868 options, as well asa MicroSD card slot with support for 128GB cards, and an M.2 connector or M2 SDs, ‘As For connectivity, there's HOMI, gigabit Ethernet, two USB 3.0 ports, two USB 2.0 ports, 3.5mm audio jack, USB-C for power, and Bluetooth and WEF For project wor, there's 40-pin GPIO, as wellasa MIPICSislot For ‘camera attachments, t's also interesting to note thatthe Ethernet port supports Power-over-Ethemnet (with an additional HAT). Not bad fora board that measures 85mm x 54mm. ‘The Rock Pi Model Ccosts $59 or £42, and while alittle more ‘expensive than the Raspberry Pit out performs the Piin nearly ‘every benchmark, Other SBCs to Use a ‘The Banana Pi MS sa tad more powerfulthan the Raspberry Pi, and the 4GB memory option copes the more common Pi available. ‘Although you wil have extra RAM if you were lucky enough to get hold ofthe 868 memory i. Youcan install both Linux or Android on the M5, and t's even Raspberry i OS compatible. Iecosts$53~at the time of writing -which equates to around €38; 50 ot too ar from the cost oF Raspberry Pi, ARE THEY WORTH IT? ‘The question of whether to use a different board other than the Raspberry Plis purely up toyou as an individual and what you're planning on using the SBC For, For most Folk, who buy a Raspberry Pi For emulation orasamedia server -which are the two most popular projects used by users then they'd probably get more mileage out ofthe aforementioned boards. True, the expense is considerablein the case of the Udoo, but i'l do afar better job of processing than the Raspberry Pi will ever do. “The real argument comes dowin to cost. F you're wing to pay a litle more For the extra performance, then the alternative SBCs wil suit ‘you fine. But when you compare them tothe Raspberry Fi, the Pi does seem to come on topin terms of cost versus-performance. Needless to say there are countless more SBC available. Some are smaller, even more powerful than the Pi and cost does vary wildly from one product to the next For most users, though ~and espedially For the beginner - the best bets to stick to the Raspberry Pi When your skills improve, and you have more specificprojects inmind, then look tothe other boards forthe specifications and Features youneed. is Raspberry Pi is Good For Yor Raspbian: The Complete Operating System Bees anata Cuneo SURV ene Te aes Ose a Nae Mee een red eee RMuhccssemntcs coche etek es ce Secucn POWERING THE PI ‘The Raspbian OS has been powering the Raspberry Pi since its release backin2013.Atits core, Raspbianisa Linux operating system, based on the hugely popular Debian Flavour of Linux. Mike Thompson and Peter Green created Raspbian in2012, towork on the low-performance ARM CPUs Found inthe eary Pi models. Toward, the end of 2014, Raspbian was Further improved to work on the then new model Pi, the Raspberry Pi; utilising the 3.18 Linux kemel while stilhaving Debian 7 (codenamed Wheezy) as the base. Mid-way through 2015, Raspbian started using Debian 8 Uessie) asthe base, with kemels 4.1, 4.4, and 49. Kernel 49 was also used From 2017's Raspbian release, which has since used Debian 9 (Stretch asthe foundation distribution, 7 More recently, from November 2018, the Raspberry Pi Foundation has spit the Raspbian OS project into three separate distributions. Although these ‘are essentially the same core operating system, those available now are a Lite, Minimal and Full desktop set of mages. (One ofthe primary reasons forthe three- ‘way split is due to the overall sizeof the ‘continually improving Raspbian. nits early years, the Raspbian desktop image size ‘was a litle under 1GB. This image contained everything the Pi user ofthe time needed to get their projects up and running, as well as enjoying thicé-party applications such as LibreOffice. Siowiy, as the P itself evolved, the Rasphian image increased. These days the image weighs in at around 18GB and it’ Ukely to continue to expand over the coming years as new software is improved on and. ‘added, alongside changing hardware. However, the three-way split _addresses the issue ofan ever-expanding OSimage, while still enabling the user to get the most From their Raspberry Pi ‘The Lite version image comes in at roughly 350MB in size. While Ik may seem like a logical choice to opt forthe Lite version t's not recommended for every user. The Lit version basically installs without ‘any ofthe software you expect From the previous versions of Raspbian it doesnt even come with the graphical desktop. This makes it an incredibly streamlined and efficient version of the OS that's ideal for those who run headless Piservers (a Piwithout a monitor, Keyboard or mouse attached, that the user remotely connects to in order to input commands). You will need to know your Linux commands in order to {get the most from the Lite version, so For most beginners it's not a ‘900d place to start. The more advanced users will, however, be able to setup their Pi projects without the unnecessary baggage of all the other applications clogging up the P's precious system resources. Its ‘worth nating tha the Lite edition can be made up toa fully Functional desktop version by installing allthe relevant software manualy The Minimal edition is now the default version recommended for most new Raspberry Pi users This version is around 1B in size and includes the PIXEL desktop, Chromium web browser, ew hardware accelerated VLC player and Python. It does not include LibreOffice, Scratch, Sonic Pi and many of the other tools, programs and applications that ‘previous versions of Raspbian included. Its a perfect start for most users and those who are more familar with the workings of Raspbian and Linux can easily add more apps later, as they require. ‘The Full desktop version is 1.8GB in size {atthe time of witing) and asyouimagine, contains pretty much everything you can squeeze into Raspbian. You get the POEL desktop, UibreOffice, VLC, browser, games, programming resources and much more. So,.which version should you download and use on your Pi?Normall,asrecommended bythe Raspberry PiFoundation, ‘most new Pi users are best opting forthe Minimal desktop; but that Fle Explorer and choose the $0 Card Inthe sidebar. The dive should be empty, but we will copy the files toitin the next steps. For now just make sue thet you can ‘access the empty root ofthe SD Card. cool Ata ee iad eee Retin ee er eee Ore neo as re Ce otter re te Cree eee ae ieee contents, These are the files you need to copy tothe root (base) oF Seer) Ee ‘Now it's time to download the NOOBS software from the Raspberry Pi website. Opena web browser and enter https://wunuraspberrypi.ora/downloads/noobs/ nto the URL Field Scroll down to find the NOOBS section not NOOBS LITE) and click Download Zip and Save. pile containing the NOOBS files copied to ‘your Downloads Folder. lice Open Folder when tis done. 8 a een tore eee eC ao) eer een ete containallthe files NOOBS needs to setup an operating system on your Raspberry Pi. Check that you can see a Defaults folder, bootcode. and BUILD-DATA files along withthe other files shown here. Remove the SD Card From your Windows PC. l’s now ready tobe inserted into Sew BB Raspberry Pi is Good For You! The Raspberry Pi Desktop: What You Will Need 12016, the Raspberry Pi Foundation started work on an x86 version ofits popular Raspbian operating system. By the end of the Following year, there was link on the Downloads page and non-Pi owners could now install and use Raspbianin almost the exact same way asif they were in front of a Raspberry Pi The Raspberry Pi Desktop (x86 version) allows you to view the same desktop and pre installed software asthe Full Desktop version avallable forthe Raspberry Pi, You can instal on any decent PC, or laptop, one that’s atleast six or seven years old would be perfect and as aPC that age usualy struggles with the latest version of Windows 10, you can now install Raspbian instead of boxing that old kitand resigning toa life oF gathering dustin the loft. ‘The major difference is that ths version has been compiled torun (0n x86 processors, thatsintel and AMD PC processors. Whereas, the version of Raspbian that you willfind on a Raspberry Pi hasbeen compiled and created exclusively For ARM processors; the type oF CCPUa Raspberry Piuses. These CPUs usea different architecture tothat oF an intel or AMD CPU, so the software required torunon ‘one won'trun on the other unless the developer has specifically ‘made either an x86 or ARM version. In short, if you've Found a piece ‘of software that you enjoy using on your Raspberry Pi, you won't beable touse it on the Raspberry Pi Desktop x86 version UNLESS, there'sa dedicated x86 version of the software. Since then, the Raspberry PiDesktop, or as is correctly called: Debian Stretch with Raspberry Pi Desktop, has Followed the same release path asits P-based sibling, However, there are some differences you need to be aware of prior to throwing your Pi away and opting For this version instead. >» ‘Another caveat worth mentioning s that you won't have access to the 40-pin GPIO that the Raspberry Pi Features, asthis isnt a standard piece of hardware on anormal PC. There i, however, a way around this. you own a Raspberry PiZero (either with or without the W), then you'reableto connect the Zerotoa spare USB port onthe PC, Via the Zero's micro USB port ad the Raspberry PiDesktop OS will recognise the Zeroas extended hardware and allow youaccessto the ero’ 40-pin GPIO, which, youhave to admis prety clever stuff. | The Raspberry Pi Desktop: What You Will Need WHAT YOU WILL NEED Here's alist of tems needed if you want to test out the latest version ofthe Debian Stretch with Raspberry Pi Desktop OSon your PC. iE Naturally youl need the Raspberry Pi Desktop 05, just Ea ‘The best method of transfering the ISO to PC For ‘asyou would with Raspbian or the Pi Open a browser installation isto use a combination of atool such as ‘and download the IO fie that containsthe OS from: hetps;//www. Rufus (ound at httpsy/rufuse/en_IE htm\), which sa piece oF raspberrypiorg/downloads/raspberry-p-desktop/. software that can create a bootable USB driver from an SO Fle and, at least, an 8GB USB stick os nw EE Scr setonrcoinnkandat | EIRENE sth rtaareey hse candidate for running the Raspberry Pi Desktop SEN ARISES) ‘spare Raspberry Pi Zero will allow you Os.whleyoucaneasy sethe test PC/apto,tsabicoverilfor”toacessthe40-in PIO rom wthntheRespbery Desktop OS this particular operating system. however, you dontt have aspare Zero, i's nota problem as there's still plenty you can do with Raspbian on aPC. 8 Raspberry Pi is Good For You! Debian Buster with Raspberry Pi Desktop 10 THINGS TO DO WITH X86 RASPBERRY PI OS “There'sjust as much you can dowith this version of Raspberry PIOSas with the dedicated Pi version. Here'sten great projects, and things to ddowith Debian Buster with Raspberry Pl Desktop, Tis version ofaspbian apes the Fl Desktop version (Genie for the Raspberry Pi, so that means it comes with all the necessary programming languages out ofthe box. Learn Python, C++, use the HAT emulator, and even earn JAVA. I’sallthere under the Programming menu option. me PT eg) Hook up aPi zero without an $0 installed and select GPIO Expansion Board from the options, ‘and you willbe able to talk to the Zero's 40-pin GPIO via the likes oF Python or Scratch. By doing so, you'llhave al the benefits of 3 Raspberry Pi, with the power of your laptop. PTT se areiay the x85 version of Raspbian ollowsthe Full, Desktop iverson, there's an entire office suite preinstalled, That means you can use that od laptop or PC asa fully Functional desktop replacement for Windows or macOS, LibreOffice is also Microsoft Office compatible. PSs telil trey As with most modem operating systems, ‘youcan aso browse the Internet exactly the same a you would with the likes of Windows 10 or the latest macOS. Asthisisa Linux-based OS, there's also an added element of security, as Windowstargeted viruses wont affect Debian Buster with Raspberry Pi Desktop i inerrant ia 5thisisa Debian based TE The Raspberry Pi, even the Pi 3 Model Bs, isn’t version of Linux, youcan the most powerful computing device available. ‘naturally install any ofthe tens of millions of Linux x86-based software Your elder laptop is probably significantly move powerful, and as currently available, Remember though, only software thet has both an such, you wil be able to play the likes of Minecraft without too [ARM and an x86 version will work on both the Pi version and this much trouble, version of Raspberry PiOS, TT RECOMMENDED SOFTWARE [eothteomueaced Freee a) retro gaming s moreto your tastes, then Software option is also Debian has a huge number of retro available with the version ofthe PIOS. Ths tool allows youto pickand emulators available covering consoles and home computers. You wll choose which of the Piavoured software you can add or remove need legal ROMs, however, to play the games, but these are widely ‘Simply tick the box next tothe name of the app. available From reputable sites som It's easy to use SSH From within the Raspberry Pi Ey ‘OF course, there's also an equally large selection of Configuration tool. Select the Enabled option, then use ‘modem gaming availabe for Debian; most of which a client such PUTTY to SSH into the OS. Here we've enabled SSH _willrun perfectly well under the Pi OSin an x86 environment. Youll, {and have connected from another Windows PC, using PUTTY as need to Google what's available, and try aut afew examples, the lit the SSH client, simply too big to mention. Explore Raspbian Explore Raspbian The Raspbian operating system is a Linux distribution that comes pre-packed with a fantastic collection of programs. and apps to help you get the most from your Pi. Raspbian Cr RUT Cyl) ap mon eeu Rm ace ODL eae eee mW RLM Olmos RR Ue tg ASR a Ue One Me ML eh Ud ie ECR m i mer OM ee me Ure relia Oli Merely 1 Mim URC MUM BOL eee) RUE el] aC) CUm Raspbian allows you to connect to your existing home network, surf the Internet, play music and videos, edit documents, send emails and much more. With a few simple tricks you can easily install more free software that, for instance enables you to edit images and videos or even connect to other computers and control the desktop. BU oem eee aie Ue) ed RSE tricks and hacks you need to take full command of the Raspberry Pi. Skills that you will use time and time again when creating your own Pi projects. 51 Explore Raspbian Take a Tour of PIXEL PIXEL, PIXEL stands for “pi Improved Xwindow Environment, Lightweight". t's lightning fast and energy saving desktop that looks good too. It contains almost everything you'l ever need to work with the Pi ET reiend the PIXEL interfaceisa module that's installed ‘ontop ofthe core OS. thas seen some improvements over the years, and with the release ofthe Pi4 and Raspbian Buster, itnows looks like this. = Fan] You tc that wthinthe Man men, Preah there's a category named Office. Inhere, youlfinda preinstalled sute of programs called bref, thtare Ihcrsat Ofc compatble there's word processor database, ‘drawing, presentation and spreadsheet program. 1 Blower Ss a -aaaeeag PEPE he programs thatcome preinstalled with WB © 5 Raspbian are easily located by clicking on the Raspberry Pilogo in the upper let comer ofthe desktop. Once there, you can select From the sub-menu categories, Followed by the program name. 5 ow as ‘Toview the files stored on your Raspbian OS, lick on the Fle Manager con in the ‘Application Launch Bar (the one that i shaped tke a pair of Files). This ‘opens a window displaying allthe Files in your home directory. The Directory Tree gives quick access to common Folders, suchas Desktop ‘and Documents. Take a Tour of PIXEL @ [ispossbletoremove and addtemstothe (aes Mey Application Menu using the Main Menu Editor. Choose Menu> Preferences» Main Men dtr, ten addr remove ticks next to programs and sections you want to include\excude, Use "Move Up and Move Down to rearrange items in the Menu. CUSTOMISE THE DESKTOP EE {es important that you switch off your Raspberry Pisafely. When youare finished with your Raspberry Psession click Menu > Shutdown, Thvee options appear ‘Shutdown, Reboot, and Logout. Click Shutdown. always walt for the screen to go blank before removing the USB power. or ‘Aswith any other operating system desktop, you're able to customise the Raspberry P's PIXEL interface, making it ore personal and more you. CPATTSN TG Choose Menu > Preferences > Appearance Settings to open the Appearance Settings window. There are four sections: Desktop, Menu Bar, System, and Defaults. You can use these to adjust the various options For your system, such as colours, ayout, and soon. ManuSar | system | Osos Falsceenwihimage © cancel Ok FREY The most common change that of EEL AUR the desktop wallpaper, or desktop ‘background. The default is called ‘Temple’, however, by clicking on ‘temple in the Picture section of the Appearance Settings, you have other images available. Natualy, you can opt For your wn. eens far System | Delete The second tab nthe Appearance Settings window (nee allows you to adjust the menu bar that runs along thetop othe desktop. Youcan changeit se, colour, and even ts lecation rom thetop tothe bottom ofthe screen. Ege se ‘The System tab in the Appearance Settings window will {enable you to change the core system Font, aswell as the ‘mouse cursor size, There are numerous Fontsto choose from and, iF ‘you want, youcan even install your own. WB Explore Raspbian Exploring the Command Line USING TERMINAL Despite its graphical PIX commands. Using the command lines an important part of learning EE ‘By default the Raspberry Pi boots directly into the PIXEL interface. Here you use a visual metaphor, ies, buttons and so on, to make changes to your computer. The command lin is where you controla computer by entering text commands. Click TTerminalin the Menu bar to view the console. S008 +0m w EE You can enter commands into the Terminal to make changes to the computer. Tis works alongside the PIXEL interface. Enter:mkdix Desktop/test older and press return. Notice a new folder appears below the Trash on the desktop. Drag ito trash to getrid oft You can use the Terminal and PIXEL environments alongside each other. 5 OOS 0 Ram interface, Raspbianis a Linux operating sy tem and this means youll spend alot of time working with text ie. Raspber EE ‘Another way to switch to a command line environment isto press Controle and F2, This gets rid oFthe desktop completely and you see just ablack screen with text. This is knownas virtual environment and you'renawin tty (ty" isa throwbackto teletext writers).You'll ned to enter your login name (Cp by default) and password (raspberry"by default) Pi computer EE There are six different virtual environments available, Press Control-AltF3 to switch to the third, ‘and Control AltF4 to go to the Fourth, and so on, You'll need to log conto.each one in the Firs instance but can then jump back and Forth between them, Dee eee ere my eT xploring the Command Line @ Een Press ControlAlt-F1 to return to the PIXEL interface, Ee ‘Some users prefer to use just the command line. One thingto realise is that PIXEL is just a program (Open Menu > Preferences > Raspberry Pi running on top ofthe tty! session. Open Terminaland enter:pkiI2 configuration and choose To CL! and click OK and Yes. The Lxsession. Ouch there goes your desktop. Don't worry, enter: Raspberry Pi will now boot into the command line interface. Enter: ‘starts to gett back again. Most of the time you just enter ‘starts to get backto PIXEL, open Raspberry Pi Configuration and ‘commands intothe Terminal window on top of the PIXEL environment. choose To Desktop to go back to normal SOUEFOR: 7 a = @ OSES & 9 Evens 5 Om & 6 Ee w w 8 OE & O Ee 8 OO & 0 Bike: w w WB Explore Raspbian Setting Up a Static IP Address DHCP RESERVATION Now that you've set up your Raspberry Pi and connected it to the network, ou should take time to ix its IP address. This will makeitalot easier For you to connectto the Raspberry Pi froma Mac or Windows computer and share ils. EE ‘When you connect your Raspberry Pitoa network, the router (or modem/router assigns ita umber, known asits IP (internet Protocol) address. Thisis a block oF Four digits and the Firs three are usually 192.1680. After thatisa digit for each electronic device. EE ‘The router typically takes the First address, soitis usually found at 192,168.01. That numbers reserved forthe router. Often youll find this number on your router marked "web address". The outer then assigns similar IP address numbers to the other devices you own asthey are added to the network, 50 192:168.02 might be your computer, 192.168.03 your smartphone and €O Eee To find out what number your Raspberry Piis using click on the Terminal icon and enter: feonfig and press Return. You should Findit next to “inet add” The challenges thatthe router assigns this number using DHCP (Oynamic Host Configuration Protocol). When the Raspberry Piisunpluggedit reuses the number and your Raspberry Pimay geta different number next time. . 05+ 0 ema EE It's better all-round if you can get the Raspberry Pi to Use the same IP address everytime you connect to the network. You do ths using DHCP Reservation Thisis where you tellyour router to remember the Raspberry Piaddress, and only use that address from now on. Start by opening the Chromium Browser ‘and entering 192,168.01 to connectto your router's web interface. Een We're using a Virgin Broadband router but the processis similar on mast routers, Google the name ‘of your router and "DHCP Reservation” tofind the router you're looking for. Enter your admin password (our default password was listed on the back ofthe router). Click Advanced Settings > DHCP Reservation nthe DHCP Settings section you wil find ll of the devices connected to your network Scroll down and find the one with thesamelP Address listed in Step 3. MANAGING YOUR DHCP DEVICES. Setting Up a Static IP Address @ EE Select the device using the check box on the right and scroll down to the Add Reservation section. t should havefiledin the Device Name, MAC Address and IP Address Fields. IF the Device name is "unknowit change itto "raspberry". Click Add Reservation to ensure it always uses that IP Address. Click Apply to enforce the changes. Now that you have set up a DHCP Reservation, you need to understand how to manage the different devices that may need to use tand connectto the IP Bea ‘Now that you have set up your Raspberry Piwith a DHCP Reservation it will always connectto the router sing that IP Address. You can check this t ay time by entering 4. €configinto terminal. The router always knows that its your Raspberry Pby checking its MAC address. Thisisthe set of six hexadecimal numbers next to HWadd" in ifconfig Een Ifyou decide to free up that IP Address so other DHCP Reservation. Scroll down to the IP Lease Tablet find the Raspberry Pi, Select the checkbox next to it and click Apply and Yes, eons ogi Ez ‘Your Raspberry Pi will till have the same IP Address butitisnt quaranteed to keep it. Restart your Raspberry Piby entering: aude shutdown ~® now into a Terminal window. When ithas restarted enters feontig and you'l find you still Use the same IP Address, Overtime the outer willuse other sits For new devices until it reaches its maximum (255 by default). Thenit wil recycle disconnected devices. Ezz ‘Setting up DHCP Reservation is good practice because it ensures you Raspberry Plis always going to use the same IP Address. ls also a good idea to writ it down or usea label printer to create a label fr the Raspberry Pi. You will need this rhumber to connect to the Raspberry Pivia SH, VPN or FPT (techniques we will use throughout this book) MB Explore Raspbian Connecting to the Pi Remotely REMOTE CONTROL “The Raspberry Ps easy to set up and use in projects around the home and, surprisingly, many of these projects don't need a keyboard, ‘mouse or a monitor, these are known as Headless devices. VNC lets you control a Headless Pi from another computer. toyour Wi router, before you attempt to connect to it remotely ‘Startby licking on the Raspberry Pimenu, then scroll down to Preferences > Raspberry Pi Configuration. so0ms9 G ‘vnc onebuscsoan ice ewe ‘Make a note of the IP Address ofthe Raspberry Pi as detailed inthe left-hand section ofthe VNC Server window; our examples 192.168.1.244. Now clckon the three horizontal ines nthe tp right of the VNC Server window. From the submenuthat appears cick on the Options enty. This will pen a new window pop-up. Connecting to the Pi Remotely om ‘With the Security option highlighted on the left, whale dia aeienetncpced Heal you to entera password, which you will use when connecting remotely from another computer. Enter a password youll member. REMOTE VIEWING ‘Wile silin the Option window, cdkon sUEHE Connections in the left hand pane. In the right hand pane, ensure thatthe Allow Direct VNC Connections Over TCP ticked andthat the Portis set to 5900 usualy is but sometimes it can be unticked iFan update to software has been applied ‘The Piside of things has now been setup, Just remember the P's IP address, and get to your PC or Mactor this next part. Reboot the Pi then disconnect the keyboard, mouse ‘and monitor; but keep the power connected. From your PC or Mac, opena browser and navigate to: hetps//wwvarealune. ‘om/en/connect/download/viewer/. Choose your operating system and click the Download VNC Viewer app. ores uh as were ema wrist satatoneenenete diet bee trnmies Ge oxoheror B utente to VNC Servet ‘sehen aneso0 (cP) (ne NOT your Ret econ ei) cos e (Ctementer pred Foractpsnset Catch app spin Van. Grp spec. ‘eonoieaidtoonfimarwedintstonar Conan adcouieonieleomor es serovervcet ent oyerhapben acing mrccimnadioocee tenes bei inet utc ooe mcs eee rae ton Va ADU Lae the biggest Internet portal, OTL UCU rth eC cy Cee ae eS tm ena aoc ee Unlimited satisfaction one low price Cheap constant access to piping hot media Protect your downloadings from Big brother Safer, than torrent-trackers 18 years of seamless operation and our users' satisfaction PNET 0-53 Te Tae MAW ha oleh) AvaxHome - Your End Place We have everything for all of your needs. Just open https://avxlive.icu WB Explore Raspbian Using APT to Install and Remove Programs ADVANCED PACKAGING TOOL ‘Add / Remove Softwares great For Finding and installing software but most ofthe time you manage apps.on a Raspberry i using a program called APT (Advanced Packaging Tool using the apt command. EE ‘Tomanage the apps on your Raspberry Pi you'll need touse atool included with Raspbian called APT (Advanced Packaging Too)). APT is a command tine tool so you need to either start your Raspberry Piin the command tine or Click on the Terminal ico, 5 Om +0 Bm EE ‘The command used to control packages in Raspbian is apt Type apt into the terminal and press Return to get a description of what the app does. The instructions tell usthat the "most frequently used commands are update and install’. You may also hear about “apt-get” which isan older version ofthe same took It ‘worksin much the same way, 6 OSM 4 6 Bas Eee ‘The command used to add new software to your Raspberry Piisapt install followed by the name ‘of the package you want, However, because apt adds (or removes) files outside of your home directory you need to preface apt withthe word sudo. Almost alof the time you will needto type sudo apt when using thistool CRED EX Bez Beginning a command with “sudo” runs the command asa superuser, "super” meaning the one above your Pi account, rather than one with superhero properties. However iit helps you to think oft that way that's Fine. Soto install anew program youtype:sudo apt install followed by thename ofthe app youwant 0 ODE + 0 Baan Using APT to Install and Remove Programs Ee You're going to installa chess game called Dreamchess. Enter: sudo apt install Games > Dreamchess EE ‘You can use aptcache to search for apps you can install and remove. Enter-apt-eache phgnames to view allthe packages avaliable. Typing apt-cache pkgnanes | Lees enables you to view a page ata time (press any key to scroll, You can use aptcache search to Find packages, enter: apt-cache ‘earch pongto view @ list of Pong games you can instal * OCH * 0 aaa EB © Elpeommn MORE APT COMMANDS ‘The apt commandis also used to EE ‘Sometimes you will try to install an app only to get an. terror thatthe File cannot be Found. Inthis case you need to update apt soit hasthe latest links. Enter sudo apt ‘update This doesn't update the apps you've installed, itjust gets a newer sting of apps. To update your apps to the latest versions enter: sudo apt upgrade. You'lloftenfind both commands rolled into one: sudo apt update & sudo apt upgrade © OCE* 0 Beaman nd delete, any apps: Ear To view the packages you've installed you use @ different command caled dpkg. Enter: dpkg =-get-selections | grep -v deinstall toview all ofthe packages on your Raspberry. Place | less afteritto view one page atatime. Or dpkg ~-gat-selections | grep -v Goinstall > ~/Desktop/packages.txt to savetthelistas a text file on your desktop. 0 OMS 0 eam have installed EEE Packages are uninstalled From your Raspberry Pi using the remove command, Enter; sudo apt: renove dreanchess to start deleting the chess game that you installed An alert saying "Do you want to continue [¥/r]? appears, lenter:y and press Return to delete the program. Es © Beas Ezz Uninstalled packages using apt doesn't remove all ‘of the files. Some are left in case you decide to reinstall the program later. To completely remove a package from your Raspberry Pi use the purge command. Enter: sudo apt: purge dreanchess to remove all ofthe supporting files. You canalso.use sudo apt clean to tidy up your packages and free up some drive space. + © Ee WB Explore Raspbian Get More from the Terminal App CUSTOM TERMINAL The Terminal gives you access tothe command tne, where the real power of the Linux OS lies. Getting used to the Terminals key ‘mastering the Pi and your projects. EE Start Terminal by clicking the Terminal icon in the EE Naming tabs makes them much easier to recognise. ‘Application Launch Bar. You can also start Terminal Choose Tabs > Name Taband enter a name forthe tab by pressing ControtAltT or choosing Menu > Accessories > suchas Home” or ‘Downloads". lick OK to set the name. You can Terminal, Terminal emulates the old style video terminals from __quicly switch between tabs sing Control Page Up and Control Page before desktop interfaces so by default it displays bright (mostly Down and rearrange them using the Tabs Move Tab Left/ Move Tab green) on a black background Right options aso 368 O ERiewnn EEEREID Te Fistttos most score overtook sth bity ATAPI Ciose Et referencesto pesos the ook nd torun multiple terminals at once indifferent tabs BED coer reors cere cow File > New Tab (Shif-Contro-T) to create a new tab. Background and drag the Opacity slider tothe halFway pont. This Navigating multiple directories simultaneously can be a challenge _enablesyou to view through te terminal background and see the in Terminal and tabs makes it that much easier. windows below. You can also personals the colour of the background. Ee While stilin Preferences lick the Display tab. Here you canadjust the Tab panel postions, pacing them on the Left makes them more prominent. You can also ajustthescrll-back line count. Thisisthe numberof lines you can scroll up with using the ‘mouse, not the history accessed by the Up and Down arows, t CONNECT USING SSH Usea different computer to control your Raspberry Pi EE IF you have your Raspberry Pi on the same network a5 @ Macor Linux-based computer, ou can control Using the Terminal program on that computer, We're going to use Terminal in macOS here but the process isthe same on a Linux ‘machine, Open the Terminal app on your computer, Get More from the Terminal App @ EE IF you prefer a more minimalist approach try moving the ‘Tabsto the bottom and selecting the Hide scrollbar, Hide menu bar and Hide Clase button options When combined witha low opacity background this makes Fora subtle terminal window You can sill access menu settings using a rightclick onthe mouse. EE Switch back to Terminal on your Mac or Linux machine and enter: eh pi@192.168.0.178 (using your own IP address). The “pi bits the name of the default ‘ser account, so iFyou have changed that it needs to match your user account on the Raspberry Pi. You'll be asked for a password, Thisis the password that you use to log in tothe Raspberry Pi (not ‘your Mac or Linux computer). Enter config into the Terminal app on your Raspberry i. This wil et you know which IP address itis using, Look fr the Four blocks oF digits Following “inet adc: They should begin with 192.168.0 Followed by a three-digit number, (Ours is 192.168.0.179, You need to use that number in Terminal on your Mac to connect. EE ‘You are now logged in to your Raspberry Pi and ‘can enter commands directly into the Terminal on your Mac or Linux computer. Unlike remote networking you don't see the commands being entered on the screen of the Raspberry Pi, you are accessing the computer from behind the scenes. Many people prefer to set up the Raspberry Piso they can control it froma more powerful computer. Enter: exit to close the connection.

You might also like