Custom Raspberry Pi Interfaces (eBook)
XV, 216 Seiten
Apress (Verlag)
978-1-4842-2406-9 (ISBN)
This book equips the reader with skills necessary to design and build custom hardware interfaces for the Raspberry Pi. A thorough chapter on interfacing 5-volt systems to 3.3-volt Raspberry Pis expands the reader's choice of peripheral options. Ready to go C++ programs involving GPIO and I2C peripherals are provided. Explores ADC, DAC, rotary encoders, CMOS shift registers. I2C I/O extenders.
Readers will discover low cost display and sensor options for embedded system projects. Master 12C communications using Raspbian Linux in C++. Perform ADC and DAC experiments. Debounce buttons and switches using hardware and software solutions. Read rotary encoders for direction and step. Develop flywheel rotary encoder effects for ease of tuning. Construct a hardware interface to the Music Playing Daemon (MPD) with developed software. Discover how to add your own hardware keypad for remote combination lock applications.
What you'll learn:
- Build simple, low cost input/output interfaces including rotary encoders
- Interface with 5-volt devices from a 3-volt Raspberry Pi system
- Conquer stuttering buttons and switches through hardware and software debouncing
- Apply analog to digital and digital to analog conversions on the Pi
- Read potentiometers (volume control) from the Pi
- Determine step, directions, and velocity of a rotary encoder
- Provide your own hardware devices for embedded applications
- Perform remote interfacing using the I2 PCF8574 chip
- Work with external CMOS devices like the 74HC595 (in C++)
Warren Gay has been an electronics enthusiast since childhood and often dragged discarded TV sets home after school. In high school he learned to program the IBM-1130 and then pursued a career in software development at Ryerson Polytechnical, in Toronto. Since then he has worked professionally for over 30 years, mainly in C/C++, under Unix and Linux. Meanwhile, the love of electronics has never faded since the early creation of his home-brewed Intel 8008 system in the 70's to the present day projects employing the Raspberry Pi. Warren also holds an advanced amateur radio license and was able to work the Mir space station (U2MIR) using packet radio in August 1991.He's authored other books including Sams Teach Yourself Linux in 24 Hours, Linux Socket Programming by Example, and Advanced Unix Programming.
Design and build custom hardware interfaces for the Raspberry Pi and discover low cost display and sensor options for embedded system projects. With this book you'll master 12C communications using Raspbian Linux in C++ and perform ADC and DAC experiments. You'll experiment with debounce buttons and switches using hardware and software solutions. Develop flywheel rotary encoder effects for ease of tuning and construct a hardware interface to the Music Playing Daemon (MPD) with developed software. Discover how to add your own hardware keypad for remote combination lock applications. Custom Raspberry Pi Interfaces offers a thorough chapter on interfacing 5-volt systems to 3.3-volt Raspberry Pis designed to expand your choice of peripheral options. Ready to go C++ programs involving GPIO and I2C peripherals are provided. This book also explores ADC, DAC, rotary encoders, CMOS shift registers. I2C I/O extenders. What you'll learn:Build simple, low cost input/output interfaces including rotary encoders Interface with 5-volt devices from a 3-volt Raspberry Pi system Apply analog to digital and digital to analog conversions on the Pi Read potentiometers (volume control) from the Pi Determine step, directions, and velocity of a rotary encoder Perform remote interfacing using the I2 PCF8574 chipWork with external CMOS devices like the 74HC595 (in C++)Who this book is for:Students and hobbyists interested in building custom interfaces for their Raspberry Pis.
Warren Gay has been an electronics enthusiast since childhood and often dragged discarded TV sets home after school. In high school he learned to program the IBM-1130 and then pursued a career in software development at Ryerson Polytechnical, in Toronto. Since then he has worked professionally for over 30 years, mainly in C/C++, under Unix and Linux. Meanwhile, the love of electronics has never faded since the early creation of his home-brewed Intel 8008 system in the 70's to the present day projects employing the Raspberry Pi. Warren also holds an advanced amateur radio license and was able to work the Mir space station (U2MIR) using packet radio in August 1991.He's authored other books including Sams Teach Yourself Linux in 24 Hours, Linux Socket Programming by Example, and Advanced Unix Programming.
Contents at a Glance 4
Contents 5
About the Author 13
About the Technical Reviewer 14
Chapter 1: Introduction 15
Raspberry Pi 3 and Zero 16
Why GPIO Is Important 16
What to Purchase 16
Software to Download 18
Let’s Begin 18
Chapter 2: 3V/5V Signal Interfacing 19
7400 Series (TTL) 20
3.3V Logic 21
Voltage Dividers 23
7400 Series Derivative Families 25
Unused CMOS Inputs 26
Converting 5V to 3V Input: 74LVC245 26
Converting 5V to 3V Input: 74LVC244 28
CD4049/CD4050 30
Input Protection Diodes 30
Converting 3 Volts to 5 Volts with the HCT Family 33
74HCT245 34
74HCT244 36
Switching Speed 36
Summary 37
Bibliography 38
Chapter 3: VGA LCD Monitors 39
VGA Converters 39
Resolution and Refresh Rates 40
/boot/config.txt 41
Confirming Resolution 47
Summary 47
Bibliography 48
Chapter 4: I2C LCD Displays 49
LCD Module 1602A 49
I2C Serial Interface 50
I2C Module Configuration 51
I2C Module Output 52
I2C Module Input 55
PCF8574P Chip 56
3 Volts to 5 Volts 56
Attaching the I2C Serial Module 58
Displaying Data 60
Reading from the LCD1602 62
Class LCD1602 65
I2C Baud Rate 66
Profit and Loss 67
Summary 68
Chapter 5: MC14490 and Software Debouncing 69
Hardware: MC14490 70
Chip Operation 71
Capacitor C1 71
Experiment 72
More Inputs 75
Software Debouncing 76
Experiment 78
Summary 80
Chapter 6: PCF8591 ADC 81
The YL-40 PCB 81
Voltage Range 84
I2C Bus 84
I2C Addresses 84
DAC (AOUT) 84
Removing YL-40 LED D1 87
Hacking YL-40 I2C Address 88
I2C Bus Setup 89
Reading from PCF8591 90
Experiment 90
Writing to the DAC 91
Experiment 91
Experiment 92
Limitations 93
Extending Voltage Range 93
Repairing the Temp Sensor 94
Conversion to Celsius 97
Reading Temperature 98
Experiment 98
The YL-40 LDR 99
Experiment 99
1N914 Experiment 99
Software 103
Potential Experiments 104
Summary 104
Bibliography 104
Chapter 7: Potentiometer Input Controls 105
Potentiometers 105
Voltage Dividers 107
ADC Circuit 109
Pot Resistance 109
Taper 110
Effect of ADC Bits 110
Experiment 111
Applying Potentiometer Controls 113
Selection Resolution 115
Summary 115
Bibliography 116
Chapter 8: Rotary Encoders 117
Keyes KY-040 Rotary Encoder 117
The Switch 119
Operation 121
Voltage 122
Evaluation Circuit 122
Interfacing to the Pi 124
Experiment 126
Experiment 127
Sequence Errors 128
Experiment 129
FM Dial 1 129
FM Dial 2 131
Class Switch 133
Main Routine 140
Summary 141
Bibliography 141
Chapter 9: More Pi Inputs with 74HC165 142
74HC165 Pinout 142
Function Table 144
Breadboard Experiment 145
Program 147
Logic Analyzer View 149
Profit and Loss 150
Even More Inputs 151
Other Bit Counts 152
Combining GPIOs 152
Chip Enable 153
CD4012B 153
Summary 153
Chapter 10: More Pi Outputs with 74HC595 154
74HC165 Pinout 154
Function Table 155
Breadboard Experiment 156
Experiment Run 159
Input and Output 161
Additional Outputs 164
Profit and Loss 165
Summary 165
Chapter 11: MCP23017 I/O Port Extender 166
MCP23017 166
Wiring 168
Output GPIO Experiment 170
Input Experiment 171
Software Operations 172
I2C Header Files 173
Opening the I2C Driver 174
I2C Write 174
I2C Read 175
Configuration 176
Interrupt Capability 177
Interrupt Profit and Loss 181
Summary 181
Chapter 12: MPD/MPC Hardware Controls 182
Audio Preparation 182
MPD/MPD 184
Hardware Setup 187
Test Volume Control 188
Test Rotary Control 189
Test LCD 189
The mpcctl Program 189
Main Program 190
Rotary Encoder Thread 194
LCD Thread 198
MPC Status Thread 200
Volume Control Thread 201
Program Summary 202
Summary 203
Bibliography 203
Chapter 13: Custom Keypads 204
Breadboard Setup 204
Output Tests 206
Input Tests 206
High-Side Driver 207
Low-Side Driver 208
Driving an LED 208
The Keypad 209
Keypad Program 214
The main Program 215
The key_lookup Function 217
The i2c_write Function 218
The i2c_read Function 219
Combination Lock 220
Combination Lock 221
The main Program 222
The get_key_code Function 224
Interrupts 225
Summary 225
Bibliography 225
Index 226
Erscheint lt. Verlag | 24.1.2017 |
---|---|
Zusatzinfo | XV, 216 p. 88 illus., 78 illus. in color. |
Verlagsort | Berkeley |
Sprache | englisch |
Themenwelt | Mathematik / Informatik ► Informatik ► Theorie / Studium |
Informatik ► Weitere Themen ► Hardware | |
Informatik ► Weitere Themen ► Smartphones / Tablets | |
Schlagworte | hardware interfaces • Maker • Projects • Raspberry Pi • Srd |
ISBN-10 | 1-4842-2406-X / 148422406X |
ISBN-13 | 978-1-4842-2406-9 / 9781484224069 |
Haben Sie eine Frage zum Produkt? |
Größe: 6,9 MB
DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasserzeichen und ist damit für Sie personalisiert. Bei einer missbräuchlichen Weitergabe des eBooks an Dritte ist eine Rückverfolgung an die Quelle möglich.
Dateiformat: PDF (Portable Document Format)
Mit einem festen Seitenlayout eignet sich die PDF besonders für Fachbücher mit Spalten, Tabellen und Abbildungen. Eine PDF kann auf fast allen Geräten angezeigt werden, ist aber für kleine Displays (Smartphone, eReader) nur eingeschränkt geeignet.
Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.
Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.
Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.
aus dem Bereich