You are previewing Electronics Cookbook.
O'Reilly logo
Electronics Cookbook

Book Description

Arduino and Raspberry Pi have brought many new people to the world of electronics, particularly artists, hobbyists, and designers who aren't trained in electrical engineering. If you’re among them, don’t fret. Rather than run out and get an EE degree, just pick up this handy cookbook whenever you need to solve a problem on your project.

Author Simon Monk (Raspberry Pi Cookbook) breaks down this complex subject into recipes that provide immediate solutions to specific issues. With this book, you can quickly search electronics topics and find the recipe you need. Each recipe includes a discussion on why and how the solution works, and allows you to explore as much or as little theory as you’re comfortable with.

Table of Contents

  1. Preface
    1. Who Should Read This Book
    2. Why I Wrote This Book
    3. A Word on Electronics Today
    4. Navigating This Book
    5. Online Resources
    6. Conventions Used in This Book
    7. Using Code Examples
    8. O’Reilly Safari
    9. How to Contact Us
    10. Acknowledgments
  2. Theory
    1. 1.0. Introduction
    2. 1.1. Understanding Current
    3. 1.2. Understanding Voltage
    4. 1.3. Calculate Voltage, Current, or Resistance
    5. 1.4. Calculate Current At Any Point in a Circuit
    6. 1.5. Calculate the Voltages within Your Circuit
    7. 1.6. Understanding Power
    8. 1.7. Alternating Current
  3. Resistors
    1. 2.0. Introduction
    2. 2.1. Read Resistor Packages
    3. 2.2. Find Standard Resistor Values
    4. 2.3. Select a Variable Resistor
    5. 2.4. Combine Resistors in Series
    6. 2.5. Combine Resistors in Parallel
    7. 2.6. Reduce a Voltage to a Measurable Level
    8. 2.7. Choose a Resistor that Won’t Burn Out
    9. 2.8. Measure Light Levels
    10. 2.9. Measure Temperature
    11. 2.10. Choose the Right Wires
  4. Capacitors and Inductors
    1. 3.0. Introduction
    2. 3.1. Store Energy Temporarily in Your Circuits
    3. 3.2. Identify Types of Capacitors
    4. 3.3. Read Capacitor Packages
    5. 3.4. Connect Capacitors in Parallel
    6. 3.5. Connect Capacitors in Series
    7. 3.6. Store Huge Amounts of Energy
    8. 3.7. Calculate the Energy Stored in a Capacitor
    9. 3.8. Modify and Moderate Current Flow
    10. 3.9. Convert AC Voltages
  5. Diodes
    1. 4.0. Introduction
    2. 4.1. Block the Flow of Current in One Direction
    3. 4.2. Know Your Diodes
    4. 4.3. Use a Diode to Restrict DC Voltages
    5. 4.4. Let There Be Light
    6. 4.5. Detect Light
  6. Transistors and Integrated Circuits
    1. 5.0. Introduction
    2. 5.1. Switch a Stronger Current with a Weaker One
    3. 5.2. Switch a Current with Minimal Control Current
    4. 5.3. Switch High Current Loads Efficiently
    5. 5.4. Switch Very High Voltages
    6. 5.5. Choosing the Right Transistor
    7. 5.6. Switching Alternating Current
    8. 5.7. Detect Light with Transistors
    9. 5.8. Isolating Signals for Safety or Noise Elimination
    10. 5.9. Discover Integrated Circuits
  7. Switches and Relays
    1. 6.0. Introduction
    2. 6.1. Switch Electricity Mechanically
    3. 6.2. Know Your Switches
    4. 6.3. Switching Using Magnetism
    5. 6.4. Rediscover Relays
  8. Power Supplies
    1. 7.0. Introduction
    2. 7.1. Convert AC to AC
    3. 7.2. Convert AC to DC (Quick and Dirty)
    4. 7.3. Convert AC to DC with Less Ripple
    5. 7.4. Convert AC to Regulated DC
    6. 7.5. Converting AC to Variable DC
    7. 7.6. Regulate Voltage from a Battery Source
    8. 7.7. Make a Constant-Current Power Supply
    9. 7.8. Regulate DC Voltage Efficiently
    10. 7.9. Convert a Lower DC Voltage to a Higher DC Voltage
    11. 7.10. Convert DC to AC
    12. 7.11. Power a Project from 110 or 220V AC
    13. 7.12. Multiply Your Voltage
    14. 7.13. Supply High Voltage at 450V
    15. 7.14. Even Higher Voltage Supply (> 1kV)
    16. 7.15. Very Very High Voltage Supply (Solid-State Tesla Coil)
    17. 7.16. Blow a Fuse
    18. 7.17. Protect From Polarity Errors
  9. Batteries
    1. 8.0. Introduction
    2. 8.1. Estimating Battery Life
    3. 8.2. Selecting a Non-Rechargeable Battery
    4. 8.3. Selecting a Rechargeable Battery
    5. 8.4. Trickle Charging
    6. 8.5. Automatic Battery Backup
    7. 8.6. Charging LiPo Batteries
    8. 8.7. Get Every Drop of Power with the Joule Thief
  10. Solar Power
    1. 9.0. Introduction
    2. 9.1. Power Your Projects with Solar
    3. 9.2. Choose a Solar Panel
    4. 9.3. Measure the Actual Output Power of a Solar Panel
    5. 9.4. Power an Arduino with Solar
    6. 9.5. Power a Raspberry Pi with Solar
  11. Arduino and Raspberry Pi
    1. 10.0. Introduction
    2. 10.1. Explore Arduino
    3. 10.2. Download and Using the Book’s Arduino Sketches
    4. 10.3. Explore Raspberry Pi
    5. 10.4. Download and Running this Book’s Python Programs
    6. 10.5. Run a Program on Raspberry Pi on Startup
    7. 10.6. Explore Alternatives to Arduino and Raspberry Pi
    8. 10.7. Switch Things on and Off
    9. 10.8. Control Digital Outputs with Arduino
    10. 10.9. Control Digital Outputs from Raspberry Pi
    11. 10.10. Connect Arduino to Digital Inputs Like Switches
    12. 10.11. Connect Raspberry Pi to Digital Inputs Like Switches
    13. 10.12. Read Analog Inputs on Arduino
    14. 10.13. Generate Analog Output on Arduino
    15. 10.14. Generate Analog Output on Raspberry Pi
    16. 10.15. Connect Raspberry Pi to I2C Devices
    17. 10.16. Connect Raspberry Pi to SPI Devices
    18. 10.17. Level Conversion
  12. Switching
    1. 11.0. Introduction
    2. 11.1. Switch More Power than Your Pi or Arduino Can Handle
    3. 11.2. Switch Power On the High Side
    4. 11.3. Switch Much More Power
    5. 11.4. Switch Much More Power on the High Side
    6. 11.5. Choose Between a BJT and MOSFET
    7. 11.6. Switch with Arduino
    8. 11.7. Switch with a Raspberry Pi
    9. 11.8. Reversible Switching
    10. 11.9. Control a Relay from a GPIO Pin
    11. 11.10. Control a Solid State Relay from a GPIO Pin
    12. 11.11. Connect to Open-Collector Outputs
  13. Sensors
    1. 12.0. Introduction
    2. 12.1. Connect a Switch to Arduino or Raspberry Pi
    3. 12.2. Sense Rotational Position
    4. 12.3. Sense Analog Input from Resistive Sensors
    5. 12.4. Add Analog Inputs to Raspberry Pi
    6. 12.5. Connect Resistive Sensors to the Raspberry Pi without an ADC
    7. 12.6. Measure Light Intensity
    8. 12.7. Measure Temperature on Arduino or Raspberry Pi
    9. 12.8. Measure Temperature without an ADC on the Raspberry Pi
    10. 12.9. Measure Rotation using a Potentiometer
    11. 12.10. Measure Temperature with an Analog IC
    12. 12.11. Measure Temperature with a Digital IC
    13. 12.12. Measure Humidity
    14. 12.13. Measure Distance
  14. Motors
    1. 13.0. Introduction
    2. 13.1. Switch DC Motors On and Off
    3. 13.2. Measure the Speed of a DC Motor
    4. 13.3. Control the Direction of a DC Motor
    5. 13.4. Setting Motors to Precise Positions
    6. 13.5. Move a Motor a Precise Number of Steps
    7. 13.6. Choose a Simpler Stepper Motor
  15. LEDs and Displays
    1. 14.0. Introduction
    2. 14.1. Connect Standard LEDs
    3. 14.2. Drive High-Power LEDs
    4. 14.3. Power Lots of LEDs
    5. 14.4. Switch Lots of LEDs at the Same Time
    6. 14.5. Multiplex Signals to 7-Segment Displays
    7. 14.6. Control Many LEDs
    8. 14.7. Change the Colors of RGB LEDs
    9. 14.8. Connect to Addressable LED Strips
    10. 14.9. Use an I2C 7-Segment LED Displays
    11. 14.10. Display Graphics or Text on OLED Displays
    12. 14.11. Display Text on Alphanumeric LCD Displays
  16. Digital ICs
    1. 15.0. Introduction
    2. 15.1. Protecting ICs from Electrical Noise
    3. 15.2. Know Your Logic Families
    4. 15.3. Control More Outputs Than You Have GPIO Pins
    5. 15.4. Build a Digital Toggle Switch
    6. 15.5. Reduce a Signal’s Frequency
    7. 15.6. Connect to Decimal Counters
  17. Analog
    1. 16.0. Introduction
    2. 16.1. Filter Out High Frequencies (Quick and Dirty)
    3. 16.2. Create an Oscillator
    4. 16.3. Flash LEDs in Series
    5. 16.4. Avoid Drops in Voltage from Input to Output
    6. 16.5. Build a Low-Cost Oscillator
    7. 16.6. Build a Variable Duty Cycle Oscillator
    8. 16.7. Make a One Shot Timer
    9. 16.8. Control Motor Speed
    10. 16.9. Apply Pulse-Width Modulation to an Analog Signal
    11. 16.10. Make a Voltage-Controlled Oscillator (VCO)
    12. 16.11. Explore Decibel Measurement
  18. Operational Amplifiers
    1. 17.0. Introduction
    2. 17.1. Select an Op-Amp
    3. 17.2. Power an Op-Amp (Split Supply)
    4. 17.3. Power an Op-amp (Single Supply)
    5. 17.4. Make an Inverting Amplifier
    6. 17.5. Make a Non-Inverting Amplifier
    7. 17.6. Buffer a Signal
    8. 17.7. Reduce the Amplitude of High Frequencies
    9. 17.8. Filter Out Low Frequencies
    10. 17.9. Filter Out High and Low Frequencies
    11. 17.10. Compare Two Voltages
  19. Audio
    1. 18.0. Introduction
    2. 18.1. Play Sounds on Arduino
    3. 18.2. Play Sound with a Raspberry Pi
    4. 18.3. Incorporate an Electret Microphone Into a Project
    5. 18.4. Make a 1W Power Amplifier
    6. 18.5. Make a 10W Power Amplifier
  20. Radio Frequency
    1. 19.0. Introduction
    2. 19.1. Make an FM Radio Transmitter
    3. 19.2. Create a Software FM Transmitter using Raspberry Pi
    4. 19.3. Build an Arduino-Powered FM Receiver
    5. 19.4. Send Digital Data Over a Radio
  21. Construction
    1. 20.0. Introduction
    2. 20.1. Create Temporary Circuits
    3. 20.2. Create Permanent Circuits
    4. 20.3. Design Your Own Circuit Board
    5. 20.4. Explore Through-Hole Soldering
    6. 20.5. Explore Surface Mount Soldering
    7. 20.6. Desolder Components
    8. 20.7. Solder Without Destroying Components
  22. Tools
    1. 21.0. Introduction
    2. 21.1. Use a Lab Power Supply
    3. 21.2. Measure DC Voltage
    4. 21.3. Measure AC Voltage
    5. 21.4. Measure Current
    6. 21.5. Measure Continuity
    7. 21.6. Measure Resistance, Capacitance, or Inductance
    8. 21.7. Discharge Capacitors
    9. 21.8. Measure High Voltages
    10. 21.9. Use an Oscilloscope
    11. 21.10. Use a Function Generator
    12. 21.11. Simulation
    13. 21.12. Working Safely with High Voltages
  23. Parts and Suppliers
    1. Parts
    2. Prototyping Equipment
    3. Resistors
    4. Capacitors and Inductors
    5. Transistors, Diodes
    6. Integrated Circuits
    7. Opto-Electronics
    8. Modules
    9. Miscellaneous
    10. Equipment
  24. Arduino Pinouts
    1. Arduino Uno R3
    2. Arduino Pro Mini
  25. Raspberry Pi Pinouts
    1. Raspberry Pi 2 model B, B+, A+, Zero
    2. Raspberry Pi model B rev. 2, A
    3. Raspberry Pi model B rev. 1
  26. Units and Prefixes
    1. Units
    2. Unit Prefixes
  27. Index