Intro: How to Build a Simple Moving Robot(beginners)
A very simple robot with very basic components used that would ignite your interests in robotics. enjoy making it!
Step 1: Tools and Components
Let's start with gathering is all the parts. You may want to go step-wise or you will end up running all around when you start your build.
1. Atmega8 microcontroller(arduino can also be used)
2. 2x Geared motors
3. L298 IC or dual H bridge module
4. metal chassis
5. screws and nuts with some connecting wires.
6. A pair of wheels for the motors
Nothing much other than the basic ones you might have.
Step 2: Understanding the Difference Between Atmega8 and Arduino and What Is H Bridge
When you delve into the world of microcontrollers there will be inevitable confusion about the different versions of what appear to be the same family of microcontroller.
In the Arduino world, the initial choice was the Atmel ATmega8 running at 16MHz. Subsequent versions of the Arduino used the ATmega168 as well as the commonly-known ATmega328, both running at 16MHz as well. (the Arduino “Mega” series are an offshoot, but the principles presented here remain valid…)
I have used atmega8 which is a lesser version but arduino compatible, which means you can code this board using your arduino platform.
H-bridge (L298): It is an electronic circuit that enables voltage across a load in either direction (or) it is simply called as a motor driving tool, it has large application in robotics because it can change the direction of the motor depending on the logic state of the respective Arduino pin (reverse or backward).
Step 3: Making the Connections
H bridge is a motor driver module made with L2938 IC which can powered by a 12v supply either by an adapter or a 9v battery in series. the connections here goes.
Motor pins 1(IN1) of H bridge TO pins 8,9 of the microcontroller.
Motor pins 2(IN2) of H bridge TO pins 10,11 of the microcontroller.
power the Hbridge using an adapter.
Thats it,very simple isnt it!?
Step 4: Coding
here i have uploaded a simple program that runs the motors in forward direction and left wheel forward and backward that helps to turn the robot.
you can change the direction of wheels but changing the power to pins in digitalWrite() either as high or low.
if you had to give analog inputs the use analogWrite() with values ranging from 0 to 255 as min and max, using these values you can vary the speed of the motor. don't forget to use pwm* pins on the board for analog values.
ATB! give various inputs to digitalWrite and explore.