Arduino freezes and lcd get blank on load switching

Hi
This forum has been great help for me for last two months. Now my project is in final stage and there is only one problem left in my system. My arduino Mega hang and 16x4 LCD display just vanishes almost every time I turn on conveyor motor (Sometime weird characters start coming on display). I have to reset my arduino . There are total of three controllers(One mega and two nanos) in the system. I think the real culprit is my power supply system. I have designed very weird power system. here is its description
there is one SMPS(12v,5V 3A)
one lipo battery charger

one boost converter

So there are 4 power cables( 12v, 5v, 5v uninterrupted, GND). See attached pic for better understading
I needed unintterupted 5v to keep arduino mega and nano ON in case of power failure so used this setup.
5v goes to adafruit minithermal printer.
12v goes to 2 ics uln2803, cd40106 and two transistors to turn on relays.
There is other 24v 10A SMPS which derive third nano and stepper motor driver cards.
The motor is not conected to this system but its contactor and control is in same pannel.
Now I am unsure what to do as I have used arduino many times to switch motor and other inductive loads but never faced such problem. Should I add big value cap to output or what? Looking forward for positive responce.

saki003:
I think the real culprit is my power supply system. I have designed very weird power system.

And you are totally correct. :grinning:

circuit4.jpg
The problem is in how you connect the grounds together and "lead dress" - you absolutely must always bundle ground and corresponding 5 V supply together at all points.

We would need a diagram of your complete system with all modules completely specified to even begin to sort out the mess and frankly it will not be easy. A 220 µF capacitor across pins 1 and 2 of the LCD module may help.

Actually I was wrong about mini ups system. Its not the culprit here. I bypassed this UPS and used 5v of power supply directly. It still crashes arduino somtimes. I also turned off power supply and turned on arduio with battery and boost converter. Motor effect was still on the system in strange way. Wheni turn off motor sometimes some strange characters show on lcd 2nd and 3 row. I am again telling that system is running on battery

OK, well ...

The problem is in how you connect the grounds together and "lead dress" - you absolutely must always bundle ground and corresponding 5 V supply together at all points.

We would need a diagram of your complete system with all modules completely specified to even begin to sort out the mess and frankly it will not be easy. A 220 µF capacitor across pins 1 and 2 of the LCD module may help.

Here are some things that might help: The 5 volt supply is usually the one that is the regulated output on dual 5v/12v supplies. The 12 volt output is often simply rectified and filtered and not tightly regulated. You can try adding several thousand microfarad capacitors on one or both of those lines, to ground. Also, there should be fairly large capacitor located on the power lines right at the motor load.
Sometimes the spikes and noise are so severe you need to put a inductor in series with the line to the heavy current load, in this case the motor. It's difficult to say what value the inductor would be but probably in the range of 0.5 to 5 millihenry at whatever load current the motor requires. Ferrite core inductors require much fewer turns of wire than iron cores, if you wanted to try winding your own
Breaking the circuit apart and using separate supplies is often helpful in tracking this kind of problem, as is tying your grounds together at a single point if possible- "star grounding"
An oscilloscope is invaluable in troubleshooting glitches like this but of course not many of us are wealthy enough to own one. I have seen low-bandwidth LCD hand-held scopes on the market which are reasonably priced
Mark

Paul__B:
OK, well ...

The problem is in how you connect the grounds together and "lead dress" - you absolutely must always bundle ground and corresponding 5 V supply together at all points.

We would need a diagram of your complete system with all modules completely specified to even begin to sort out the mess and frankly it will not be easy. A 220 µF capacitor across pins 1 and 2 of the LCD module may help.

All grounds are connected but not on single point. I will try that. No idea about lead dressing but searching for it. I am uploading sketches and pics of my system

Is the conveyor motor AC or DC? What is it's voltage and current? How is it switched?

JCA79B:
Is the conveyor motor AC or DC? What is it's voltage and current? How is it switched?

Its 3-phase 1/2Hp 380VAC, 1.1-1.9A Motor

markba633csi:
Here are some things that might help: The 5 volt supply is usually the one that is the regulated output on dual 5v/12v supplies. The 12 volt output is often simply rectified and filtered and not tightly regulated. You can try adding several thousand microfarad capacitors on one or both of those lines, to ground. Also, there should be fairly large capacitor located on the power lines right at the motor load.
Mark

I added 4400uF on 5v supply and 470uf on 12v supply. Did not help.

markba633csi:
Sometimes the spikes and noise are so severe you need to put a inductor in series with the line to the heavy current load, in this case the motor. It's difficult to say what value the inductor would be but probably in the range of 0.5 to 5 millihenry at whatever load current the motor requires. Ferrite core inductors require much fewer turns of wire than iron cores, if you wanted to try winding your own
Breaking the circuit apart and using separate supplies is often helpful in tracking this kind of problem, as is tying your grounds together at a single point if possible- "star grounding"
An oscilloscope is invaluable in troubleshooting glitches like this but of course not many of us are wealthy enough to own one. I have seen low-bandwidth LCD hand-held scopes on the market which are reasonably priced

You are totally right about budget So I bought DSO138 oscillloscope but that was piece of crap.

markba633csi:
Breaking the circuit apart and using separate supplies is often helpful in tracking this kind of problem, as is tying your grounds together at a single point if possible - "star grounding"

Unfortunately, that is a grossly simplistic and misleading notion of the matter of grounding.

Let's see what we have:
mega circuit.png

nano circuit.png

IMG_20190621_195412-min.jpg

OK, a number of things concern me about that design. The principal one is the routing of power traces through the PCB which makes it extremely difficult to implement any order to the grounding paths. I see sixteen analog input wires coming off connectors with no associated ground so these are at extreme risk of pickup of interference. Similarly for three "LED" wires though these may be less critical.

I see three electrolytic capacitors surrounding the MAX232 where 0.1μF is specified. This is probably not a problem but is most odd. Perhaps to the point, there are no bypass capacitors on the PCB for any of the components or modules.

Adding capacitors to the supplies which already have capacitors on them is not really relevant. The bypass capacitors need to be associated with the components switching power - in this case apparently a ULN2803 which is mysteriously under-utilised and the "COM" shown as not connected - I imagine it actually is.

I do wonder why there is a Nano there. The second processor substantially complicates the design and makes the issues of circuit paths and grounding more difficult.

Paul__B:
OK, a number of things concern me about that design. The principal one is the routing of power traces through the PCB which makes it extremely difficult to implement any order to the grounding paths. I see sixteen analog input wires coming off connectors with no associated ground so these are at extreme risk of pickup of interference. Similarly for three "LED" wires though these may be less critical.

I see three electrolytic capacitors surrounding the MAX232 where 0.1μF is specified. This is probably not a problem but is most odd. Perhaps to the point, there are no bypass capacitors on the PCB for any of the components or modules.

Adding capacitors to the supplies which already have capacitors on them is not really relevant. The bypass capacitors need to be associated with the components switching power - in this case apparently a ULN2803 which is mysteriously under-utilised and the "COM" shown as not connected - I imagine it actually is.

I do wonder why there is a Nano there. The second processor substantially complicates the design and makes the issues of circuit paths and grounding more difficult.

About analog pins, They are not being used in system . I just included in PCB because so if I NEED any more input I will sold header on it and use these inputs. currently they are open.
You are right about max232. After making pcb i realized that the circuit I used was wrong and then put 4th cap beneath the PCB.
ULN2803 is used as voltage booster( from arduino 5 to 12v). Yes I havn't connected COM pin to 12V as during testing on breadboard it was not switching properly with com pin connected and I read that its only nessary when switching inductive loads so I left it open. Here it is only giving signal to Schmitt trigger IC or IR LEDS.
Please if you could elaborate more about using bypass capacitor on uln2803.
Arduino nano is actually measuring arrea here so it is compulsary here.

Hi,
Can you post a picture of the copper side of your PCB please?

Do you have a DMM?

Thanks.. Tom.. :slight_smile:

TomGeorge:
Hi,
Can you post a picture of the copper side of your PCB please?

Do you have a DMM?

Thanks.. Tom.. :slight_smile:

here is pcb design and back of pcb
changes
1 black cable directly giving ground to lcd heder
2 black cable directly giving ground to arduino nao
3 2 white cables for reset push buttn( added after seeing problem of arduino freezing)
4 2 cables with forward biased diodes one from mega diital pin and one from nano digital pin
5 another direct ground cable
red cable is from mega to arduino nano D2( used as interrupt to nano.

YEAH I have DMM

What is connected here?

conn.png

conn.png

Pin 2 of this connector is open. On pin 1, 2 cables are coming one from mega and one fr9m nano throug forward biased diodes( simple OR ) and then a wire goes to other board where it switches relay. Problem persist even I remove wire from this connecor.

Hi,

Tom.... :slight_smile:

Because he does not want to!

See #10.

Apparently "Motor" is not yet implemented.


Actually, in the second last paragraph of #9, I was confusing "COM" with ground - which is of course, not shown in his schematic.

This problem is making me cry and I am unable to get any clue how to eradicate this problem. Now I am switching to different approach. I will save data in EEPROM so in case of power failure arduino will start from same state. This EMI is still making my life miserable in other part of hardware but i will ask that in other thread. Thanks for all suggestions

Sadly, this will require a complete re-design according to good engineering principles. Otherwise I foresee further problems once the present matter is suppressed.

Part of the problem is that you have not provided sufficient detail about the components you are using.

Referring to your first post,

saki003:
My Arduino Mega hang and 16x4 LCD display just vanishes almost every time I turn on conveyor motor (Sometime weird characters start coming on display).

You have yet to completely describe what this conveyor motor is, how it is connected to/ controlled by your system.

saki003:
5v goes to Adafruit minithermal printer.

I cannot see a full description of how this is connected.

saki003:
There is other 24v 10A SMPS which derive third Nano and stepper motor driver cards.

I cannot see a full description of how this is connected.

saki003:
The motor is not connected to this system but its contactor and control is in same panel.

So, where is the full description of this - and photos? If that is where the problem appears to be, this is critical information.

You have numerous floating input pins, no bypass capacitors and no ground plane on the main pc board.

But, most importantly, you've never shown/mentioned/explained how the mains connected motor is controlled. No photos, no sign of what’s controlling it, nothing. It’s the central device, apparently the source of your troubles as it’s use causes the lockup.

Is it a direct, across the line, contactor? How the is coil controlled? AC? DC? Voltage? How is it wired? Do the mains/motor wires run near any Arduino I/O wiring?

You want to focus on the Arduino as that is what freezes. But, experience tells us the actual cause is most likely that switching, mains connected device right next to the Arduino. EMI is a very common problem when mixing low voltage logic and common, high voltage industrial devices.