Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Robotics at Home with Raspberry Pi Pico

You're reading from  Robotics at Home with Raspberry Pi Pico

Product type Book
Published in Mar 2023
Publisher Packt
ISBN-13 9781803246079
Pages 400 pages
Edition 1st Edition
Languages
Concepts
Author (1):
Danny Staple Danny Staple
Profile icon Danny Staple

Table of Contents (20) Chapters

Preface Part 1: The Basics – Preparing for Robotics with Raspberry Pi Pico
Chapter 1: Planning a Robot with Raspberry Pi Pico Chapter 2: Preparing Raspberry Pi Pico Chapter 3: Designing a Robot Chassis in FreeCAD Chapter 4: Building a Robot around Pico Chapter 5: Driving Motors with Raspberry Pi Pico Part 2: Interfacing Raspberry Pi Pico with Simple Sensors and Outputs
Chapter 6: Measuring Movement with Encoders on Raspberry Pi Pico Chapter 7: Planning and Shopping for More Devices Chapter 8: Sensing Distances to Detect Objects with Pico Chapter 9: Teleoperating a Raspberry Pi Pico Robot with Bluetooth LE Part 3: Adding More Robotic Behaviors to Raspberry Pi Pico
Chapter 10: Using the PID Algorithm to Follow Walls Chapter 11: Controlling Motion with Encoders on Raspberry Pi Pico Chapter 12: Detecting Orientation with an IMU on Raspberry Pi Pico Chapter 13: Determining Position Using Monte Carlo Localization Chapter 14: Continuing Your Journey – Your Next Robot Index Other Books You May Enjoy

Planning and Shopping for More Devices

We now have a beginner robot platform up and running. The robot can drive around, and we have a pair of sensors already wired in. However, it becomes more interesting and useful if we add other sensors and devices – perhaps also a way to control the robot remotely!

In this chapter, we will look at some of the devices we will use and what types they are, learning more about robot sensors in general. Then, we will look at actual device part numbers and plan where to put our devices on the robot, where there is space for them, and test-fitting them. Next, we will look at a purchase list to build this. Finally, we will build a sensor bracket for our robot.

In this chapter, we’re going to cover the following main topics:

  • Introducing sensors
  • Choosing device types
  • Planning what to add and where
  • Shopping list – parts and where to find them
  • Preparing the robot

Technical requirements

This chapter requires the following software and computer setup:

  • A computer with the internet
  • A printer
  • FreeCAD

The following robot-related hardware is required:

  • The robot build from previous chapters and a Micro USB cable
  • A sharp or fresh-blade plastic cutter
  • A metal ruler
  • Pin vise drill with 0.5 mm, 2 mm, and 3 mm High-Speed Steel (HSS)/twist bits
  • Safety goggles
  • A flat work area with good lighting, free of interruptions or being nudged
  • Standoff or mounting kit with M2 and M3 standoffs, bolts, and nuts
  • Screwdrivers with appropriate ends for the bolts
  • M2 and M3 spanners to tighten bolts and standoffs

You can find all the FreeCAD designs, along with printable templates for this chapter, on GitHub at https://github.com/PacktPublishing/Robotics-at-Home-with-Raspberry-Pi-Pico/tree/main/ch-07.

Introducing sensors

Sensors are how our robot collects information. You’ve already seen and used one – the encoders. You were also introduced to absolute versus relative sensors in Chapter 6, Measuring Movement with Encoders on Raspberry Pi Pico, so what additional sensors can we consider? And how do we interface with them?

Sensors collect information from devices on the robot, making closed-control feedback loops. Sensors can also collect information about the world around the robot, what is present there, or how it has changed in response to the robot’s motions.

Analog sensor types

We briefly talked about analog and digital in Chapter 1. Analog sensors create a varying voltage, whereas digital sensors output only 1s and 0s – binary – using two fixed voltages.

Raspberry Pi Pico has a 12-bit Analog-to-Digital Converter (ADC) supporting analog sensors connected to 4 pins. Analog inputs are suitable for simple light sensors and variable...

Choosing device types

We will add other sensors and Bluetooth to communicate with our robot. We will look in depth at each in later chapters, but we should know enough to consider which we will buy. This section will involve taking a brief overview, making some trade-offs, and choosing the parts to use.

Distance sensors

Distance sensors, briefly mentioned in Chapter 1, let the robot sense its situation and surroundings to avoid or follow obstacles. Some kinds only return if a distance has crossed a threshold, but the more suitable types return a sensed distance value. We will focus on this latter type.

Most distance sensors bounce a beam from objects and measure their return time or angle to determine the distance. For example, clap opposite a wall in a large open space, and you will hear how long your echo takes to return. If you move further from the wall, the return time will be longer.

These fall into two major categories: sound-based and light-based. Each has pros...

Planning what to add and where

The product pages for these devices usually include their dimensions. Depending on which exact breakout you buy, you may need to adapt these designs. Let us use some known models and make a rough test fit to turn into a design.

Bluetooth and IMU mounting plan

The Bluetooth and IMU should be above the rest of the robot. The IMU’s magnetic sensors should not be near the motors and encoders. Putting the Bluetooth higher improves the signal. This rough drawing shows the plan:

Figure 7.3 – Rough sketch of the shelf

The Bluetooth and IMU, shown in the figure as darker boxes, could be placed on a shelf to distance them from interference with the motors. This shelf, shown in transparent white in the preceding figure, is mounted on standoffs, shown as darker bolt holes. This rough part is superimposed on a FreeCAD sketch to show where it goes.

We are likely, at least while we are developing this robot, to change...

Shopping list – parts and where to find them

We’ve collected enough information to buy the parts we’ll need. Let us see what exact parts I recommend.

You bought parts in Chapter 1, and used some of these items in previous chapters. However, you should still have stock of the following:

  • Styrene 3 mm sheet – these usually come in packs of a few, so you’ll have a few around
  • Standoff kits with 2 mm, 2.5mm, and 3 mm standoffs, bolts, and screws
  • 2.54 mm pitch straight breakaway single-row headers

I then recommend the following additional parts:

  • The Adafruit 2742 BNO055 IMU
  • The Adafruit Bluefruit LE UART Friend ADA 2479 module
  • 2 x Pimoroni PIM373 VL53L1X Time-of-Flight (ToF) sensor breakouts
  • Male-to-female extension jumper wires
  • 30 mm PVC right-angle cover trim

We are also going to need some additional tools as we make more interesting parts:

  • A medium hacksaw or tenon saw to cut the cover...

Preparing the robot

We have parts and rough ideas for how to mount our sensors.

Using the techniques learned in Chapter 3, Designing a Robot Chassis in FreeCAD, we can model these brackets and shelves in FreeCAD. You can also get these designs from GitHub at https://github.com/PacktPublishing/Robotics-at-Home-with-Raspberry-Pi-Pico/tree/main/ch-07.

The following image shows what this looks like in FreeCAD 3D View:

Figure 7.5 – The chassis with the sensor mounts

In the preceding figure, there is a 3D view of the robot in FreeCAD. At the rear, above the batteries, is a shelf for the Bluetooth and IMU. There are bolt holes under this in the chassis.

At the front of the figure are the two brackets for the distance sensors, with mounting holes for the sensors and slots cut out for the connection header to poke through.

Let us take a closer look at each sensor mounting design.

Designing the shelf

We will make the shelf with styrene. The following...

Summary

In this chapter, we learned about more sensor and device types. We then revisited our robot, planning where to add these sensors.

The chapter showed a shopping list for these parts and then used dimensions from the product pages of these parts to make CAD drawings. The CAD drawings let us visualize what we wanted in 3D. Next, we fabricated parts from these drawings.

We revisited manufacturing parts and used a variation on the template technique to make the brackets.

Finally, we assembled all these parts and now have a robot base ready to add sensors. We will wire in and program these sensors in the following chapters, starting with the distance sensors.

Exercises

These exercises will help further develop the skills learned in this chapter. As we have not attached the switch to the chassis, we can use it to practice these skills:

  • The sensor brackets are facing directly forward. The robot would have better sensor coverage and look better if you aligned the sensors with an angled front. This will likely require using other FreeCAD constraints or skills.
  • The shelf is flat and uses a hook-and-loop to hold devices. Using FreeCAD, could you design another layer with recesses for the peripheral boards? Could you then use the skills learned here to build it? You may require a coping saw for this.

Further reading

We referenced these datasheets and product pages in the text:

For further information on Bluetooth LE, consider Building Bluetooth Low Energy Systems by Muhammad Usama bin Aftab. This dives into the details of wireless network communication systems suitable for use in the Internet of Things (IoT). IoT concepts translate well into robotics.

To find out more about sawing, check out the following guide:

  • A Little Saw – A Workshopshed Guide to Cutting Tools by Andy Clarke has excellent information on cutting different materials well. This...
lock icon The rest of the chapter is locked
You have been reading a chapter from
Robotics at Home with Raspberry Pi Pico
Published in: Mar 2023 Publisher: Packt ISBN-13: 9781803246079
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}