You are previewing Lego Mindstorms EV3 Essentials.
O'Reilly logo
Lego Mindstorms EV3 Essentials

Book Description

Create and program complex autonomous robots using the third-generation Lego Mindstorms robotics kit

In Detail

Building robots from scratch can be a tough task, but the Lego Mindstorms EV3 robotics kit makes it easy to create them in minutes. Far more than a toy, the programming brick allows you to create functional robots while its open source and hackable nature will allow you to use the powerful LeJOS framework to create projects of increasing complexity.

This book provides a rapid and practical guide to building with EV3. Get up and running and swiftly learn how to construct and program automated robots using the EV3's brick, motors, and sensors. Next, you'll construct an obstacle-avoiding robot and learn how to program the EV3 brick before moving on to the advanced possibilities of the LeJOS framework. You will also learn how to install LeJOS, link your computer to EV3, and how to use it to program your Lego robots in Java. You will then quickly get to grips with using LeJOS by constructing an autonomous line-tracking robot. By the end of this book, you will be able to unleash the full creative power of Lego Mindstorms EV3.

What You Will Learn

  • Get to grips with the components of Lego EV3
  • Calibrate sensors and motors for your robot
  • Program essential commands to EV3 on the brick
  • Connect EV3 to your computer using USB, Bluetooth, and Wi-Fi
  • Build several robots that navigate obstacles and follow line paths
  • Install LeJOS on EV3 and program EV3 using Java
  • Automate code compilation and deployment using Gradle and SSH
  • Set up various IDEs with a focus on Android Studio for development using LeJOS
  • 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. Lego Mindstorms EV3 Essentials
      1. Table of Contents
      2. Lego Mindstorms EV3 Essentials
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      8. 1. Introducing EV3
        1. Presenting EV3
        2. Introducing the EV3 components
          1. Brick
          2. Motors
          3. Sensors
          4. Technic pieces
        3. Differentiating between the Home and Education sets
        4. An overview of the brick
          1. The front face
          2. The back face
          3. The top face
          4. The bottom face
          5. The left face
          6. The right face
        5. Navigating the menu
          1. The Recent Programs tab
          2. The File Browser tab
          3. The Apps tab
          4. The Settings tab
          5. Turning off EV3
        6. Summary
      9. 2. Sensors and Motors
        1. Introducing inputs
          1. The touch sensor
          2. The color sensor
            1. The reflect mode
            2. The ambient mode
            3. The color mode
          3. The infrared sensor
            1. The proximity mode
            2. The remote mode
          4. The ultrasonic sensor
          5. The gyroscopic sensor
            1. The angle mode
            2. The rate mode
          6. Motors
            1. The large motor
              1. The degree mode
              2. The rotation mode
            2. The medium motor
        2. Outputs
          1. Motors
        3. The Motor Control application
        4. Constructing a rover robot
        5. Summary
      10. 3. EV3 Brick Programming
        1. The Brick Program application
        2. Visual programming – blocks and icons
          1. Explaining the Hello program
          2. Programming blocks
        3. Sample programs
          1. Multiple segments
          2. Simultaneous actions
          3. Button-activated greeting
          4. Sensor-activated greeting
            1. The touch sensor
            2. The color sensor (the REFLECT mode)
            3. The color sensor (the COLOR mode)
            4. The IR sensor (the PROX mode)
          5. Motor control
            1. The motor rotation event
          6. Detecting obstacles
        4. Obstacle-avoiding robot
          1. Desired functionality
          2. Construction
          3. Differential drive
          4. Program sequence
        5. Limitations of visual programming
        6. Summary
      11. 4. LeJOS – Unleashing EV3
        1. Classic programming on EV3
        2. LeJOS – introduction
        3. The advantages of LeJOS
        4. Installing LeJOS
          1. Confirming the SD card's filesystem
          2. Loading firmware on the SD card
          3. Installing LeJOS on EV3
        5. Testing the LeJOS installation
        6. Summary
      12. 5. Connecting with LeJOS
        1. Copying files to the SD card
          1. Limitations
        2. Mini USB cable
        3. SSH access
          1. Setting up the SSH configuration
          2. Limitations
        4. Bluetooth
          1. Configuring the computer
          2. Configuring EV3
          3. Connecting to EV3 using Bluetooth
        5. Wi-Fi
          1. Configuring EV3
            1. Wi-Fi configuration using SSH
          2. Limitations
        6. Summary
      13. 6. Hello, World – Writing Our First Program
        1. Installing the JDK
          1. Testing the JDK
            1. Explanation
            2. Compiling and running the code
        2. Gradle
          1. Testing the Gradle installation
            1. Explanation
            2. Compiling and running the code
        3. LeJOS libraries
        4. The Hello, World EV3 program
          1. The HelloWorld.java program
            1. Explanation
          2. The build.gradle file
            1. Explanation
          3. Compilation
          4. Deployment
          5. Execution
        5. Summary
      14. 7. Sensors and Motors – the LeJOS way
        1. A brief interlude about IDEs
        2. Large motor
          1. The build.gradle file
          2. The Motor.java file
          3. Compile, deploy, and execute
          4. More motor commands
        3. The touch sensor
          1. The TouchSensor.java file
          2. The Touch.java file
            1. Explanation
          3. Compile, deploy, and execute
        4. Summary
      15. 8. The Line-follower Robot
        1. The Line-follower robot
          1. The required behavior
        2. Construction
        3. Differential drive
        4. Setting up the LeJOS project
          1. The build.gradle file
          2. The LineFollower.java file
        5. Programming the differential drive
          1. The differential drive code
            1. Constructors
            2. Commands
              1. Forward
              2. Stop
              3. Rotate clockwise
              4. Rotate counterclockwise
        6. Testing the differential drive
          1. Modified Line-follower code
        7. Summary
      16. 9. Sensing the Path
        1. Exploring the color sensor
          1. The ColorSensor.java file
          2. The LineFollower.java file
          3. Testing
        2. Detecting the path
          1. The ColorSensor.java file
          2. The LineFollower.java file
          3. Testing
        3. Interrupting the motion
          1. The LineFollower.java file
          2. Testing
        4. Summary
      17. 10. Tracking the Line
        1. The objective
        2. The project structure
        3. Controller
          1. The LineFollower.java file
          2. The Controller.java file
            1. Explanation
        4. The project code
          1. The ColorSensor.java file
          2. The DifferentialDrive.java file
          3. The LineFollower.java file
          4. The build.gradle file
          5. Makefile
        5. Tracking a straight line
          1. The Controller.java file
            1. Explanation
        6. Sweeping for the path
          1. Code changes (Controller.java)
            1. Testing
            2. Issues
        7. The limited sweep
          1. Code changes (Controller.java)
            1. Testing
        8. The narrow seek capability
          1. Code changes (Controller.java)
            1. Testing
        9. The final version
          1. Code (Controller.java)
            1. Explanation
            2. Testing
        10. Summary
      18. A. The Make Utility
        1. Makefile
          1. Prerequisites
          2. Basic usage
          3. Explanation
      19. B. LeJOS and IDEs
        1. Eclipse
        2. IntelliJ IDEA
        3. Android Studio
      20. Index