big problem with using key in my project (controlling the dc motor with AVR))

Discussion in 'Embedded Systems and Microcontrollers' started by roberty, Jan 6, 2011.

  1. roberty

    Thread Starter New Member

    Aug 18, 2010
    11
    0
    hi every one.
    i have a problem whit using these keys
    http://upload1.imgdl.ir/images/21420101119257.jpg

    please take a look at the picture of the protoes file that i've uploaded here
    http://s22.aks98.com/files/13864853689662246064.jpg

    when i use these keys in this progect i can increase and decrease the engine turning ratio but i can NOT ghange the direction of rotation of engine and this is my problem.

    i dont know how to fix it... these keys look very goog in running the engine but dont work in changing the direction at all....!!

    please help me...
     
  2. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
  3. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    That is not a key - it is a pushbutton switch.

    As to your motor rotation problem, the two diodes prevent current from flowing in one direction, so the motor can only turn one way.
     
  4. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    Actually,... the way those diodes are wired I can't see how it turns at all. He can't possibly have them wired like that unless at least one of them is shorted. ;)
     
  5. roberty

    Thread Starter New Member

    Aug 18, 2010
    11
    0
    thanks.... but those diods are just in the proteos and Not on my project...
    there is no diode in the project...

    my problem is that the word in front of the " direction" on my LCD doseNOT change to "LEFT" or "right" whit pressing thse push buttons...

    in other word the first and second push buttons in my project can easily increase and decrease the rotation cycle but the 3rd anf 4th push buttons can NOT change the direction (( i mean in real project NOT in proteos))
     
  6. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    Oh, dear, they are in opposition.

    As to the continued problem, that schematic is questionable. You might get a data sheet for an L298 and see if there is a direction control line.

    Yes - page 15 of the SGS Thompson data sheet shows how to control motor direction - http://www.datasheetcatalog.com/datasheets_pdf/L/2/9/8/L298N.shtml
     
    Last edited: Jan 6, 2011
  7. roberty

    Thread Starter New Member

    Aug 18, 2010
    11
    0
    dear friends

    i've built this project:
    http://s22.aks98.com/files/13864853689662246064.jpg

    and the picture of the project is this:



    [​IMG]



    i think the picture shows every thing. those two upper push buttons work very well but those two lower ones cant change the direction and nothing happens in front of the word"direction" on my lcd when i push these buttons.
    also those diods are NOT connected tho anyting yet... my problem is still about these push buttons.

    please help me...
     
  8. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    First off, you shouldn't be running that motor without the Diode H-Bridge that's shown in the pdf data sheet; you could destroy the chip from back EMF.

    Secondly, if your LCD readout is also not displaying the direction then you could have miss-wired those two switches or you may have a programming error. Do you have a DVM?
     
    roberty likes this.
  9. roberty

    Thread Starter New Member

    Aug 18, 2010
    11
    0
    thanks my friend for the answer.

    i'm sure that i've attached the pins of those push buttuns correctly. just like those two upper keys that are working well. but the 3rd and 4th push buttons still NOT working.

    yes.
    i have a dvm.
     
  10. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    Those two cylinders on either side of the L298 are diodes. Check and you will see they are 1N400x (could be 4001 - 4). The wiring is not visible.

    Do you make use of the direction line as indicated in the L298 data sheet? Check to see if pins 10 & 12 are being changed properly (sorry, that was page 13).
     
  11. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    Ha, I didn't bother giving a good look at that photo because I didn't think it would reveal anything worthwhile. I also took his word for it. Wow, was I wrong! :eek:
     
  12. GetDeviceInfo

    Senior Member

    Jun 7, 2009
    1,571
    230
    Let me ask;

    Your project photo shows no brake pushbutton, yet the display shows a brake condition. Tell me, where is your brake pushbutton.
    If you have a DVM, place a lead on your AVR's input pin for the left or the right pushbutton. Tell us what the readings are before and after you push the corresponding pushbutton. Then do the same for your brake pushbutton.

    Until you resolve the controllers ability to decipher the inputs, don't worry about the outputs. Unless of course someone has spied smoke potential.
     
  13. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    OK, this time I took a good look at that photo. There's a graphic (arrow) pointing at the LCD display with the note: "No Change". This can only mean one of two things,.. or both. That is; the switches are not connected properly or your program is incorrect.

    BTW, why do you call switches "Keys"? Curious, where are you located?

    Telegraph Key:
    http://morsetelegraphkey.com/vintage-lionel-morse-code-telegraph-key-j-38
     
  14. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    The OP posted the code in another thread. Here is a link to what I believe is the code containing thread.

    hgmjr
     
  15. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    I have examined the code and cannot find a "C" statement anywhere that sets PORTB BIT3 high to enable the L298. It gets set to zero during the initialization and the statement DDRB = 0x08; clearly set PORTB BIT3 to be an output. Is it possible that there is additional code that you have excluded from the listing that you provided?

    hgmjr
     
Loading...