Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Wi-Fi Controlled Stepper Motor with Wemos D1 Mini

View and Edit Project In Cirkit DesignerImage of Wi-Fi Controlled Stepper Motor with Wemos D1 Mini

Circuit Documentation

Summary

This circuit involves a Wemos D1 Mini microcontroller, a ULN2003A breakout board, and a 28BYJ-48 stepper motor. The Wemos D1 Mini is used to control the stepper motor via the ULN2003A breakout board. The microcontroller is programmed to connect to a WiFi network and control the stepper motor through a web server interface.

Component List

Wemos D1 Mini

28BYJ-48 Stepper Motor

ULN2003A Breakout Board

Wiring Details

Wemos D1 Mini

28BYJ-48 Stepper Motor

ULN2003A Breakout Board

Code Documentation

Wemos D1 Mini Code

#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <Stepper.h>

const char* ssid = "your_SSID";
const char* password = "your_PASSWORD";

ESP8266WebServer server(80);

const int stepsPerRevolution = 2048; // 28BYJ-48 için adım sayısı
Stepper myStepper(stepsPerRevolution, D1, D3, D2, D4);

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.on("/", handleRoot);
  server.begin();
  Serial.println("HTTP server started");

  myStepper.setSpeed(10); // RPM cinsinden hız
}

void loop() {
  server.handleClient();
  rotateMotor();
}

void handleRoot() {
  server.send(200, "text/plain", "Stepper motor control");
}

void rotateMotor() {
  myStepper.step(stepsPerRevolution / 8); // 45 derece sağa dön
  delay(2000); // 2 saniye bekle
  myStepper.step(-stepsPerRevolution / 8); // 45 derece sola dön
  delay(120000); // 2 dakika bekle
}

This code sets up the Wemos D1 Mini to connect to a WiFi network and start an HTTP server. The server handles requests to control the stepper motor, which rotates 45 degrees in both directions with specified delays.