Internet of Things Programming Projects - Colin Dow - E-Book

Internet of Things Programming Projects E-Book

Colin Dow

0,0
31,19 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.
Mehr erfahren.
Beschreibung

The Internet of Things (IOT) has managed to attract the attention of researchers and tech enthusiasts, since it powerfully combines classical networks with instruments and devices.
In Internet of Things Programming Projects, we unleash the power of Raspberry Pi and Python to create engaging projects. In the first part of the book, you’ll be introduced to the Raspberry Pi, learn how to set it up, and then jump right into Python programming. Then, you’ll dive into real-world computing by creating a“Hello World” app using flash LEDs.
As you make your way through the chapters, you’ll go back to an age when analog needle meters ruled the world of data display. You’ll learn to retrieve weather data from a web service and display it on an analog needle meter, and build a home security system using the Raspberry Pi. The next project has a modern twist, where we employ the Raspberry Pi to send a signal to a web service that will send you a text when someone is at the door. In the final project, you take what you've learned from the previous two projects and create an IoT robot car that you can use to monitor what your pets are up to when you are away.
By the end of this book, you will be well versed in almost every possible way to make your IoT projects stand out.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 334

Veröffentlichungsjahr: 2018

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Internet of Things Programming Projects
Build modern IoT solutions with the Raspberry Pi 3 and Python
Colin Dow

BIRMINGHAM - MUMBAI

Internet of Things Programming Projects

Copyright © 2018 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Commissioning Editor: Vijin BorichaAcquisition Editor:Prachi BishtContent Development Editor:Deepti ThoreTechnical Editor:Varsha ShivhareCopy Editor:Safis EditingProject Coordinator:Kinjal BariProofreader: Safis EditingIndexer: Mariammal ChettiyarGraphics:Jisha ChirayilProduction Coordinator: Aparna Bhagat

First published: October 2018

Production reference: 1301018

Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.

ISBN 978-1-78913-480-3

www.packtpub.com

mapt.io

Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.

Why subscribe?

Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals

Improve your learning with Skill Plans built especially for you

Get a free eBook or video every month

Mapt is fully searchable

Copy and paste, print, and bookmark content

Packt.com

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.

At www.packt.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.

Contributors

About the author

Colin Dow is the owner and chief engineer of Sigma Rockets and Aerospace Inc., a model aerospace business. He has enjoyed working with numerous educational facilities and hobbyists in delivering product sales, presentations, and aerospace workshops over the years.

Colin has extensive experience of creating website content, educational documentation, and instructional videos.

He has been a programmer since early home computers first caught his eye. He has worked as a software developer for some of Canada's largest companies, using technologies such as Python, Java, J2EE, PHP, Pearl, Ruby on Rails, Apache, and SOAP web services.

I would like to thank my wife Constance for her encouragement, support and assistance; and my sons Maximillian and Jackson for their inspiration and optimism. I am forever grateful to them for this unique opportunity.
I would also like to thank Deepti Thore and Varsha Shivhare at Packt for their guidance and expertise throughout the whole process. Without their assistance and patience this book would not have been possible.

About the reviewer

Arvind Ravulavaru is a platform architect at Ubiconn IoT Solutions, with over 9 years of experience of software development and 2 years experience of hardware and product development. For the last 5 years, he has been working extensively on JavaScript, both on the server side and the client side. Over the past couple of years, his focus has been on IoT, building a platform for rapidly developing IoT solutions named The IoT Suitcase. Prior to that, Arvind worked on big data, cloud computing, and orchestration.

Packt is searching for authors like you

If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.

Table of Contents

Title Page

Copyright and Credits

Internet of Things Programming Projects

Packt Upsell

Why subscribe?

Packt.com

Contributors

About the author

About the reviewer

Packt is searching for authors like you

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Download the color images

Conventions used

Get in touch

Reviews

Installing Raspbian on the Raspberry Pi

A brief history of the Raspberry Pi

A look at operating systems for the Raspberry Pi

Project overview

Getting started

Installing the Raspbian OS

Formatting a microSD card for Raspbian

Copying the NOOBS files to the microSD RAM

Running the installer

A quick overview of the Raspbian OS

The Chromium web browser

The home folder

The Terminal

Mathematica

Sonic Pi

Scratch and Scratch 2.0

LibreOffice

Summary

Questions

Further reading

Writing Python Programs Using Raspberry Pi

Project overview

Technical requirements

Python tools for Raspberry Pi

The Terminal

Integrated Development and Learning Environment

Thonny

Using the Python command line

Writing a simple Python program

Creating the class

Creating the object

Using the object inspector

Testing your class

Making the code flexible

Example one

Example two

Summary

Questions

Further reading

Using the GPIO to Connect to the Outside World

Project overview

Technical requirements

Python libraries for the Raspberry Pi

picamera

Pillow

sense-hat and sense-emu

Accessing Raspberry Pi's GPIO

Pibrella

RPi.GPIO

GPIO zero

Setting up the circuit

Fritzing

Building our circuit

Hello LED

Blink LED using gpiozero

Morse code weather data

Summary

Questions

Further reading

Subscribing to Web Services

Prerequisites

Project overview

Getting started

Cloud services for IoT

Amazon Web Services IoT

IBM Watson platform

Google Cloud platform

Microsoft Azure

Weather Underground

A basic Python program to pull data from the cloud

Accessing the web service

Using the Sense HAT Emulator

Summary

Questions

Further reading

Controlling a Servo with Python

Knowledge required to complete this chapter

Project overview

Getting started

Wiring up a servo motor to the Raspberry Pi

Stepper motors

DC motors

Servo motors

Connecting the servo motor to our Raspberry Pi

Control the servo through the command line

Write a Python program to control the servo

Summary

Questions

Further reading

Working with the Servo Control Code to Control an Analog Device

Knowledge required to complete this chapter

Project overview

Getting started

Accessing weather data from the cloud

Controlling the servo using weather data

Correcting for servo range

Changing the position of the servo based on weather data

Enhancing our project

Printing out the main graphic

Adding the needle and LED

Summary

Questions

Further reading

Setting Up a Raspberry Pi Web Server

Knowledge required to complete this chapter

Project overview

Getting started

Introducing CherryPy – a minimalist Python web framework

What is CherryPy?

Who uses CherryPy?

Installing CherryPy

Creating a simple web page using CherryPy

Hello Raspberry Pi!

Say hello to myFriend

What about static pages?

HTML weather dashboard

Summary

Questions

Further reading

Reading Raspberry Pi GPIO Sensor Data Using Python

Project overview

Getting started

Reading the state of a button

Using GPIO Zero with a button

Using the Sense HAT emulator and GPIO Zero button together

Toggling an LED with a long button press

Reading the state from an infrared motion sensor

What is a PIR sensor?

Using the GPIO Zero buzzer class

Building a basic alarm system

Modifying Hello LED using infrared sensor

Configuring a distance sensor

Taking Hello LED to another level

Summary

Questions

Further reading

Building a Home Security Dashboard

Knowledge required to complete this chapter

Project overview

Getting started

Creating our dashboard using CherryPy

Using the DHT11 to find temperature and humidity

Using the Pi camera to take a photo

Creating our dashboard using CherryPy

Displaying sensory data on our dashboard

Home security dashboard with a temperature sensor

Home security dashboard with quick response

Summary

Questions

Further reading

Publishing to Web Services

Project overview

Getting started

Publishing sensory data to cloud-based services

Install the MQTT library

Set up an account and create a device

Reading sensory data and publishing to ThingsBoard

Creating a dashboard in ThingsBoard

Sharing your dashboard with a friend

Setting up an account for text message transmission

Setting up a Twilio account

Installing Twilio on our Raspberry Pi

Sending a text through Twilio

Creating a new home security dashboard

Summary

Questions

Further reading

Creating a Doorbell Button Using Bluetooth

Project overview

Getting started

Introducing Blue Dot

Installing the bluedot library on the Raspberry Pi

Pairing Blue Dot with your Raspberry Pi

Wiring up our circuit

What is an RGB LED?

Testing our RGB LED

Completing our doorbell circuit

Reading our button state using Bluetooth and Python

Reading button information using Python

Creating a Bluetooth doorbell

Creating a secret Bluetooth doorbell

Summary

Questions

Further reading

Enhancing Our IoT Doorbell

Project overview

Getting started

Sending a text message when someone is at the door

Creating a simple doorbell application with text messaging

Creating a secret doorbell application with text messaging

Summary

Questions

Further reading

Introducing the Raspberry Pi Robot Car

The parts of the robot car

Building the robot car

Step 1 – Adafruit 16-Channel PWM/Servo HAT for Raspberry Pi

Step 2 – Wiring up the motors

Step 3 – Assembling the servo camera mount

Step 4 – Attaching the head

Step 5 – Assembling the DC motor plate

Step 6 – Attaching the motors and wheels

Step 7 – Wiring up the motors

Step 8 – Attaching the camera mount, Raspberry Pi, and Adafruit servo board

Step 9 – Attaching the buzzer and voltage divider

Step 10 – Wiring up T.A.R.A.S

Learning how to control the robot car

Configuring our Raspberry Pi

Python library for Adafruit Servo HAT

Summary

Questions

Controlling the Robot Car Using Python

Knowledge required to complete this chapter

Project overview

Getting started

Taking a look at the Python code

Controlling the drive wheels of the robot car

Moving the servos on the robot car

Taking a picture

Making a beep noise

Making the LEDs blink

Modifying the robot car Python code

Move the wheels

Move the head

Make sounds

Enhancing the code

Stitching our code together

Summary

Questions

Further reading

Connecting Sensory Inputs from the Robot Car to the Web

Knowledge required to complete this chapter

Project overview

Getting started

Identifying the sensor on the robot car

Taking a closer look at the HC-SR04

Reading robot car sensory data with Python

Publishing robot car sensory data to the cloud

Create a ThingsBoard device

Summary

Questions

Further reading

Controlling the Robot Car with Web Service Calls

Knowledge required to complete this chapter

Project overview

Technical requirements

Reading the robot car's data from the cloud

Changing the look of the distance gauge

Changing the range on the distance gauge

Viewing the dashboard outside of your account

Using a Python program to control a robot car through the cloud

Adding a switch to our dashboard

Controlling the green LED on T.A.R.A.S

Using the internet to make T.A.R.A.S dance

Summary

Questions

Further reading

Building the JavaScript Client

Project overview

Getting started

Introducing JavaScript cloud libraries

Google Cloud

AWS SDK for JavaScript

Eclipse Paho JavaScript client

Connecting to cloud services using JavaScript

Setting up a CloudMQTT account

Setting up an MQTT Broker instance

Writing the JavaScript client code

Running the code

Understanding the JavaScript code

Publishing MQTT messages from our Raspberry Pi

Summary

Questions

Further reading

Putting It All Together

Project overview

Getting started

Building a JavaScript client to connect to our Raspberry Pi

Writing the HTML code

Writing the JavaScript code to communicate with our MQTT Broker

Creating a JavaScript client to access our robot car's sensory data

Writing the code for T.A.R.A.S

Livestreaming videos from T.A.R.A.S

Enhancing our JavaScript client to control our robot car

Nipple.js

HTML5 Gamepad API

Johnny-Five

Summary

Questions

Further reading

Assessments

Chapter 1

Chapter 2

Chapter 3

Chapter 4

Chapter 5

Chapter 6

Chapter 7

Chapter 8

Chapter 9

Chapter 10

Chapter 11

Chapter 12

Chapter 13

Chapter 14

Chapter 15

Chapter 16

Chapter 17

Chapter 18

Other Books You May Enjoy

Leave a review - let other readers know what you think

Preface

The Internet of Things (IoT) promises to unlock the real world the way that the internet unlocked millions of computers just a few decades ago. First released in 2012, the Raspberry Pi computer has taken the world by storm. Originally designed to give newer generations the same excitement to programming that personal computers from the 1980s did, the Raspberry Pi has gone on to be a staple of millions of makers everywhere.

In 1991, Guido van Rossum introduced the world to the Python programming language. Python is a terse language and was designed for code readability.Python programs tend to require fewer lines of code than other programming languages.Python is a scalable language that can be used for anything from the simplest programs to massive large-scale projects.

In this book, we will unleash the power of Raspberry Pi and Python to create exciting IoT projects.

The first part of the book introduces the reader to the amazing Raspberry Pi. We will learn how to set it up and jump right into Python programming. We will start our foray into real-world computing by creating the "Hello World" app for physical computing, the flashing LED.

Our first project takes us back to an age when analog needle meters ruled the world of data display. Think back to those old analog multimeters and endless old sci-fi movies where information was controlled and displayed with buttons and big flashing lights. In our project, we will retrieve weather data from a web service and display it on an analog needle meter. We will accomplish this using a servo motor connected to our Raspberry Pi through the GPIO.

Home security systems are pretty much ubiquitous in modern life.Entire industries and careers are based on the installation and monitoring of them.Did you know that you could easily create your own home security system? In our second project, we do just that, as we build a home security system using Raspberry Pi as a web server to display it.

The humble doorbell has been with us since 1831. In our third project, we will give it a 21st century twist and have our Raspberry Pi send a signal to a web service that will text us when someone is at the door.

In our final project, we take what we've learned from our previous two projects and create an IoT robot car we call T.A.R.A.S (This Amazing Raspberry-Pi Automated Security Agent).

In years to come, driverless cars will become the rule instead of the exception, and ways of controlling these cars will be needed. This final project gives the reader insight and knowledge into how someone would go about controlling cars devoid of a human driver.

Who this book is for

This book is geared toward those who have had some sort of exposure to programming and are interested in learning about the IoT. Knowledge of the Python programming language would be a definite asset. An understanding of, or a keen interest in, object-oriented programming will serve the reader well with the coding examples used in the book.

What this book covers

Chapter 1, Installing Raspbian on the Raspberry Pi, sets us off on our Raspberry Pi IoT journey by installing the Raspbian OS on our Raspberry Pi. We will then take a look at some of the programs that come pre-installed with Raspbian.

Chapter 2, Writing Python Programs Using Raspberry Pi, covers how Windows, macOS, and Linux are operating systems that are familiar to developers. Many a book on developing the Raspberry Pi involves using one of these operating systems and accessing the Raspberry Pi remotely. We will take a different approach in this book. We will use our Raspberry Pi as a development machine. In this chapter, we will get our feet wet with using the Raspberry Pi as a development machine.

Chapter 3, Using the GPIO to Connect to the Outside World, explains how, if the Raspberry Pi was just a $35 computer, that would be enough for many of us. However, the real power behind the Raspberry Pi is the ability of the developer to access the outside world through the use of the General Purpose Input Output (GPIO) pins. In this chapter, we will delve into the GPIO and start to connect the Raspberry Pi to the real world. We will create a Morse code generator for our project using an outside LED and then use this generator to blink out simulated weather information.

Chapter 4, Subscribing to Web Services,explores a few web services offered by some of the biggest companies in the world. Our project will use the virtual version of the Raspberry Pi Sense HAT as a ticker to display current weather information from the Yahoo! Weather web service.

Chapter 5, Controlling a Servo with Python,introduces the concept of creating an analog meter needle using a servo motor connected to the Raspberry Pi.

Chapter 6,Working with the Servo Control Code to Control an Analog Device, continues the theme of working with servo motors as we build our first real IoT device, a weather dashboard. Not only will this weather dashboard feature an analog needle; it will use the needle to point to a picture of a suggested wardrobe based on the weather conditions.

Chapter 7, Setting Up a Raspberry Pi Web Server,goes into how to install and configure the web framework CherryPy. We will conclude the chapter by building a local website that displays weather information.

Chapter 8, Reading Raspberry Pi GPIO Sensor Data Using Python,covers how to read the state of a button before moving on to a PIR sensor and distance sensor. We will conclude the chapter by building simple alarm systems.

Chapter 9, Building a Home Security Dashboard, explains how to build a home security dashboard using the Raspberry Pi as a web server serving up HTML content containing sensory data collected from the GPIO.

Chapter 10,Publishing to Web Services,goes into how to measure room temperature and humidity and publish these values to the web through the use of an IoT dashboard. We will also set up and run a text messaging alert using the service Twilio.

Chapter 11,Creating a Doorbell Button Using Bluetooth, turns our focus to using Bluetooth in this chapter. Bluetooth is a wireless technology that allows for transmission of data over short distances. For our project we will explore the BlueDot app from the Android Play Store. We will use this app to build a simple Bluetooth connected doorbell.

Chapter 12,Enhancing Our IoT Doorbell, will take the simple doorbell we created in Chapter 11, Creating a Doorbell Button Using Bluetooth, and turn it into an IoT doorbell using the knowledge we learned in Chapter 10, Publishing to Web Services.

Chapter 13,Introducing the Raspberry Pi Robot Car, starts us off on our journey into the IoT robot car by introducing This Amazing Raspberry-Pi Automated Security Agent (T.A.R.A.S). This chapter will begin by outlining the components we need to build T.A.R.A.S and then we will proceed to putting it all together.

Chapter 14,Controlling the Robot Car Using Python, goes into how to write Python code for our robot car. We will utilize the GPIO Zero library to make the car wheels move forward, move the servo motors holding the camera, and light up the LEDs at the back of the robot car.

Chapter 15,Connecting Sensory Inputs from the Robot Car to the Web, helps us understand that in order to turn our robot car into a true IoT device we have to connect it to the internet. In this chapter we will connect the distance sensor from our robot car to the internet.

Chapter 16,Controlling the Robot Car with Web Service Calls, continues to turn our robot car into an Internet of Things device by taking a deeper look at the internet dashboard we created for the robot car.

Chapter 17,Building the JavaScript Client,moves our attention away from Python, switching our focus to JavaScript instead. We will use JavaScript to build a web-based client that communicates over the internet using the MQTT protocol.

Chapter 18,Putting It All Together, covers how we will connect our robot car, T.A.R.A.S, to a JavaScript client, and control it over the internet using the MQTT protocol.

To get the most out of this book

To get the most out of this book, I will assume the following:

You have purchased, or will purchase, a Raspberry Pi Computer, preferably a 2015 model or newer.

You have had some exposure to the Python programming language, or are eager to learn it.

You have a basic familiarity with electronic components and how to use a breadboard.

You have purchased, or are willing to purchase, basic electronic components.

In terms of hardware requirements, you will need at least the following:

A Raspberry Pi Model 3 (2015 model or newer)

A USB power supply

A computer monitor

A USB keyboard

A USB mouse

A microSD RAM card

A breadboard and breadboard jumpers

Additional pieces of hardware will be introduced at the beginning of every chapter.

In terms of software requirements, you will require the Raspberry Pi NOOBS image (https://www.raspberrypi.org/downloads/noobs/). Additional software, accounts, and Python packages will be presented along the way. Any piece of software, web service, or Python package we use in this book is free of charge.

Download the example code files

You can download the example code files for this book from your account atwww.packt.com. If you purchased this book elsewhere, you can visitwww.packt.com/supportand register to have the files emailed directly to you.

You can download the code files by following these steps:

Log in or register at

www.packt.com

.

Select the

SUPPORT

tab.

Click on

Code Downloads & Errata

.

Enter the name of the book in the

Search

box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

WinRAR/7-Zip for Windows

Zipeg/iZip/UnRarX for Mac

7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Internet-of-Things-Programming-Projects. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available athttps://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here:https://www.packtpub.com/sites/default/files/downloads/9781789134803_ColorImages.pdf.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book,mention the book title in the subject of your message and email us [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visitwww.packt.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us [email protected] a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in, and you are interested in either writing or contributing to a book, please visitauthors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packt.com.

Installing Raspbian on the Raspberry Pi

The Raspberry Pi is marketed as a small and affordable computer that you can use to learn programming. At least that was its initial goal. As we will see in this book, it is much more than that.

The following topics will be covered in this chapter:

A brief history of the Raspberry Pi

A look at operating systems for the Raspberry Pi

Installing the Raspbian OS

A quick overview of the Raspbian OS

A brief history of the Raspberry Pi

First released in 2012, the first Raspberry Pi featured a 700 MHz single core processor and 256 MB of RAM. The Raspberry Pi 2was released in February of 2015 with a 900 MHz quad core processor and 1 GB of RAM. Released in February of 2016, the Raspberry Pi 3 increased the processor speed to 1.2 GHz.This model was also the first one to include wireless LAN and Bluetooth.

Here is an image of a Raspberry Pi 3 B (2015):

This version of the Raspberry Pi features the following parts:

Four USB 2 ports

A LAN port

A 3.5 mm composite video and audio jack

An HDMI port for video and audio

An OTG USB port (which we will use to connect the power)

A microSD slot (to hold our operating system)

A DSI display port for the Raspberry Pi touchscreen

A

General Purpose Input Output

(

GPIO

) pins

A camera port for a special Raspberry Pi camera

The Raspberry Pi Zero was released in November of 2015. Here is an image of it:

Although not as powerful as the previous Raspberry Pis, the Zero featured a smaller size (65 mm X 30 mm), perfect for projects with limited physical space (namely, wearable projects). Plus, the Raspberry Pi zero was priced at $5 USD, making it very affordable.The Raspberry Pi zero W was released on February 28, 2017 at double the price ($10 USD) with built-in Wi-Fi and Bluetooth capabilities.

The latest model, as of the time of writing, is the Raspberry Pi 3 B+, which was released on March 14, 2018.The processor speed has been upgraded to 1.4 GHz as well as the wireless LAN now supporting both 2.4 GHz and 5 GHz bands.Another upgrade is theaddition of Bluetooth low energy, a technology built for applications that do not require large amounts of data to be exchanged but are required to have a long battery life.

Creators of the Raspberry Pi initially believed that they would sell at most 1,000 units.Little did they know that their invention would explode in popularity.As of March 2018, sales of Raspberry Pi computers has passed the 19 million mark.

A look at operating systems for the Raspberry Pi

There are various operating systems (or system images) that may be installed on the Raspberry Pi. These range from application-specific operating systems, such as audio players, to various general purpose operating systems.The power behind Raspberry Pi is the way it can be used for various applications and projects.

The following is a list of just a few of the operating systems (system images) available for the Raspberry Pi:

Volumio

:Do you have a desire to set up a networked audio system where you access your music list using a computer or cell phone?

Volumio may be what you are looking for.

Installing it on a Raspberry Pi creates a headless audio player (a system that does not require a keyboard and mouse) that connects to your audio files either over USB or a network.

A special audio

Hardware Added on Top

(

HAT

)

may be added to your Pi to provide a pristine audio connection to an amplifier and speakers.

There is even a plugin to add Spotify so that you can set up your Raspberry Pi to access this service and play music over your sound system.

PiFM radio transmitter

: The PiFM radio transmitter

turns your Raspberry Pi into an FM transmitter, which you can use to send audio files over the air to a standard FM radio receiver. Using a simple wire connected to one of the GPIO pins (we will learn more about GPIO later), you can create an antenna for the transmitted FM signal, which is surprisingly strong.

Stratux

: ADS-B is the new standard in aviation where geo-location and weather information are shared with ground controllers and pilots.

The Stratux image with additional hardware turns the Raspberry Pi into an ADS-B receiver of this information.

RetroPie

: RetroPie turns your Raspberry Pi into a retro game console by emulating gaming consoles and computers from the past.

Some of the emulations include Amiga, Apple II, Atari 2600, and the Nintendo Entertainment System of the early 1980s.

OctoPi

: OctoPi turns your Raspberry Pi into a server for your 3D printer.

Through OctoPi, you may control your 3D printer over the network, including viewing the status of your 3D printer using a webcam.

NOOBS

: This is arguably the easiest way to install an operating system on the Raspberry Pi.

NOOBS stands for New Out-Of-the Box Software, and we will be using NOOBS to install Raspbian.

Project overview

In this project, we will install the Raspbian operating system onto our Raspberry Pi. After installation, we will take a quick tour of the operating system to familiarize ourselves with it. We will start by formatting a microSD card to store our installation files. We will then run the installation from the microSD card. After Raspbian has been installed, we will take a quick look at it in order to familiarize ourselves with it.

This project should take about two hours to complete, as we install the Raspbian operating system and take a quick look at it.

Getting started

The following is required to complete this project:

A Raspberry Pi Model 3 (2015 model or newer)

A USB power supply

A computer monitor

A USB keyboard

A USB mouse

A microSD RAM card

A Raspberry Pi NOOBS image (

https://www.raspberrypi.org/downloads/noobs/

)

Installing the Raspbian OS

The Raspbian OS is considered the default or go-to operating system for the Raspberry Pi. In this section, we will install Raspbian using the NOOBS image.

Formatting a microSD card for Raspbian

Raspberry Pi uses a microSD card to store the operating system.This allows you to easily switch between different operating systems (system images) for your Raspberry Pi.We will be installing the default Raspbian OS for our projects using the NOOBS image.

Start by inserting the microSD card into a USB adapter and plug it into your computer:

You may need to format the microSD card.If so, use the utilities appropriate for your computer's operating system to format the card to FAT32. It is recommended that you use a card with a capacity of 8 GB or greater.For Windows OS and cards with 64 GB of capacity or greater, a third-party tool such as FAT32 format should be used for formatting.

Copying the NOOBS files to the microSD RAM

Unzip the NOOBS image that you downloaded. Open up the unzipped directory and drag the files over to the microSD card.

The files should look the same as in the following screenshot:

Running the installer

We will now install Raspbian on our Raspberry Pi. This step should be familiar to those that have previous experience installing operating systems such as Windows or macOS. The Raspbian operating system will be installed and will run off of our microSD card.

To install Raspbian onto our microSD card, do the following:

Start by inserting the microSD card into the appropriate slot on the Raspberry Pi. Be sure to install it so that the label side (opposite side of the exposed contacts) is facing up. Insert it with the metal contacts facing the board.The microSD card should have a slight ridge at the top of the label side, which is good for easy removal using a fingernail.

Insert a keyboard and mouse into the USB slots on the side, a monitor into the HDMI port, and lastly, a USB power cable into the power port.

The Raspberry Pi does not have an on/off switch and will power up as soon as the power cable is connected:

After an initial black screen with rolling white text, you should see the following dialog:

In the previous screenshot, we clicked on the

Language

option. For our purposes, we will keep the default of

English (UK)

. We will also keep the keyboard at the standard

gb

.

As the Raspberry Pi 3 has wireless LAN, we can set up our Wi-Fi (for older boards, please plug a Wi-Fi dongle into a USB port or use the wired LAN port and skip the next step):

Click on the

Wifi networks (w)

button. Choose the

Authentication method

using the radio buttons.Some routers are

equipped with a

WPS

button that allows you to connect directly to the router.To use the

password

method, choose the

Password authentication

radio button and enter the password for your network.

After connecting to your network, you will notice that there are now more operating system options to select

from

:

We will go with the top option,

Raspbian

. Check the box beside

Raspbian [RECOMMENDED]

and then click on the

Install (i)

button at the top-left corner of the dialog. Raspbian will start installing on your Raspberry Pi. You will see a progress bar with previous graphics, describing various features of the Raspbian operating system:

After the progress bar hits 100%, the

computer will reboot and you will see a screen with text before the default desktop loads

up:

A quick overview of the Raspbian OS

The Raspbian desktop is similar to the desktops of other operating systems such as Windows and macOS.Clicking the top-left button drops down the application menu where you may access the various pre-installed programs. We may also shut down theRaspberry Pi from this menu:

The Chromium web browser

The second button from the left loads the Google Chromium web browser for the Raspberry Pi:

The Chromium browser is a lightweight browser that runs remarkably well on the Raspberry Pi:

The home folder

The two-folders button opens up a window showing the home folder:

The home folder is a great place to start when looking for files on your Raspberry Pi. In fact, when you take screenshots using either thescrotcommand or thePrintScreenbutton, the file is automatically stored in this folder:

The Terminal

The third button from the left opens up the Terminal. The Terminal permits command-line access to Raspberry Pi's filesand programs:

It is from the command line where you may update the Raspberry Pi using thesudo apt-get updateandsudo apt-get dist-upgrade commands.

apt-getupdates the packages list, andapt-get dist-upgradeupdates the packages:

It's a good idea to run both of these commands right after installing Raspbian using thesudocommand. The default user for Raspbian on the Raspberry Pi ispi, which is part of the Super Users group in Raspbian, and thus must use thesudocommand (the default password for thepiuser israspberry):

Mastering the command line is a virtue that many a programmer aspires to acquire. Being able to rapidly type command after command looks so cool that even movie makers have picked up on it (when was the last time you saw the computer wiz in a movie clicking around the screen with a mouse?). To assist you in becoming this uber cool computer wiz, here are some basic Raspbian commands for you to master using the Terminal:ls: Command to see the contents of the current directorycd: Command to change directories. For example, use cd to move up a directory from where you currently arepwd: Command to display the directory you are currently insudo: Allows the user to perform a task as the super usershutdown