๐”– Scriptorium
โœฆ   LIBER   โœฆ

๐Ÿ“

Learning Python with Raspberry Pi

โœ Scribed by Dogan Ibrahim


Publisher
Elektor Publication
Year
2019
Tongue
English
Leaves
284
Category
Library

โฌ‡  Acquire This Volume

No coin nor oath required. For personal study only.

โœฆ Synopsis


This book is about teaching the Python programming language using the Raspberry Pi 4 computer. The book makes an introduction to Raspberry Pi 4 and then teaches Python with the topics: variables, strings, arrays, matrices, tuples, lists, dictionaries, user functions, flow of control, printing, keyboard input, graphics, GUI, object oriented programming and many more topics.

The book is aimed for beginners, students, practising engineers, hobbyists, and for anyone else who may want to learn to program in Python.

The book includes many example programs and case studies. All the example programs and case studies have been tested fully by the author and are all working. The example programs aim to teach the various programming concepts of Python. The case studies cover the use of Python in the analysis and design of electronic circuits. Some of the case study topics are:

  • Resistor colour code identification
  • Resistive potential divider circuits
  • Resistive attenuator design
  • Zener diode voltage regulator design
  • RC and RLC transient circuits
  • Circuit frequency response
  • Saving data on external memory stick
  • Mesh and node circuit analysis using matrices
  • Resonance in RLC circuits
  • Transistor Biasing analysis
  • Transistor amplifier design
  • Design of active filters
  • Interfacing hardware with GPIO, IยฒC and SPI
  • Using Wi-Fi with Python and TCP/IP and UDP programs
  • Using Bluetooth from Python

Full program listings of all the programs used in the book are available at the Elektor website of the book. Readers should be able just to copy and use these programs in their Raspberry Pi projects without any modifications.

โœฆ Table of Contents


Contents
Preface
Chapter 1 โ€ข Raspberry Pi 4
1.1 Overview
1.2 Parts of the Raspberry Pi 4
1.3 Requirements of the Raspberry Pi 4
1.3.1 Setup Option 1
1.3.2 Setup Option 2
1.4 Summary
Chapter 2 โ€ข Setting up the Raspberry Pi 4
2.1 Overview
2.2 Installation Steps
2.3 Powering Up your Raspberry Pi 4
2.4 Remote Access
2.4.1 Configuring the Putty
2.5 Remote Access of the Desktop
2.6 Summary
Chapter 3 โ€ข Using the Command Line
3.1 Overview
3.2 The Raspberry Pi Directory Structure
3.3 File Permissions
3.4 Help
3.5 Date, Time, and Calendar
3.6 File Operations
3.7 System and User Information
3.8 Resource Monitoring on Raspberry Pi
3.9 Shutting Down
Chapter 4 โ€ข Using a Text Editor in Command Mode
4.1 nano Text Editor
4.2 Summary
Chapter 5 โ€ข Creating and Running a Python Program
5.1 Overview
5.2 Method 1 โ€“ Interactively from Command Prompt
5.3 Method 2 โ€“ Create a Python File in Command Mode
5.4 Method 3 โ€“ Create a Python File in GUI mode
5.5 Which Method?
5.6 Summary
Chapter 6 โ€ข Python Programming
6.1 Overview
6.2 Variable Names
6.3 Reserved Words
6.4 Comments
6.5 Line Continuation
6.6 Blank Lines
6.7 More Than One Statement on a Line
6.8 Indentation
6.9 Python Data Types
6.10 Numbers
6.11 Strings
6.11.1 String Functions
6.11.2 Escape Sequences
6.12 Print Statement
6.13 List Variables
6.13.1 List Functions
6.14 Tuple Variables
6.15 Dictionary Variables
6.15.1 Dictionary Functions
6.16 Keyboard Input
6.17 Comparison Operators
6.18 Logical Operators
6.19 Assignment Operators
6.20 Control of Flow
6.20.1 if, if..else, and elif
6.20.2 for Statement
6.20.3 while Statement
6.20.4 continue Statement
6.20.5 break Statement
6.20.6 pass Statement
6.21 Case Study 1 โ€“ 4 Band Resistor Colour Code Identifier
6.22 Case Study 2 โ€“ 4 Band Resistor Colour Code Identifier Including Small Resistors
6.23 Case Study 3 โ€“ Series or Parallel Resistors
6.24 Case Study 4 - Resistive Potential Divider
6.25 Trigonometric Functions
6.26 User-defined Functions
6.27 Example Programs
6.28 Case Study 5 - Resistive Attenuator Design โ€“ Equal Source & Load
Resistances
6.29 Case Study 6 - Resistive Attenuator Design โ€“ Unequal Source & Load Resistances
6.30 Recursive Functions
6.31 Exceptions
6.31.1 try/final Exceptions
6.32 Case Study 7 โ€“ Zener Diode Based Voltage Regulator
6.33 Date and Time
6.34 Creating Our Own Modules
6.35 Summary
Chapter 7 โ€ข Plotting Graphs with Python
7.1 Overview
7.2 The Matplotlib Graph Plotting Library
7.3 Case Study 8 โ€“ RC Transient Circuit Analysis - Charging
7.4 Case Study 9 โ€“ RC Transient Circuit Analysis - Discharging
7.5 Transient RL Circuits
7.6 Case Study 10 โ€“ RCL Transient Circuit Analysis
7.7 Summary
Chapter 8 โ€ข Files in Python with the Raspberry Pi
8.1 Overview
8.2 Python File Operations
8.3 Case Study 11 โ€“ RC Circuit Frequency Response
8.4 Case Study 12 โ€“ Save Raspberry Pi 4 CPU Temperature in a File
8.5 Saving Data on an External USB Memory Stick
8.6 Case Study 13 โ€“ Save Raspberry Pi 4 CPU Temperature on Memory Stick
8.7 Summary
Chapter 9 โ€ข Array and Matrix Operations with Python
9.1 Overview
9.2 Arrays
9.2.1 Array Operations and Functions
9.2.2 Array Multiplication
9.2.3 Copying Arrays
9.3 Systems of Linear Algebraic Equations
9.4 Case Study 14 โ€“ DC Circuits Mesh Analysis 1
9.5 Case Study 15 โ€“ DC Circuits Mesh Analysis 2
9.6 Case Study 16 โ€“ DC Circuits Mesh Analysis 3
9.7 Case Study 17 โ€“ DC Circuits Node Analysis 1
9.8 Summary
Chapter 10 โ€ข Using the Tkinter Graphical User Interface (GUI) in Python
10.1 Overview
10.2 GUI with the Tkinter
10.2.1 Label
10.2.2 Button
10.2.3 Message
10.2.4 Entry
10.2.5 Grid
10.2.6 Radio Button
10.2.7 Checkbox
10.2.8 Dialogs
10.2.9 Scale (Slider)
10.2.10 Menu
10.2.11 Binding to Events
10.3 Case Study 18 โ€“ Resonance in Series RLC Circuits
10.4 Case Study 19 โ€“ Inductance of a Single Layer Coil
10.5 Summary
Chapter 11 โ€ข BJT Transistor Circuit Analysis and Design
11.1 Overview
11.2 BJT Transistor DC Analysis
11.2.1 Collector Feedback Biasing
11.3 Case Study 20 โ€“ Analyzing Collector Feedback Biasing
11.4 Voltage Divider Biasing
11.5 Case Study 21 โ€“ Analyzing Voltage Divider Biasing
11.6 Case Study 22 โ€“ Designing Transistor Amplifier Circuit
11.7 Summary
Chapter 12 โ€ข Active Filters
12.1 Overview
12.2 Case Study 23 โ€“ Designing Low-Pass Active Filters
12.3 High-Pass Filters
12.4 Band-Pass Filters
12.5 Summary
Chapter 13 โ€ข Accessing Raspberry Pi 4 Hardware and PeripheralDevices from Python
13.1 Overview
13.2 GPIO โ€“ Parallel Interface
13.2.1 The GPIO Library
13.2.2 Pin Numbering
13.2.3 Channel (I/O port pin) Configuration
13.2.4 Case Study 24 โ€“ Flashing an LED
13.3 PWM
13.3.1 Case Study 25 โ€“ Changing the Brightness of an LED
13.4 I2C
13.4.1 Case Study 26 โ€“ Using I2C LCD
13.5 SPI
13.5.1 Case Study 27 โ€“ Using SPI โ€“ Analog Temperature Sensor
13.6 The serial
13.6.1 Case Study 28 โ€“ Using Serial Communication โ€“ Serial Loopback
13.7 Summary
Chapter 14 โ€ข Python and the Internet on Raspberry Pi 4
14.1 Overview
14.2 Internet Communication Protocols
14.3.1 Case Study 29 โ€“ Sending a Text Message to a Mobile Phone using TCP/IP
14.3.2 Case Study 30 โ€“ Communicating with a PC using TCP/IP
14.3.3 Case Study 31 โ€“ Controlling an LED Connected to Raspberry Pi from Mobile Phone using TCP/IP
14.4 UDP Based Communication
14.4.1 Case Study 32 โ€“ Sending a Text Message to a Mobile Phone using UDP
14.4.2 Case Study 33 โ€“ Controlling an LED Connected to Raspberry Pi from Mobile Phone using UDP
14.5 Using Flask to Create a Web Server to Control Raspberry Pi GPIO Ports from the Internet
14.5.1 Case Study 34 โ€“ Web Server - Controlling an LED Connected to Raspberry Pi Using Flask
14.6 Summary
Chapter 15 โ€ข Bluetooth Communication on Raspberry Pi 4 using Python
15.1 Overview
15.2 Case Study 35 โ€“ Bluetooth Control of LED from a Mobile Phone
15.3 Summary
Appendix A โ€ข Using wxPython Graphical User Interface
A.1 wxPython Template
A.2 Some Example Widgets
A.3 Case Study 36 โ€“ Display the Raspberry Pi 4 CPU Temperature using
Appendix B โ€ข Object-oriented Programming
B.1 Classes and Methods
B.2 Variables
B.3 Inheritance
INDEX


๐Ÿ“œ SIMILAR VOLUMES


Learning Python with Raspberry Pi
โœ Alex Bradbury, Ben Everard ๐Ÿ“‚ Library ๐Ÿ“… 2014 ๐Ÿ› Wiley ๐ŸŒ English

Raspberry Pi chose Python as its teaching language of choice to encourage a new generation of programmers to learn how to program. This approachable book serves as an ideal resource for anyone wanting to use Raspberry Pi to learn to program and helps you get started with the Python programming langu

Learning Python with Raspberry Pi
โœ Alex Bradbury, Ben Everard ๐Ÿ“‚ Library ๐Ÿ“… 2014 ๐Ÿ› Wiley ๐ŸŒ English

<p><span>The must-have companion guide to the Raspberry Pi User Guide!</span></p><p><span>Raspberry Pi chose Python as its teaching language of choice to encourage a new generation of programmers to learn how to program. This approachable book serves as an ideal resource for anyone wanting to use Ra

Learning Python with Raspberry Pi
โœ Bradbury, Alex;Everard, Ben ๐Ÿ“‚ Library ๐Ÿ“… 2014 ๐Ÿ› John Wiley & Sons Ltd ๐ŸŒ English

Rรฉsumรฉ : "The must-have companion guide to the Raspberry Pi User Guide! Raspberry Pi chose Python as its teaching language of choice to encourage a new generation of programmers to learn how to program. This approachable book serves as an ideal resource for anyone wanting to use Raspberry Pi to lear

Learning Python with Raspberry Pi
โœ Bradbury, Alex;Everard, Ben ๐Ÿ“‚ Library ๐Ÿ“… 2014 ๐Ÿ› John Wiley & Sons Ltd ๐ŸŒ English

Rรฉsumรฉ : "The must-have companion guide to the Raspberry Pi User Guide! Raspberry Pi chose Python as its teaching language of choice to encourage a new generation of programmers to learn how to program. This approachable book serves as an ideal resource for anyone wanting to use Raspberry Pi to lear

Learning Python with Raspberry Pi
โœ Bradbury, Alex;Everard, Ben ๐Ÿ“‚ Library ๐Ÿ“… 2014 ๐Ÿ› Wiley ๐ŸŒ English

<b>The must-have companion guide to the Raspberry Pi User Guide!</b><br /><br />Raspberry Pi chose Python as its teaching language of choice to encourage a new generation of programmers to learn how to program. This approachable book serves as an ideal resource for anyone wanting to use Raspberry Pi