Carro Todo Terreno Arduino
Carro "Todo Terreno" :) Tutorial completo: https://youtu.be/BqBb3FfbrHk
Materiales:
(12) tornillo M3-25mm cabeza Allen cónica
(13) tuerca M3
(6) tornillo M6-25mm cabeza Allen cónica
(8) tornillo M3-10mm cabeza Allen cónica
(3) tornillo M3-10mm cabeza hexagonal
(1) tornillo M3-16mm cabeza hexagonal
(1) arandela M3
(2) ligas
Componentes:
(1) Arduino Nano
(2) L293D puente H
(1) L7805CV regulador de voltaje 5VDC
(1) L7809CV regulador de voltaje 9VDC
(1) Módulo Bluetooth HC06 esclavo
(1) HC-SR04 Sensor de ultrasonido
(6) Motor reductor 3-6V + Llantas
#define motorPin1 7 // Pin de control del motor 1
#define motorPin2 8 // Pin de control del motor 2
#define motorPin3 2 // Pin de control del motor 3
#define motorPin4 4 // Pin de control del motor 4
#define TRIGGER_PIN 11 // Pin de disparo del sensor ultrasónico
#define ECHO_PIN 10 // Pin de eco del sensor ultrasónico
bool rotating = false;
bool ultrasonicEnabled = false;
void setup() {
pinMode(motorPin1, OUTPUT);
pinMode(motorPin2, OUTPUT);
pinMode(motorPin3, OUTPUT);
pinMode(motorPin4, OUTPUT);
Serial.begin(9600);
pinMode(TRIGGER_PIN, OUTPUT);
pinMode(ECHO_PIN, INPUT);
}
void loop() {
if (Serial.available() > 0) {
char command = Serial.read();
if (command == 'F') {
forward();
}
else if (command == 'G') {
backward();
}
else if (command == 'L') {
turnLeft();
}
else if (command == 'R') {
turnRight();
}
else if (command == 'S') {
stop();
}
else if (command == 'X') {
rotate();
ultrasonicEnabled = true;
}
else if (command == 'Y') {
stopMotors();
ultrasonicEnabled = false;
}
}
if (ultrasonicEnabled) {
long duration, distance;
digitalWrite(TRIGGER_PIN, LOW);
delayMicroseconds(2);
digitalWrite(TRIGGER_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIGGER_PIN, LOW);
duration = pulseIn(ECHO_PIN, HIGH);
distance = (duration / 2) / 29.1;
if (distance < 30) {
stop();
backward();
delay(500);
stop();
delay(200);
turnLeft();
delay(500);
stop();
forward();
}
}
}
void forward() {
digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, LOW);
}
void backward() {
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, HIGH);
}
void turnLeft() {
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, LOW);
}
void turnRight() {
digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, HIGH);
}
void stop() {
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, LOW);
}
void rotate() {
if (!rotating) {
rotating = true;
digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, HIGH);
delay(200);
stop();
delay(200);
backward();
delay(500);
stop();
rotating = false;
forward();
}
}
void stopMotors() {
stop();
}
Carro Todo Terreno Arduino
Project images are for reference only. Actual production is based on the manufacturing files on the project page.
Please review the designer's notes (e.g., PCB thickness) and select the appropriate options.
PCBWay is not responsible
for issues caused by unsuitable parameter selections.
For more important ordering information, please refer to
Read More
Raspberry Pi 5 7 Inch Touch Screen IPS 1024x600 HD LCD HDMI-compatible Display for RPI 4B 3B+ OPI 5 AIDA64 PC Secondary Screen(Without Speaker)
BUY NOW- Comments(0)
- Likes(4)
-
Engineer
Jan 08,2024
-
Alexander Fabrizio Maylle Lugo
Dec 31,2023
-
Engineer
Jul 24,2023
-
Engineer
Jul 06,2023
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by Alexander Fabrizio Maylle Lugo
-
Programmable Mist Maker - XIAO / QT PY Extension
1393 2 1 -
RadioHAT - Raspberry Pi radio development platform
1167 0 2 -
QWIIC-VL53L4CD Time-of-Flight Distance Sensor Module
1377 0 1 -
-
-
-
ARPS-2 – Arduino-Compatible Robot Project Shield for Arduino UNO
3540 0 6 -
-
A Compact Charging Breakout Board For Waveshare ESP32-C3
4212 3 8 -
AI-driven LoRa & LLM-enabled Kiosk & Food Delivery System
4591 2 2







