APC

Design and build a Pi robot

YOU’LL NEED THIS

• Robot kit

• Pi 3B+ or 4 4GB

• 2x L298D motor controllers

• 12x female- to-female jumper wires

• USB battery for testing

• Code: tinyurl.com/ APC518ROBOT

PART 2/3

Don’t miss next issue, subscribe on page 21!

At the end of part one, we had built our robot from a kit and soldered wires from the motor terminals. In this part, we move on to writing code that will control the motors and move our robot. As our robot has four motors, we need to use two motor controllers. One for the rear motors, the other for the front. But which are the best choice for this project, and how do we interface the Raspberry Pi to them? We will create our own Python module (a library of prewritten code) to control the motors and create a test script to ensure it all works.

This part can get quite complex – we are working with four motors. Take your time, tackle just one motor at once, and double-check your connections before moving on. Sure, we want to get to the bit where our robot runs around under our command, but we need to put some work in before we reach those giddy delights.

Motor controllers

We can’t just connect the GPIO of the Raspberry Pi to the motors. The amount of current consumed by a motor is many times what the Pi GPIO can produce. Instead we need something that sits between the Pi and the motors: a motor controller. The controller receives the signal from the Raspberry Pi’s GPIO and triggers its output pins

You’re reading a preview, subscribe to read more.

More from APC

APC3 min read
Hold A Conversation With AI
As a naturally shy person, I always feel self-conscious when talking to machines. If I get transferred to somebody’s voicemail, I either hang up as soon as I hear the beep or gabble a barely intelligible message like “callmeback whenyou getachancetha
APC3 min read
Asus Zenbook 14 OLED (UX3405)
PRICE $2,399 WEB asus.com/au Asus has been putting out some cracking laptops in recent years, and while the Zenbook 14 OLED isn’t perfect, it offers a compelling range of features for a quite reasonable price. The UX3405 sits in the diverse Zenbook
APC5 min read
Skype vs Teams
SKYPE | PRICE Free WEB www.skype.com TEAMS | PRICE Free/$9 per month WEB www.microsoft.com Two apps that do the same thing, owned by the same company, that run on the same platforms and are even interoperable. It may seem strange that one hasn’t bee

Related