Arduino Motor Controller

Discussion in 'Embedded Systems and Microcontrollers' started by skusku, Oct 7, 2013.

  1. skusku

    Thread Starter Active Member

    Aug 9, 2009
    63
    1
    Hi

    I hope anyone can help me please. It is very urgent!!!!

    This is a barcode scanner and then moves some motors accordingly.
    The arduino is connected with a ps/2 barcode reader, 2x ultrasonic sensors, a 10A motor controller and an lcd.
    I have connected all to a 6V 4.8ah battery (very big battery) (I have also tried it with a 12V 7.2ah battery)

    Following the code:
    ....
    else if (buffer =='3'){
    //MOTOR to POINT-B//

    analogWrite(H_Bridge6V60A_Dir2, 255); //Direction=Down/Point-B
    analogWrite(H_Bridge6V60A_Pwm2, 140); //speed=Pwm2 (255=full speed)
    delay(1000);

    So when I scan "3" as a bar-code the motor turns on for 1second and moves the machine as expected.


    The problem I have is in the code when I scan "7". Its suppose to do the TESTB_SHELVE1() part as the ultrasonic sensor gives a reading of "distance_B<=75" but it seems this part only runs once with the motor being on for like 100ms and thus basically moves nowhere (it seems the ultrasonic sensor gives a reading under "75", and then continues out of the loop.

    The strange thing is that in the TESTB_SHELVE1() part, if I change the part of

    //MOTOR to POINT-B//
    analogWrite(H_Bridge6V60A_Dir2, 255); analogWrite(H_Bridge6V60A_Pwm2, 140);

    to
    analogWrite(13,255);


    //OR flashing the built-in LED

    The ultrasonic behaves as expected with it waiting for the distance to be under 45. Updating on the LCD accordingly. (WHICH MEANS THE CODING IS CORRECT, or so it seems to me???)

    I dont know if this is a 5v power problem or whatever the case may be(all the devices is connected to the arduino's 5v output in parallel.

    Please help me as this is very very urgent. Even if it might only be something small you can think of.
    I know its a messy code at the moment so please disregard the other parts.
    Thanks alot
     
    Last edited: Oct 8, 2013
  2. skusku

    Thread Starter Active Member

    Aug 9, 2009
    63
    1
    This is the H-Bridge controller controlling the motor...

    http://www.ebay.com/itm/High-AMP-60A-Dual-Motor-H-Bridge-Driver-Board-Reversible-PWM-Control-e-/281117109458?pt=LH_DefaultDomain_0&hash=item4173e2acd2
     
Loading...