Reader small image

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

Product typeBook
Published inMar 2023
Reading LevelBeginner
PublisherPackt
ISBN-139781803246079
Edition1st Edition
Languages
Concepts
Right arrow
Author (1)
Danny Staple
Danny Staple
author image
Danny Staple

Danny Staple builds robots and gadgets as a hobbyist, makes videos about his work with robots, and attends community events such as PiWars and Arduino Day. He has been a professional Python programmer, later moving into DevOps, since 2009, and a software engineer since 2000. He has worked with embedded systems, including embedded Linux systems, throughout the majority of his career. He has been a mentor at a local CoderDojo, where he taught how to code with Python. He has run Lego Robotics clubs with Mindstorms. He has also developed Bounce!, a visual programming language targeted at teaching code using the NodeMCU IoT platform. The robots he has built with his children include TankBot, SkittleBot (now the Pi Wars robot), ArmBot, and SpiderBot.
Read more about Danny Staple

Right arrow

Building a Robot around Pico

Building a robot involves utilizing some practical skills in a workshop – cutting, drilling, and, most importantly, measuring. It also requires assembling parts and keeping them in place. The robot platform will be the base for our Raspberry Pi Pico robotics experiments, since we want to try out our FreeCAD designs in the real world.

Cutting and scratch building from styrene is a workshop technique that’s used by model makers and robot builders in many situations – it’s cheap and convenient in terms of materials but requires some patience and practice. Could you 3D-print, CNC-mill, or laser-cut these parts? Almost certainly – however, not everyone has access to these tools, and learning about scratch build techniques to complement them will give you flexibility as a workbench wizard.

Later in this chapter, we will look at wiring our robot and connecting the electronics so that the robot is ready for us to code on...

Technical requirements

This chapter uses various tools and materials. You will need to have the right tools and be able to work safely. You’ll find this equipment in the shopping lists from Chapter 1.

You will require the following materials:

  • 3 mm styrene sheet – A4 or larger
  • A soldered Raspberry Pi Pico
  • The solderless breadboard
  • Precut jumper wire kit
  • The motor controller with headers soldered in
  • A 5V 3A UBEC
  • 8 x AA battery compartment, with switch
  • N20 micro-metal gear motors with encoders
  • Ball caster ¾ inch with 4 x M2 nuts – 2 x M2 x 6 mm
  • Hook and loop/Velcro dots
  • Wheels with N20 d-hole hubs
  • 1n5817 or equivalent Schottky Diode
  • A standoff or a mounting kit with M2 standoffs, bolts, and nuts

You will need the following tools:

  • A plastic cutter
  • A pair of scissors
  • A metal ruler that’s at least 250 mm long
  • Sandpaper – 400, 600, and 1,200 grit
  • A pin vise drill...

Cutting styrene parts

Styrene is a great material for building robots. It is easy to find, can be cut and glued, and comes in many forms. We will be using sheets and rods. In this section, we will look at cutting this material, starting with transferring our CAD measurements. First, we look at making a good cut and refining the parts so that they are smooth.

Transferring CAD measurements to a plastic sheet

Before we cut, we will need to make markings so that we know where to cut. In the previous chapter, we made a paper template and ensured that we printed it out 1:1 on a sheet of A4 paper. You’ll need that, along with some tools, as shown in the following figure:

Figure 4.1 – Parts needed to transfer the drawing

The preceding figure shows the tools we will need, laid out and ready to use, followed by the drawing adhered onto a sheet of plastic. Prepare the following:

  • Scissors
  • Pin vise and bits
  • Metal ruler
  • Plastic...

Assembling a robot chassis

The chassis is the base of our robot. We have cut the required part, preparing it for use. In this section, we’ll attach the caster battery box, and motors.

Attaching the caster and battery box

The battery box is assembled above the caster. Therefore, we must start with the caster; the following figure shows how:

Figure 4.8 – Attaching the caster ball to the chassis

The preceding figure shows me attaching the ball caster to the chassis. Let us take a look at this in more detail:

  1. The large inset at the bottom left shows a cross-section of how this will turn out. Note that the nylon screw must go through the bottom of the ball caster housing, through the chassis plate, and then an upper securing nut.
  2. The top-left figure shows the parts for this assembly. We have the ball caster housing (with the ball separated), 2 x M2 long nylon screws, and 2 x M2 nuts. Also, prepare a suitable screwdriver, spanner,...

Wiring a Raspberry Pi Pico robot

In this section, we will look at connecting Raspberry Pi Pico to the motors via the motor controller we chose in Chapter 1, Planning a Robot with Raspberry Pi Pico. We will add the power circuitry and recommend a few techniques for robot wiring. Although the breadboard can adhere to the chassis, I tend to leave off using adhesive until it’s necessary – it is easier to wire and make changes sometimes with the breadboard out of the robot.

Wiring Pico and the motor controller into the breadboard

The motor controller that we suggested in the planning phase was the TB6612-FNG. I have used a SparkFun board. The following table shows the pins for this module:

...

Summary

With that, you have built your robot from the designs provided. You learned how to measure patterns from a CAD design onto plastic and then cut and drill them. In addition, you now have experience attaching motors, wheels, casters, and battery boxes to a robot.

You wired the robot while following the circuit diagram and suggested breadboard layouts to build. Then, you powered up the robot and performed some troubleshooting (if it did not light up).

However, the robot will not move yet, as we have not implemented any code. In the next chapter, we will add code so that we can move the robot and control its wheels. Then, we will learn how to use them to make turns and drive at different speeds.

Exercises

The following exercises will help improve your robot and help you practice your skills:

  • This robot is quite flat. Consider how you might add other layers or add depth to it.
  • The breadboard is currently not adhered to the robot; perhaps hook and loop disks could help?
  • It is a good idea to get familiar with the robot’s wiring. Sketch a diagram for yourself showing the path between Raspberry Pi Pico and the motors.

Further reading

To learn more about the topics that were covered in this chapter, take a look at the following resources:

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 2023Publisher: PacktISBN-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.
undefined
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

Author (1)

author image
Danny Staple

Danny Staple builds robots and gadgets as a hobbyist, makes videos about his work with robots, and attends community events such as PiWars and Arduino Day. He has been a professional Python programmer, later moving into DevOps, since 2009, and a software engineer since 2000. He has worked with embedded systems, including embedded Linux systems, throughout the majority of his career. He has been a mentor at a local CoderDojo, where he taught how to code with Python. He has run Lego Robotics clubs with Mindstorms. He has also developed Bounce!, a visual programming language targeted at teaching code using the NodeMCU IoT platform. The robots he has built with his children include TankBot, SkittleBot (now the Pi Wars robot), ArmBot, and SpiderBot.
Read more about Danny Staple

Pin name

Type

Function

GND

Power

Ground – power connection back to batteries.