Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Robotics at Home with Raspberry Pi Pico
Robotics at Home with Raspberry Pi Pico

Robotics at Home with Raspberry Pi Pico: Build autonomous robots with the versatile low-cost Raspberry Pi Pico controller and Python

eBook
£15.99 £23.99
Paperback
£29.99
Subscription
Free Trial
Renews at £16.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
Table of content icon View table of contents Preview book icon Preview Book

Robotics at Home with Raspberry Pi Pico

Planning a Robot with Raspberry Pi Pico

When you plan, you create the best chance for a mission’s success. We want to build robots in an achievable way. Let’s start with a plan in mind! We’ll use this plan to explore why Raspberry Pi Pico is a great fit for this and make a shopping list!

In this chapter, you’ll learn about Raspberry Pi Pico’s capabilities. You’ll discover CircuitPython and understand why it is a great language for Raspberry Pi Pico. Additionally, we’ll plan a robot design and understand the trade-offs to make choices about the robot early in the project. We’ll check that our robot fits together, working out the parts and tools you’ll need with suggestions on how to get them.

At the end of the chapter, you’ll have both a plan and parts arriving so that you are ready to build a robot. Additionally, you’ll have a starting process for making other robots and setting yourself up for success with them.

In this chapter, we’ll cover the following main topics:

  • What is Raspberry Pi Pico, and why is it suitable for robotics?
  • What is CircuitPython?
  • Planning a Raspberry Pi Pico robot
  • Test fitting a Raspberry Pi Pico robot
  • A recommended shopping list for robot basics

Technical requirements

We’ll go into the necessary hardware and shopping list as we progress further in this chapter. So, in this section, we’ll just focus on what you will need physically and on your computer to get started.

You will require the following:

  • Some thin cardboard
  • A ruler, pencil, and scissors
  • A good web browser with internet access

What is Raspberry Pi Pico, and why is it suitable for robotics?

At the heart of every robot is a controller. Usually, this is a computing device that is responsible for running the code for the robot to perform its tasks and behaviors. Choosing a controller is a key choice in robot design. You can either come from the I have this controller, what can I do with it? perspective or the which controllers have the capabilities I’ll want for a particular robot? perspective.

In this section, we’ll take a closer look at what Raspberry Pi Pico offers as a controller and the trade-offs it’s made. We’ll explore why it is good for robotics and why it could be part of a larger, more interesting system, too.

Additionally, we’ll delve into the details of its interfaces and how they’ll be useful to us.

A microcontroller that runs Python

Let’s start by taking a look at Raspberry Pi Pico, and discover what it has. The following photograph shows Raspberry Pi Pico:

Figure 1.1 – Raspberry Pi Pico

Figure 1.1 – Raspberry Pi Pico

Raspberry Pi Pico, as shown in Figure 1.1, is an RP2040 microcontroller on a Raspberry Pi-designed board. This microcontroller is a small computing device that has been designed to interface closely with hardware. It has a USB connection on the right-hand side for power or programming on a computer. The LED is useful for debugging. Also, there are many input/output (IO) pins around the edges to connect things. It is with these IO pins that the magic happens when it comes to controlling robots!

Controllers use IO pins to write and read from attached hardware. They can group pins into buses (which we’ll cover in more detail later) to exchange data with other devices. Additionally, they can create waveforms on outputs for controlling motors and LEDs.

This sounds a lot like the other Raspberry Pi models. However, this is a different class of computer. Raspberry Pi Pico has more in common with an Arduino board. Let’s take a closer look at what that difference means with the following diagram:

Figure 1.2 – Microcontroller boards versus single-board computers

Figure 1.2 – Microcontroller boards versus single-board computers

Figure 1.2 shows that while microcontroller boards such as Raspberry Pi Pico and Arduino might look similar to single-board computers (SBCs) such as Raspberry Pi 4 or BeagleBone, they have different key areas. For instance, they differ in storage, CPU speed, cost size, the complexity of software, and how closely your software runs to the hardware.

While Raspberry Pi Pico is brilliantly suited to controlling hardware, such as robots, it isn’t as suited to high-memory or CPU tasks such as AI or visual recognition. There’s a kind of robot system known as horse-and-rider, which combines an SBC (for example, Raspberry Pi 4) for complex processing with a microcontroller (for example, Pico) for controlling hardware.

The low complexity means that code on a microcontroller has nearly no boot time, which means your code doesn’t have to coexist with other software in an operating system. Take a look at the following block diagram:

Figure 1.3 – Running your code on Raspberry Pi versus Pico

Figure 1.3 – Running your code on Raspberry Pi versus Pico

This preceding diagram represents the software architecture on Raspberry Pi versus Raspberry Pi Pico. It shows how a Linux computer, such as Raspberry Pi, has additional layers of software along with competing apps running alongside your code.

In addition to this, controllers have interrupts. They can notify the code that something has changed, such as the state of an IO pin. You’ll find this on the other Raspberry Pi models, but they are controlled by that pesky operating system again. In Pico and other microcontrollers, you get more control over what happens or when something changes on an IO pin, allowing responsive code with predictable timing.

So, how does Raspberry Pi Pico compare with the Arduino Uno? The following table shows details from their specifications and datasheets:

Table 1.1 – Comparing the Pico with the Arduino Uno

Table 1.1 – Comparing the Pico with the Arduino Uno

The preceding table shows that Raspberry Pi Pico has a faster multicore processor, along with more storage and digital IO pins. Additionally, Raspberry Pi Pico has a unique Programmable IO (PIO) system for extreme flexibility in organizing data to and from these pins. Official Pico boards are also cheaper than official Arduino boards.

Another place that Raspberry Pi Pico compares favorably with Arduino is in its use of Python (CircuitPython or MicroPython). Many microcontrollers, such as Arduino, require C/C++ to program, which can be difficult for beginners. Python is easier to understand, allows for complex and interesting data structures, and has access to many libraries of code, too.

In short, the key features of Raspberry Pi Pico are as follows:

  • A microcontroller—this offers low power and is small compared with SBCs.
  • It has responsible and flexible IO options.
  • It is low cost compared to many microcontroller boards and most SBCs.
  • It is programmable in Python.

A number of the features I attribute to Raspberry Pi Pico are due to the RP2040—the chip that powers Pico and is available in forms other than Raspberry Pi Pico.

IO flexibility is Raspberry Pi Pico’s most interesting feature, so let’s take a look at that next.

Raspberry Pi Pico’s interfaces for sensors and devices

Raspberry Pi Pico has many interfaces for connecting to hardware, along with its unique PIO system. In this section, we’ll look at each type of interface.

A digital IO pin is the basic IO system for Raspberry Pi Pico. An output can be on or off, which is great for turning LEDs on or off, but you are unable to control their brightness. Similarly, an input can also detect on or off states. Raspberry Pi Pico has 26 of these pins.

Pulse-Width Modulation (PWM) is a waveform for controlling outputs such as LEDs and motors—including DC motors, stepper motors, and servo motors. PWM pins output square wave pulses, with a changing (modulating) on-off ratio (pulse widths). Changing pulse width results in changes to the brightness of an LED, the speed of a motor, or a servo motor’s position. Raspberry Pi Pico has 16 PWM channels, making it capable of controlling many such devices at once. These PWM pins still require a power control device to drive the motors.

Analog input pins detect levels of voltage between ground (GND) and 3.3V. This is good for interfacing with simple sensors, such as light sensors, joysticks, slider/knob controls, temperature sensors, and measuring currents (using a bit of additional circuitry). Raspberry Pi Pico has three of these inputs.

A universal asynchronous receiver-transmitter (UART) controls a serial port. It can send streams of data to and from devices using two pins: a TX transmit pin and an RX receive pin. With this, it is capable of sending/receiving data that is more complicated than just a varying level. Raspberry Pi Pico has two independent UART interfaces.

Pico has two Serial Peripheral Interface (SPI) bus controllers. SPI uses four pins, as shown in the following diagram:

Figure 1.4 – Raspberry Pi Pico SPI bus usage

Figure 1.4 – Raspberry Pi Pico SPI bus usage

The preceding diagram shows Raspberry Pi Pico using an SPI bus to connect to two devices—for example, displays or sensors. The bus has transmit (TX), also known as Controller Out/ Peripheral In (COPI) or Microcontroller Out/Sensor In (MOSI) for transmitting data from the controller, receive (RX) also known as Controller In/ Peripheral Out (CIPO) or Microcontroller In/Sensor Out (MISO) for receiving data back to the controller, SCK (a clock for timing the signal), and Chip Select (CSEL/CS) a chip selection pin for each peripheral. SPI uses chip selections to enable communication with multiple devices, as shown by the dashed lines of Device 1 CS and Device 2 CS. See https://makezine.com/article/maker-news/mosi-miso-and-140-years-of-wrong/ for details on the current SPI acronyms.

The Inter-Integrated Circuit (I2C) is a data bus designed for communicating between integrated circuits such as sensors, memory devices, and output devices. An I2C bus has a data pin (which is often called SDA – Serial Data) and a clock pin (which is often called SCL – Serial Clock) keeping things synchronized. Multiple devices share an I2C bus by sending/receiving data with addresses, such as those in the following diagram:

Figure 1.5 – I2C buses on Raspberry Pi Pico

Figure 1.5 – I2C buses on Raspberry Pi Pico

Figure 1.5 shows Pico and then some child peripherals connected via two independent I2C buses, assignable to different pin configurations, with some devices having the same address but different I2C connections. Additionally, I2C can address registers (such as memory locations) within devices. We’ll use I2C later to communicate with sensors.

Finally, Raspberry Pi Pico has PIO. PIO is a feature that is unique to Pico. PIO consists of two blocks with four state machines. Each can run simple code independently of the main CPU and control one or more pins to send data to or from them. A single-state machine can control all the pins if that was useful for the code. Additionally, each state machine comes with buffers to hold data until it can be transferred. The following is an example block diagram of the PIO system:

Figure 1.6 – The Raspberry Pi Pico PIO system

Figure 1.6 – The Raspberry Pi Pico PIO system

The preceding diagram shows two PIO devices inside the Pico. Each has code storage memory, so you can have two independent functions. In each PIO device, there are state machines that can independently run the code from that local memory.

Since PIO state machines run independently, and their instructions are about shifting data to/from pins, they can create interfaces for many kinds of hardware. For example, is there a weird protocol device? Use PIO. Do you need rapid counting independent of the main CPU? Use PIO. People have made Video Graphics Array (VGA) outputs with PIO, so it’s capable of fast and complex data handling. Additionally, you can also get interrupts from PIOs to tell you when something has happened.

That was quite a lot of IO systems. Let’s summarize them in a table, as follows:

Table 1.2 – The Raspberry Pi Pico IO systems

Table 1.2 – The Raspberry Pi Pico IO systems

These protocols share pins, so using an I2C bus consumes 2 pins from the 26-pin pool.

Now that we’ve had a tour of Raspberry Pi Pico’s features and interfaces, let’s take a look at how we’ll program it in this book, using CircuitPython.

What is CircuitPython?

Many microcontrollers require C/C++ or Assembler to program—for example, the popular Arduino ecosystem. However, in robotics, Python is rapidly becoming a de facto language. It is used for AI and data science and is great for rapidly trying out new ideas. Let’s examine why it is handy and, specifically, why I’ve chosen CircuitPython for this book.

Python does not require a compile step. Getting you quick feedback on your code and Python’s read-eval-print loop (REPL) allow you to start typing and experimenting with code instantly. The REPL allows you to see what works before using ideas in code that you’ll keep. Here’s a REPL session with CircuitPython:

Adafruit CircuitPython 6.2.0 on 2021-04-05; Raspberry Pi Pico with rp2040
>>> print("Hello, world!")
Hello, world!

The preceding session shows a print running in a REPL on Raspberry Pi Pico. We’ll explore how to use the REPL for some Pico experiments. It even comes with built-in assistance; however, on Pico, not all of the help is left in, for size reasons.

Python has other things that help, such as being able to directly return multiple values from a function. Python has function calls and classes like C++, but functions can be used as data, and references to them can be stored in variables. Additionally, Python has functional programming elements that allow programmers to chain tools together for processing streams of data.

Python uses exceptions to handle errors, allowing you to choose how to respond to them or observe their output, leading you directly to a problem.

MicroPython is the original port of the Python language to run on small memory devices such as microcontrollers. It has a community working on it, and CircuitPython builds on it.

In CircuitPython, Raspberry Pi Pico mounts as a USB storage device, so you can copy your code and the libraries your code uses, directly onto the Pico. This makes composing code from multiple libraries or using third parties simple. Copying code over with the correct name is enough to run that code when Raspberry Pi Pico is powered up again.

CircuitPython has a huge library of device support for Neopixel LEDs, Bluetooth, many sensors, displays, and other devices. This library not only works with Pico but runs across many CircuitPython controllers, so familiarity with these library components will be useful when you are working with other controllers.

Now that we’ve chosen a language and the controller that we will build robots with in this book, it’s time to start planning a robot!

Planning a Raspberry Pi Pico robot

We’ve been fact-finding for our robot-building mission. Before we start our robot-building journey, we’ll make a rough plan of what we want to do, then refine it. We’ll make important decisions, which we can examine further as we start to build the robot.

An overview of robot planning

When planning the robot, there are several things we need to consider:

  • What do we want this robot to do? What is it for?
  • What style of robot is suitable?
  • What kinds of sensors or outputs will we need?
  • What rough shape and size will it have?

Once we’ve answered these questions, we can make further decisions about what we build. These don’t require much detail. Robotics is full of interesting diversions, making it tempting to jump between ideas. By having a constrained plan and working to it, you can keep your pace on getting a robot built, saving distractions and cool ideas for the next robot or three!

What do we want this robot to do? What is it for?

Will the robot solve a problem, clean your kitchen, explore a space, deliver packages, impress guests at a conference, or compete in a robot competition?

The robot we’ll build in this book has several purposes:

  • Exploring Raspberry Pi Pico and its capabilities
  • Trying out sensors
  • Writing algorithms guided a little by challenges in robot competitions
  • Navigating a known space
  • Building a custom chassis, adaptable for future ideas
  • Keeping it simple enough to get started

With these goals in mind, we can look at the specific details.

What style of robot is suitable?

There are many robot styles. We should choose one, probably the simplest possible for our goal. Take a look at the following diagram for a selection of different robot styles:

Figure 1.7 – Different robot styles

Figure 1.7 – Different robot styles

The first robot style is a robot arm used in industry. These are fascinating and fun to build. However, they do not satisfy our goals of building a robot chassis to try out sensors.

The next panel shows a quadcopter drone—an unmanned aerial vehicle (UAV). These are complicated to build and program, so they do not meet our goal of keeping it simple.

The third panel shows a walking robot—a hexapod. These require controlling many servo motors. Their power usage and complexity make them an unsuitable but exciting option for a follow-up robot!

The fourth panel shows a wheeled robot. Wheeled robots can be simple two-wheel-drive (2WD) robots with a roller, such as this one. 2WD rover platforms such as this satisfy our goals of building a chassis and getting to know sensors and algorithms. They can later be made more interesting, with tracks, mecanum wheels, rocker bogies, or individually steered wheels, allowing them to also meet the adaptable goal.

I recommend that we go ahead with a 2WD rover throughout this book but keep the other variations in mind for further robot builds!

What kinds of sensors or outputs will we need?

One of our goals is to try out different sensors. A robot made to navigate spaces will influence the sensors we’ll use. They all contribute to locating the robot.

Good sensors for this include the following:

  • Distance sensors: What is in front of the robot? How far are the nearest objects? We might want more than one of these devices.
  • Encoders: How has the robot moved? How far did it go?
  • Inertial Measurement Unit (IMU): Has the robot turned? What is its position relative to north?

Along with these sensors, we can have simple outputs—the motors that we drive wheels with. As a later extension, we could also add Bluetooth to give us some feedback on our robot’s status. We don’t need to plan all of this yet but leave space for it so that we can extend the robot later.

What rough shape and size will it have?

Now, we have a firm idea of a 2WD robot. We know it probably needs to support the following:

  • Raspberry Pi Pico
  • A pair of motors with wheels and a caster
  • Many sensors and, later, Bluetooth
  • Power for the system, including batteries plus voltage conversion
  • A breadboard for wiring all of this together

Although we don’t want the robot to be too big, we are going to need some real estate to play with. Let’s start with a rough estimate of 150 mm x 200 mm.

So, we’ve answered some questions about what we want. We will use the next few sections to dive deeper into the planning of this robot, looking at the different aspects of the planning and the choices we’ll make. The first of those is to consider trade-offs.

A note on trade-offs

All designs make trade-offs. The truth is that no design fits all cases, and usually, no design is perfect but will be good enough in the right aspects where it works. We will need to make decisions and read datasheets for parts to also assist us.

One example is size and weight—we already mentioned that we don’t want a large robot. After all, we have a limited workbench size, and larger robots require more power, larger motors, and larger batteries. Additionally, we’d need to work with tougher and—likely—harder-to-cut materials. For a different context and goal, perhaps a large, heavier robot would be more suitable. So, the first trade-off is to keep the robot small but not too small—that is, to keep it simple.

We’ve suggested Raspberry Pi Pico, and the trade-offs from Raspberry Pi there, for example lighter weight, reduced cost, and power.

But what of sensor trade-offs? Every sensor has multiple types, which we will dive into in their respective chapters. They differ in price, features, and complexity.

In many aspects, we can trade having more complexity for reduced weight or cost or more features for a higher cost.

Choosing a robot chassis

We have many options for our 2WD robot chassis. Again, this depends on what we want to learn or achieve. We have stated our goal of building a flexible chassis. Some good options for doing this are as follows:

  • Buying a chassis kit
  • Adapting a lunchbox or toy
  • Doing a scratch build by hand
  • 3D printing or laser cutting a chassis

Chassis kits are an easy option but have limited flexibility. Many come with motors, wheels, batteries, and even a motor driver designed for a specific main controller. In this way, they can save time and money, allowing you to focus entirely on the code and sensors, but they offer less opportunity to learn design aspects. It’s often tricky to find a chassis kit with the right shape and size, and as they get larger, they quickly become more expensive.

You could also adapt a lunchbox into a robot chassis—cutting mounting holes for motors, sensors, boards, and other parts can be a good place to learn design skills. However, you’d need to fit your robot electronics and hardware in a constrained space. Note that the curved sides of lunchboxes can complicate things.

Scratch-building a chassis gives you great flexibility. You can learn how to design in CAD and how to use hand tools. Additionally, you need to make choices about the type and thickness of the material, and in doing so, you’ll be able to understand more about making strong robots. You’ll learn how to fit sensors and expand your robot if things get a bit tight. This requires more time and patience than the kits, but the rewards are great.

3D printing and laser cutting require precise designs, along with expensive and specialist tools or services. As you dive further into robotics, and progress beyond a simple 2WD robot, creating more interesting shapes and sensor mounts, it is likely to be an important area of exploration. If you are not confident with hand tools, finding a laser-cutting service for the same parts will achieve good results, but it can be costly.

In this book, so that you can get exposure to the design and hand tools while still giving us lots of flexibility, we will take the scratch-building option. We will learn CAD skills that are transferable to 3D printing. We’ll learn how to cut and drill parts, looking at some premade parts to save time. Additionally, we’ll size our design at approximately 150 mm x 200 mm and modify this if needed. But what about the motors?

Choosing motors

This 2WD motor requires two main drive motors. We could consider stepper motors, which move a little each time they are pulsed, although these bring a little extra complexity—perhaps an idea to keep for later. DC motors, which rotate continuously when powered, seem like the right choice. They will need to be geared so that they have enough power to move the robot, without being too quick and hard to control.

We should keep these motors small and at a low voltage. As we are unlikely to want to build an additional gearbox, geared motors are sensible. There are some options here in terms of the size we are working with. First is the yellow TT motor with plastic gears— however, these motors are not of great quality and take up a fair amount of space. Another option is to use servomotors that are adapted for continuous rotation—however, these can be a little expensive.

A small, common, high-quality but inexpensive option is N20 or micro-metal gear motors. To save space and effort, there are models of these that have encoders pre-fitted. We can use similarly common plastic brackets to attach them to our robot. That makes them convenient to use, too.

Robot wheels

For a 2WD robot, there are a few ways in which to lay the wheels out. One possibility is to have two driving wheels with two idler wheels (that is, unpowered). However, those wheels can drag, making it harder to turn the robot. A common way is to have a third wheel as a caster—either a ball that can roll in any direction or a swivel wheel such as a shopping trolley. Because of the size of the robot, a ball caster seems like a good idea.

The wheels themselves should have a hub that is compatible with the motors that we’ve chosen. A pair of N20 wheels with a diameter of 60-100 mm should be suitable.

So, we have a rough size for our robot, and we know the controllers, motors, and some of the sensors. The next item to choose is the power systems.

Choosing the power systems

A robot isn’t much fun without independent power—by which I mean its own source of power without needing to be plugged into a wall. Usually, this means batteries. It then needs ways to provide power to the control electronics, sensors, external boards, and motors. Take a look at the following diagram for an outline of power distribution in a 2WD robot:

Figure 1.8 – Power distribution in a 2WD robot

Figure 1.8 – Power distribution in a 2WD robot

In Figure 1.8, the thicker lines show raw battery power connections. A 2WD chassis will need to drive at least two motors, which are power-hungry devices that require a battery connection.

This robot needs to power Raspberry Pi Pico and other sensors. Since we intend to add Bluetooth, we should leave power aside for that. So, the other thick line goes to a regulator for these, making more palatable power for these systems—the raw battery voltage would likely destroy them. The thinner solid lines show regulated power.

The Pico will be sending/receiving electronic control signals, designated by the thin dashed lines in the preceding diagram. These also go to the motor controller. The motor controller will provide PWM-controlled power from the batteries to the motor, modulated by the signals the Pico sends to them. The motor power is shown by the thick dashed lines to the motors on the left-hand side.

Here, we have a few considerations to bear in mind. We require an input voltage that is suitable for the motors and to drive a regulator. We need a regulator that can handle the power capacity requirements for the Pico, sensors, and Bluetooth, and we need batteries that can supply enough current to drive them.

Calculating power requirements

Let’s start with what we know—5V is a good output voltage for a regulator, and where needed, the Pico can further regulate down to 3.3V. A regulator for 5V likely requires 7V or more.

Important note

Voltage measures electrical pressure. A current measures how fast electrical energy flows. Combining both of them shows system power usage. A current in amps or milliamps can be used as a stand-in for power in watts when the voltage is known.

Let’s look up the specifications for the N20 gear motors. Perform an online search for the N20 motor datasheet. You’ll be looking for a PDF document. Usually, these have a picture or diagram of the product, followed by the specification and feature tables. If you look for Rated Voltage, they say 6V; however, further down the sheet, there is usually a table relating to the voltage of the motor speed. Based on the motors and regulator basics, an input voltage of 7V-12V would make sense.

Our electronics don’t operate on voltage alone and require a current to operate. So, a regulator will need to handle the minimum current requirements. We’ll need to look at some datasheets and specifications for the other parts. We will include sensors. For Bluetooth, we will include a low-power Bluetooth Low Energy (BLE) board using the highest current measurements from https://learn.adafruit.com/introducing-the-adafruit-bluefruit-le-uart-friend/current-measurements.

We’ll base it on worst-case values so that we can handle them. Let’s start by looking at datasheets and gathering numbers into a table, as follows:

Table 1.3 – Device power requirements

Table 1.3 – Device power requirements

Chapter 3 of the datasheet for Raspberry Pi Pico (which can be found at https://datasheets.raspberrypi.com/pico/pico-datasheet.pdf) shows the electrical specification, with peak currents at a little under 92 mA (milliamps—a measure of current). We’ll round this up to 100 mA as a margin.

The Adafruit Bluetooth board uses only 15.2 mA when fully active, but we can round it up to 20 mA to be generous. The sensors need maybe 50 mA of extra room to accommodate them.

We can add these estimates together to suggest a minimum current specification. Based on these datasheets and estimates, any regulator capable of over 400 mA will be plenty.

Choosing a regulator

Motor control and power supplies can be totally separate concerns, giving great flexibility, but this can take up more space. There are boards designed for Raspberry Pi Pico that allow you to control motors while supplying power to Raspberry Pi Pico. However, will they supply 400 mA?

Kitronik has some neat Raspberry Pi Pico motor boards—a small motor only, along with a larger robotics board with servo motor outputs and a prototyping area. However, the supply for the Pico on the robotics board datasheet has 100 mA for peripherals, which won’t work.

Now, we understand that we need a regulator that is capable of outputting 5V, at a minimum of 400 mA. We want something small and simple. A suitable device for this is a Universal Battery Eliminator Circuit (UBEC). These can handle 3 A. We’d put this through a VSYS pin on the Pico.

Choosing a motor controller

The suggested motors are small. Motors have a stall current—that is, the power they draw if they are trying to move and block a logical maximum. For the N20s, their datasheet suggests 350 mA at 6V. It might be a little over that, perhaps 550 mA. A motor controller needs to handle a little over this peak per channel—motor controllers that are unable to handle motor load tend to go up in smoke! Take a look at the following two common simple motor controllers:

Figure 1.9 – An L298N motor controller next to a TB6612fng

Figure 1.9 – An L298N motor controller next to a TB6612fng

In Figure 1.9, on the left-hand side, you can see the very common L298N—internet searches suggest this handles 2 A per channel. They are small, inexpensive, and easy to find. However, this is a 5V logic device. Raspberry Pi Pico outputs 3.3V logic, which might not work properly with this controller without logic-level conversion.

On the right-hand side is another good choice, the Toshiba TB6612fng. These handle 1.2 A per channel, which is a bit less than shown previously but still good enough. It will handle up to 15V for controlling motors and logic voltages from 3V to 5V, so it won’t require level shifters for Raspberry Pi Pico. There is a module from SparkFun for these, which will work well with the Pico and is small enough to fit on a breadboard next to it.

Additionally, we should plan to have a power switch on the breadboard from the batteries to the motor controller and regulator. Talking of batteries, we still need to select them.

Choosing batteries

We also need something to go through the power regulator—batteries.

While we can (and should, at a more advanced stage) consider Lithium-ion batteries, the type used in remote control cars, the simplest possible option is AA batteries. For our motor and regulator choice, 8 x AA gives 12V. These are easy to buy and replace but take up a lot of space for their power output. Our motors don’t require a lot of current, so they will be good enough.

Now that we’ve examined our power requirements and some solutions, we’ll take a look at which pins are being used on our Raspberry Pi Pico and ensure that our plans for hardware won’t conflict.

Pin usage

Our Raspberry Pi Pico has many IO pins, but we need to consider whether all the items we intend to connect to it will be able to simultaneously connect to it.

Let’s re-examine the specifications for the Pico at https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html:

  • 26 General Purpose Input/Output (GPIO) pins
  • 2 x UART, 2 x SPI, and 2 x SPI

The motor controller will consume two pins per motor, and we know these motors come with encoders, with a further two pins each. That means, so far, we’ve used 8 of the 26 IO pins. This should leave us plenty of room for expansion.

Now that we’ve checked our basic concept, we’ll move on to test fitting—an approximation of how we’ll build the robot.

Test fitting a Raspberry Pi Pico robot

Now that we’ve checked that we can power our system, we need to make sure it is all going to fit on the robot. In this step, you get a rough idea of where things will be, whether your chassis will be big enough, and whether the robot design is likely to work.

The key thing for a test fit is that it is not detailed. Use the simplest method to check whether things will fit, be it sliding around cut-out paper rectangles or using simple software.

Let’s make some simple paper or card parts. For this section, you’ll require card, a pencil, a ruler, and scissors. Card from a cereal box is great for this, but paper will also do.

For a test fit, rectangles are often good enough. The intention is to determine what will fit inside a space and position things. Detail isn’t necessary. For large robots, you might need to make a scale model. As this robot is small, you can make parts at a 1:1 scale. This has an added advantage—if you already have parts in your possession, you get to use them.

Creating your first test-fit part

You’ll need the datasheets for your devices again—this time to start looking at the mechanical sizes of things. For a test fit, you just need to create bounding boxes for items, ensuring there is enough space for them.

Let’s start with a breadboard and the Pico. Since the Pico is on the breadboard, you can just model the breadboard size. I recommend a 400-pin breadboard, which is also known as a half-plus. Use a search engine to look for half plus breadboard dimensions and click on the images panel. What you are looking for is a flat diagram showing the outside dimensions of the board, such as the following diagram:

Figure 1.10 – Breadboard dimensions

Figure 1.10 – Breadboard dimensions

The preceding diagram shows what to expect with a drawing/picture in terms of dimensions, which, in this case, is a breadboard. It measures 84 mm along the top and 56 mm along the right-hand side. It’s important to note here that I’m using millimeters throughout the book, and I will convert from other units if necessary. Stick to one measurement system in a robot design!

We can take the paper or card and draw an 84 mm by 56 mm rectangle in pencil. This does not need to be too accurate—the nearest 5 mm is good enough. The following photograph shows this:

Figure 1.11 – Making a breadboard test-fit part

Figure 1.11 – Making a breadboard test-fit part

As the preceding photograph shows, you simply draw it out. Additionally, so that we can identify it later, write breadboard on the part, along with its dimensions of 84 x 56. Keep these handy so that they can be used for reference later.

Then, you can cut this out with scissors. I tend to make a wide rough cut, and then a finer close cut as a second pass for this.

This simple rectangle, with the right measurements, is our first test-fit part. Next, we will need the motor parts.

Motors

The motors we are using are N20 motors. If we place them on the underside of the robot, as is common with these designs, we still need to consider how their wires come up through the chassis. It is easier to put them on top so that the motor wires can face upward.

We can search the web for N20 motor brackets. Look in the images tab for drawings so that we can get the correct dimensions and add extra space for wiring behind the motor. The following photograph shows me making these test parts:

Figure 1.12 – Making cardboard motor test-fit parts

Figure 1.12 – Making cardboard motor test-fit parts

For this part, as the preceding photograph shows, we want two rectangles of 30 mm by 35 mm. Label them. On one of the longer edges of each part, add an arrow to show that this is where the wheels will go.

We have motors and a breadboard. Next, we need to make stand-in parts for powering them.

Power systems

The UBEC doesn’t take up a lot of space, so we can ignore it. The controller we’ve chosen will fit on a breadboard with the Pico, so it is already accounted for. We do need to account for the batteries.

We have a couple of variants on an 8 x AA battery holder—the flat kind, which takes up more space but comes with mounting screws, or the 4 x 2 kind. These use vertical space instead. Another way to save space is to put batteries on the underside of the chassis.

At this stage, we will use the flat holder as it is easier. You can look up the size for them and create a labeled rectangle for them. My battery box came out as 93 mm x 57 mm:

Figure 1.13 – A battery box in cardboard

Figure 1.13 – A battery box in cardboard

The preceding photograph shows a battery box created from cardboard. Now, we have a bunch of parts to go on the chassis. Next, we need to represent the chassis itself.

Creating a rough chassis

We previously suggested that the chassis should be about 150 mm x 200 mm. Create this rectangle in cardboard, as follows:

Figure 1.14 – The cardboard chassis

Figure 1.14 – The cardboard chassis

As you can see from the preceding photograph, this is not—at all—intended to be a perfectly neat cut. It is simply meant to be good enough to see where things likely need to go. Give the chassis labels just as we have done so far with the other parts. Additionally, we can label one of the shorter edges of the chassis part as the front.

This is the last item to test fit. Let’s start to arrange these parts.

Arranging the test-fit parts

Now, you should have a set of rectangles representing the different parts. The following photograph shows the parts and how we can arrange them:

Figure 1.15 – Our test-fit parts in cardboard

Figure 1.15 – Our test-fit parts in cardboard

The boxes on the left-hand side of Figure 1.15 are correctly proportioned parts and have been placed in a rough position. However, they aren’t properly laid out yet. The right-hand side shows a possible layout.

It’ll be easier to fit motors around the breadboard if we rotate it so that it’s tall instead of wide. We have the batteries at the back of the robot, in the middle, then we have the breadboard in front of them, along the middle. Notice that there is a gap between the batteries and the breadboard—we don’t want any parts to be too close together.

We’ve put the motors on either side of the breadboard, leaving space at the front to expand our robot design.

We have accounted for the major parts of the robot, including computing, power, and motors. There’s also adequate space for expansion. We’ll tune this later as we get deeper into the design, but this shows our combination is viable.

Now that we have our robot design, it’s time to shop for tools and materials!

A recommended shopping list for robot basics

We’ve got a plan—a test fit, a method to make the chassis, decisions about the processing on board, and how we will power the thing. Now, we need to buy the necessary parts and tools to make this happen.

Let’s start with the parts.

Robot parts and where to find them

There are many places to find robot parts, and some of these parts go by different names from different manufacturers. I’ll attempt to provide enough information about the parts so that they can be easily found in many countries.

Part shopping list

We’ll start with a part list for the initial robot chassis. For each part, where necessary, we’ll show search terms, synonyms, and manufacturer numbers. You can try combinations of these to find parts—I wouldn’t suggest using all the terms at once but instead refining them until you get something else. Then, we can discuss places to buy them:

  • Raspberry Pi Pico: This is the most important part to get you started. Other RP2040-based boards might be suitable; however, with different form factors and pins, you’ll need to get creative when it comes to wiring them. Beware of parts with fewer exposed pins, and ensure that they are RP2040 boards. Alternative parts: Headered Pico, Pimoroni Pico LiPo, Adafruit Feather RP2040, SparkFun Pro Micro RP2040, RP2040 Plus.
  • A USB micro cable: You might already have one for your phone, but phones have been coming with USB-C cables for some time. To be specific, I mean a USB-A to USB-Micro cable. However, some laptops have a USB-C port—for those cases, consider a USB-C to USB-Micro cable instead.
  • Headers: You’ll need to solder headers onto Raspberry Pi Pico and the motor controller. Later sensors will require them, too. Search terms for these include male breakaway strip and single-row PCB through-hole pin headers. Make sure that you choose 2.54 mm or 0.1-inch pitch headers.
  • A solderless breadboard: I suggest a mini/half plus 400 tie-point breadboard, self-adhesive. Standard 0.1-inch (or 2.54 mm) pitch spacing, with a separating channel between the columns.
  • Wiring: You’ll need wiring between the components on the breadboard. For this, I suggest precut breadboard jump wire kits. These should be of the U-shape solderless kind—insulated cables with bare ends. They will be in different color-coded lengths and can be bent into shape to fit across breadboard connections.
  • A Drv8833 or TB6612fng motor controller or motor driver: I recommend the SparkFun or Adafruit models; however, other models will work. Stick to this chip, and ensure it’s a module/breakout board, not just the bare chip. It should have a square device with a capacitor on the board, too. I recommend getting a model that has pin functions printed on it. Alternatives are the L9110S, the less efficient L298n boards, or the L293 chip, which may need additional space.
  • A 5V 3A UBEC or a 5V UBEC (DC/DC step-down buck converter): Search for ones that can handle a minimum of 3 A. Larger ones are also fine. Look for those with a 5V output. If they allow 6V too, just make sure that you set the jumper to 5V. Look for those with bare input cables and a pin header end. Other buck converter modules may be suitable, but check for 3 A current capacity, and ensure that the output is 5V.
  • 8 x AA battery holder or battery compartment: Look for the flat-style ones with an integrated switch. Some come with round barrel jacks instead of bare ends—in which case, a 2.1-mm jack to screw the terminal block can be used to finish this.
  • A 1N5817 Schottky diode: These are common in many electronic outlets.
  • Motors: The N20 micro-metal gear motors with encoders. The 298:1 ratio motors have the right combination of speed and torque. Adafruit has these as ADA4640. Small DC gear motors with encoders can be substituted, but please be aware that the larger motors may require the robot to scale up along with power requirements.
  • Ball caster: A 16-30-mm caster should be fine. Most models will be suitable. Just remember to use the drawings for their mount holes later.
  • 40-90-mm wheels with N20 d-hole or universal hubs: Make sure they are designed for N20 motors.
  • 3 mm or 0.118-inch thick styrene card sheets/plates: Go for an A4, 200 x 150 mm, or greater size. They should be solid, flat sheets—not foam or hollow, and, ideally, not textured. Possible search terms include Plasticard, styrene sheet, Evergreen, and Plastruct. ABS sheets are suitable, but not acrylic as this can be brittle.
  • Kit for mounting parts: Possible search terms include standoff and mounting kit. Preferably, they should be in metal, but nylon will do fine. They should be M2, M2.5, or M3 if possible. M2.5 will cover most cases. They should have standoffs, bolts (including machine screws and truss screws), and nuts.

This list of parts and search terms will help you find all the suggested parts to build this robot. Here is a helpful list of places to buy parts from. It isn’t exhaustive, and there might be sellers in your country that can help.

For electronics parts, wheels, motors, and modules, the following stores ship worldwide:

For the styrene sheet, model supply shops are a good bet. Brands such as Evergreen are widely distributed. Hobbycraft, AliExpress, Alibaba, and Amazon carry these. While there, I suggest getting styrene angle strips and square tubes for later robot enhancements.

The robot workshop and makerspaces

There is a list of workshop and hand tools associated with this book. You can buy them yourself or use a makerspace. Let’s start with the tools that you will need access to.

List of tools

The tools required for this book are common in many workshops. In addition to this, school and college DT rooms, makerspaces, and many workshop stores will carry them:

  • Plastic cutter: The kind with changeable blades. We will be cutting through styrene, which can quickly dull a knife. Linoleum flooring cutting blades will also be a useful alternative here.
  • A cutting mat to protect your work surfaces.
  • You’ll need a try square, preferably metal.
  • A ruler: This should be at least 200 mm long. Since the book is working in metric, I suggest metric markings, too.
  • Sandpaper: You will need a selection of, at the very least, 400, 600, and 1,000 grit or similar.
  • Soldering iron and stand: You’ll be soldering some parts, so an iron is essential. Do not use a soldering iron without a stand! Many come with them. I recommend a temperature-controlled iron. In addition to this, a brass wool tip cleaner and some solder are required. We’ll use lead-free flux core solder wire.
  • 10-20-mm hook and loop self-adhesive disks.
  • A drill with 2-mm and 3-mm bits. This should be a small drill, preferably cordless. These are small parts, so precision is required more than power.
  • You’ll need a pencil to make draft lines with. Personally, I like mechanical pencils.
  • I recommend safety goggles when you drill or cut. Get a good comfortable pair—cheap uncomfortable ones might end up on your head instead of covering your eyes and won’t be protecting you.
  • For drilling and cutting, a hobby vise or clamp keeps the part still and your hands safe. A small bench vise is suitable.
  • You need a flat work area with good lighting.
  • Screwdrivers: You will want a screwdriver set. It should have Phillips (PH0 and PH1) and flat-bladed (2 mm and 3 mm) screwdrivers.
  • Spanner or wrenches in metric. Precision sets will be useful.

You can purchase these items and tools from electronics, hobby, DIY, and tool stores. AliExpress, Alibaba, eBay, and Amazon will also have them. However, if you do not have all of these tools, it feels like a lot of stuff.

An alternative to buying all these tools is to find a makerspace or hackerspace near you. They will have most, if not all, of these tools. Makerspaces are community-run spaces, have collections of tools, and might even have scrap material of just the right kind of styrene. Additionally, they have other makers, who can lend you a hand and assist you if you run into difficulty with a robot project.

There are makerspaces in most cities globally. They can be easily found on search engines and social media. If there is no makerspace in your area, reaching out via social media to other makers might help you to find a similar community project. There is a global makerspace directory at https://makerspaces.make.co/.

Summary

In this chapter, you learned about Raspberry Pi Pico, why it’s a good controller to build a robot around, and why we will be using CircuitPython to program it. You discovered the planning process of a robot, choosing parts for it, and then test-fitting them to ensure our plan is likely to work. You had a view of datasheets and discovered a little about the size and electrical characteristics of parts. You also had a tour of the parts you’ll need to buy and the tools you’ll need to work with them. Finally, you were introduced to makerspaces as places to find tools and other makers.

We have a rough robot plan. However, to start building something, we need to take some practical steps to prepare Raspberry Pi Pico for use in one. We’ll discover how to do this in the next chapter.

Exercises

To get you familiar with the content of this chapter, these additional exercises will attempt to test you on what you’ve learned, and prepare you for later sections:

  • Find a datasheet for the Bluefruit LE UART Friend. Find the electrical current used by the device, along with its width and height for fitting it.
  • We are going to add such a Bluetooth board to our robot. Use the dimensions from the datasheet to make a part in your test-fit diagram.
  • Find a space on the robot for this part that does not overlap with other parts.
  • Look on the websites of the previously mentioned stores. See if you can find out where you’d be able to buy this part.

Further reading

Please refer to the following resources for more information:

  • To learn more about CircuitPython, the https://circuitpython.readthedocs.io/ website is a great resource.
  • For a detailed look at Python on microcontrollers, please refer to MicroPython Cookbook, by Marwan Alsabbagh, Packt Publishing. This book has sections on CircuitPython and MicroPython in general.
  • Embedded Systems Architecture, by Daniele Lacamera, Packt Publishing, offers an extensive dive into the I2C and SPI bus interfaces.
  • Another perspective on makerspaces comes from Progression of a Maker, which can be found at https://hub.packtpub.com/progression-maker/.
Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Gain in depth knowledge of robotics with easy-to-follow instructions
  • Build a rover platform designed for experimentation and extension
  • Enhance your robot building skills through planning, building, and coding
  • Purchase of the print or Kindle book includes a free PDF eBook

Description

The field of robotics is expanding, and this is the perfect time to learn how to create robots at home for different purposes. This book will help you take your first steps in planning, building, and programming a robot with Raspberry Pi Pico, an impressive controller bursting with I/O capabilities. After a quick tour of Pico, you’ll begin designing a robot chassis in 3D CAD. With easy-to-follow instructions, shopping lists, and plans, you’ll start building the robot. Further, you’ll add simple sensors and outputs to extend the robot, reinforce your design skills, and build your knowledge in programming with CircuitPython. You’ll also learn about interactions with electronics, standard robotics algorithms, and the discipline and process for building robots. Moving forward, you’ll learn how to add more complicated sensors and robotic behaviors, with increasing complexity levels, giving you hands-on experience. You’ll learn about Raspberry Pi Pico’s excellent features, such as PIO, adding capabilities such as avoiding walls, detecting movement, and compass headings. You’ll combine these with Bluetooth BLE for seeing sensor data and remotely controlling your robot with a smartphone. Finally, you’ll program the robot to find its location in an arena. By the end of this book, you’ll have built a robot at home, and be well equipped to build more with different levels of complexity.

Who is this book for?

This book is for beginner robot makers, keen hobbyists, technical enthusiasts, developers and STEM teachers who want to build robots at home. Prior knowledge of coding - beginner to intermediate programming, will be helpful.

What you will learn

  • Interface Raspberry Pi Pico with motors to move parts
  • Design in 3D CAD with Free CAD
  • Build a simple robot and extend it for more complex projects
  • Interface Raspberry Pi Pico with sensors and Bluetooth BLE
  • Visualize robot data with Matplotlib
  • Gain an understanding of robotics algorithms on Pico for smart behavior

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Mar 17, 2023
Length: 400 pages
Edition : 1st
Language : English
ISBN-13 : 9781803230412
Vendor :
Raspberry Pi
Category :
Languages :
Concepts :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning

Product Details

Publication date : Mar 17, 2023
Length: 400 pages
Edition : 1st
Language : English
ISBN-13 : 9781803230412
Vendor :
Raspberry Pi
Category :
Languages :
Concepts :

Packt Subscriptions

See our plans and pricing
Modal Close icon
£16.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
£169.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just £5 each
Feature tick icon Exclusive print discounts
£234.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just £5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total £ 95.97
Raspberry Pi Pico DIY Workshop
£38.99
Practical Arduino Robotics
£26.99
Robotics at Home with Raspberry Pi Pico
£29.99
Total £ 95.97 Stars icon

Table of Contents

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

Customer reviews

Most Recent
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.8
(13 Ratings)
5 star 92.3%
4 star 0%
3 star 7.7%
2 star 0%
1 star 0%
Filter icon Filter
Most Recent

Filter reviews by




William Weidmark Sep 04, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
All around great resource for the pico w, I'm gutting and converting a Rovio robot. I'm using the pico and some accessory boards to bring the Rovio back to life.
Amazon Verified review Amazon
garage man Aug 11, 2023
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
I’m only giving this book 3 stars because although the author makes an admirable effort to explain the technology in detail, and although the book does have a lot of useful information about devices such as Bluetooth LE, it can be frustrating to use. The overall approach to building and programming is difficult, and the code provided has errors or in some cases does not work at all. As a result, beginners are likely to be extremely challenged working through this book. Here are some of the problems I encountered along with fixes if I found any.1. Chapter 3 introduces FreeCAD and shows how to model the robot car. FreeCAD is powerful but difficult to learn, and it’s not necessary to build this car, as it’s only used to create a “technical drawing” of the chassis. All you need to know are the dimensions of the chassis and the locations of the mounting holes for the motors and the caster, and that’s provided on page 79. If you want to follow the instructions and learn FreeCAD, be aware that the author failed to mention that you need to create ShapeBinders for all three subassemblies. Also, you can save time and expense if you buy a chassis kit with motors, wheels and platform for $15 or $20, and avoid having to score, snap and drill a styrene sheet.2. Because of the choice of CircuitPython, the motor encoders must be read using the Raspberry Pi Pico PIO, and the PIO must be programmed in assembly code. The PIO has only 9 instructions, and they are not intuitive; for instance, there is no ADD instruction, instead you must invert the bits, subtract, and re-invert. Not something most beginners will have an easy time understanding. However, the author does provide working code to read the encoders, so you can just import that file when needed.3. The dimensions for the distance sensor brackets do not match the current VL53L1X sensors now shipped by Adafruit. Don’t build or 3D print the brackets using the information in the text.4. The code for the distance sensors needs a check for the “None” value returned by the sensors if there is no obstacle within 4 or 5 feet, otherwise you get a TypeError and the robot won’t run. Also, the uart.write calls in the Bluetooth section have a syntax error; there is a second “f” which must be removed for the code to run.5. Up through Chapter 8 all of the code worked perfectly, including the obstacle avoidance algorithm. In Chapter 9 the Bluetooth code worked well, except the left and right keypad directions were reversed. The wall-following code in Chapter 10 did not work at all, in spite of many hours of testing and debugging. In Chapter 11, driving a known distance worked perfectly, except that the robot ran backwards instead of forwards; also it’s not mentioned that you will need to install the circup utility if you want to use it. (The preceding three problems seem to be related, but I could not figure out how.) In Chapter 12 the procedure and code given for calibrating the IMU did not work at all, and as a result the always-face-north code did not run because it first checks the calibration.6. Just to be fair, although the illustrations in the print version of the book are in black and white and difficult to read, if you download the Color Images file, those images are excellent and especially useful for wiring. Also, the publisher will provide (with proof of purchase) a *.pdf copy of the book, handy if don’t have the physical book present where you’re working.In summary, this is a great book to learn about robotics if you have the time and experience to work through its shortcomings. However, this book requires more effort and experience than a beginner is likely to possess. If you’re just starting with robotics, a better choice would be to just use an Arduino board with the much simpler robot code which you can find almost anywhere online.
Amazon Verified review Amazon
Sebastián Viviani Aug 07, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The book covers the three main aspects you need to get hands on to start a hobby project: mechanical design, hardware design, and software development. It's definitely a good reading if you have some knowledge on one or two of those areas, and need some help with the missing one.It's written in a clear and simple style, which helps to keep focus in the foundations and basic learnings.It also keeps that spirit in the examples, showing that low cost material like cardboard or open source tools like "FreeCAD" can give good results, compared to more expensive and sophisticated alternatives.The only criticism I can make is that some chapters seem to be a bit disconnected, specially the ones that touch more advanced topics. Probably because it's too hard to tackle them from a beginner optic without a big theorical introduction - and that would require way more pages than this book have!
Amazon Verified review Amazon
Nagamohan Kumar Palakurthy May 03, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
"Robotics at Home with Raspberry Pi Pico" is an outstanding guide for anyone looking to delve into the world of robotics using the affordable and versatile Raspberry Pi Pico controller. The book provides a well-structured and comprehensive approach to building autonomous robots using Python programming language, making it easy for beginners and experienced enthusiasts alike to follow along. The author's clear explanations and step-by-step instructions are highly engaging, ensuring that readers will feel confident and empowered to tackle even the most complex of robotics projects. With a strong focus on practical applications and real-world examples, "Robotics at Home with Raspberry Pi Pico" is a must-read for anyone looking to explore the exciting possibilities of home robotics. Highly recommended!
Amazon Verified review Amazon
Sanjay Subbarao Apr 13, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Robotics at Home with Raspberry Pi is a comprehensive guide to building and programming robots using the Raspberry Pi Pico. The book covers a wide range of topics, from the basics of robotics to more advanced concepts such as IMU and Localization.The book is written in a clear and engaging style, and the author does a great job of explaining complex concepts in a way that is easy to understand. The book is also well-illustrated with diagrams and photographs, which help make the subject matter easier to grasp.One of the things that I loved about this book is that it is very hands-on. The author provides step-by-step instructions for building and programming a variety of robots, from simple line-following to more self aware orienting and locating bots that can navigate their environment and avoid obstacles.If you are interested in learning how to build and program robots, then Robotics at Home with Raspberry Pi Pico is a must have. The book is packed with information and will for sure help you get started on your robotics journey.Things I liked about the book: Comprehensive coverage of robotics topics Clear and engaging writing style Well-illustrated with diagrams and photographs Hands-on approachOverall, Robotics at Home with Raspberry Pi is an excellent resource for anyone who wants to learn how to program and build robots. The book is well-written, engaging, informative and it provides step-by-step instructions. If you are interested in learning how to go from 0 to 1 in robotics, then I would highly recommend this book.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.