In this series of tutorials, we will try to explain how to make a simple robot that follows a simple line with Arduino Nano. First of all, let’s talk about the parts:
We need a body to hold all the materials together. The body may be made of hard plastic, wood or iron. Since our line following robot is simple, we prefer the cheapest one, ie wood.
The motors are the parts that allow the robot to move. The most important point to consider when choosing a motor is torque (power). For this, we need to buy motors with gearboxes. Since we are going to run the motors with battery (DC), we need to buy DC motors. If the motor is without gearbox, it will not be able to perform the first movement of the robot as the speed of the motor will be high but the torque (power) will be low. In motors, the term rpm (rotate per minute) is used to refer to speed. With this term, we can understand how many turns the engine turns in 1 minute. Now 500 rpm is enough for us.
There is also the voltage value in which the motors are operated. We can use 6V or 12V motors for this robot. Our preference will be from 6V motors. Because 6V batteries are lighter than 12V, and we can start the 12V and 6V engine (at least we did). So maybe running the 6V motor with 12V may damage the motor, but what we want to say is that we can run the 6V motor with a voltage greater than 6V. As a result, the motor we recommend to you is a 6V 500 RPM Geared DC Motor.
We’re not going to focus on the wheel. Just be aware of the following two things: First, the wheels must not slip on the ground (materials such as silicone or rubber prevent slipping), and secondly, the wheels must be compatible with the motors (the motors must be able to enter the wheels).
We cannot run motors directly with a microcontroller. For this, we can prepare a circuit with transistors (like MOSFETs). But there are integrated circuits that do this and these are called motor drives. Motor driver, it helps us to drive the engines. With the microcontroller, we can send some signals to the input of this integrated circuit so that the motors can move forward or backward at certain speeds. Such as L293D or L298N motor drivers will work for our project. We can use them alone, but they are sold as modules. In our preference is to buy from the ones in the form of a module. The most suitable motor drive to make following a simple line is the L298N Motor Driver Module.
They are one of the most important parts we can say as the eyes of our robot. With sensors, our robot will be able to communicate with the outside world. A contrast sensor is the most important sensor for our robot to follow the line. There are three kinds of sensors we can recommend for this.
- The first one, CNY70: While the price is affordable, it will take up a lot of space because of its size.
- Second, QRD1114: Again, we can choose because it is affordable and the size is small compared to CNY70.
- Third, QTR Series: This series has two options, analog and digital, and the sensors can be used as single, triple, six or octal modules.
Although a little expensive in terms of size and ease of use in terms of our choice is the QTR Series. We can improve our robot by using sensors other than the contrast sensor, such as the distance sensor (for obstacle and door) or tilt sensor (to adjust the speed on incline way).
Microcontroller (Arduino Nano)
The microcontroller we will use will fulfill the brain function of our robot. There are some things to consider when choosing a microcontroller. These; size, speed, number of pins, number of analog inputs, PWM module…
- The small size would be good for us.
- The speed depends on the crystal and is sufficient for us to be between 8-40 MHz.
- Instead of saying the number of pins, the I/O (Input / Output) pin number is more appropriate to say. For us, there must be enough pins for the circuit elements such as motor drive, sensors, buttons, and LEDs.
- The analog input is required for contrast sensors (we can also circuit externally and convert the analog signal to digital – not necessary for the QTR-RC series). It will be easier for us to have at least as many analog inputs as the microcontroller we are going to use.
- PWM module, we need this module to control the speed of the motors. Since we will drive two motors, let’s make sure there are at least two PWM outputs.
We can use Microchip or Atmel products as microcontrollers. Examples are the PIC16F877 and ATmega328 microcontrollers. Internally we need to install additional circuits such as crystal and voltage regulators. If you do not want to deal with such things, the solution is Arduino. Arduino is an open-source development board based on Atmel microcontrollers. With this board, we can make our robot more easily. Our choice is Arduino Nano. Because it has all the features mentioned above.
The battery is the heart of our robot, the energy source. A good battery is very important for motors. We can run the microcontroller and motors with different batteries, or we can operate them all with one battery. Since weight is important, we prefer to run on a single battery. And the battery we use may be LiPo batteries. We chose it because these batteries are robust, powerful and rechargeable.
We can use 2S (1S = 3.7V) or 3S batteries. Our motors were working with 6V. The motors will not start because the 7.4V battery will drop below 6V after a while. That’s why we prefer the 11.1V battery. As a result, we can use the 11.1V 850mAh LiPo battery in our project.
These are our main parts. In the next article, we will examine in detail some of the materials. I hope that it has been useful. Stay in good health.