L293d /mega328p problem

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Dear all,

I am using 328p for my project. I have to control the 6 motor, so i have used 3 293d to soo.
To make it easy I am using one 293d at a time

But i observed some strange behaviours
1) one moter with channel 1 is working fine but i dnt have any control over other channel or motor. Second motor running continuesly
2) even 328p behave strangely. Its not at all run the code routine
3) Same circuit when i build in breadboard with same component they work fine, with same power supply to motorand controller. With out any decoupling capacitor.

I am really stuck and dnt know how to debug it and possible cause.

Note, as it is working fine with breadboard i don't have any doubt on power supply or i dnt know it could be
I am using decoupling capacitors at 293d output.

Could any one please help me what is the problem
I also need a alternative to run more motor in futrue

Attaching pcb solder side for a look. Will attch schamatic in while

Rgds
Sourabh

Goswami Sourabh,

The Creator....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

goswami sourabh wrote:
Attaching pcb solder side for a look.

It seems you forgot to do that?

 

Note: don't use 'ADD ATTACHMENTS' - instead, follow these instructions: https://www.avrfreaks.net/wiki/em...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

goswami sourabh wrote:
don't know how to debug it

Well, you say it works on the breadboard, but not on the PCB - so the obvious first step is, surely, to look for differences between the PCB and the breadboard?

 

Double check connections.

 

Measure voltages.

 

If you have an oscilloscope, use it. If you don't, then make it your goal to get one as soon as possible!

 

Can you do a simple LED blink on the PCB?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Post the circuit and code , please.

 

- Check hardware connections

- Dont send PWM as first - send '1' like 100% duty cycle and check what happens

- Check channels 1-1 ( you may damaged the 293D )

- If all OK try with PWM ( but you must check if you 'realy' send PWM , maybe with oscilloscope or analyzer )

- What freq you send ;

 

Its ok on breadboard as you take care of high current paths (i usualy use veroboard but OK ) . L293D's max outpout current is 600mA per channel..

Wireless remote car device using hand movements:

https://www.youtube.com/watch?v=uerWyUwLLBo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SavKokki wrote:
- Dont send PWM as first

Agreed

 

Quote:
send '1' like 100% duty cycle and check what happens

Not so useful - that gives no indication of whether your code is actually doing anything, or just "stuck".

 

That's why I suggested a simple LED blink.

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

goswami sourabh wrote:
I am using 328p

http://www.atmel.com/devices/atm...

 

ATMega328p has debugWIRE On-chip Debug System - use it!

 

This will allow you to trace your program execution, and see what's actually happening within the chip.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

 

Not so useful - that gives no indication of whether your code is actually doing anything, or just "stuck".

 

That's why I suggested a simple LED blink.

 

 

Ah ++ , but i said it to check if L293D is working properly

Wireless remote car device using hand movements:

https://www.youtube.com/watch?v=uerWyUwLLBo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for your great suggesttions

 

Add my Schematic and PCB screenshot here.. if you guys have express PCB I will share both

 

I have AVR dragon with me and used the debug wire... but the controller behave crazy, it never goes to point if I Run F5 / or single stepping IN AS6. but I put breakpoint..it goes there but after few hits it lost the debug wire mode and ICs will never go in debug wire again, I'll already make two ICs useless.

 

I used LED in code to check the code is running, LED runs.. Ist Motor also runs but second runs continously. I have check the disassembly in single stepping code never goes to that point..

 

this behaviour is same wiht my all 3 L293D.

 

Might be some thing could wrong in my code....attached here, but same code works fine withbreadboard. Let me Try LED blink also..reply back soon

 

DDRB = 0x03; //Makes PORTB as Output // PB0 and PB1

DDRD |= 0xE0; //Makes PORTD as Output // Pd5-- PD7

while(1) //infinite loop--

{

//TODO:: Please write your application code

 

// LED blink

_delay_ms(500);

PORTB |= 0x02; // PB1

_delay_ms(500);

PORTB &= ~0x02;

 

_delay_ms(500);

PORTB |= 0x01; // PB0 to run in one direction

_delay_ms(500);

PORTB &= ~0x01;

 

_delay_ms(500);

PORTD |= 0x40; // PD6

_delay_ms(500);

PORTD &= ~0x40;

 

 

_delay_ms(500);

PORTD |= 0x80; // PD7

_delay_ms(500);

PORTD &= ~0x80;

 

 

_delay_ms(500);

PORTD |= 0x20; // PD5

_delay_ms(500);

PORTD &= ~0x20;

}

 

Oscilloscope is the next in my list... I dnt have now but going to buy soon.

 

 

 

 

.

Goswami Sourabh,

The Creator....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's better since you have problems, to run motors on 1 direction (at least for start till you found the problem).

 

- So its better give only 1 signal per Motor control

- You can let mC if you cant measure signals, and use buttons to check if Bridge working as it must

- In diagram im posting is what you send on your above program and how L293D uses them

 

 

 

 

 

 

Wireless remote car device using hand movements:

https://www.youtube.com/watch?v=uerWyUwLLBo

Last Edited: Tue. Jun 23, 2015 - 01:36 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

(Delete post, phoned stucked :) )

Wireless remote car device using hand movements:

https://www.youtube.com/watch?v=uerWyUwLLBo

Last Edited: Tue. Jun 23, 2015 - 01:35 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i think I have found the Problem, i have put electrolytic cap as decoupling capacitor around motor ( C-22 to C26 ).... I used same PCB without Capacitor as in breadboard and it is working fine... I have checked for 30 mins and its working fine

 

But i didnt understand how Ist motor is working....

 

thanks everyone for suggestion

 

 

Kindly suggest a alternative to run more motor... using 3 L293d could create problem any time.

Goswami Sourabh,

The Creator....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Using L293D and other H-bridge/Half-Bridge takes some cost and can burn easily.

 

Also most of them can carry only 1-1.5A max ( i am talking about IC's with 2-3-4 Motor_Outputs ) , if you are using low motors

then buy some 4_Motor_Bridge from ebay and keep on.

 

If you can make some PCB or veroboard, build your own with optocouplers/mosfet drivers or whatever you prefer.

 

Will take more time but you will know what may cause problem and will handle as current you want.

 

You choose :)

 

 

( Popolu has some nice bridges but check price and also few outputs. I build me own 2xMotor bridge for 4$ MAX and could carry 30A on 7.2V. Plus galvanic isolation)

Wireless remote car device using hand movements:

https://www.youtube.com/watch?v=uerWyUwLLBo

Last Edited: Tue. Jun 23, 2015 - 02:37 PM