I am new to Arduino Mega2560. For one of my projects I have to control 8 DC motors for direction and another 8 DC motors as pairs for direction. The motors are driven directly by pairs of relays. The relays are driven by ULN2003. The inputs for the ULN2003 are given by the Digital output pins. High on one pin drives a input of the ULN2003 which activates the relay which drives the motor in a particular direction. There are 3 numbers of ULN2003 with a total of 20 inputs from the Mega2560
The motors are driven at 12V from an independent power source fed directly to ULN2003 from that of the Mega which is powered by the USB of my laptop. Now the outputs from the Arduino have been tested and found to be working properly. but when conected to the ULN2003 they just start to oscillate randomly. The Mega2560 hangs up and then the system has to be shutdown and rebooted for it to start working. I thought there is more current being drawn from the output pins of the Mega and maybe they could not drive all the pins of the ULN2003
I have tried adding 20K between the mega2560 and the input of ULN2003 to limit the current but with no success.
To put a long story short I have blown the Mega2560 and am getting a new one. But before I fry another board I would like to know what I am doing wrong. I came across
Loading/stalling DC motor temporarily breaks serial communication to PC over USB http://arduino.cc/forum/index.php/topic,58217.0.html
There is a reference to adding 0.1uF capacitors to the end of motors. Here I can try adding them to the relay coil as they are both inductive load. http://www.pololu.com/docs/0J15/9
Another solution to limit back EMF would be to add diodes to the digital output of the mega2560 to the ULN2003
Would this be a solution?
but why is the mega hanging up?
Has anybody else faced a simillar problem?