0%

The Arduino is an affordable, flexible, open source microcontroller platform designed to make it easy for hobbyists to use electronics in homemade projects. With an almost unlimited range of input and output add-ons, sensors, indicators, displays, motors, and more, the Arduino offers you countless ways to create devices that interact with the world around you.

This second edition of Arduino Workshop has been updated for the latest version of Arduino IDE. It begins with an overview of the Arduino system and then moves on to coverage of various electronic components and concepts, including revised content reflecting advances in displays, touchscreens, sensors, motors, GPS, and wireless technology. You’ll learn about new hardware and find updated projects that cover areas like touchscreens and LED displays, robotics, using sensors with wireless data links, and even controlling projects remotely through a cell phone. Brand new chapters include coverage of MAX7219-based LED numeric displays, LED matrix modules, and creating your own Arduino libraries.

Throughout the book, hands-on projects reinforce what you've learned and show you how to apply that knowledge. As your understanding grows, the projects increase in complexity and sophistication. Along the way, you’ll learn valuable lessons in coding, including how to create your own Arduino libraries to efficiently reuse code across multiple projects.

Among the book's 65 projects are useful devices like:

•A digital thermometer that charts temperature changes on an LCD
•A GPS logger that records data from your travels, which can be displayed on Google Maps
•A handy tester that lets you check the voltage of any single-cell battery
•A keypad-controlled lock that requires a secret code to open

You'll also learn to build Arduino toys and games like:

•An electronic version of the classic six-sided die
•A binary quiz game that challenges your number conversion skills
•A motorized remote control car with collision detection to keep it from crashing

Arduino Workshop will teach you the tricks and design principles of a master craftsman. Whatever your skill level, you'll have fun as you learn to harness the power of the Arduino for your own DIY projects.

Table of Contents

  1. Reviews for the first edition of Arduino Workshop
  2. Title Page
  3. Copyright
  4. Dedication
  5. About the Author
  6. Acknowledgments
  7. Chapter 1: Getting Started
    1. The Possibilities Are Endless
    2. Strength in Numbers
    3. Parts and Accessories
    4. Required Software
    5. macOS
    6. Windows 10
    7. Ubuntu Linux
    8. Using Arduino Safely
    9. Looking Ahead
  8. Chapter 2: Exploring the Arduino Board and the IDE
    1. The Arduino Board
    2. Taking a Look Around the IDE
    3. The Command Area
    4. The Text Area
    5. The Output Window
    6. Creating Your First Sketch in the IDE
    7. Comments
    8. The setup() Function
    9. Controlling the Hardware
    10. The loop() Function
    11. Verifying Your Sketch
    12. Uploading and Running Your Sketch
    13. Modifying Your Sketch
    14. Looking Ahead
  9. Chapter 3: First Steps
    1. Planning Your Projects
    2. About Electricity
    3. Current
    4. Voltage
    5. Power
    6. Electronic Components
    7. The Resistor
    8. The Light-Emitting Diode
    9. The Solderless Breadboard
    10. Project #1: Creating a Blinking LED Wave
    11. The Algorithm
    12. The Hardware
    13. The Schematic
    14. The Sketch
    15. Running the Sketch
    16. Using Variables
    17. Project #2: Repeating with for Loops
    18. Varying LED Brightness with Pulse-Width Modulation
    19. Project #3: Demonstrating PWM
    20. More Electric Components
    21. The Transistor
    22. The Rectifier Diode
    23. The Relay
    24. Higher-Voltage Circuits
    25. Looking Ahead
  10. Chapter 4: Building Blocks
    1. Using Schematic Diagrams
    2. Identifying Components
    3. Wires in Schematics
    4. Dissecting a Schematic
    5. The Capacitor
    6. Measuring the Capacity of a Capacitor
    7. Reading Capacitor Values
    8. Types of Capacitors
    9. Digital Inputs
    10. Project #4: Demonstrating a Digital Input
    11. The Algorithm
    12. The Hardware
    13. The Schematic
    14. The Sketch
    15. Understanding the Sketch
    16. Modifying Your Sketch: Making More Decisions with if-else
    17. Boolean Variables
    18. Comparison Operators
    19. Making Two or More Comparisons
    20. Project #5: Controlling Traffic
    21. The Goal
    22. The Algorithm
    23. The Hardware
    24. The Schematic
    25. The Sketch
    26. Running the Sketch
    27. Analog vs. Digital Signals
    28. Project #6: Creating a Single-Cell Battery Tester
    29. The Goal
    30. The Algorithm
    31. The Hardware
    32. The Schematic
    33. The Sketch
    34. Doing Arithmetic with an Arduino
    35. Float Variables
    36. Comparison Operators for Calculations
    37. Improving Analog Measurement Precision with a Reference Voltage
    38. Using an External Reference Voltage
    39. Using the Internal Reference Voltage
    40. The Variable Resistor
    41. Piezoelectric Buzzers
    42. Piezo Schematic
    43. Project #7: Trying Out a Piezo Buzzer
    44. Project #8: Creating a Quick-Read Thermometer
    45. The Goal
    46. The Hardware
    47. The Schematic
    48. The Sketch
    49. Looking Ahead
  11. Chapter 5: Working with Functions
    1. Project #9: Creating a Function to Repeat an Action
    2. Project #10: Creating a Function to Set the Number of Blinks
    3. Creating a Function to Return a Value
    4. Project #11: Creating a Quick-Read Thermometer That Blinks the Temperature
    5. The Hardware
    6. The Schematic
    7. The Sketch
    8. Displaying Data from the Arduino in the Serial Monitor
    9. The Serial Monitor
    10. Project #12: Displaying the Temperature in the Serial Monitor
    11. Debugging with the Serial Monitor
    12. Making Decisions with while Statements
    13. while
    14. do-while
    15. Sending Data from the Serial Monitor to the Arduino
    16. Project #13: Multiplying a Number by Two
    17. long Variables
    18. Project #14: Using long Variables
    19. Looking Ahead
  12. Chapter 6: Numbers, Variables, and Arithmetic
    1. Generating Random Numbers
    2. Using Ambient Current to Generate a Random Number
    3. Project #15: Creating an Electronic Die
    4. The Hardware
    5. The Schematic
    6. The Sketch
    7. Modifying the Sketch
    8. A Quick Course in Binary
    9. Binary Numbers
    10. Byte Variables
    11. Increasing Digital Outputs with Shift Registers
    12. Project #16: Creating an LED Binary Number Display
    13. The Hardware
    14. The Schematic
    15. The Sketch
    16. Project #17: Making a Binary Quiz Game
    17. The Algorithm
    18. The Sketch
    19. Arrays
    20. Defining an Array
    21. Referring to Values in an Array
    22. Writing to and Reading from Arrays
    23. Seven-Segment LED Displays
    24. Controlling the LED
    25. Project #18: Creating a Single-Digit Display
    26. The Hardware
    27. The Schematic
    28. The Sketch
    29. Modifying the Sketch: Displaying Double Digits
    30. Project #19: Controlling Two Seven-Segment LED Display Modules
    31. The Hardware
    32. The Schematic
    33. Modulo
    34. Project #20: Creating a Digital Thermometer
    35. The Hardware
    36. The Sketch
    37. Looking Ahead
  13. Chapter 7: Expanding Your Arduino
    1. Shields
    2. ProtoShields
    3. Project #21: Creating a Custom Shield
    4. The Hardware
    5. The Schematic
    6. The Layout of the ProtoShield Board
    7. The Design
    8. Soldering the Components
    9. Testing Your ProtoShield
    10. Expanding Sketches with Libraries
    11. Downloading an Arduino Library as a ZIP File
    12. Importing an Arduino Library with Library Manager
    13. SD Memory Cards
    14. Connecting the Card Module
    15. Testing Your SD Card
    16. Project #22: Writing Data to the Memory Card
    17. The Sketch
    18. Project #23: Creating a Temperature-Logging Device
    19. The Hardware
    20. The Sketch
    21. Timing Applications with millis() and micros()
    22. Project #24: Creating a Stopwatch
    23. The Hardware
    24. The Schematic
    25. The Sketch
    26. Interrupts
    27. Interrupt Modes
    28. Configuring Interrupts
    29. Activating or Deactivating Interrupts
    30. Project #25: Using Interrupts
    31. The Sketch
    32. Looking Ahead
  14. Chapter 8: LED Numeric Displays and Matrices
    1. LED Numeric Displays
    2. Installing the Library
    3. Project #26: Digital Stopwatch
    4. Project #27: Using LED Matrix Modules
    5. Installing the Library
    6. Editing the Display Font
    7. Looking Ahead
  15. Chapter 9: Liquid Crystal Displays
    1. Character LCD Modules
    2. Using a Character LCD in a Sketch
    3. Displaying Text
    4. Displaying Variables or Numbers
    5. Project #28: Defining Custom Characters
    6. Graphic LCD Modules
    7. Connecting the Graphic LCD
    8. Using the LCD
    9. Controlling the Display
    10. Project #29: Seeing the Text Functions in Action
    11. The Sketch
    12. Running the Sketch
    13. Creating More Complex Display Effects with Graphic Functions
    14. Project #30: Seeing the Graphic Functions in Action
    15. The Sketch
    16. Project #31: Creating a Temperature History Monitor
    17. The Algorithm
    18. The Hardware
    19. The Sketch
    20. Running the Sketch
    21. Modifying the Sketch
    22. Looking Ahead
  16. Chapter 10: Creating Your Own Arduino Libraries
    1. Creating Your First Arduino Library
    2. Anatomy of an Arduino Library
    3. The Header File
    4. The Source File
    5. The KEYWORDS.TXT File
    6. Installing Your New Arduino Library
    7. Creating a ZIP File Using Windows 7 and Later
    8. Creating a ZIP File Using Mac OS X or Later
    9. Installing Your New Library
    10. Creating a Library That Accepts Values to Perform a Function
    11. Creating a Library That Processes and Displays Sensor Values
    12. Looking Ahead
  17. Chapter 11: Numeric Keypads
    1. Using a Numeric Keypad
    2. Wiring a Keypad
    3. Programming for the Keypad
    4. Testing the Sketch
    5. Making Decisions with switch case
    6. Project #32: Creating a Keypad-Controlled Lock
    7. The Sketch
    8. Understanding the Sketch
    9. Testing the Sketch
    10. Looking Ahead
  18. Chapter 12: Accepting User Input with Touchscreens
    1. Touchscreens
    2. Connecting the Touchscreen
    3. Project #33: Addressing Areas on the Touchscreen
    4. The Hardware
    5. The Sketch
    6. Testing the Sketch
    7. Mapping the Touchscreen
    8. Project #34: Creating a Two-Zone On/Off Touch Switch
    9. The Sketch
    10. Understanding the Sketch
    11. Testing the Sketch
    12. Using the map() Function
    13. Project #35: Creating a Three-Zone Touch Switch
    14. The Touchscreen Map
    15. The Sketch
    16. Understanding the Sketch
    17. Looking Ahead
  19. Chapter 13: Meet the Arduino Family
    1. Project #36: Creating Your Own Breadboard Arduino
    2. The Hardware
    3. The Schematic
    4. Running the Sketch
    5. The Many Arduino and Alternative Boards
    6. Arduino Uno
    7. Freetronics Eleven
    8. The Adafruit Pro Trinket
    9. The Arduino Nano
    10. The LilyPad
    11. The Arduino Mega 2560
    12. The Freetronics EtherMega
    13. The Arduino Due
    14. Looking Ahead
  20. Chapter 14: Motors and Movement
    1. Making Small Motions with Servos
    2. Selecting a Servo
    3. Connecting a Servo
    4. Putting a Servo to Work
    5. Project #37: Building an Analog Thermometer
    6. The Hardware
    7. The Schematic
    8. The Sketch
    9. Using Electric Motors
    10. Selecting a Motor
    11. The TIP120 Darlington Transistor
    12. Project #38: Controlling the Motor
    13. The Hardware
    14. The Schematic
    15. The Sketch
    16. Using Small Stepper Motors
    17. Project #39: Building and Controlling a Robot Vehicle
    18. The Hardware
    19. The Schematic
    20. Connecting the Motor Shield
    21. The Sketch
    22. Connecting Extra Hardware to the Robot
    23. Sensing Collisions
    24. Project #40: Detecting Robot Vehicle Collisions with a Microswitch
    25. The Schematic
    26. The Sketch
    27. Infrared Distance Sensors
    28. Wiring It Up
    29. Testing the IR Distance Sensor
    30. Project #41: Detecting Robot Vehicle Collisions with an IR Distance Sensor
    31. The Sketch
    32. Modifying the Sketch: Adding More Sensors
    33. Ultrasonic Distance Sensors
    34. Connecting the Ultrasonic Sensor
    35. Testing the Ultrasonic Sensor
    36. Project #42: Detecting Collisions with an Ultrasonic Distance Sensor
    37. The Sketch
    38. Looking Ahead
  21. Chapter 15: Using GPS with Your Arduino
    1. What Is GPS?
    2. Testing the GPS Shield
    3. Project #43: Creating a Simple GPS Receiver
    4. The Hardware
    5. The Sketch
    6. Running the Sketch
    7. Project #44: Creating an Accurate GPS-Based Clock
    8. The Hardware
    9. The Sketch
    10. Project #45: Recording the Position of a Moving Object over Time
    11. The Hardware
    12. The Sketch
    13. Running the Sketch
    14. Looking Ahead
  22. Chapter 16: Wireless Data
    1. Using Low-Cost Wireless Modules
    2. Project #46: Creating a Wireless Remote Control
    3. The Transmitter Circuit Hardware
    4. The Transmitter Schematic
    5. The Receiver Circuit Hardware
    6. The Receiver Schematic
    7. The Transmitter Sketch
    8. The Receiver Sketch
    9. Using LoRa Wireless Data Modules for Greater Range and Faster Speed
    10. Project #47: Remote Control over LoRa Wireless
    11. The Transmitter Circuit Hardware
    12. The Transmitter Schematic
    13. The Receiver Circuit Hardware
    14. The Receiver Schematic
    15. The Transmitter Sketch
    16. The Receiver Sketch
    17. Project #48: Remote Control over LoRa Wireless with Confirmation
    18. The Transmitter Circuit Hardware
    19. The Transmitter Schematic
    20. The Transmitter Sketch
    21. The Receiver Sketch
    22. Project #49: Sending Remote Sensor Data Using LoRa Wireless
    23. The Transmitter Circuit Hardware
    24. The Receiver Circuit Hardware
    25. The Receiver Schematic
    26. The Transmitter Sketch
    27. The Receiver Sketch
    28. Looking Ahead
  23. Chapter 17: Infrared Remote Control
    1. What Is Infrared?
    2. Setting Up for Infrared
    3. The IR Receiver
    4. The Remote Control
    5. A Test Sketch
    6. Testing the Setup
    7. Project #50: Creating an IR Remote Control Arduino
    8. The Hardware
    9. The Schematic
    10. The Sketch
    11. Modifying the Sketch
    12. Project #51: Creating an IR Remote Control Robot Vehicle
    13. The Hardware
    14. The Sketch
    15. Looking Ahead
  24. Chapter 18: Reading RFID Tags
    1. Inside RFID Devices
    2. Testing the Hardware
    3. The Schematic
    4. Testing the Schematic
    5. The Test Sketch
    6. Displaying the RFID Tag ID Number
    7. Project #52: Creating a Simple RFID Control System
    8. The Sketch
    9. Understanding the Sketch
    10. Storing Data in the Arduino’s Built-in EEPROM
    11. Reading and Writing to the EEPROM
    12. Project #53: Creating an RFID Control with “Last Action” Memory
    13. The Sketch
    14. Understanding the Sketch
    15. Looking Ahead
  25. Chapter 19: Data Buses
    1. The I2C Bus
    2. Project #54: Using an External EEPROM
    3. The Hardware
    4. The Schematic
    5. The Sketch
    6. Running the Sketch
    7. Project #55: Using a Port Expander IC
    8. The Hardware
    9. The Schematic
    10. The Sketch
    11. The SPI Bus
    12. Pin Connections
    13. Implementing the SPI
    14. Sending Data to an SPI Device
    15. Project #56: Using a Digital Rheostat
    16. The Hardware
    17. The Schematic
    18. The Sketch
    19. Looking Ahead
  26. Chapter 20: Real-Time Clocks
    1. Connecting the RTC Module
    2. Project #57: Adding and Displaying Time and Date with an RTC
    3. The Hardware
    4. The Sketch
    5. Understanding and Running the Sketch
    6. Project #58: Creating a Simple Digital Clock
    7. The Hardware
    8. The Sketch
    9. Understanding and Running the Sketch
    10. Project #59: Creating an RFID Time-Clock System
    11. The Hardware
    12. The Sketch
    13. Understanding the Sketch
    14. Looking Ahead
  27. Chapter 21: The Internet
    1. What You’ll Need
    2. Project #60: Building a Remote Monitoring Station
    3. The Hardware
    4. The Sketch
    5. Troubleshooting
    6. Understanding the Sketch
    7. Project #61: Creating an Arduino Tweeter
    8. The Hardware
    9. The Sketch
    10. Controlling Your Arduino from the Web
    11. Project #62: Setting Up a Remote Control for Your Arduino
    12. The Hardware
    13. The Sketch
    14. Controlling Your Arduino Remotely
    15. Looking Ahead
  28. Chapter 22: Cellular Communications
    1. The Hardware
    2. Hardware Configuration and Testing
    3. Project #63: Building an Arduino Dialer
    4. The Hardware
    5. The Schematic
    6. The Sketch
    7. Understanding the Sketch
    8. Project #64: Building an Arduino Texter
    9. The Sketch
    10. Understanding the Sketch
    11. Project #65: Setting Up an SMS Remote Control
    12. The Hardware
    13. The Schematic
    14. The Sketch
    15. Understanding the Sketch
    16. Looking Ahead
  29. Index
3.238.62.124