Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Problem with L293D

Status
Not open for further replies.

Klitzie

New Member
Just wanna ask i have this problem in my line follower that my when i turn on the power the left motor always running even if there is no detection from my sensor?
 
Pin 3-6 for Left Motor, Pin 11-14 Right Motor
Pin 2-7 Connected from RB0-RB1 of my PIC16F877a
Pin 10-15 Connected from RB2-RB3
 
Klitzie said:
Pin 3-6 for Left Motor, Pin 11-14 Right Motor
Pin 2-7 Connected from RB0-RB1 of my PIC16F877a
Pin 10-15 Connected from RB2-RB3

You have to isolate where is the problem. Have you got an oscilloscope to check whether there is PWM waveform (or noise) on the left motor control pins when there is no detection from the sensor. Or you can disconnect the connection from the PIC to the left motor control pins, if motor stops, that means the cause is from the PIC, if motor still running, the cause is from the L293D. Hope this helps.
 
I had a similar problem but of course the cause might be entirley different from what t he casue might be in your case.

In my case, I had a blown up pin on my PIC :-(
 
I tried to disconnect the RB0-RB1 from the pic to the motor control pins of L293D when i turn on the supply the motor halt. I can figure out why in the world pin RB0 is always high?

By the way i didn't used PWM for this one.
 
Klitzie said:
I tried to disconnect the RB0-RB1 from the pic to the motor control pins of L293D when i turn on the supply the motor halt. I can figure out why in the world pin RB0 is always high?

By the way i didn't used PWM for this one.

At lease now you know the cause was from the PIC. May be there's programming error?

I'm working on a line tracking robot too, and I am using L293D, just curious, how do you adjust the motor speed if you not using PWM?
 
Its just the factory speed of futaba when your not using a PWM. Can i post my source code here so that you can help me find the problem easily i know people here are all pro about electronics and robotics stuff.
 
Klitzie said:
Its just the factory speed of futaba when your not using a PWM. Can i post my source code here so that you can help me find the problem easily i know people here are all pro about electronics and robotics stuff.


I'm sure there're many people will help.
 
Klitzie said:
Its just the factory speed of futaba when your not using a PWM. Can i post my source code here so that you can help me find the problem easily i know people here are all pro about electronics and robotics stuff.

You don't drive a servo motor with an H-Bridge.
 
Im actually using L293D as my h-bridge but i came across a problem where my left motor always running so i isolate it then came to conclusion it was the PIC sending high input to my driver that causes my left motor to run.

I tried a simulation using Proteus Wingmax everything is fine but when i try it in actual hardware my RB0 always high. Please try to review my codes here below: By the way pic-lite is my compiler.

#include<pic.h>

/* BLACK LINE = 1 */
/* WHITE SURFACE = 0*/

#define FORWARD 0x09
#define RIGHT 0x08
#define LEFT 0x01
#define L_SENSOR 0x01
#define C_SENSOR 0x02
#define R_SENSOR 0x04
#define STOP 0x00

void delayslow(int x);
void delayfast(int x);
void servoleft();
void servoright();
void forward();
void stop();

void main()
{

__CONFIG(0x3FF9);

TRISA = 0x1F;
TRISB = 0x00;

while(1)
{
if((PORTA&L_SENSOR)==L_SENSOR)
{
servoright();
}
else if((PORTA&C_SENSOR)==C_SENSOR)
{
forward();
}
else if((PORTA&R_SENSOR)==R_SENSOR)
{
servoleft();
}
else
stop();

}

}

void servoleft()
{
PORTB = LEFT;

}

void forward()
{
PORTB = FORWARD;
}

void servoright()
{
PORTB = RIGHT;
}

void stop()
{

PORTB = STOP;
}

void delayslow(int x)
{
int y,z;
y=5000;
z=5000;

while(x)
{
while(y)
{
while(z)
{
z--;
}
y--;
}
x--;
}

}

void delayfast(int x)
{
int y,z;
y=5;
z=5;

while(x)
{
while(y)
{
while(z)
{
z--;
}
y--;
}
x--;
}
}
 
Klitzie said:
Im actually using L293D as my h-bridge but i came across a problem where my left motor always running so i isolate it then came to conclusion it was the PIC sending high input to my driver that causes my left motor to run.

I tried a simulation using Proteus Wingmax everything is fine but when i try it in actual hardware my RB0 always high. Please try to review my codes here below: By the way pic-lite is my compiler.

}


Your code seems to be OK. Have you check the state of PORTA&R_SENSOR when the left motor is running?
 
Klitzie said:
Im actually using L293D as my h-bridge but i came across a problem where my left motor always running so i isolate it then came to conclusion it was the PIC sending high input to my driver that causes my left motor to run.

I tried a simulation using Proteus Wingmax everything is fine but when i try it in actual hardware my RB0 always high. Please try to review my codes here below: By the way pic-lite is my compiler.

Why not try to build an independent H-Bridge first, test it manually, then simulate your micro controller circuit with LEDs, test the signals, then, when everything is correct, connect the all.

take a look at that H-bridge build upon an L293D. this might help:
**broken link removed**

Note: when a PIN is behaving such is such a stange way, this is usually cased by hardware short circuit, or sort-off..

good luck.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top