In this instructable i want to explain how I build a Lego car with Arduino that will avoid obstacles.
Step 1: What Do You Need
- 4 motors and wheel
- Distance sensor (HC-SR04)
- Servor motor (Micro Servo 9g SG90)
- Motor driver (L298N Dual H-Bridge)
- Arduino one
- Lego and some materials to construct you're car
- 1 or 2 power supplies (powerbank)
Breadboard and wires
Step 2: Build a Car
I used Lego to build the car, to connect the motors to the lego I used some metal screw-threaded rod.
Step 3: Wire It Together
See the diagram for the correct wiring of the Arduino. Make sure the Led's are set the right way, I wire everything to a breadboard and then to the different ports on the Arduino but you could connect them directly of course.
I used a separate power supply for the Arduino and the motors, you can use one power source if you just have one.
Step 4: Start Coding
I attached a example program to use with you're Arduino. Its not perfect but it should work. At the top you can change to ports to you're own configuration if you need.