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
- Description: A microcontroller board based on the ESP8266 WiFi module.
- Pins: RST, A0, D0, D5, D6, D7, D8, 3V3, 5V, G, D4, D3, D2, D1, RX, TX
28BYJ-48 Stepper Motor
- Description: A small, inexpensive stepper motor commonly used in various applications.
- Pins: BLUE, PINK, YELLOW, ORANGE, RED
ULN2003A Breakout Board
- Description: A driver board for controlling the 28BYJ-48 stepper motor.
- Pins: In 1, In 2, In 3, In 4, In 5, In 6, In 7, 0V, +5V, ON/OFF jumper switch, BLUE wire, PINK wire, YELLOW wire, ORANGE wire, RED wire
Wiring Details
Wemos D1 Mini
- 5V connected to +5V on ULN2003A breakout board
- G connected to 0V on ULN2003A breakout board
- D4 connected to In 4 on ULN2003A breakout board
- D3 connected to In 3 on ULN2003A breakout board
- D2 connected to In 2 on ULN2003A breakout board
- D1 connected to In 1 on ULN2003A breakout board
28BYJ-48 Stepper Motor
- BLUE connected to BLUE wire on ULN2003A breakout board
- PINK connected to PINK wire on ULN2003A breakout board
- YELLOW connected to YELLOW wire on ULN2003A breakout board
- ORANGE connected to ORANGE wire on ULN2003A breakout board
- RED connected to RED wire on ULN2003A breakout board
ULN2003A Breakout Board
- +5V connected to 5V on Wemos D1 Mini
- 0V connected to G on Wemos D1 Mini
- In 4 connected to D4 on Wemos D1 Mini
- In 3 connected to D3 on Wemos D1 Mini
- In 2 connected to D2 on Wemos D1 Mini
- In 1 connected to D1 on Wemos D1 Mini
- BLUE wire connected to BLUE on 28BYJ-48 Stepper Motor
- PINK wire connected to PINK on 28BYJ-48 Stepper Motor
- YELLOW wire connected to YELLOW on 28BYJ-48 Stepper Motor
- ORANGE wire connected to ORANGE on 28BYJ-48 Stepper Motor
- RED wire connected to RED on 28BYJ-48 Stepper Motor
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.
