O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Mastering Arduino

Book Description

Mastering Arduino is a practical, no-nonsense guide that will teach you the electronics and programming skills that you need to create advanced Arduino projects.

Key Features

  • Covers enough electronics and code for users at any level
  • Includes complete circuit diagrams for all projects
  • Final robot project combines knowledge from all the chapters

Book Description

Mastering Arduino is an all-in-one guide to getting the most out of your Arduino. This practical, no-nonsense guide teaches you all of the electronics and programming skills that you need to create advanced Arduino projects. This book is packed full of real-world projects for you to practice on, bringing all of the knowledge in the book together and giving you the skills to build your own robot from the examples in this book. The final two chapters discuss wireless technologies and how they can be used in your projects.

The book begins with the basics of electronics, making sure that you understand components, circuits, and prototyping before moving on. It then performs the same function for code, getting you into the Arduino IDE and showing you how to connect the Arduino to a computer and run simple projects on your Arduino.

Once the basics are out of the way, the next 10 chapters of the book focus on small projects centered around particular components, such as LCD displays, stepper motors, or voice synthesizers. Each of these chapters will get you familiar with the technology involved, how to build with it, how to program it, and how it can be used in your own projects.

What you will learn

  • Explains the basics of electronics and circuits along with the Arduino IDE and basic C operations
  • Use sensors to build a mini weather station
  • Control LEDs using code
  • Power a robot arm using stepper motors
  • Remotely control your Arduino using RF, Bluetooth LE, and Bluetooth Classic
  • Make a sound tone generator with buttons

Who this book is for

Mastering Arduino is for anybody who wants to experiment with an Arduino board and build simple projects. No prior knowledge is required, as the fundamentals of electronics and coding are covered in this book as well as advance projects.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Mastering Arduino
  3. Dedication
  4. Packt Upsell
    1. Why subscribe?
    2. packt.com
  5. Contributors
    1. About the author
    2. About the reviewers
    3. Packt is searching for authors like you
  6. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  7. The Arduino
    1. History of the Arduino
      1. What is the Arduino?
    2. Touring the Arduino UNO R3
    3. Powering the Arduino
      1. Using the VIN/GND pins to power the Arduino
      2. Using the DC supply input to power the Arduino
      3. Using the USB connector to power the Arduino
    4. Arduino shields
    5. Arduino pin
      1. Digital pins
      2. Analog input pins
      3. PWM pins
      4. Power pins
      5. Serial pins
      6. SPI pins
    6. Different Arduino boards
      1. Arduino Micro
      2. Arduino Mega 2560
      3. Lilypad
      4. Arduino Nano
      5. Generic boards
    7. Summary
  8. Basic Electronics
    1. Electronic building block
      1. Power supply
      2. Input
      3. Output
      4. Control circuit
    2. Multimeter
    3. Electronic components
      1. Resistor
      2. Potentiometer
      3. Switches
      4. Transistor
      5. LED
      6. Capacitor
      7. Integrated circuit
    4. What is electricity?
    5. Current
    6. Voltage
    7. Resistance
    8. Ohm's law
    9. What is power?
    10. Resistor color codes
    11. Summary
  9. Circuit Diagrams
    1. What is a circuit?
    2. Fritzing
    3. Fritzing diagrams
    4. Schematic diagrams
    5. Parallel and series circuits
    6. Series circuits
      1. Resistance
      2. Voltage
      3. Current
    7. Parallel circuits
      1. Resistance
      2. Voltage
      3. Current
    8. Voltage drop
    9. Light up LED
    10. Summary
  10. Basic Prototyping
    1. Setting up a work area
    2. Using a solderless breadboard
    3. Dupont (jumper) cables
    4. Prototyping
      1. Four building blocks of an electronic project
      2. Creating a diagram
      3. Building the prototype
    5. First prototype
    6. Summary
  11. Arduino IDE
    1. Arduino Sketch
    2. Arduino IDE
      1. Exploring the IDE
      2. Configuring the Arduino within the IDE
    3. Arduino web editor
      1. Exploring
      2. Configuring the Arduino within the IDE
    4. Examples
    5. Arduino libraries
    6. Serial monitor
    7. Hello World
    8. Echo
    9. Summary
  12. Programming the Arduino - The Basics
    1. Curly brackets
    2. Semicolons
    3. Comments
    4. Variables
    5. Data types
      1. Boolean
      2. Byte
      3. Integer
      4. Long
      5. Double and float
      6. Character
    6. Arrays
    7. Character arrays
    8. Constants
    9. Arithmetic functions
    10. Comparison operators
    11. Logical operators
    12. Casting
    13. Decision making
    14. Looping
    15. Functions
    16. Summary
  13. Programming the Arduino - Beyond the Basics
    1. Setting digital pin mode
    2. Digital write
    3. Digital read
    4. Analog write
    5. Analog read
    6. Structures
    7. Unions
    8. Adding tabs
    9. Working with tabs
    10. Object-oriented programming
    11. String library
    12. Summary
  14. Motion Sensor
    1. Introduction
    2. Components needed
    3. Circuit diagrams
    4. Code
    5. Running the project
    6. Challenge
    7. Summary
  15. Environment Sensors
    1. Introduction
    2. Components needed
    3. Circuit diagrams
    4. Code
    5. Running the project
    6. Challenge
    7. Summary
  16. Obstacle Avoidance and Collision Detection
    1. Introduction
      1. Crash sensor
      2. Obstacle avoidance sensor
      3. Ultrasonic range finder
    2. Components needed
    3. Circuit diagrams
    4. Code
    5. Running the project
    6. Challenge
    7. Summary
  17. Fun with Lights
    1. Introduction
    2. Components needed
    3. Circuit diagrams
    4. Code
      1. RGB LED
      2. NeoPixel shield
    5. Running the project
    6. Challenge
    7. Summary
  18. Fun with Sound
    1. Introduction
    2. Components needed
    3. Circuit diagrams
    4. Code
      1. Using the tone function
      2. Playing a ringtone in the RTTTL format
    5. Challenge
    6. Summary
  19. Using LCD Displays
    1. Introduction
    2. Components needed
    3. Circuit diagrams
    4. Code
      1. Drawing a line
      2. Displaying text
      3. Rotating text
      4. Basic shapes
      5. Filled shape
      6. Rectangle
      7. Filled rectangle
      8. Rounded rectangle
      9. Filled rounded rectangle
    5. Challenge
    6. Summary
  20. Speech Recognition and Voice Synthesizing
    1. Introduction
    2. Components needed
    3. Circuit diagrams
    4. Code
    5. Running the project
    6. Challenge
    7. Summary
  21. DC Motors and Motor Controllers
    1. Introduction
    2. Components needed
    3. Circuit diagrams
    4. Code
    5. Running the project
    6. Challenge
    7. Summary
  22. Servo Motors
    1. Introduction
    2. Components needed
    3. Circuit diagrams
    4. Code
    5. Challenge
    6. Summary
  23. Using a Relay
    1. Introduction
    2. Components needed
    3. Circuit diagrams
    4. Code
    5. Challenge
    6. Summary
  24. Remotely Controlling the Arduino
    1. Introduction
    2. Components needed
    3. Circuit diagrams
    4. Code
    5. Challenge
    6. Summary
  25. Creating a Robot
    1. Introduction
    2. Chassis and movement
    3. Motors and power
    4. Autonomous robot–obstacle avoidance and collision detection
    5. Remotely controlling a robot
    6. User feedback
    7. Making things rotate
    8. Non-robotic projects
      1. Weather station
      2. Smart thermostat
    9. Proximity sensor
    10. Challenge
    11. Summary
  26. Bluetooth LE
    1. Introduction
    2. Bluetooth LE radio
      1. Network topology
        1. Bluetooth LE broadcasting
        2. Bluetooth LE connections
      2. Bluetooth LE profiles
        1. Generic access profile (GAP)
        2. Generic attribute (GATT) profile
      3. HM-10 Bluetooth module
    3. Components needed
    4. Circuit diagrams
    5. Project 1 – serial communication
      1. Test command
      2. Query software version
      3. Restore factory default
      4. Restart module
      5. Query MAC (Media Access Control) address
      6. Set name
      7. Query name
      8. Set the advertising interval
      9. Query the advertising interval
      10. Set advertising type
      11. Query advertising type
      12. Set baud rate
      13. Query baud rate
      14. Set characteristic id
      15. Set service id
      16. Query service id
      17. Set role
      18. Query role
      19. Clear last connected device
      20. Try to connect to last connected device
      21. Try to connect to an address
      22. Set pin code
      23. Query pin code
      24. Set module power
      25. Query module power
      26. Set bond mode
      27. Query bond mode
      28. Set notify information
      29. Query notify information
    6. Project 2 – controlling LED
    7. Project 3 – environmental sensor
    8. What is new with Bluetooth 4.1, 4.2 and 5.0?
      1. Bluetooth 4.1
      2. Bluetooth 4.2
      3. Bluetooth 5.0
      4. Bluetooth mesh
    9. Challenge
    10. Summary
  27. Bluetooth Classic
    1. Introduction
    2. Bluetooth radio
      1. Network topology
    3. Components needed
    4. Circuit diagrams
    5. Project 1 – configuring the Bluetooth modules
      1. Test command
      2. Reset command
      3. Query firmware
      4. Restore defaults
      5. Query module address
      6. Set/Query module mode
      7. Set/Query UART parameters
      8. Set/Query connection mode
      9. Set/Query bind address
    6. Project 2 – serial connection, sending data
    7. Project 3 – joystick remote control
    8. Summary
  28. Another Book You May Enjoy
    1. Leave a review - let other readers know what you think