Hallo,
ich habe für ein kleines Projekt einen Nema17 via DRV8825 und "AccelStepper" angesteuert. Nachdem der Motor x Schritte fährt kommt ein Delay, dann springt eine kleine 5V Pumpe über einen Digitalpin und TIP120 Transistor an. Dabei nutze ich ein 3A 12V Netzteil und den internen Spannungswandler für die Pumpe.
Mit einem Arduino uno klappt das super. Dann habe ich aus Platzgründen auf ein Nano gewechselt und dort stottert der Stepper immer wenn die Pumpe angeht, als würde die Pumpe Störsignale zum Schrittmotor senden. Ich habe mehrmals zwischen Uno und Nano gewechselt immer mit dem selben Ergebnis. Auch einen anderen Nano habe ich getestet. Warum geht es mit dem Uno aber nicht mit dem Nano?
Stepper D1,2
Pumpe D13
// Quickstop.pde
// -*- mode: C++ -*-
//
// Check stop handling.
// Calls stop() while the stepper is travelling at full speed, causing
// the stepper to stop as quickly as possible, within the constraints of the
// current acceleration.
//
// Copyright (C) 2012 Mike McCauley
// $Id: $
#include <AccelStepper.h>
int x=3200;
// Define a stepper and the pins it will use
AccelStepper stepper; // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5
void setup()
{
stepper.setMaxSpeed(2000);
stepper.setAcceleration(1000);
int x=3200;
pinMode(13, OUTPUT);
}
void loop()
{
stepper.moveTo(x);
stepper.runToPosition();
// Now stopped after quickstop
delay(500);
digitalWrite(13, HIGH);
delay(4000);
digitalWrite(13, LOW);
delay(500);
stepper.moveTo(0);
stepper.runToPosition();
// Now stopped after quickstop
delay(500);
digitalWrite(13, HIGH);
delay(4000);
digitalWrite(13, LOW);
delay(500);
}