Circuit Documentation
Summary
This document provides a detailed overview of a circuit designed to control two DC motors using an L298N motor driver and a Vietduino Uno microcontroller. The circuit also includes two IR sensors for obstacle detection. The Vietduino Uno is programmed to control the motor driver and read inputs from the IR sensors.
Component List
L298N DC Motor Driver
- Description: A dual H-Bridge motor driver that allows control of the speed and direction of two DC motors.
- Pins: OUT1, OUT2, 12V, GND, 5V, OUT3, OUT4, 5V-ENA-JMP-I, 5V-ENA-JMP-O, +5V-J1, +5V-J2, ENA, IN1, IN2, IN3, IN4, ENB
Motor amarillo motorreductor hobby
- Description: A small DC motor with a gearbox, commonly used in hobby projects.
- Pins: vcc, GND
IR Sensor
- Description: An infrared sensor used for obstacle detection.
- Pins: out, gnd, vcc
Vietduino Uno USB-B
- Description: A microcontroller board based on the ATmega328P, compatible with Arduino Uno.
- Pins: AREF, GND, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 3V3, 5V, RESET, VIN, A0, A1, A2, A3, A4, A5
Wiring Details
L298N DC Motor Driver
- ENA connected to Vietduino Uno USB-B pin 9
- IN1 connected to Vietduino Uno USB-B pin 7
- IN2 connected to Vietduino Uno USB-B pin 6
- IN3 connected to Vietduino Uno USB-B pin 5
- IN4 connected to Vietduino Uno USB-B pin 4
- ENB connected to Vietduino Uno USB-B pin 3
- OUT1 connected to Motor amarillo motorreductor hobby pin GND
- OUT2 connected to Motor amarillo motorreductor hobby pin vcc
- OUT3 connected to Motor amarillo motorreductor hobby pin vcc
- OUT4 connected to Motor amarillo motorreductor hobby pin GND
Motor amarillo motorreductor hobby
- Motor 1:
- vcc connected to L298N DC Motor Driver pin OUT2
- GND connected to L298N DC Motor Driver pin OUT1
- Motor 2:
- vcc connected to L298N DC Motor Driver pin OUT3
- GND connected to L298N DC Motor Driver pin OUT4
IR Sensor
- Sensor 1:
- vcc connected to Vietduino Uno USB-B pin 5V
- gnd connected to Vietduino Uno USB-B pin GND
- out connected to Vietduino Uno USB-B pin A0
- Sensor 2:
- vcc connected to Vietduino Uno USB-B pin 5V
- gnd connected to Vietduino Uno USB-B pin GND
- out connected to Vietduino Uno USB-B pin A1
Vietduino Uno USB-B
- Pin 9 connected to L298N DC Motor Driver pin ENA
- Pin 7 connected to L298N DC Motor Driver pin IN1
- Pin 6 connected to L298N DC Motor Driver pin IN2
- Pin 5 connected to L298N DC Motor Driver pin IN3
- Pin 4 connected to L298N DC Motor Driver pin IN4
- Pin 3 connected to L298N DC Motor Driver pin ENB
- Pin 5V connected to IR Sensor pins vcc
- Pin GND connected to IR Sensor pins gnd
- Pin A0 connected to IR Sensor pin out (Sensor 1)
- Pin A1 connected to IR Sensor pin out (Sensor 2)
Code Documentation
sketch.ino
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
documentation.txt
