Can you make a robot with Arduino?

Today I will show you how to make a simple robot with Arduino microcontroller that can autonomously avoid obstacles in its path. While there are many ready-made kits available for sale among the vast array of IoT (Internet of Things) components, which include motors, drivers, platforms, microcontrollers, etc., I have decided to assemble the robot myself.

Used components

1. Arduino Uno board arduino uno
2. Motors driver  L293D for Arduino dc driver
3. 18650 batteries 18650
4. Ultrasonic sensor HC-SR04 ultrasonic sensor
5. Servo servo
6. DC motors motor
7. Wheels wheel
8. Compartment for batteries; wires wires

In general, Arduino and the L293D motor driver are a commonly used combination for creating various projects, especially in the fields of robotics and automation. Arduino is an open-source electronics development platform that allows for easy programming of microcontrollers, while the L293D is an integrated circuit used for controlling motors, including changing rotation direction and speed.

The main applications of Arduino with L293D include:

  • Motor control: Arduino is used to control various types of motors, such as DC motors, stepper motors, etc. The L293D acts as a bridge driver, allowing Arduino to control the direction and speed of motor rotation.
  • Robotics: With Arduino and L293D, a wide range of robots can be built, from simple mobile platforms to complex robotic systems.
  • Load control: If precise control of speed and direction is required for a load, such as a conveyor or elevator, Arduino with L293D can be an effective solution.
  • Home automation: Using Arduino with L293D allows for the automation of various processes in home devices, such as automatic curtains, plant watering systems, etc.
  • Variable speed projects: With the ability to control motor speed using the L293D driver, Arduino can be used in projects where motor speed regulation is necessary, such as fans, vehicles, etc.
  • Learning programming and electronics: Arduino with L293D is excellent for learning the basics of programming and electronics. It can be used in educational institutions to create various projects that help students understand basic concepts.

Overall, the combination of Arduino and the L293D driver opens up broad possibilities for creative projects in the fields of robotics, automation, and electronics, providing the ability to control a variety of devices and mechanisms. This is what we’ll delve into further.


Connection diagram

arduino robot schema

Body-platform for the robot

So, as the robot platform, I decided to use a simple cardboard box. I placed the motors inside, punched holes for the axles, and secured them using cardboard and hot glue.

motors mounting

I made a cardboard cover and placed the Arduino Uno microcontroller board on it, to which I connected the L293D motor driver. In turn, I connected the HC-SR04 ultrasonic distance sensor with a servo motor and a battery power supply to the driver. I mounted the distance sensor on the servo motor, securing the servo motor on top of the front inner wall of the cardboard box with a strap.

arduino mounting dc motorsdriver

I attached wheels to the axles of the motors from the outside, carefully holding each motor from the inside of the box with my hand.

arduino robot mounting servo    arduino robot car

Robot car algorithm

  1. After turning on, the robot starts moving forward and scanning for obstacles.
  2. If there are no obstacles, it continues moving forward. 
  3. If there is an obstacle ahead, it stops and analyzes left and right.
  4. If the path is clear to the left, it turns left.
  5. If the path is clear to the right, our robot with Arduino turns right.

Programming of a robot with Arduino

I found and reused an existing code for my robot. You can also get it from this link. The provided program describes the process of reading data from the ultrasonic sensor to detect obstacles near the robot and controlling the motors accordingly based on the received data. Of course, you can modify the basic code of the program by adding more functionality for your robot. After that, you need to flash the Arduino board with the code using the Arduino IDE.

On completion

When constructing this robot with Arduino Uno, I used the L293D motor driver for Arduino. However, you may also encounter many projects built using the L298N driver.

The L298N is an integrated circuit bridge driver used for controlling DC and stepper motors. It has two H-bridges that allow controlling the direction of rotation and speed of motors. The L298N is widely used in robotics, automotive electronics, and other areas where precise and efficient motor control is needed. It operates with a power supply voltage from 5 to 35 volts and can control currents up to 2 amps per channel.

The L298N easily integrates with Arduino or any other microcontrollers, making it a popular choice for many projects. In fact, I plan to use it in the future as well, not only in conjunction with Arduino but also with the Raspberry Pi mini-computer. You can see my robot with Arduino below.

robot with arduino

Maybe you will also be interested in my other project? For example, mining on Arduino.

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *