Building Robot Basics – Wheels, Power, and Wiring
local graph
Chapter 5 — Building Robot Basics – Wheels, Power, and Wiring
Section titled “Chapter 5 — Building Robot Basics – Wheels, Power, and Wiring”Building Robot Basics – Wheels, Power, and Wiring
Section titled “Building Robot Basics – Wheels, Power, and Wiring”In previous chapters, you planned the robot, built an SD card for your Raspberry Pi, and saw how to look after your code and configuration. In this chapter, we will start building the robot. We will assemble our robot chassis kit with wheels and motors. We will then fit the Raspberry Pi and the Raspberry Pi HAT.
After this, you will see how common connectors can be used to assemble motor connectors. Once the motors are wired, we will check the wiring and then add power to the robot. By the end of the chapter, you will have your basic robot structure ready.
In this chapter, you will learn about the following:
- Assembling the base
- Fitting the Raspberry Pi
- Connecting the motors to the Raspberry Pi
- Connecting independent power
- The completed robot base
Technical requirements
Section titled “Technical requirements”For this chapter, you will require the following:
- A computer with access to the internet.
- The shopping list items from Appendix A*: Shopping for Robot Parts*.
- The robot tool list from Ap p endix A*: Shopping for Robot Parts*.
- The microSD card and code from the previous chapters.
Disclaimer: This chapter is based on the hardware components as mentioned in A ppendix A*: Shopping for Robot Parts*. Specific hardware models or component versions may change over time due to product updates or availability.
Assembling the base
Section titled “Assembling the base”This section will assume you bought the recommended chassis and motors. For a completely different chassis, I strongly recommend consulting the documentation for assembly instructions.
The chassis I recommended you buy is a SparkFun Shadow chassis. The chassis parts will come on a sprue. Please press them out of the sprue before assembly. I use the original shipping box in which my robot components came in as a convenient storage container for the parts and any spares.
For this stage, prepare the chassis and motor parts, as shown in the following figure:

Figure 5.1 – Parts for robot chassis assembly
Figure 5.1 – Parts for robot chassis assembly
The parts shown in the preceding figure include:
- Motor end brackets
- Motor collar brackets
- Castor/skid nub
- Wheels
- FIT0450 Motors with magnetic encoders
- Side struts
- Line follower parts
- Mainboard mount
- Bottom chassis plate
- Top chassis plate
Shaded in gray are a 4xAA battery clip and encoder clips that we will not be using in our robot, although they will assist us in assembly later. There’s also an included 4xAA battery box, which we will not be using.
Fitting the motor brackets
Section titled “Fitting the motor brackets”The first assembly step is to mount the motors into their brackets. Let’s look closer at their parts:

Figure 5.2 – Motor bracket parts
Figure 5.2 – Motor bracket parts
The diagram above identifies the parts used for the motor assembly. The brackets will be used to attach the motor to the robot chassis. We will use the diagram terms during assembly.
The left side has a photo and diagram of the motor, showing its parts.
The right side shows the collar bracket and end bracket parts.
First, we need to assemble the brackets onto the motors. The next figure shows how:

Figure 5.3 – Motor bracket assembly
Figure 5.3 – Motor bracket assembly
The preceding diagram shows how to assemble the collar bracket onto the motor.
The collar bracket is pushed over the flat edges of the motor holder, between the retention clips and gearbox.
The collar bracket is then rotated around the motor holder, so the bracket’s flat edge is facing the same direction as the motor’s axle. This locks the bracket in place and ensures the wheel will be clear of the bracket when it is added. You will need to make this assembly twice. We now need to assemble these motors onto the chassis.
See the following figure to assist with assembly instructions:

Figure 5.4 – Assembling motors onto the lower chassis
Figure 5.4 – Assembling motors onto the lower chassis
The preceding figure shows how to attach the motors to the lower chassis of the robot. See the following steps to attach the motors:
- Assemble the end bracket onto the motor, keeping the flat side of the bracket facing the same orientation as the axle.
- Line the motor up with the slots – note the direction the connectors and encoder disk are facing in relation to the chassis.
- Push the clips into the slots. This may take a little rocking back and forth to get in, but it will have a solid click as it locks in place.
- Repeat this for the other motor.
Now our robot has motors, but for it to go anywhere, we’ll need to put wheels on its axles.
Putting the wheels and support on
Section titled “Putting the wheels and support on”The wheels now need to be pushed on as shown in the following figure:

Figure 5.5 – Adding the wheels
Figure 5.5 – Adding the wheels
The preceding figure shows a side view of the chassis and how we attach the wheels. The top-left corner includes a zoomed-in detail of the castor nub, on which the robot will sit. The zoomed detail at the top right shows the motor shaft, both in photo and diagram form. This shaft has flat edges that align with the axle hole in the wheel for a secure fit.
Use the following steps to fit them:
- Line the wheels up with the axles, aligning the flat edges on the axles. Begin to gently push them in.
- You may need to rotate the wheels until they push in securely. You should be able to feel them engage.
- Before pushing the wheels all the way in, be sure to support the motor from the other side. The caster nub should be clipped into place underneath.
With the wheels now on the motors, the robot is starting to take shape. It should now be able to sit on two wheels and the castor nub.
Let’s continue building the chassis.
Assembling the rest of the chassis
Section titled “Assembling the rest of the chassis”You can now attach the top chassis plate on this lower chassis assembly:

Figure 5.6 – Assembling the support struts
Figure 5.6 – Assembling the support struts
The preceding figure shows the first steps for assembling the chassis plates. The following list shows how:
- Prepare the parts for this section. You will need the lower chassis assembly with the wheels, the struts, and the upper chassis plate. Note the arrows indicating the front of these plates during assembly.
- Snap the struts into each of the diagonal corners.
- Align and orient the plates. The upper deck should have slots that align with the motor struts and the 4 support struts.
- Now press on each strut until it clicks into place. Start with the four outer struts, then move to the four motor struts. Push each of the struts until its clips are fully engaged.
- The chassis decks are now assembled.
This robot is now ready to add the electronics. In the next section, we’ll start by adding the main controller, the Raspberry Pi.
Fitting the Raspberry Pi
Section titled “Fitting the Raspberry Pi”The chassis comes with brackets to retain and hold the Raspberry Pi. We will assemble the Raspberry Pi with the main breakout (Inventor HAT Mini), attach the brackets to the chassis, and clip the Raspberry Pi assembly into the brackets.
For this stage, you will need the following items:

Figure 5.7 – Parts ready for electronics assembly
Figure 5.7 – Parts ready for electronics assembly
The preceding figure shows the following parts you will require for this stage:
- A: The robot from the last stage
- B: Raspberry Pi
- C: Any cooling you have purchased – for this Raspberry Pi 4, I’ve used a heatsink and a GPIO riser
- D: The main breakout, the Inventor HAT Mini
- E: The 2 mainboard mounts
- F: 2.5 mm standoffs, nuts, and bolts
First, if you are using one, assemble the heatsink or cooling arrangement onto the Raspberry Pi according to the instructions it came with:

Figure 5.8 – Heatsink and GPIO riser
As the preceding figure shows, the heatsink will increase the height under the main breakout. The GPIO pins must be accessible, and the Inventor HAT Mini must not be touching any metal heatsink parts. Therefore, use a GPIO riser header along with the M2 standoffs bolted into the Pi. The standoffs should be long enough that the bottom of the mainboard will align with them. This reduces stress on the header.
Now you can push the breakout board onto the Pi header, and use the bolts to screw this into the standoffs:

Figure 5.9 – Raspberry Pi and main breakout assembly
Figure 5.9 – Raspberry Pi and main breakout assembly
The preceding figure shows assembling the main breakout onto the Raspberry Pi. As you push it onto the headers, try to push with even pressure around where it plugs into the GPIO pins. Then put the screws in where shown, and bolt it in. Tighten so that the screw does not have a gap, but no further as this may damage the parts.
The mainboard clips should be assembled as shown at: https://learn.sparkfun.com/tutorials/assembly-guide-for-redbot-with-shadow-chassis/6-mainboard.
We can then mount the Raspberry Pi assembly onto the clips:

Figure 5.10 – Clipping the electronics onto the chassis
Figure 5.10 – Clipping the electronics onto the chassis
The preceding diagram shows how to clip the Raspberry Pi and hat electronics assembly onto the chassis. The clips have been positioned to avoid pressure on the connectors on the Raspberry Pi. The insets provide zoomed-in views of the clips.
This robot now has a Raspberry Pi with a motor controller, and connectors for sensors and servo motors, along with some lights. Let’s connect the motors to the electronics.
Connecting the motors to the Raspberry Pi
Section titled “Connecting the motors to the Raspberry Pi”The cables that came with the motors do not have connectors that fit the Inventor HAT Mini motor ports. The Inventor Hat’s motor ports have pins for motor power and the encoder sensors built into these motors. How can we connect these? Having different-shaped connectors is a common problem. Let’s see how we can solve it.
Making connector cables
Section titled “Making connector cables”We are going to make some cables. We need to specify what we are connecting first. The following diagram shows both ends of these connectors.

Figure 5.11 – Motor connectors
Figure 5.11 – Motor connectors
The motor connectors shown on the left of *Figure 5.*1 1 are 6-pin JST 1.0 mm SH on the Inventor HAT Mini. The connectors on the right are for the motor: a 2-pin JST 2.0 PH, which powers/moves the motor, and a 4-pin JST 2.0 PH, which connects the encoder sensors built into these motors. At the bottom of the figures are pin outs for each connector.
The motor came with cables, but they will not fit. Some adaptation is needed. For each end, we will use pigtail connectors, which are connectors with a small wire length or tail, ready to connect with other wires.
We will connect these wires using WAGO 221 inline connectors, which use levers with a cam to push wire metal ends into a conductor, letting you join two wires securely without soldering. These are designed for thicker wires, but work well with the technique shown below.
Your motors came with two connectors:
- A 2-pin pigtail for driving the motor, around 30 cm long.
- A 4-pin JST 2.0 PH pigtail for connecting the encoders, around 30 cm long.
You will have bought other types:
- A 6-pin JST 1.0 SH pigtail for connecting to the hat – around 120 cm.
- 12 WAGO 221 inline connectors.
The following diagram shows the connections needed:

Figure 5.12 – Wiring for motors
Figure 5.12 – Wiring for motors
Figure 5.1 2 shows the connections needed for the motors. Please note that wire colors are used for illustration, and pigtail color wiring will not match these. There are three groups of connections:
- Motor movements M1 and M2
- Encoder power VCC and GND
- Encoder signals A and B
For now, we will use the whole length of each pigtail. Take care not to cross groups. The following diagram shows how to connect the wires to the WAGO inline connectors:

Figure 5.13 – Using WAGO connectors
Figure 5.13 – Using WAGO connectors
The preceding figure shows steps for making a good connection with these tiny wires and the WAGO 221 inline connector. Strip the wire by putting the wire in the stripping tool at the point where it should be stripped. Press the top so it bites the plastic cover (the insulation), make a small circle to cut around, and then pull it off.
Twisting the folded parts together should result in a thicker end. Twist by holding the wire by its insulation, pinch the wire end between the thumb and forefinger of the other hand, and twist by sweeping the thumb and finger in opposite directions.
Ensure your other fingers are not under the connector when it snaps shut – they can snap with some force!
Work through the connections, making one assembly, which will have 6 inline connectors and 12 connections. This process will get familiar after making a few. You should end up with wire assemblies that look like the following figure:

Figure 5.14 – The cable wiring assembly stages
Figure 5.14 – The cable wiring assembly stages
Figure 5.1 4 shows two stages of the wiring assembly. You will need two assemblies like this.
The top diagram shows WAGO connectors grouped with a little poster-putty/Blu-Tack to cluster the WAGOs into a set of 4 and a set of 2. The wires are then connected in the wiring schematic from Figure 5.12 (a few diagrams back).
When the wiring is complete, you can then stack the group of two WAGOs onto the bottom of the group of 4 WAGOs, using some Blu-Tack to stick them. This makes them take up less space in the robot.
If you have the optional spiral wire wrap, wrapping around the wire groups now will make it easier to route the wires through the robot. Wrap one length around the 6 wires to the Inventor hat, and one around the 4 wires to the encoder. The motor wires are already twisted together, so don’t need this.
When you have one wiring assembly for each side, they are now ready to wire in.
Wiring the cables in
Section titled “Wiring the cables in”The wires now have connectors terminating each end, which can be plugged into the motors, encoders, and the board, one on each side of the robot.
Let’s see how we start the wiring on the top side of the robot:

Figure 5.15 – Motor wiring top side
Figure 5.15 – Motor wiring top side
The preceding image shows how to wire the top part. The 6-pin connectors are pushed into the sockets indicated with arrow A. You can also see the spiral wrap around this wire group.
The other sets of wires coming out are routed through the left and right slots indicated by arrow B. Finally, the WAGO connector groups can be tucked gently under the Raspberry Pi as indicated by arrow C. Do not force this.
This routing then carries on under the robot, as shown in the following pictures:

Figure 5.16 – Motor wiring underneath the robot
Wiring this part of the robot is going to be easier by flipping the robot over. The D arrows indicate access ports for you to pull the wire through. Plug the cables into the connectors indicated by the E arrows. If you have a lot of excess wire, you can consider cutting and stripping the wires, likely the long 30 cm wires. You will need to go through the process above to prepare the ends for the WAGO connector again.
Work on one side at a time, so the motor connections and encoders stay together.
This robot now has the motors connected to the controller and can run code and command the robot. However, before it will do much, the controller and motors need power.
Connecting independent power
Section titled “Connecting independent power”We are powering this robot from a single large USB power bank. We will strap this into the lower chassis plate, and wire it into the Raspberry Pi.
For this step, you will need:
- The robot from the previous steps
- The NanoWave 3 5000 mAh USB-C & A power bank
- The USB cable that came with the power bank
- Velcro ties
See the following figure for strapping this into the robot:

Figure 5.17 – Attaching the battery
Figure 5.17 – Attaching the battery
The preceding images show how to attach the battery. The initial image shows the velcro tie next to a top chassis plate, with the Raspberry Pi shaded out so the slots can be seen underneath. You will do this on the plate already in situ.
Thread the large end of the tie-up through the slot beneath the Raspberry Pi, then slide the battery underneath. Wrap the tie around the battery and pull it tight. Position the battery so that the button and lights face the rear of the robot, making them visible from the outside. You can then add the USB cable from the battery, but do not plug this into the Raspberry Pi until ready. This cable goes up through the large opening under the Raspberry Pi.
At this point, I suggest charging the battery. The charge input port should be available while under the robot.
Power on test
Section titled “Power on test”So far, although we have set up a headless Raspberry Pi, we have still been plugging it into the wall. Now it is time to try powering it independently. We can power on the robot with its independent power and see that the Raspberry Pi wakes up.
Plug the USB Micro or USB-C connector into the Raspberry Pi and lights should come on. Wait for the lights to stop flashing and use SSH (from C hapter 3*, Preparing a Headless Raspberry Pi for a Robot*) to access the Raspberry Pi. If there are no lights, verify that the battery pack has been charged. You may need to plug the Raspberry Pi into a monitor to see if the lightning icon is showing, which also indicates a low power problem.
You should now see the prompt from the headless robot. It is now totally untethered and reachable remotely!
We can shut this down again, using sudo poweroff before removing the power. Ensure to always issue a poweroff command, otherwise SD cards can be corrupted by removing power from the Pi without shutting it down.
We’ve done a power-on test. Let’s now look at our completed robot!
The completed robot base
Section titled “The completed robot base”You have now completed the robot base, which should look something like the following figure:

Figure 5.18 – The completed chassis
Figure 5.18 – The completed chassis
You’ve now built your first robot chassis! Hopefully, the first of many. Another way to look at what we’ve built is as a block diagram.

Figure 5.19 – The robot base as a block diagram
Figure 5.19 – The robot base as a block diagram
Figure 5.1 9 shows the current robot as blocks. We have the wheel assemblies, with built-in encoder sensors connected to the Inventor HAT Mini. That hat also has a cluster of RGB LEDs along with motor debug LEDs. The hat is connected to the Raspberry Pi, which has a connection to Wi-Fi shown as a cloud, which we can use to connect with it headlessly.
With the robot chassis completed, sporting wheels, a Raspberry Pi, and a battery, it is nearly ready to roll. It will need some code to really come to life.
Your motors are ready to drive, and the Raspberry Pi is ready to run code without needing to be plugged into a wall. Combining independent power with headless Wi-Fi control means the robot can be driven around by instructions from your computer.
Summary
Section titled “Summary”In this chapter, you’ve built a rover chassis from the parts we’ve ordered, gaining some techniques for wiring a robot and dealing with different connector types. We’ve added motors with encoders, attached the Raspberry Pi and a breakout hat (the Inventor HAT Mini), and secured a battery to the chassis too.
By hooking up independent power, and connecting the motors, the robot has the hardware it will need to drive itself around without being tethered to a wall. What it doesn’t yet have is any code to move with. In the next chapter, we will start writing the code to get this robot moving!
Challenges
Section titled “Challenges”- Thinking back to the alternative robot design you made in C hapter 2*, Exploring Robot Building Blocks – Code* a nd Electronics, are there components that may need to be removed easily? How could you approach that? Can you come up with alternatives to hook and loop tape? Keep it simple.
- What steps could you take to improve this robot? Bearing in mind that we’ll add sensors, consider how you might embellish this chassis.
Further reading
Section titled “Further reading”Please refer to the following to get more information:
- For further reading on chassis designs, consider Raspberry Pi Robotic Blueprints,Dr. Richard Grimmett. This includes modifying an RC car into a robot.
- I’ve conducted more investigation into the WAGO connectors at https://orionrobots.co.uk/2023/12/11/change-of-viewpoint-on-wiring.html.
- For more robot chassis types, the community sharing website https://www.instructables.com has many buildable examples. Some of these are very interesting and more advanced than our robot.
- Another good site for robot ideas is Pi Wars. They have competition team lists at https://piwars.org/2024-disaster-zone/team-list/.