LCD I2C with motor nema doesn't work well


I have a simple program that while the NEMA engine is moving, it will display something on the 16x2 screen with I2C but it does not work at all, at the moment of entering “lcd.begin ()” the engine stops working, the screen does not display anything, I think may have programming problems or the library of the LCD screen.

#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <AccelStepper.h>
// Define stepper motor connections and motor interface type. Motor interface type must be set to 1 when using a driver:
#define dirPin 2
#define stepPin 3
#define motorInterfaceType 1

LiquidCrystal_I2C lcd(0x27,16,2); // Set the LCD I2C address
// Create a new instance of the AccelStepper class:
AccelStepper stepper = AccelStepper(motorInterfaceType, stepPin, dirPin);
void setup() {
  // Set the maximum speed in steps per second:
void loop() {
  lcd.setCursor(3, 0);                   // Move the cursor to 4th position on 1st line
    // Set the speed in steps per second:
  // Step the motor with a constant speed as set by setSpeed():


Are you really powering a stepper from the Uno 5V?

If you disconnect the stepper driver, does the display work?

no, I'm using a power supply 12v 5A for powering the motor

Then why does your diagram show the stepper powered by 5V. Inaccurate information wastes time, or worse, will get inaccurate answers.

Does the display work with the motor driver disconnected?

sorry, here is exactly the circuit. yes the lcd function correctly when it works alone, the problem is when I connect the lcd with the motor

Your code is waiting for pin 11 to be HIGH, but pin 11 is set as OUTPUT. What causes pin 11 to go HIGH?

OPs fritzy.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom.. :slight_smile: