Robotics at home with raspberry pi pico build autonomous robots with the versatile low-cost raspberry pi pico controller and python
Design, build, and program a mobile robot platform while gaining an understanding of the Raspberry Pi Pico, Free CAD, and robot sensors using Python to code, Bluetooth to connect & smartphone to control your projects Key Features Gain in depth knowledge of robotics with easy-to-follow instructio...
Other Authors: | |
---|---|
Format: | eBook |
Language: | Inglés |
Published: |
Birmingham, England ; Mumbai :
Packt Publishing
[2023]
|
Edition: | 1st ed |
Subjects: | |
See on Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009729739706719 |
Table of Contents:
- Cover
- Copyright
- Contributors
- Table of Contents
- Preface
- Part 1: The Basics - Preparing for Robotics with Raspberry Pi Pico
- Chapter 1: Planning a Robot with Raspberry Pi Pico
- Technical requirements
- What is Raspberry Pi Pico, and why is it suitable for robotics?
- A microcontroller that runs Python
- Raspberry Pi Pico's interfaces for sensors and devices
- What is CircuitPython?
- Planning a Raspberry Pi Pico robot
- An overview of robot planning
- A note on trade-offs
- Choosing a robot chassis
- Choosing the power systems
- Pin usage
- Test fitting a Raspberry Pi Pico robot
- Creating your first test-fit part
- Motors
- Power systems
- Creating a rough chassis
- Arranging the test-fit parts
- A recommended shopping list for robot basics
- Robot parts and where to find them
- The robot workshop and makerspaces
- Summary
- Exercises
- Further reading
- Chapter 2: Preparing Raspberry Pi Pico
- Technical requirements
- Getting CircuitPython onto Raspberry Pi Pico
- Preparing the CircuitPython library for Pico
- Coding on Pico - first steps
- Downloading the Mu editor
- Lighting the Pico LED with CircuitPython
- Blinking the LED with code
- Soldering headers to Raspberry Pi Pico
- Summary
- Exercises
- Further reading
- Chapter 3: Designing a Robot Chassis in FreeCAD
- Technical requirements
- Introducing FreeCAD
- The FreeCAD screen
- Selecting workbenches
- FreeCAD settings
- Making robot chassis sketches in FreeCAD
- Preparing the document
- Sketching the chassis outline
- Creating the upper parts main sketch
- Sketching the motor holes
- Designing the castor placement
- Modeling chassis parts from sketches
- Modeling the chassis plate
- Modeling the other parts
- Troubleshooting the model
- Modeling the castor in 3D
- Making FreeCAD technical drawings.
- Setting up the page
- Adding parts to the drawing
- Preparing the drawing for print
- Summary
- Exercises
- Further reading
- Chapter 4: Building a Robot around Pico
- Technical requirements
- Cutting styrene parts
- Transferring CAD measurements to a plastic sheet
- Cutting the plastic sheet
- Finishing and sanding the chassis plate
- Assembling a robot chassis
- Attaching the caster and battery box
- Attaching the motors and wheels
- Wiring a Raspberry Pi Pico robot
- Wiring Pico and the motor controller into the breadboard
- Adding the batteries
- Wiring in the motors and encoders
- Powering the robot up
- Summary
- Exercises
- Further reading
- Chapter 5: Driving Motors with Raspberry Pi Pico
- Technical requirements
- Driving forward and back
- Testing each motor with CircuitPython
- Driving wheels in a straight line
- Steering with two motors
- An introduction to pulse width modulation speed control
- Driving fast and slow
- Turning while moving
- Driving along a planned path
- Putting line and turn moves together
- The flaw with driving this way
- Summary
- Exercises
- Further reading
- Part 2: Interfacing Raspberry Pi Pico with Simple Sensors and Outputs
- Chapter 6: Measuring Movement with Encoders on Raspberry Pi Pico
- Technical requirements
- About encoders and odometry
- Absolute and relative sensing
- Types of encoders
- Encoder pulse data
- Wiring in encoders on a Raspberry Pi Pico robot
- Examining the motors
- Examining the wiring
- Programming Raspberry Pi Pico PIO
- Introduction to PIO programming
- Introducing PIOASM
- Detecting input with PIO
- PIO instructions and registers
- Making a counter with PIO
- Measuring encoder count for movement
- Making a simple PIO change detection loop
- Making a bidirectional counter with PIO
- Making reusable encoder code.
- Measure counts for a known time
- Summary
- Exercises
- Further reading
- Chapter 7: Planning and Shopping for More Devices
- Technical requirements
- Introducing sensors
- Analog sensor types
- Timed pulses
- Data bus sensors
- The robot block diagram
- Choosing device types
- Distance sensors
- Inertial measurement unit
- Bluetooth devices
- Device pin usage summary
- Planning what to add and where
- Bluetooth and IMU mounting plan
- Distance sensor mounting plan
- Shopping list - parts and where to find them
- Preparing the robot
- Designing the shelf
- Cutting the shelf
- Designing the front sensor brackets
- Cutting the sensor brackets
- Preparing the chassis plate
- Assembling the robot
- Summary
- Exercises
- Further reading
- Chapter 8: Sensing Distances to Detect Objects with Pico
- Technical requirements
- How distance sensing works
- Soldering headers and attaching them to the robot
- Soldering headers
- Mounting the sensors
- Introduction to I2C communication
- Communicating with a single distance sensor
- Wiring the distance sensors
- VL53LX theory of operation
- Reading a single distance sensor in CircuitPython
- Troubleshooting
- Connecting two distance sensors
- Troubleshooting
- Building a wall avoider with Raspberry Pi Pico
- Preparing the robot library
- Wall-avoiding theory of operation
- Distance sensor wall avoider code
- Troubleshooting
- Summary
- Exercises
- Additional reading
- Chapter 9: Teleoperating a Raspberry Pi Pico Robot with Bluetooth LE
- Technical requirements
- Wireless robot connection options
- Connecting Bluetooth LE to Raspberry Pi Pico
- Attaching the Bluetooth module to the robot
- Wiring the Bluetooth breakout to Raspberry Pi Pico
- Connecting to the Bluefruit LE device with UART
- Connecting a smartphone
- Troubleshooting the Bluefruit module.
- Getting sensor data over Bluetooth LE on Raspberry Pi Pico
- Graphing the data
- Controlling the robot with Bluetooth LE
- Printing what we got
- Button control mode
- Decoding button control packets to drive the robot
- Troubleshooting
- Summary
- Exercises
- Further reading
- Part 3: Adding More Robotic Behaviors to Raspberry Pi Pico
- Chapter 10: Using the PID Algorithm to Follow Walls
- Technical requirements
- Introducing the PID algorithm
- Control and feedback
- Bang-bang control
- Distance sensing with proportional control
- Troubleshooting
- Using the integral to handle small distances
- Dealing with oscillations using the derivative
- Using PID to follow a wall
- Changing the sensor's placement
- Wall-following code
- Troubleshooting
- PID tuning - using graphs to tune the PID
- Controlling motor speed
- The proportional component
- Adjusting the derivative gain
- Tuning the integral
- Closing notes on tuning
- Summary
- Exercises
- Further reading
- Chapter 11: Controlling Motion with Encoders on Raspberry Pi Pico
- Technical requirements
- Converting an encoder count into a speed
- Loose bolts and nuts
- Robot wheel geometry
- Encoder geometry
- Measuring the speed of each wheel
- Fixing the encoder glitches
- Using PID to maintain speed and a straight line
- The speed control system
- Speed control code
- Speed controller PID tuning
- Driving a known distance
- Theory of operation
- Code to control distance and speed
- Summary
- Exercises
- Further reading
- Chapter 12: Detecting Orientation with an IMU on Raspberry Pi Pico
- Technical requirements
- What is an IMU and how to choose one
- Components of an IMU
- Choosing an IMU module
- Connecting the IMU to the robot
- Preparing the BNO055
- Attaching the BNO055
- Wiring the BNO055 to Raspberry Pi Pico.
- Setting up the software and connecting
- Troubleshooting
- Calibrating and getting readings
- Calibration code
- The calibration process
- Always face North behavior
- CircuitPython code for the face North behavior
- Troubleshooting
- Making a known turn behavior
- Summary
- Exercises
- Further reading
- Chapter 13: Determining Position Using Monte Carlo Localization
- Technical requirements
- Creating a training area for our robot
- What we will make
- How we will make the arena
- Tips for cutting
- Modeling the space
- Representing the arena and robot position as numbers
- Serving the arena from the robot
- The Bleak library
- Creating a Bluetooth LE wrapper library
- Showing the robot's data on the computer screen
- Using sensors to track relative pose
- Setting up poses
- Displaying poses
- Moving with collision avoidance
- Moving poses with the encoders
- Pose movement probabilities
- Monte Carlo localization
- Generating pose weights from a position
- Resampling the poses
- Incorporating distance sensors
- Tuning and improving the Monte Carlo model
- Summary
- Exercises
- Further reading
- Chapter 14: Continuing Your Journey - Your Next Robot
- Technical requirements
- A summary of what you have learned in this book
- Basic robotics with Raspberry Pi Pico
- Extending a Raspberry Pi Pico robot with sensors
- Writing CircuitPython behavior code for Raspberry Pi Pico
- Planning to extend this robot
- Sensors you could add
- Interacting with the robot
- Chassis and form enhancements
- Electronics enhancements
- Outputs you could add
- Extending the code and behaviors
- Planning your next robot
- Form, shape, and chassis
- Electronics and sensors
- Code and behavior
- Further suggested areas to learn about
- Electronics
- Design and manufacturing
- Robotic competitions and communities.
- Robotics systems and code.