L293 Driver Issue/Zoetrope Project issue

Hello again

I'm having issues with another project and was hoping I could get some assistance.

Here's a photo of the schematic from the book:

I have used some different pins but the idea is the same, here is my set up:


In order from right to left the components are:

  1. Push button - puts arduino in either "on" or "off" mode. Button must be pressed to send power to integrated circuit. Signal runs to pin 12 on uno.

  2. Push button - used to switch state so that 5v is sent to a different pin on the integrated circuit. This is wired to pin 11.

  3. Potentiometer - control amount of voltage to VC pin on IC - this is wired to pin A0

  4. Integrated Circuit the "tab" or cut out is on the right side, so as per the documentation I believe the top right side of the IC looking at it from the top is pin #1.

In order I have:

Pin #1 - enable pin - connected to +5v on the breadboard
Pin #2 - input pin 1 - connected to pin 3
Pin #3 - output to motor
Pin #4 + #5 - ground
Pin #6 - output to motor
Pin #7 - input pin 2 - connected to pin 2
Pin #8 - VC connected to the 9v battery on the other side of the breadboard

The grounds of each side of the breadboard are connected together

I have probed with a multimetre,

I am finding pin 1 on IC: 4v
pin 2: 4.2v
pin 3: 4.24
pin 6: also 4.24v (not sure why)
pin 7: 0v (I think this is ok because only one input pin receives power)
pin 8: 8.68v from 9v battery

I am finding it pin 3 & 6 each both have 4.24 v when tested to the breadboard ground. This doesn't seem right.

I have also found that pin 3 & 6 from the IC is not distributing the power to all of the pins on the breadboard horizontally like the row is normally powered or grounded when using the 5v input from the uno.

Here is the code, I tried to copy & paste the one from the project book but it still wasn't working. I decided to try and make my own. It makes sense logically I think, but not sure what else I can try.

// constants
const int LEDPin = 13;
const int powerButton = 12;
const int directionButton = 11;
const int pot = A0;
const int enablePin = 6;
const int controlPinOne = 3;
const int controlPinTwo = 2;

// variables
bool motorRotation = false;  // false for forward true for backward
bool isPowerOn = false;
int potentiometreInput;

void setup() {
  Serial.begin(9600);
  pinMode(powerButton, INPUT);
  pinMode(directionButton, INPUT);
  pinMode(pot, INPUT);

  pinMode(enablePin, OUTPUT);
  pinMode(controlPinOne, OUTPUT);
  pinMode(controlPinTwo, OUTPUT);
  pinMode(LEDPin, OUTPUT);

  digitalWrite(enablePin, LOW);
}

void loop() {
  // controls state for power button
  if (digitalRead(powerButton) == HIGH) {
    isPowerOn = !isPowerOn;
  }

  // function loop
  if (isPowerOn) {
    digitalWrite(LEDPin, HIGH);
    while (isPowerOn) {

      Serial.println("Power On...");
      potentiometreInput = map(analogRead(pot), 0, 1023, 0, 255);
      analogWrite(enablePin, potentiometreInput);

      // controls state for which direction the control pins send power
      if (digitalRead(directionButton) == HIGH) {
        motorRotation = !motorRotation;
        Serial.println(motorRotation);
      }

      // if both pins are for some reason high, set them both to low
      if (digitalRead(controlPinOne) == HIGH && digitalRead(controlPinTwo) == HIGH) {
        digitalWrite(controlPinOne, LOW);
        digitalWrite(controlPinTwo, LOW);
      }

      // power the motor based on if the button has been pressed
      if (!motorRotation) {
        digitalWrite(controlPinOne, HIGH);
        digitalWrite(controlPinTwo, LOW);
        Serial.println("Motor now spinning forward");
        Serial.println(potentiometreInput);
      } else if (motorRotation) {
        digitalWrite(controlPinOne, LOW);
        digitalWrite(controlPinTwo, HIGH);
        Serial.println("Motor now spinning backward");
        Serial.println(potentiometreInput);
      }
      Serial.println(motorRotation);
      delay(200);

      // if the power button is pressed while inside the function loop, change state to "off"
      if (digitalRead(powerButton) == HIGH) {
        Serial.println("Unit powering off...");
        delay(1000);
        isPowerOn = !isPowerOn;
      }
    }
  } else {
    // just the "off" state
    digitalWrite(enablePin, LOW);
    digitalWrite(LEDPin, LOW);
    digitalWrite(enablePin, LOW);
    Serial.println("Unit now off...");
    delay(200);
  }
}

And where is the question hidden?

My motor is not spinning, trying to see if anyone can spot anything I've missed?

I've pointed out a few things I thought were issues but I cannot explain. Everything looks normal to me as far as the wiring and programming goes but unfortunately I don't have another H-bridge to test.

Measure the voltage on the Arduino output pins and what arrives at the driver pins. Using signal names instead of pin numbers would help to follow your findings.

As I've already mentioned the control pins, pin 2 & 7 on the IC which are connected to pins 2 and 3 on the arduino are inputting the correct voltages, either 0 or 5v depending on which side I'm powering.

My issue as I've already mentioned is that I'm finding the output pins on the IC always have battery voltage regardless of whether or not the input pins are sending high or low signal. I'm no electrical expert but this is obviously a problem without looking into much else.

Apart from this, the horizontal pins on the breadboard are not receiving the same voltage power as the horizontal pin on the IC like they usually do when connected to 5V... this means that whatever is connected to the row... i.e. my motor is also not receiving voltage.

Does anyone here actually read the thread?

You want me to stop reading your thread?

Breadboards are known for poor contacts. You only can verify that all supply and signal pins are really connected. Is in detail GND connected all over?

And make a minimal example, e.g.:

void setup() {
  pinMode(2,OUTPUT);
  pinMode(3,OUTPUT);
  digitalWrite(2,LOW);
  digitalWrie(3,HIGH);
}

void loop() {}

Does the motor turn? Which voltages do you read?

It's ok guys I just ran this in tinker CAD arduino simulator with exact same set up without changing anything and it worked. I think maybe either dodgy breadboard or IC. I will experiment with a new IC and try again.

Cheers.

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