Hi all,
I am using a stepper motor 28BYJ with an ULN2003 driver in the same project as a ST7735 1.8'' display. The stepper is connected to pins 4,5,6 and 7. The display is connected to pins 8,9, and 10.
I use the Adafruit library for the display and the TinyStepper library for the motor, which seem common and tested libraries to me.
I can run the motor without the display just fine. I can add the display and it works fine as well, but then the motor only buzzes but does not really turn.
I could break it down to the line
tft.initR(INITR_BLACKTAB);
If I comment that line out, the motor runs as expected. With the line, it shows the behavior that I expect if the motor control is not run fast enough. But according to documentation, the motor.moveRelativeInSteps(x); command that I use is blocking and will only return after finished, so this should not be possible to happen.
The power supply is through a 5V power supply that seems to have a lot of names: Yatwin YwRobot MB-V2 545043 are some of them. It is the black one with the yellow pins for use in small breadboards that can be seen everywhere. It feeds into the Nanos 5V pin, the TFTs VCC and the second connector to the ULN2003s Vmotor. The TFT LED pin is powered through the Nanos 3.3V output.
Here is the code:
#include <TinyStepper_28BYJ_48.h>
// >>> TFT <<<
// import Adafruit ST7735 Library for the 1.8'' display
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
#include <SPI.h>
#include <ezButton.h>
// TFT
#define TFT_CS 10
#define TFT_RST 8 // Or set to -1 and connect to Arduino RESET pin
#define TFT_DC 9
// create TFT object
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
TinyStepper_28BYJ_48 motor;
void setup() {
tft.initR(INITR_BLACKTAB); // Init ST7735S chip, black tab
motor.connectToPins(4, 5, 6, 7);
motor.setSpeedInStepsPerSecond(1000);
motor.setAccelerationInStepsPerSecondPerSecond(2000);
}
void loop() {
motor.moveRelativeInSteps(300);
delay(1000);
motor.moveRelativeInSteps(-300);
delay(1000);
}
If I comment out the tft.initR(...) line, the motor starts turning normaly.
My question is, how is that even possible? The devices do not share pins, the motor command should be blocking. The power during motor run only drops from 5V to 4.99V, so extremely stable.
What is happening here?

