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! 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
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Practical Arduino Robotics

You're reading from   Practical Arduino Robotics A hands-on guide to bringing your robotics ideas to life using Arduino

Arrow left icon
Product type Paperback
Published in Mar 2023
Publisher Packt
ISBN-13 9781804613177
Length 334 pages
Edition 1st Edition
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Lukas Kaul Lukas Kaul
Author Profile Icon Lukas Kaul
Lukas Kaul
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Part 1: Selecting the Right Components for Your Robots
2. Chapter 1: Introducing Robotics and the Arduino Ecosystem FREE CHAPTER 3. Chapter 2: Making Robots Perceive the World with Sensors 4. Chapter 3: Making Your Robot Move and Interact with the World with Actuators 5. Chapter 4: Selecting the Right Arduino Board for Your Project 6. Part 2: Writing Effective and Reliable Robot Programs for Arduino
7. Chapter 5: Getting Started with Robot Programming 8. Chapter 6: Understanding Object-Oriented Programming and Creating Arduino Libraries 9. Chapter 7: Testing and Debugging with the Arduino IDE 10. Part 3: Building the Hardware, Electronics, and UI of Your Robot
11. Chapter 8: Exploring Mechanical Design and the 3D Printing Toolchain 12. Chapter 9: Designing the Power System of Your Robot 13. Chapter 10: Working with Displays, LEDs, and Sound 14. Chapter 11: Adding Wireless Interfaces to Your Robot 15. Part 4: Advanced Example Projects to Put Your Robotic Skills into Action
16. Chapter 12: Building an Advanced Line-Following Robot Using a Camera 17. Chapter 13: Building a Self-Balancing, Radio-Controlled Telepresence Robot 18. Chapter 14: Wrapping Up, Next Steps, and a Look Ahead 19. Index 20. Other Books You May Enjoy

Wiring up the robot

With the robot built and the electronic components attached, it is time to wire it up! The importance of good wiring of a robot is an often-overlooked part of a robot build, but it is critical to your robot’s reliability. Figure 12.6 gives you an overview of the complete wiring that we will discuss in detail in the following paragraphs:

Figure 12.6 – Symbolic wiring diagram of the line-following robot with close-ups of the motor driver connections

Figure 12.6 – Symbolic wiring diagram of the line-following robot with close-ups of the motor driver connections

Let us split the aspects of wiring into three categories (battery and motor, connections on the breadboard, and connections between boards) and go over these three categories one by one.

Battery and motor connections

Most hobby lithium batteries come with high-current connectors, such as the red Deans connectors (also called T-connectors), or the yellow XT60 connectors. These connectors are designed to carry high currents and ensure correct polarity when you mate them. You will need to buy or make a mating pigtail connector cable that you can use to connect the battery to the motor controller board. It is a very good idea to integrate a 5A fuse into this cable, especially if you use lithium batteries. You can connect the pigtail to the motor controller via the screw terminals on the board, which makes for a secure and safe connection. Just make sure that there are no stray copper strands coming from your cable that could potentially cause a short circuit between the battery poles (you can tin the cable ends with a soldering iron or use crimp-on ferrules to eliminate this risk). Also, double-check that the polarity is correct. Because the cables from the batteries carry the most current anywhere in your robot, you will want to use thick cable stock for this connection. Soldering thick cables to high-current connectors requires a strong soldering iron that can deliver the required heat quickly. If your soldering iron is not strong enough and takes a long time to heat up the cable and connectors, you might damage both and end up with an unreliable solder joint.

Most L298N motor driver boards have screw terminals for the motor connections as well. Attach cables to your motors with the included connectors or by soldering directly to the motor terminals. If your motor has an encoder and the motor and encoder cables all exit in one bundle, consult the datasheet to identify the two motor cables. Connect them to the two outputs of the motor driver shield via the screw terminals. Since we do not use the motor encoders for this project, you can just stow them somewhere – for example, by routing them along the frame of your robot and securing them with clear tape.

On-breadboard connections

So far, we always used flexible jumper cables to connect our Arduino board to other parts of our project. There is a better solution for connections between components and rails on a breadboard, namely, rigid jumper wires. You can buy them in sets of different lengths and colors. They are the best choice for on-breadboard connections because they keep the board much more organized than long, flexible cables. For this robot, you can use these wires to connect the two ground rails along the outer edges of the breadboard and to connect the Bluefruit BLE adapter to power. You can also use this type of wire to make the connections between the GND, 5V, and battery voltage terminals of the motor controller and the respective power rails of the breadboard, just to keep the wiring as organized as possible.

Inter-board connections

For the connections between the three boards, we can use the same flexible jumper cables that we have been using in the previous experiments. None of these connections carry significant currents, so thin jumpers are sufficient. Battery power, GND, and 5V need to be routed from the motor controller to the breadboard where we use one of the power rails for the battery voltage and the other for 5V. From there, 5V and GND are connected to the Arduino board. We also connect the Arduino’s Serial2 port to the Bluefruit BLE adapter on the breadboard (remember to cross TX and RX) and the Arduino’s A0 analog input to the center point of the battery voltage divider. Lastly, three signals per motor need to be connected from the Arduino to the motor controller: one for enable input (PWM) and two for the direction inputs.

Note

It is important to ensure that the GND inputs of all components of the robot are connected to one another. Otherwise, potentially confusing and unexpected behavior can occur.

The following is a photo of how the robot looks when it is fully wired up:

Figure 12.7 – Wired up and ready for a test drive

Figure 12.7 – Wired up and ready for a test drive

If you build the robot with the bigger motors and wheels that we will be using for the next chapter’s self-balancing robot, it will look like this:

Figure 12.8 – The same robot, but with bigger motors and wheels (and with the camera attached)

Figure 12.8 – The same robot, but with bigger motors and wheels (and with the camera attached)

With the wiring done, you have completed your first mobile robot platform, which you can now use as the base for a lot of exciting experiments. Congratulations!

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime