1

I was trying to use my L293D motor driver module. But when I upload the following sketch to try and run my motor, but it would get stuck on "Uploading". This happens with this sketch only, and happens randomly, with odds of happening being 3 in 5 times. After a bit fiddling around I found an error

Programmer is not responding.

When I try to reset the board or just reconnect it to my PC it might work.
Here's the sketch-

int RightMotorForward = 12;
int RightMotorReverse = 13;


void setup()
{
  pinMode(RightMotorForward, OUTPUT);
  pinMode(RightMotorReverse, OUTPUT); 
}

void loop()

{
   digitalWrite(RightMotorForward, HIGH);
   delay(10000);

   digitalWrite(RightMotorForward,LOW);
   delay(1000);
}

Can anybody point out where I am going wrong? I am using Arduino UNO. Is this just some problem in my code?

  • Can you please upload a schematic of your wiring? Do you use a bare L293D or do you use a prefabricated shield containing it? – Ariser Apr 21 '16 at 6:40
  • I'm using a prefabricated shield. See this - arduino.stackexchange.com/questions/23383/… – YaddyVirus Apr 21 '16 at 7:27
  • This may very well be a problem related to power supply and/or grounding. Please report all power supplies connected in your setup (including the one powering your computer!) and how they are connected to your arduino, shield and further equipment. – Ariser Apr 21 '16 at 7:57
  • That's the exact conclusion I came to just a moment ago (I was just going to post it!). I have a laptop, connected to the wall outlet. I am powering up the Arduino from a USB port on my laptop. I have inserted the 5v and GND pins from Arduino to the 12v and GND pins on the motor driver. If you have seen the link I send you, I think I should connect the 5v pin to the 5v input on the motor driver and some other power supply on the 12v output (Lets say a 9v battery for experimentation.) – YaddyVirus Apr 21 '16 at 8:01
  • Yes. the USB port definitely cannot supply the power for high power actors on any shield (there may be exceptions, though). If you connect another, let's say 12V, wall wart to the 12 V input of the shield, I strongly recommend to unplug your laptop from the wall outlet during testing, as two SMPS can cause problematic interference due to their so called Y-capacitors. – Ariser Apr 21 '16 at 8:06
0

Is the motor driver connected to the Arduino while you program it?

When the Arduino is reset, the output pins on the Arduino are driven high. If too much current is drawn though any of these pins, then the voltage supply to the ATMega328 may drop, and the ATMega328 gets stuck in a brownout.

  • Yes the motor driver is connected to the Arduino. What I don't understand is, it takes, sometimes, several resets and reconnections to get the board working again... And sometime it would say "COM8 not available". So even if to voltage supply drops on the ATMega, it should work in only one reset only. Is this some problem with my code? – YaddyVirus Apr 21 '16 at 5:09
0

Found the solution... Just connect the 5v from arduino to the 5v on the Module. Then another battery (12-36 V, I tried a 9v one... it worked but only for about 40 seconds), to the 12 V input, keeping the ground common... That's gonna make the motors run!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.