Preface

Traditional wisdom requires people using electronics to have at least an EE degree before they can do anything useful, but in this book the whole subject of electronics is given the highly respected O’Reilly Cookbook treatment and is broken down into recipes. These recipes make it possible for the reader to access the book at random, following the recipe that solves their problem and learning as much or as little about the theory as they are comfortable with.

While it is impossible to cover in one volume everything in a complex and wide-ranging subject like electronics, I have tried to select recipes that seem to come up most frequently when I talk to other makers, hobbyists, and inventors.

Who Should Read This Book

If you are into electronics or want to get into electronics, then this is the book that will help you get more from your hobby. The book is full of built-and-tested recipes that you can trust to do just what you need them to do, no matter what your level of expertise.

If you are new to electronics then this book will serve as a guide to get you started; if you are an experienced electronics maker, it will act as a useful reference.

Why I Wrote This Book

This book has been gestating for a while. I believe that the original concept came from no less a person than Tim O’Reilly himself. The idea was to fill the gap in the market between books like the Arduino Cookbook and the Raspberry Pi Cookbook and heavyweight electronics textbooks.

In other words, to cover more of the fundamentals of electronics and topics peripheral to the use of microcontrollers that often get neglected, except in heavyweight electronic tomes. Topics such as how to construct various types of power supply, using the right transistor for switching, using analog and digital ICs, as well as how to construct projects and prototypes and use test equipment.

A Word on Electronics Today

Boards like the Arduino and Raspberry Pi have lured whole new generations of makers, hobbyists, and inventors into the world of electronics. Components and tools are now low cost and within the reach of more people than at any time in history. Hackspaces and Fab Labs have electronic workstations where you can use tools to realize your projects.

The free availability of information including detailed designs means that you can learn from and adapt other people’s work for your own specific needs.

Many people who start with electronics as a hobby progress to formal education in electronic engineering, or just jump straight to product design as an inventor and entrepreneur. After all, if you have access to a computer and a few tools and components, you can build a working prototype of your great invention and then find someone to manufacture it for you, all financed with the help of crowdfunding. The barrier of entry to the electronics business is at an all-time low.

Navigating This Book

As a “cookbook” you can dive in and use any recipe, rather than read the book in order. Where you have a recipe that relies on some knowledge or skills from another recipe, there will be a link back to the prerequisite recipe.

The recipes are arranged in chapters, with Chapters 1 to 6 providing more fundamental recipes, some concerning theory but mostly about different types of component (your recipe ingredients). These chapters are:

  • Chapter 1, Theory. As the title suggests, the recipes in this chapter provide you with the few theoretical concepts such as Ohm’s Law and the power law you just can’t avoid.
  • Chapter 2, Resistors. These most common of electronic components are explained and recipes provided for some of their uses.
  • Chapter 3, Capacitors and Inductors. Here you will find recipes explaining how these components work, how to identify them, and recipes for making use of them.
  • Chapter 4, Diodes. In this chapter you will find recipes explaining diodes and uses for different types of diode including Zener diodes, photodiodes, and LEDs.
  • Chapter 5, Transistors and Integrated Circuits. This chapter mostly contains fundamental recipes for using transistors and guides for using different types of transistors in different settings. ICs (integrated circuits) are introduced, but you will find individual recipes for ICs scattered throughout the rest of the book.
  • Chapter 6, Switches and Relays. The section ends with a look at these common but often overlooked components.

The next section of chapters looks at how the components introduced in the first section can be used together in various recipes covering pretty much anything electronic that you might like to design.

  • Chapter 7, Power Supplies. Whatever your project, you are going to need to provide it with power. You will find recipes here for both traditional power supply designs as well as switched mode power supplies (SMPS) and more exotic high-voltage power supplies.
  • Chapter 8, Batteries. This chapter contains recipes for selecting batteries and also practical circuits for charging batteries (including LiPo batteries) and automatic battery backup.
  • Chapter 9, Solar Power. In this chapter, you will find recipes to help you power your projects using solar panels, including providing solar power to an Arduino and Raspberry Pi.
  • Chapter 10, Arduino and Raspberry Pi. Most Maker projects now include the use of a computing element like an Arduino or Raspberry Pi. These boards are introduced along with some recipes for using them to control external electronics.
  • Chapter 11, Switching. Not to be confused with “switches,” this chapter provides recipes that show you how to use transistors, electromechanical relays, and solid-state relays to turn things on and off using an Arduino or Raspberry Pi.
  • Chapter 12, Sensors. This chapter is packed with recipes for many different types of sensor and shows you how to use them with both Arduino and Raspberry Pi.
  • Chapter 13, Motors. In this chapter, there are recipes for using different types of motors (DC, stepper, and servo) with both Arduino and Raspberry Pi. There are also recipes for controlling both the speed and direction of motors.
  • Chapter 14, LEDs and Displays. In addition to recipes for controlling standard LEDs from an Arduino or Raspberry Pi, this chapter also has recipes for using high-power LEDs and various types of displays, including OLED graphical displays, addressable LED strips (NeoPixels), and LCD displays.
  • Chapter 15, Digital ICs. This chapter contains recipes for using those digital ICs that are still useful in your projects in spite of the advent of microcontrollers.
  • Chapter 16, Analog. In this chapter, you will find a collection of recipes for various useful analog designs from simple filtering to a range of oscillator and timer designs.
  • Chapter 17, Operational Amplifiers. Continuing with the analog theme, this chapter provides recipes for using op-amps for various tasks from straightforward amplification to filter design, buffering, and comparators.
  • Chapter 18, Audio. Here, you will find recipes for making sounds from an Arduino or Raspberry Pi as well as power amplifier designs (both analog and digital) and amplifying the signal from a microphone.
  • Chapter 19, Radio Frequency. This chapter has some interesting recipes for FM transmitters and receivers as well as for sending packet data from one Arduino to another.

The final section of the book contains recipes for construction and the use of tools.

  • Chapter 20, Construction. This chapter contains recipes for building “unsoldered” prototypes and for making those projects into a more permanent soldered form. It also provides recipes for soldering, both through-hole and surface-mount devices.
  • Chapter 21, Tools. The use of bench power supplies, multimeters, oscilloscopes, and the use of simulations software are all described here in a series of recipes.

The book also includes appendices that list all the parts used in the book along with useful suppliers and provide pinouts for devices including the Arduino and Raspberry Pi.

Online Resources

There are many wonderful resources available for the electronics enthusiast.

If you are looking for project ideas then sites like Hackaday and Instructables are a great source of inspiration.

When it comes to getting help with a project, you will often get great advice from the many experienced and knowledgable people that hang out on the following forums. Remember to search the forum before asking your question, in case it has come up before (usually it has) and always explain your question clearly, or “experts” can get impatient with you.

Conventions Used in This Book

The following typographical conventions are used in this book:

Italic

Indicates new terms, URLs, email addresses, filenames, and file extensions.

Constant width

Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.

Constant width bold

Shows commands or other text that should be typed literally by the user.

Constant width italic

Shows text that should be replaced with user-supplied values or by values determined by context.

Tip

This element signifies a tip or suggestion.

Warning

This element indicates a warning or caution.

Using Code Examples

Supplemental material (code examples, exercises, etc.) is available for download at https://github.com/simonmonk/electronics_cookbook.

This book is here to help you get your job done. In general, if example code is offered with this book, you may use it in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Electronics Cookbook by Simon Monk (O’Reilly). Copyright 2017 Simon Monk, 978-1-491-95340-2.”

If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .

O’Reilly Online Learning

Note

For more than 40 years, O’Reilly Media has provided technology and business training, knowledge, and insight to help companies succeed.

Our unique network of experts and innovators share their knowledge and expertise through books, articles, conferences, and our online learning platform. O’Reilly’s online learning platform gives you on-demand access to live training courses, in-depth learning paths, interactive coding environments, and a vast collection of text and video from O’Reilly and 200+ other publishers. For more information, please visit http://oreilly.com.

How to Contact Us

Please address comments and questions concerning this book to the publisher:

  • O’Reilly Media, Inc.
  • 1005 Gravenstein Highway North
  • Sebastopol, CA 95472
  • 800-998-9938 (in the United States or Canada)
  • 707-829-0515 (international or local)
  • 707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at http://bit.ly/electronics-cookbook.

To comment or ask technical questions about this book, send email to .

For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com.

Find us on Facebook: http://facebook.com/oreilly

Follow us on Twitter: http://twitter.com/oreillymedia

Watch us on YouTube: http://www.youtube.com/oreillymedia

Acknowledgments

Thanks to Duncan Amos, David Whale, and Mike Bassett for their technical reviews of the book and the many useful comments that they provided to help make this book as good as it could be.

I’d also like to thank Afroman for permission to use his great FM transmitter design and the guys at Digi-Key for their help in compiling parts codes.

As always, it’s been a pleasure working with the professionals at O’Reilly, in particular Jeff Bleiel, Heather Scherer, and of course, Brian Jepson.

Get Electronics Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.