Contents


1 Introducing the Arduino and Raspberry Pi

What Is an Arduino?

Arduino Uno

Arduino Uno Specifications

Arduino Uno Components

Arduino Development System Requirements

Arduino IDE Software

Hands-on Example:

A Simple Arduino “Hello World” Program with a LED

Playing Around with the Code

What Is Raspberry Pi?

Raspberry Pi 3 Hardware Overview

Raspberry Pi System Setup

Python IDLE Development Environment

Hands-on Example:

A Simple Raspberry Pi “Hello World” Program with a LED

Summary

2 Arduino and Raspberry Pi Programming Language Basics

Overview of the C/C++ Language for the Arduino

Object-Oriented Programming

Overview of Python for Raspberry Pi

Python Functions

Python Modules

Python Class Overview

Python Class Inheritance

Summary

3 Basic Electrical Components

Electronics Basics

Resistor

LEDs

Piezo Buzzer

Potentiometer

Push Buttons

Breadboards

Hands-on Example:

Arduino Serial Monitor and LED Indicator

Hands-on Example:

Arduino RGB LED

Hands-on Example:

Arduino LED Buzzer Siren

Hands-on Example:

Arduino Random RGB LED Colors Using a Potentiometer

Hands-on Example:

Arduino RGB Light Switch

Hands-on Example:

Raspberry Pi LED Blinker Counter

Hands-on Example:

Raspberry Pi LED Fading

Hands-on Example:

Raspberry Pi RGB LED Color Selector

Hands-on Example:

Raspberry Pi LED Fading Up and Down Using a Button

Summary

4 Touch Sensor Projects

Analog Joystick

Hands-on Example:

Arduino Joystick Test

Hands-on Example:

Arduino “Simon Says” Game

Running the Program

Rotary Encoder Controller (KY-040)

Hands-on Example:

Arduino Rotary Encoder Test

Hands-on Example:

Arduino Rotary Encoder Controlling an RGB LED

Hands-on Example:

Raspberry Pi Rotary Encoder Test

Hands-on Example:

Raspberry Pi Rotary Encoder LED Blinker

Summary

5 Environmental Sensor Projects I

Reed Switch Magnetic Field Sensor

Hands-on Example:

Arduino Reed Switch Test

Hands-on Example:

Arduino Door Buzzer Alarm

Hands-on Example:

Raspberry Pi Reed Switch Test

Hands-on Example:

Raspberry Pi Reed Switch Door Alarm

TMP36 Temperature Sensor

Hands-on Example:

Arduino TMP36 Temperature Sensor Test

Flame Sensor

Hands-on Example:

Arduino Flame Sensor Test

Hands-on Example:

Arduino Fire Alarm

Hands-on Example:

Raspberry Pi Flame Sensor Test

Hands-on Example:

Raspberry Pi Fire Alarm

Infrared Proximity/Collision Sensor

Hands-on Example:

Arduino Infrared Proximity/Collision Detector

Hands-on Example:

Raspberry Pi Infrared Collision/Proximity Sensor Alarm

Temperature and Humidity Sensor (DHT11)

Hands-on Example:

Arduino DHT11 Temperature and Humidity Sensor Test

Summary

6 Environmental Sensor Projects II

Water Detector/Soil Moisture Sensor

Hands-on Example:

Arduino Water Detector Alarm

Hands-on Example:

Arduino Soil Moisture Detector

Light Detector (Photo Resistor)

Hands-on Example:

Arduino Rooster Alarm

Sound Detector

Hands-on Example:

Arduino Light Clapper

Hands-on Example:

Raspberry Pi “Out of Breath” Game

Summary