Raspberry Pi Zero Cookbook

Over 80 practical and interesting recipes that explore the plethora of functionalities and opportunities available with Raspberry Pi Zero

Raspberry Pi Zero Cookbook

This ebook is included in a Mapt subscription
Edward Snajder

Over 80 practical and interesting recipes that explore the plethora of functionalities and opportunities available with Raspberry Pi Zero
$0.00
$31.99
$39.99
$29.99p/m after trial
RRP $31.99
RRP $39.99
Subscription
eBook
Print + eBook
Start 30 Day Trial
Subscribe and access every Packt eBook & Video.
 
  • 4,000+ eBooks & Videos
  • 40+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 
Preview in Mapt

Book Details

ISBN 139781786463852
Paperback422 pages

Book Description

The Raspberry Pi Zero, one of the most inexpensive, fully-functional computers available, is a powerful and revolutionary product developed by the Raspberry Pi Foundation. The Raspberry Pi Zero opens up a new world for the makers out there. This book will give you expertise with the Raspberry Pi Zero, providing all the necessary recipes that will get you up and running.

In this book, you will learn how to prepare your own circuits rather than buying the expensive add–ons available in the market. We start by showing you how to set up and manage the Pi Zero and then move on to configuring the hardware, running it with Linux, and programming it with Python scripts. Later, we integrate the Raspberry Pi Zero with sensors, motors, and other hardware. You will also get hands-on with interesting projects in media centers, IoT, and more.

Table of Contents

Chapter 1: Kick-Start Your Raspberry Pi Zero
Introduction
Understanding the standard connectors and test points
Reviewing power supply requirements
Choosing an operating system to install
Writing to an SD card with NOOBS
Using Windows to write a Raspbian image to an SD card
Using OS X to validate a Raspbian image and write it to an SD card
Using Ubuntu 16.04 to validate a Raspbian image and write it to an SD card
Identifying RCA solder points for analog video connections
Adding a USB extension over a USB OTG connector
Connecting to displays and changing the configuration settings
Logging in to the RPZ desktop for the first time, creating users, and rebooting
Chapter 2: Setting Up Physical and Wireless Connections
Introduction
Controlling the RPZ from the UART GPIO port using the console cable
Adding Wi-Fi dongle over USB OTG
Hacking RPZ hardware to add up permanent Wi-Fi dongle
Setting Up dynamic and static IP address for RPZ
Pinging from another computer over same network
SSHing your RPZ from your desktop computer
Sharing a screen on your desktop computer
Copying different files to and from your home network
Adding USB functions to Raspbian Jessie
Using a virtual serial adapter on USB OTG
Programming over a virtual Ethernet modem on USB OTG
Making your RPZ a USB mass storage device
Chapter 3: Programming with Linux
Navigating a filesystem and viewing and searching the contents of a directory
Creating a new file, editing it in an editor, and changing ownership
Renaming and copying/moving the file/folder into a new directory
Installing and uninstalling a program
Downloading a file from the Internet and deleting a file
Changing to root and using superpowers
Extracting a zipped file and zipping it back
Searching executed code from the terminal's history
Changing RPZ configuration settings from the command line
Checking running processes and killing a process running in the background
Creating our first shell program and automating a process
Syncing with NTC servers to update the current time
Running a background process in Linux
Setting a file to run automatically on startup
Using crontab to run a script automatically at predefined intervals
Chapter 4: Programming with Python
Introduction
Choosing between Python 2 and 3
Installing important Python packages
Creating our first Python program and running loops
Playing with strings
Plotting graphs using Python
Sending an e-mail from a Python Script
Creating a program to log and append data to a CSV file
Using a Python script to upload data online to a Google spreadsheet interface
Adding help and parameters to your Python Program
Chapter 5: Getting Your Hands Dirty Using the GPIO Header
Introduction
Pin configurations and precautions for using the GPIO pins
Using the GPIOs with the WiringPi library
Connecting an LED with RPZ and controlling it using C, Python, and a shell
Basics of the UART port and getting data from the desktop on the serial port using Minicom
Writing a Python/C program to get UART data in your code
Basics of I2C and checking the I2C devices present on a port
Basics of SPI and setting up an SPI module
Converting a 5V signal into a 3.3V signal and slew rates
Running RPZ on a battery
Controlling GPIOs using a web interface
Making RPZ a radio transmitter and sharing music
Using a Node.js library to control the GPIOs
Interfacing the ESP8266 WiFi module with RPZ
Chapter 6: Controlling the LEDs and Displays
Introduction
Setting up brightness using PWM
Monitoring Twitter/e-mails to blink an LED
Connecting a seven-segment number display module to the RPZ
Connecting an LED matrix display to the RPZ
Connecting an RGB LED and generating different colors
Interfacing the 16x2 LCD display with RPZ
Connecting the 74HC595N shift register to control many LEDs
Chapter 7: Controlling the Hardware
Introduction
Integrating voltage translators with the RPZ
Controlling a stepper motor using a RPZ and motor drivers
Connecting a DC motor and controlling its speed and direction
Controlling high power AC load using relays
Controlling high power DC load using MOSFETs
Controlling a buzzer with an RPZ
Monitoring the physical health of the RPZ hardware
Interfacing the PiFace with the RPZ
Chapter 8: Taking Digital Inputs to the Raspberry Pi Zero
Introduction
Interfacing push switches
Interfacing toggle switches and setting debouncing
Avoiding the floating states of the input line
Interfacing a keypad with the RPZ
Interfacing RTC to get accurate time
Setting up Interrupts on a toggle switch through GPIO
Interfacing RFID tags with the RPZ
Interfacing a GPS module with the RPZ
Chapter 9: Interfacing Sensors with the Raspberry Pi Zero
Interfacing any resistive sensor on GPIO
Interfacing an LDO with the RPZ
Interfacing an ultrasonic sensor with the RPZ
Interfacing an analog-to-digital convertor to interface any analog sensor with the RPZ
Interfacing an infrared receiver to read remote controls and control a TV with the RPZ
Interfacing a motion sensor
Interfacing a temperature humidity sensor using bit-banging
Interfacing a gyroscope and accelerometer with the RPZ
Pulling it all together with the Pi Sense Hat
Chapter 10: Cooking up Projects to Amaze the World!
Introduction
Setting up hardware for home automation with the RPZ
Setting up software for home automation with the RPZ
Making the RPZ an IoT Sensor Node
Making the RPZ a media center
Controlling RPZ media center using IR remote
Heartrate monitoring wearable device

What You Will Learn

  • Set up your Raspberry Pi Zero with the operating system, networking, and different interfaces
  • Get a hands-on introduction to Linux, Python, and shell scripts with the Raspberry Pi Zero
  • Become a master at driving GPIOs and controlling relays, motors, transistors, buzzers, audio, read switches, and interrupts with the Raspberry Pi Zero
  • Control GPIOs using the web interface and Node.js
  • Connect displays, LED matrixes, analog sensors, and digital sensors
  • Hack the Ethernet on the Raspberry Pi Zero
  • Make your Raspberry Pi Zero an IoT-based sensor node and remotely monitor your data

Authors

Table of Contents

Chapter 1: Kick-Start Your Raspberry Pi Zero
Introduction
Understanding the standard connectors and test points
Reviewing power supply requirements
Choosing an operating system to install
Writing to an SD card with NOOBS
Using Windows to write a Raspbian image to an SD card
Using OS X to validate a Raspbian image and write it to an SD card
Using Ubuntu 16.04 to validate a Raspbian image and write it to an SD card
Identifying RCA solder points for analog video connections
Adding a USB extension over a USB OTG connector
Connecting to displays and changing the configuration settings
Logging in to the RPZ desktop for the first time, creating users, and rebooting
Chapter 2: Setting Up Physical and Wireless Connections
Introduction
Controlling the RPZ from the UART GPIO port using the console cable
Adding Wi-Fi dongle over USB OTG
Hacking RPZ hardware to add up permanent Wi-Fi dongle
Setting Up dynamic and static IP address for RPZ
Pinging from another computer over same network
SSHing your RPZ from your desktop computer
Sharing a screen on your desktop computer
Copying different files to and from your home network
Adding USB functions to Raspbian Jessie
Using a virtual serial adapter on USB OTG
Programming over a virtual Ethernet modem on USB OTG
Making your RPZ a USB mass storage device
Chapter 3: Programming with Linux
Navigating a filesystem and viewing and searching the contents of a directory
Creating a new file, editing it in an editor, and changing ownership
Renaming and copying/moving the file/folder into a new directory
Installing and uninstalling a program
Downloading a file from the Internet and deleting a file
Changing to root and using superpowers
Extracting a zipped file and zipping it back
Searching executed code from the terminal's history
Changing RPZ configuration settings from the command line
Checking running processes and killing a process running in the background
Creating our first shell program and automating a process
Syncing with NTC servers to update the current time
Running a background process in Linux
Setting a file to run automatically on startup
Using crontab to run a script automatically at predefined intervals
Chapter 4: Programming with Python
Introduction
Choosing between Python 2 and 3
Installing important Python packages
Creating our first Python program and running loops
Playing with strings
Plotting graphs using Python
Sending an e-mail from a Python Script
Creating a program to log and append data to a CSV file
Using a Python script to upload data online to a Google spreadsheet interface
Adding help and parameters to your Python Program
Chapter 5: Getting Your Hands Dirty Using the GPIO Header
Introduction
Pin configurations and precautions for using the GPIO pins
Using the GPIOs with the WiringPi library
Connecting an LED with RPZ and controlling it using C, Python, and a shell
Basics of the UART port and getting data from the desktop on the serial port using Minicom
Writing a Python/C program to get UART data in your code
Basics of I2C and checking the I2C devices present on a port
Basics of SPI and setting up an SPI module
Converting a 5V signal into a 3.3V signal and slew rates
Running RPZ on a battery
Controlling GPIOs using a web interface
Making RPZ a radio transmitter and sharing music
Using a Node.js library to control the GPIOs
Interfacing the ESP8266 WiFi module with RPZ
Chapter 6: Controlling the LEDs and Displays
Introduction
Setting up brightness using PWM
Monitoring Twitter/e-mails to blink an LED
Connecting a seven-segment number display module to the RPZ
Connecting an LED matrix display to the RPZ
Connecting an RGB LED and generating different colors
Interfacing the 16x2 LCD display with RPZ
Connecting the 74HC595N shift register to control many LEDs
Chapter 7: Controlling the Hardware
Introduction
Integrating voltage translators with the RPZ
Controlling a stepper motor using a RPZ and motor drivers
Connecting a DC motor and controlling its speed and direction
Controlling high power AC load using relays
Controlling high power DC load using MOSFETs
Controlling a buzzer with an RPZ
Monitoring the physical health of the RPZ hardware
Interfacing the PiFace with the RPZ
Chapter 8: Taking Digital Inputs to the Raspberry Pi Zero
Introduction
Interfacing push switches
Interfacing toggle switches and setting debouncing
Avoiding the floating states of the input line
Interfacing a keypad with the RPZ
Interfacing RTC to get accurate time
Setting up Interrupts on a toggle switch through GPIO
Interfacing RFID tags with the RPZ
Interfacing a GPS module with the RPZ
Chapter 9: Interfacing Sensors with the Raspberry Pi Zero
Interfacing any resistive sensor on GPIO
Interfacing an LDO with the RPZ
Interfacing an ultrasonic sensor with the RPZ
Interfacing an analog-to-digital convertor to interface any analog sensor with the RPZ
Interfacing an infrared receiver to read remote controls and control a TV with the RPZ
Interfacing a motion sensor
Interfacing a temperature humidity sensor using bit-banging
Interfacing a gyroscope and accelerometer with the RPZ
Pulling it all together with the Pi Sense Hat
Chapter 10: Cooking up Projects to Amaze the World!
Introduction
Setting up hardware for home automation with the RPZ
Setting up software for home automation with the RPZ
Making the RPZ an IoT Sensor Node
Making the RPZ a media center
Controlling RPZ media center using IR remote
Heartrate monitoring wearable device

Book Details

ISBN 139781786463852
Paperback422 pages
Read More

Read More Reviews