Component Name: 200 RPM Gear Motor + 7x4cm Wheel + 6-7 Inch Black Metal Chassis
Description: This component is a comprehensive robotic platform consisting of a 200 RPM gear motor, a 7x4cm wheel, and a 6-7 inch black metal chassis. The gear motor provides a reliable and efficient means of propulsion, while the wheel provides traction and stability. The metal chassis provides a sturdy base for the robot, allowing for easy mounting of sensors, microcontrollers, and other components.
Technical Specifications:
Gear Motor:
+ RPM: 200
+ Voltage: 6-12V DC
+ Current: 300-500mA
Wheel:
+ Diameter: 7cm
+ Width: 4cm
Chassis:
+ Material: Black metal
+ Dimensions: 6-7 inches (15-17.5 cm)
+ Mounting points: Multiple holes and slots for easy mounting of components
Example 1: Arduino Line Follower Robot
In this example, we'll demonstrate how to use the component to build a simple line follower robot using an Arduino Uno board.
200 RPM Gear Motor + 7x4cm Wheel + 6-7 Inch Black Metal Chassis
Arduino Uno board
IR sensor module (e.g. VL53L0X)
Jumper wires
Breadboard
Code:
```c
const int leftMotorForward = 2;
const int leftMotorBackward = 3;
const int rightMotorForward = 4;
const int rightMotorBackward = 5;
const int sensorPin = A0;
void setup() {
pinMode(leftMotorForward, OUTPUT);
pinMode(leftMotorBackward, OUTPUT);
pinMode(rightMotorForward, OUTPUT);
pinMode(rightMotorBackward, OUTPUT);
}
void loop() {
int sensorValue = analogRead(sensorPin);
if (sensorValue < 500) { // Line detected
digitalWrite(leftMotorForward, HIGH);
digitalWrite(rightMotorForward, HIGH);
} else {
digitalWrite(leftMotorForward, LOW);
digitalWrite(rightMotorForward, LOW);
}
delay(20);
}
```
Explanation:
In this example, we connect the gear motor to digital pins 2-5 of the Arduino Uno board, and the IR sensor module to analog pin A0. The code reads the sensor value and controls the motor speed based on whether the line is detected or not.
Example 2: Raspberry Pi Robot Arm
In this example, we'll demonstrate how to use the component to build a simple robot arm using a Raspberry Pi board.
200 RPM Gear Motor + 7x4cm Wheel + 6-7 Inch Black Metal Chassis
Raspberry Pi board
L298N motor driver module
Jumper wires
Breadboard
Robot arm components (e.g. servo motors, arm links)
Code:
```python
import RPi.GPIO as GPIO
import time
leftMotorForward = 17
leftMotorBackward = 23
rightMotorForward = 24
rightMotorBackward = 25
GPIO.setup(leftMotorForward, GPIO.OUT)
GPIO.setup(leftMotorBackward, GPIO.OUT)
GPIO.setup(rightMotorForward, GPIO.OUT)
GPIO.setup(rightMotorBackward, GPIO.OUT)
while True:
# Move the robot arm to a specific position
# using servo motors and arm links
# Move the robot forward
GPIO.output(leftMotorForward, GPIO.HIGH)
GPIO.output(rightMotorForward, GPIO.HIGH)
time.sleep(1)
# Stop the robot
GPIO.output(leftMotorForward, GPIO.LOW)
GPIO.output(rightMotorForward, GPIO.LOW)
time.sleep(1)
```
Explanation:
In this example, we connect the gear motor to GPIO pins 17, 23, 24, and 25 of the Raspberry Pi board, and use the L298N motor driver module to control the motor speed. The code moves the robot arm to a specific position using servo motors and arm links, and then moves the robot forward and stops it using the gear motor.
Example 3: ESP32 Wi-Fi Controlled Robot
In this example, we'll demonstrate how to use the component to build a Wi-Fi controlled robot using an ESP32 board.
200 RPM Gear Motor + 7x4cm Wheel + 6-7 Inch Black Metal Chassis
ESP32 board
L298N motor driver module
Jumper wires
Breadboard
Wi-Fi router
Code:
```c
#include <WiFi.h>
const char ssid = "your_wifi_ssid";
const char password = "your_wifi_password";
const int leftMotorForward = 18;
const int leftMotorBackward = 19;
const int rightMotorForward = 21;
const int rightMotorBackward = 22;
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
Serial.println("Connected to WiFi");
server.begin();
pinMode(leftMotorForward, OUTPUT);
pinMode(leftMotorBackward, OUTPUT);
pinMode(rightMotorForward, OUTPUT);
pinMode(rightMotorBackward, OUTPUT);
}
void loop() {
WiFiClient client = server.available();
if (client) {
String request = client.readStringUntil('
');
if (request.indexOf("/forward") != -1) {
digitalWrite(leftMotorForward, HIGH);
digitalWrite(rightMotorForward, HIGH);
} else if (request.indexOf("/backward") != -1) {
digitalWrite(leftMotorBackward, HIGH);
digitalWrite(rightMotorBackward, HIGH);
} else if (request.indexOf("/stop") != -1) {
digitalWrite(leftMotorForward, LOW);
digitalWrite(rightMotorForward, LOW);
digitalWrite(leftMotorBackward, LOW);
digitalWrite(rightMotorBackward, LOW);
}
}
}
```
Explanation:
In this example, we connect the gear motor to GPIO pins 18, 19, 21, and 22 of the ESP32 board, and use the L298N motor driver module to control the motor speed. The code sets up a Wi-Fi server and waits for incoming requests from a client (e.g. a mobile app). Based on the request, it controls the motor speed to move the robot forward, backward, or stop.