Help! unable to upload code in to the Arduino with specific conditions

Hi guys,

I need help for my home automation project. It's a new installation all build for the automation project. What I mean is that lights have 220v capable cabling running to the relay groups and relay groups are connected to the Arduino Mega 2560 with internet cables. Relay groups (special relay groups designed for Arduino) have they're own power supply and function without problem when input gets a ground connection. In this principle I connected 2 relay groups and they're functioning without any problems. As I connected the third relay group to the Arduino I encountered "interesting" error. When I power up the relay group I can't upload the software to the Arduino. If I disconnect the +5V power of the relay group the program uploads without problems. After that when I connect the power to the relay group it function as programed as well.

When the power to the relay group is connected and I try to upload the software all I get is one flash or red power led and one flash of green TX or RX led. The software waits for something, but nothing happens, only every 10 or so seconds the TX or RX led flashes. All I can do is to disconnect the USB cable, the software gets an time out error naturally and I have to restart the Arduino after that it resumes with the old software without any errors.

Did some one had that kind of problem? please give me a hint what could be wrong...

P.s. I'm not using the Arduino communication pins (0 and 1).

Are you powering it from USB? If so, you may be drawing too much current through the USB port causing the +5v line voltage to drop sufficiently to cause the avr to brownout.

No, Arduino is powered with a external 12V power supply and every relay group has it's own 5V power supply.

AS relay groups I have the following model: http://www.ebay.de/itm/Neu-8-Channel-Kanal-5V-Relais-Relay-Module-Modul-fur-Arduino-DSP-AVR-PIC-ARM-/320912667367?pt=Elektromechanische_Bauelemente&hash=item4ab7e2b2e7

I tried to exchange it with similar one, without luck.. and the other ones are functioning without problems..

I'll try to draw a scheme to give a better impression of this problem..

From that page it says that each relay requires 20mA from the pin controlling it. If there are 8 per group x 3 groups, thats 480mA - which is enough to overload the USB port, and even if it doesn't it is enough to cause the output voltage of the arduino's port drivers to drop off considerably (the max current rating for the whole chip is 200mA!).

You may want to consider using an n-channel mosfet to drive each relay pin. The gate would go directly to the arduino, the drain to the relay boards IN pin, and the source to GND.

intruder82: No, Arduino is powered with a external 12V power supply and every relay group has it's own 5V power supply.

I take it that you disconnected that blue jumper on the relay board and attached its own 5V power supply there (make sure you connect to the correct pin).

You can completely isolate the arduino signal from the relay by only connecting the +5 from arduino and the signal pin (no ground) since the relay boards are designed to be optically isolated and active low..

doughboy:

intruder82: No, Arduino is powered with a external 12V power supply and every relay group has it's own 5V power supply.

I take it that you disconnected that blue jumper on the relay board and attached its own 5V power supply there (make sure you connect to the correct pin).

You can completely isolate the arduino signal from the relay by only connecting the +5 from arduino and the signal pin (no ground) since the relay boards are designed to be optically isolated and active low..

doughboy thank you for the hint! That could be it. I haven't disconnected the jumper. My connections on the relay group looks like this: 10 pin group: +5V from external power supply, 8 input pins from arduino () GND from external power supply and Arduino GND connected on to the one GND pin on relay group.

The three pins with the jumper don't have anything connected except the jumper on them.

But could you please explain a little bit how it should be connected? If I understood correctly it should look like this 10 pin group: +5V from Arduino 8 input pins from Arduino GND from Arduino.

The three pins: external +5V should be connected on VCC-JD GND from external power suply on GND?

And what is the difference from my current wiring? Why two relay groups are OK with that kind of power supply and with the third on I get this problem?

Thank's Vaidas

in the 10 pin group, if you omit the ground from arduino, then you are isolating the arduino circuit from the relay circuit. you only need to connect the external supply +5 to jd-vcc and gnd. isolating would make the arduino circuit ground independent of the relay circuit ground.

doughboy:
in the 10 pin group, if you omit the ground from arduino, then you are isolating the arduino circuit from the relay circuit. you only need to connect the external supply +5 to jd-vcc and gnd. isolating would make the arduino circuit ground independent of the relay circuit ground.

But what is the difference between optically isolated relays and a setup with shared ground? Could it inflict the error that I get (that I’m not able to upload my code in to the Arduino)

I’m attaching a principle scheme to get a better understanding of my setup. I have a common GND but Arduino doesn’t drive the relays itself. It only gives a LOW (GND) signal when a relay needs to be turned on, all the other time it has it’s internal pull-up resistors on.

I hope you could clear this theme for me a little bit up

principal connection scheme.JPG

In my sketch I forgot to add control wires from arduino to the input pins 1-8 of the relay group. It's the same cable where common ground is connected (10 wires signaling cable, 8 wires used for controlling 1 for common ground)

Any ideas?