By Phil King
Published Jun 19, 2021
Planning to build a robot? Here’s everything you’ll need to get started and help you budget for your project.
Have you ever wanted to build your own robot? It’s not as difficult as you might think, either using a kit or?an array of standard electronic components.
The?main?hurdle is navigating the bewildering number of options available for building a wheeled robot, including?its microcontroller, chassis, motors, and sensors. The easiest option is to buy a full robot kit, but?if you want to create a custom-built robot, we take you step by step through the main choices to make.
Your robot will need an electronic ‘brain’ to control all of its functions, including movement. Two of the most popular options are the Raspberry Pi and Arduino.
The?Raspberry Pi is a single-board computer (SBC) with an Arm microprocessor that can run a full Linux operating system.? The main benefit for robot building is that it’s more powerful than a microcontroller like an Arduino, enabling you to run more complex programs. This is ideal for?face recognition?and other forms of AI, so you can create a really smart robot.
Another advantage is that you can program it in pretty much any language.?One of the most popular for robotics in Python, which is less daunting than C for newbies to coding.
An Arduino, on the other hand, is ideal for simpler robotics projects. As well as typically being lower-cost, it uses less power, so takes longer to drain?a portable?power bank or battery pack.
While it is?normally programmed in C using the Arduino IDE on a computer, it is possible to use?a graphical IDE called Xod to?control Arduino robots.
Other microcontrollers are also suitable for robotics, including Teensy, BeagleBone, micro:bit, and Raspberry Pi Pico.
For your wheeled robot,?you’ll need a chassis to form?its body, house the electronics, and?mount the motors (using brackets).
There are numerous chassis kits available, in?various sizes and materials,?typically for?two- or four-wheeled robots–sometimes six wheels. Most are simple platforms for mounting the electronics and motors; more expensive options may include a suspension system.
Alternatively, you can custom-build your own DIY chassis, from materials such as plastic, metal, wood, Lego bricks, or even cardboard. An important?consideration is how rugged you want your robot to be. It if needs to deal with difficult terrain, you’ll want a more durable chassis.
To make your robot move, you’ll need motors. For a wheeled robot, these?will be standard DC motors that–unlike servos or stepper motors– spin freely at high speed.
Some?motors feature a built-in gearbox to increase torque and drive heavier loads. Check the gear (or speed reduction) ratio: the higher it is, the more the torque and?lower?the speed. Higher ratios are recommended for beginner projects.
If you?require accurate reading and control of motor speed, there’s also the option of adding a magnetic or optical speed encoder to each motor shaft, which will feed the data back to your microcontroller.
Each motor’s speed is usually controlled by PWM (pulse-width modulation), which?involves sending?a stream of digital on-off pulses: the more on pulses in a cycle, the faster it spins.
You can’t connect DC motors directly to your single-board computer or microcontroller board, as?the latter?won’t be able to supply enough power for the motors and you may damage the board.
Instead, you’ll need a motor?driver/controller?board connected between the motors and?your microcontroller, and also to the power source. Low-cost driver boards are often based on?an L298N or?DRV8833 dual-channel H-bridge chip. The number of channels?determines how many motors?can be controlled independently, so you’ll need?more channels?(and drivers) for 4WD or 6WD.
While it’s possible for someone with electronics knowledge to build their own H-bridge motor driver, it’s easier to buy a driver board. There are numerous HATs available?to mount on the Raspberry Pi, and a dedicated Motor Shield for Arduino.
A?key factor when choosing a motor driver?is to ensure?it can handle the voltage required by the motors, as well as their continuous operating current.?If you can’t find?the latter in the motors’ specs, it is typically 20% to 25% lower than the stall current. The motor driver’s maximum current should be around double the motors’ continuous current.
Naturally, these are essential for a wheeled robot! A simple two-wheeled robot is easiest for beginners, usually featuring a small unpowered caster, wheel, or?skid at the front?to help it maintain?balance.
A four-wheeled robot is the next step up, providing extra stability and control.?If you want independent control of each motor/wheel for true 4WD, you’ll need two dual-channel motor driver chips on your board. Alternatively, you can use?a single?driver to control two motors on each channel, providing it has enough maximum current capacity to handle them all.
For off-road terrain, you may even want to go up to six wheels, but you‘ll need a longer chassis to accommodate them. You could add?caterpillar tracks for extra?grip, or even a rocker-bogie system as featured on NASA’s Perseverance Mars rover.
While it’s possible to have steerable wheels using servos to rotate them and their motors, the most common method for steering a robot is to simply to run wheels on one side faster than the other.
Another interesting option is using Mecanum wheels, whose special?rollers enable them to move sideways when the four wheels are rotated in a certain pattern. Great for parallel parking!
Having your robot tethered to a mains power outlet would be a?little limiting, so you’ll need a portable source of power.?There are two main methods:
Use?separate power sources for the motors and electronics.
Use?a single power source connected to both via a BEC (battery eliminator circuit). Your motor driver board may include a BEC.
Whichever option you choose, possible power sources include USB power banks, battery packs (e.g. 4x AA),?and LiPo batteries. Just make sure you’re supplying the correct voltages and current levels.?Many motor driver boards offer protection against over-current and reverse polarity.
While it’s possible to program your robot to move in a set pattern or control it manually from a remote device, adding sensors will enable it to?act autonomously.
An ultrasonic distance sensor, such as the?HC-SR04, will?allow the robot to sense a wall or other obstruction ahead of it so it can take evasive action.
Getting a robot to following a path on the floor is another popular option. One or more IR line-following sensors?mounted at the front enable it to detect a dark line on the floor and steer along it.
You can even give your robot ‘eyes’ with the addition of a small camera. Images can be interpreted using a computer vision library such as OpenCV to detect objects or even faces.
You now have an overview of how to?build your own wheeled robot. We hope it has inspired you to make your first foray?into the wonderful world of robotics. Once you’ve?built your first robot, you might want to make a different type, such as one with legs or a robotic arm.
9 iPhone Apps You Can Lock With Touch ID or Face ID
Learn how to lock several popular iPhone apps with Face ID or Touch ID, including WhatsApp, Apple Notes, and more.
DIY Project Ideas
About The Author
(14 Articles Published)
Freelance technology and entertainment journalist Phil has edited numerous official Raspberry Pi books. A long-time Raspberry Pi and electronics tinkerer, he is a regular contributor to The MagPi magazine.
From Phil King
Subscribe To Our Newsletter
Join our newsletter for tech tips, reviews, free ebooks, and exclusive deals!
One More Step…!
Please confirm your email address in the email we just sent you.