Easy Pump arduino stepper by mochr 3d model
3dmdb logo
Thingiverse
Easy Pump arduino stepper by mochr

Easy Pump arduino stepper by mochr

by Thingiverse
Last crawled date: 3 years, 1 month ago
Easy pump with arduino and Stepper motor.https://youtu.be/dSlVYtNwtlo
i use:
6x bearings: 10x5x4 mm
NEMA 17Stepper motor with 5mm shaft
steper driver pololu A4988
Arduino Nano
rezistor 10k
switch
silicone pipe 5x3mm
some screws M3,M2 and nuts
arduio code:
int x;
const int buttonPin = 2;
int buttonState = 0;
void setup()
{
pinMode(6, OUTPUT); // Enable
pinMode(5, OUTPUT); // Step
pinMode(4, OUTPUT); // Dir
digitalWrite(6, LOW); // Set Enable low
pinMode(buttonPin, INPUT);
Serial.begin(9600);
}
void loop()
{
buttonState = digitalRead(buttonPin);
Serial.println(buttonState);
if (buttonState == HIGH) {
digitalWrite(6, LOW); // Set Enable low
digitalWrite(4, HIGH); // Set Dir high
for (x = 0; x < 4000; x++) // Loop 200 times
{
digitalWrite(5, HIGH); // Output high
delayMicroseconds(300); // Wait 1/2 a ms
digitalWrite(5, LOW); // Output low
delayMicroseconds(300); // Wait 1/2 a ms
}
delay(1000); // pause one second
}
else {
digitalWrite(6, HIGH); // Set Enable low
}
}

Tags