[SOLVED] Project 10 'Zeotrope' Battery Overheating - Possible Short Circuit?

I am trying to complete Project 10 with an arduino uno. When I attempt to run the code, nothing happens and right after I attached the 9V battery for the motor, the wires connected to the battery heated up (maybe a short circuit in the h bridge) [I believe I followed the instructions perfectly].
I ran a code to test if the buttons work which was successful.

Attached is a picture of my circuit (I apologize for the bad quality) and below is the code I used:

const int controlPin1 = 2;
const int controlPin2 = 3;
const int enablePin=9;
const int directionSwitchPin = 4;
const int onOffSwitchStateSwitchPin;
const int potPin = A0;

int onOffSwitchState = 0;
int previousOnOffSwitchState = 0;
int directionSwitchState = 0;
int previousDirectionSwitchState = 0;

int motorEnabled = 0;
int motorSpeed = 0;
int motorDirection = 1;

void setup() {
    pinMode(directionSwitchPin, INPUT);
    pinMode(onOffSwitchStateSwitchPin, INPUT);
    pinMode(controlPin1, OUTPUT);
    pinMode(controlPin2, OUTPUT);
    pinMode(enablePin, OUTPUT);
    

    digitalWrite(enablePin, LOW);
    
    Serial.begin(9600);

}

void loop() {
  //Serial.print(digitalRead(4));
  
    onOffSwitchState = digitalRead(onOffSwitchStateSwitchPin);
    delay(1);
    directionSwitchState = digitalRead(directionSwitchPin);
    motorSpeed = analogRead(potPin)/4;
    
    if(onOffSwitchState != previousOnOffSwitchState){
      if(onOffSwitchState == HIGH){
        motorEnabled = !motorEnabled;
      }
    }
    
    if(directionSwitchState != previousDirectionSwitchState){
      if(directionSwitchState == HIGH){
        motorDirection = !motorDirection;
      }
    }
    
    if(motorDirection == 1){
      digitalWrite(controlPin1, HIGH);
      digitalWrite(controlPin2, LOW);
    }
    else{
      digitalWrite(controlPin1, LOW);
      digitalWrite(controlPin2, HIGH);
    }
    
    if(motorEnabled == 1){
      analogWrite(enablePin, motorSpeed);
    }else{
      analogWrite(enablePin, 0);
    }
    
    previousDirectionSwitchState = directionSwitchState;
    previousOnOffSwitchState = onOffSwitchState;
    
}

I have no idea why the project is not working.

  • WIN_20190731_14_24_37_Pro.jpg is the picture of the circuit
  • 1564616132741.jpg is a drawing of the circuit
  • sct.JPEG a picture of a short circuit test

Draw out a circuit of what you have.
Trying to trace though the photo is almost impossible.

right after I attached the 9V battery for the motor, the wires connected to the battery heated up

Yes that means you have a short circuit.

believe I followed the instructions perfectly

You are mistaken in that belief.

Picture way too blurred and not showing all the wiring to spot your error. Try and track it down by removing the Arduino and measuring the resistance with a DVM across the power rails. Remove components until it stops showing a short.

I added a drawing of the circuit and one of a shortage test.

I am not sure if i did the test correctly but I removed everything until it was just wires, the h-bridge, motor, and the battery. The Volt Circuit Tester that I connected to ground, lit up whenever it touched a pin on the H-Bridge. Could it be that the h-bridge is broken?

Now remove the h-bridge and replace the wires one by one testing as you go. If it all works fine up to the h-bridge it could be faulty but it could be that you have wired it wrong or that is is drawing a lot of current, more than the small battery can supply.

As a test replace the h-bridge with a couple of LEDs and resistors and see if it all works like that.

Try testing the H-bridge on its own driving just two LEDs and resistors.

Can you post a link to this H-bridge please.

The h-bridge I am using is L293D ( Powerdip 16 ), from the arduino uno starter kit here: https://www.arduino.cc/documents/datasheets/H-bridge_motor_driver.PDF

"As a test replace the h-bridge with a couple of LEDs and resistors and see if it all works like that."
"H-bridge on its own driving just two LEDs and resistors"?

How would I replace the H-Bridge with LEDs and resistors?

I only find examples with transistors and resistors like the one here: https://www.instructables.com/id/H-Bridge-on-a-Breadboard/

How would I replace the H-Bridge with LEDs and resistors?

The H-bridge has one signal input. So make that signal go to an LED. You will then see if that lights up correctly.

Then put the bridge back in the circuit and connect the two outputs to an LED and resistor. And connect a second LED and resistor in parallel but wired the opposite way round.
That way either one or the other LED will be on. You can check if this changes like you would expect.

Here is a tip that if you follow will reduce your chances of getting wrong information, never even look at an article with instructables in the URL. The vast majority of then are written by rank beginners who have an grossly inflated idea of their own ability.

The H-bridge has one signal input. So make that signal go to an LED. You will then see if that lights up correctly.

I am still not sure how to do this. It sounds like you want me to remove the H-Bridge and just connect an LED to the battery.

Then put the bridge back in the circuit and connect the two outputs to an LED and resistor. And connect a second LED and resistor in parallel but wired the opposite way round.
That way either one or the other LED will be on. You can check if this changes like you would expect.

I am not sure here as well but I tried to do as you said. I wasn't sure what i was supposed to do with Inputs 1 and 2, as well as the enable pin (pin #s 1, 2, & 7), so I connected pins 1 & 2 to power and left pin 7 unconnected. After several attempts, neither LED would turn on. Attached is a drawing of what I mean.

It sounds like you want me to remove the H-Bridge and just connect an LED to the battery.

No read what I wrote.

The H-bridge has one signal input. So make that signal go to an LED.

This is to test that the input to the H-Bridge is working correctly.

I am not sure here as well but I tried to do as you said. I wasn't sure what i was supposed to do with Inputs 1 and 2, as well as the enable pin (pin #s 1, 2, & 7), so I connected pins 1 & 2 to power and left pin 7 unconnected.

I said:-

Then put the bridge back in the circuit

That means wiring up the H-bridge back to the Arduino with all the connections to the Arduino not trying to run the H-bridge in stand alone mode.

You should also be connecting pins 12 & 13 of that chip to ground.

You are only using half that H-bridge circuit so if it is damaged you could use the other half, search for L293D and download the data sheet.

Can you try again with taking a photograph, this time not so blurred.

For others trying to follow this thread this is what the OP is trying to make.

Hi,

OPs circuit;


Also when you edit code or add images, please do it in following posts, please do not go back and edit previous posts as this can cause confusion when someone else reads the thread.

Can I suggest you purchase a DMM, rather than trouble shoot with a test light.

Tom... :).

FIXED IT!

There were 2 things I had to do:

  1. Set onOffSwitchStateSwitchPin to 5 which I originally forgot do

connecting pins 12 & 13 of that chip [h bridge] to ground

Thanks for everyone's help!