Arduino's Random Behavior! - Help

Hi friends, I have made this Aquarium controller for my aquarium. Written the code with a help of a few members in this forum and all seems to work perfectly

I am mainly using I2C to control my devices.

The main layout is : The Display of the controller : have another display also attached to the system for secondary viewing. The controller with the I2C, Clock and with the back of the LCD panel and the Keyboard

The power Module, using ULN 2003 and Relays. The Power module is Connected to the Controller using a 25Pin DB Wire.

The Outlook of the power Module

These are the problems: (I think they are related)

  1. When the power module is not connected to the main system, the system works perfectly. There is a mode called FEEDMode, when i am into that mode by press of a key in the keypad, a few of the power modules are to TURN OFF for a period of time and then TURN ON again after that period, this works perfectly when the power Module is not connected to the system. But when i connect the power Module to the system, and go into that FEED MODE it TURNS OFF the devices, goes through the Count and then TURNS on the DEVICES but the moment it turns ON The Devices the LCD goes BLANK with just a display of "1" in the SCREEN and KeyPad is FROZEN.. .so i need to restart the Arduino by powering it down and then ON it again.

  2. Some times when there is a power Outtage, and when the System turns on again, i go into the Blank Screen Mode and Frozen keypad. But all the other controls in the Power Module are WORKING...

I even put diodes across the Relays to protect them, but no USE.

The Arduino Goes into FREEZE Mode when it handles the Power Module that is done using UNL2003/2004 ICs and Relays. The ULNs drive the Relays (+5v) and Relays Output (230vac) control the Motors and Pumps.

Is this a problem of De-coupling ? I have added NO capacitors to the Circuit. Or is it any other Problem?

Is this a problem of De-coupling ?


I even put diodes across the Relays to protect them

No the diodes protect the rest of the circuit from the relay.

there are 2 power supplies:

  1. Supplies the Arduino
  2. Supplies to the Power Module (+5V)

The Grounds of these are connected together.

There are 6 ICs in the Controller and 3 ICs in the Power Module.

so what should i do: 1. Have a 47uF between the GND and + of each of the Power Supply? or just 1 will do? as i have a common ground? 2. Have a 0.01uF between the GND and + of each of the IC?

Will this eliminate the problem?

Will this eliminate the problem?

I can only say it might, you might have to do more but if you have nothing it is a start and can only make things better.

or just 1 will do? as i have a common ground?

No the point of decoupling is that it makes the ground "more common", it needs to go on each device as close a s possible to that device.

thanks mike.

So will try the 47uF at each of the power Supply. Since the 6 ICs are connected to the Power supply in Parallel, can i have just 1 0.01uf between the ICs-GND and ICs-+5V?

Dont have a 47, can i use 100uF at the Power?

I have just edited my last post to answer that. ;)

i have edited mine.

Will insert 2 100uF at the power. will that be ok?

As I said it's a start, fingers crossed it will be enough. You can never predict when you will have enough decoupling, however you can never (well almost never) have too much.

I say almost never but last week I was working on part of a circuit, another engineer had put so much decoupling on that the power supply (a DC - DC switched converter) had difficulty starting up. Still that was the only time in over 40 years. ;)

thanks will do the 100uF and see what happens. will try to insert 0.01uf near the ICs if possible. and keep you posted on the results.

mike, the 100uF at the 2 power Supplies is not working. still have the same freezing problem.

what to do now?

As I understand it your power module is connected to the control module through lots of long wires. Is this correct?

If so it sounds like you are getting pick up on these wires and that pick up is disrupting the arduino. Can you do a test to see if you can do any control without it freezing? If it is this pickup then the next thing to try would be to put something like a 100R resistor in line with each of the signal lines and put a 0.1uF to ground either side of the signal line. If that doesn't work then you could change the resistor to an inductor. Also if long lines are going into the power module you could try some catching diodes on the lines like in:- It is difficult getting these sort of things stable.

Mike, There are 25 Lines going from the Controller to the Power Panel. And getting 25 Resistors and 0.1uF Caps i think wont be possible in that circuit. I have a common ground going from the PWR of the Power Panel to the PWR of the Controller through one of the 25 lines, if i do it in that line alone with that be of help?

the cable is 2m long, can i use a shorter cable = will that help?

if i do it in that line alone with that be of help?

No that will only make things worse. Try disconnecting some of the lines. In fact disconnect all the signal lines and then replace them one at a time, you might be able to find a line that is picking up more than the others and deal with that.

Yes a shorter lead would be better but it is no cure.