Linux Format

Pi robots: motors and control

At the end of part one, we had built our robot from a kit and soldered wires from the motor A 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

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

More from Linux Format

Linux Format1 min read
Ultimate Desktop Upgrade!
LXF316 will be on sale Tuesday 28th May 2024 Word processors that can help craft that novel you’ve always been talking about and organise large projects. Revive the old roleplaying system for a digital age as we recreate our own play-by-mail gaming
Linux Format4 min read
Linux
The #1 open source mag Future Publishing Limited, Quay House, The Ambury, Bath, BA1 1UA Email contact@linuxformat.com EDITORIAL Editor-in-chief Neil Mohr Art editor Fraser McDermott Production editor Katharine Davies Group editor-in-chief Graham Bar
Linux Format2 min read
Platform Support And Editions
Kali has a huge variety of install options, and these include images for ARM-based computers and pre-made virtual K machine images for most of the popular virtualisers. It’s even possible to install a version of Kali on to an Android-powered device.

Related