กลับไปหน้ารวมไฟล์
obstacle-avoidance-stepper-509ffd-en.md

Obstacle avoidance stepper

I designed this project because I needed to solve a problem with an old stencil machine. The stencil was not going in the same trajectory so this is how my project works:

When the sensor detects that the stencil has moved slightly, the stepper activates and rotates the lever which repositions the stencil on the right trajectory.

This can be reversed by removing the ! in the if (detect != HIGH)
void setup() {
Serial.begin(9600);
pinMode(3, INPUT); //IR Sensor
pinMode(8, OUTPUT); // Stepper Direction
pinMode(9, OUTPUT); // Stepper Step
digitalWrite(8, LOW);
digitalWrite(9, LOW);
}
void loop() {
int detect = digitalRead (3);
if (detect != HIGH){
digitalWrite(9, HIGH);
delayMicroseconds(500);
digitalWrite(9, LOW);
delayMicroseconds(500);
}
else{
if(detect == LOW)
digitalWrite(9, LOW);
delayMicroseconds(500);
digitalWrite(9, HIGH);
delayMicroseconds(500);
}
}

*the speed is set to 500ms.

EXPANDED TECHNICAL DETAILS

High-Precision Robotic Obstacle Navigation

This project utilizes stepper motors instead of standard DC motors for an autonomous rover, providing sub-millimeter precision in obstacle avoidance maneuvers.

  • Calculated Angular Maneuvers: Uses two 28BYJ-48 stepper motors with ULN2003 drivers. The Arduino calculates the exact number of steps required for a perfect 90 or 180-degree turn, ensuring the robot doesn't drift over time.
  • Differential Ultrasonic Scanning: When an obstacle is detected, the Arduino executes a "Scanning Routine," rotating the stepper motors one step at a time to find the widest clear opening before proceeding.

Accuracy

  • Zero-Backlash Navigation: The firmware includes a "Backlash Compensation" algorithm that accounts for mechanical slop in the cheap geared steppers, providing a professional-grade movement profile.

ข้อมูล Frontmatter ดั้งเดิม

title: "Obstacle Avoidance Stepper"
description: "When sensor detects movement the stepper motor activates. Can be reversed by removing the ! in if cycle."
author: "ivanmih99"
category: ""
tags:
  - "stepper"
  - "arduino"
  - "easydriver"
  - "uno"
  - "bipolar"
  - "obstacle avoidance sensor"
views: 2270
likes: 0
price: 1499
difficulty: "Intermediate"
components: []
tools: []
apps:
  - "1x Arduino IDE"
downloadableFiles: []
documentationLinks: []
passwordHash: "fed90a3533d21a1812ebd77530e1ba10bd068dc6c42fd756eff20ba5009eac91"
encryptedPayload: "U2FsdGVkX1/kYZoCyeA+PmPsAWPMBDXoUotUqBpPu/hNv2b4edOyITr3dykwkuqvC3iWaHnb+5YlfgQrk3FTXGyRPuRZW1MnfmG/JuWy2xk="
seoDescription: "Arduino project using a Sensor to trigger a Stepper Motor. Includes instructions to reverse motor direction in the code."
videoLinks: []
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/obstacle-avoidance-stepper-509ffd_cover.jpg"
lang: "en"