SPI LCD and MISO line used as an OUTPUT for motor

HI guys,
I m using a SPI LCD that do not need the MISO line on my UNO. I would like to use it to give the rotation way for a motor through a L293D. However the MISO line connot maintain the 5V (HIGH), therefore the motor is not moving when MISO line is supposely at HIGH (measuring the stuff I found out that the line is 2.7 to 0.9V only). The motor move fine when MISO is put LOW (0V).
Using the same electronic sheme (so with the LCD screen plugged in), but not having the LCD (and the SPI lib) enabled in the programming part, it is working fine, the motor can drive front and reverse.
Any tips to counter that?

I believe the SPI library takes control of that for you. You have several problems that appear to be hardware related (no code given). Post a schematic, not a frizzy thing showing all connections, power, ground, interconnections and links to the various hardware parts.

Hi, thx for the answer.
however I do not believe it is hardware related .. as I manage to make the motor spinning both ways when the ILI9341 library (and SPI) is not active, while the hardware stay similar (screen plugged and powered).
Enclosed is the schematics of my hardware. the screen is a 2.2 LCD using ILI9341

Here is the .ino file. if you comment out the tft.begin(); and other TFT related stuff, motor will spin both way. If TFT.begin() is activated, it only spin one way ... (of course if MISO is used for controlling the spinning way... no problem if I choose another UNO pin!) here is the main file (other are just copy of the ILI9341 lib but light version and with correct pin connection :slight_smile:
Any advices to counter this MISO effect?

#include "TFT_ILI9341.h"

#include "TFT_ILI9341.h"

#define MOTOR1_IN1 12 // only one pin so use a logic gate
#define MOTOR1_PMW 9

#define TFT_LED   10
#define LBLUE   0x7639

TFT_ILI9341 tft = TFT_ILI9341();

boolean SpinningWay = 0;

unsigned long motorTime, previousMotorTime;

void setup() {
  // put your setup code here, to run once:
  digitalWrite(MOTOR1_PMW, LOW);
  pinMode(MOTOR1_IN1, OUTPUT);
  // pinMode(motor1_in2Pin, OUTPUT); // no need if using a logic gate
  pinMode(MOTOR1_PMW, OUTPUT);

//Start TFT 

  tft.setRotation(3); //rotation de l ecran: 0,1,2,3



void loop() {
  // put your main code here, to run repeatedly:

  SetMotor1(200, SpinningWay, 3000);

  //digitalWrite (MOTOR1_IN1, 0);
  //analogWrite(MOTOR1_PMW, 200);

SpinningWay = !SpinningWay;

void SetMotor1 (int speed, boolean updir, int timer) //speed (0-255), upward direction, timer from the calibration
  previousMotorTime = millis();
  motorTime = millis();

  analogWrite(MOTOR1_PMW, speed);
  digitalWrite (MOTOR1_IN1, updir);
  //digitalWrite (motor1_in2Pin, !updir);

  while ((motorTime - previousMotorTime ) < timer) {
    motorTime = millis();

  analogWrite(MOTOR1_PMW, 0);


test_DC_bin2.zip (35.1 KB)

Why is U4 connected with emitter and collector swapped?

Thanks Paul__B you nailed it. I also question R1 and R3.


Good spot ... however it is just because I did a screendump of an unfinished (and wrong) version of my diagram. here the latest one (the one I have on real on the breadboard).

I was using the idea from this page to get a NAND NOT Gate Realization using BC 547 and Arduino Mega « Funny Electronics

Regarding R3: it is just a pull down for the enable pin: otherwise when then pin is floating the motor is spinning ( when you upload the sketch or do a reset...)
For R1, just to limit the intensity going through the base ... value from the webpage above...

no one has an idea?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.