My Arduino and 20x2 LCD is going crazy after a while. What is going wrong?

I made a nice iButton-garage-door-opener (see The thing works great, but after a while the iButton doesn't react anymore and as soon as I push one of the buttons, the LCD goes crazy. Normally it stops going crazy after a few seconds and shows a weird text. As soon as I push a button again, it goes crazy again.
The strange thing is that sometimes it works correctly for hours and sometimes it doesn't. Does anybody has any ideas how to fix this?
You can see the code in the instructable.

Picture of My Arduino and 20x2 LCD is going crazy after a while. What is going wrong?
sort by: active | newest | oldest
The original Ible doesn't seem to include any supply reservoir capacitors. Is there a proper circuit diagram for the design ?

kenyer (author)  steveastrouk6 years ago
Hi Steve,

You totally lost me. The capacitor is an electronic part that I don't really know what to do with yet.
The breadboard-drawing as shown in the ible is exactly how I wired it up. Where should I put the capacitors and what type should I use?
And why? I really want to understand electronics better.

First thing Peter, draw a circuit diagram that I can follow, then I'll show you where to add the bits you need to add for reliability. There MIGHT be a code problem, but lets start by looking at the circuit.

kenyer (author)  steveastrouk6 years ago
I hope this makes sense. (and I hope I didn't make any mistakes)
Not bad for a new guy ;-)

Always draw the circuit with the positive suppy at the top, and the ground at the bottom.

Your transistor Q1 has no visible method of switching it on and off.

What does S3 do ? Is it connected to the relay somehow ?

....and MOST important, you need a 100uF capacitor across as close to the supply incoming pins as possible, AND a 0.1uF (that's 100nF) across the 100uF too.

Another 0.1 on the display supply pins won't do any harm at all.

Did you use an RTC chip too ?

kenyer (author)  steveastrouk6 years ago
Ok, I couldn't wait.
Did you mean like this? Does it matter how much V the capacitors are? And should they be electrolytic or tantalum?
I don't really understand the position of the second 0,1 uF?

The cap voltage should be higher than the supply volts that's all.
They can be electrolytics.

Put the 2nd 0.1 across the pins of the display.

If I get a chance today, I might redraw the diagram in a more logical way still for you .

kenyer (author)  steveastrouk6 years ago
I think that I found the problem. It runs for two hours now, so I'm not fully confident yet. I will let you know.
kenyer (author)  steveastrouk6 years ago
You are right, there where some mistakes in the drawing. I'm new to that (if you hadn't noticed already)
This must be a better version.
The S3 button is the existing button that opens my garage-door.
I don't use an RTC, but just use the time-telling skills of the Arduino and set the time manually with the buttons.
This drawing is the situation like it is now. I will try to draw the capacitors in it. (tomorrow, it is one hour later here than in GB and I have to open the shop early tomorrow.)
Thanx a lot already.

tongez4 years ago
Hello to everyone

I have a similar isue with this
I m using arduino to operate a vacuum machine for food seal
The machine consists of 2 hydralic valves a reley to drive 3 phase 380v motor and a relay to drive a high curent resistor to seal the bag.
The valves and relays are operate at single phase 220v and are driven from a 4-chanel 5v relay with photocouplers.
The arduino board with lcd is driven by an 9v transformer and the relays from a separate 5v transformer.
(I done this to separate completely the power from arduino and the whole other circuit)
The this problem was mostly isued when the motor stops and some times you can see a visible arc from inside of the relay when this disconects the power of the motor.

I have 2 2x16 lcd's one green and one blue

I used an an antiparasitic filter for the 9v transformer and capacitor on the suply of the screen.

Now the green lcd works perfect but the blue has the same isues but a litlebit less.

If i operate the arduino and 5v relays without the mashine only for test purpose it works fine without antiparasitic filter.

Please i need your advise for this i'm sure its a hardware problem and that comes from parasites created by the phase load change.

Thank you in advise.
kenyer (author) 6 years ago
Yeah!!! I finally fixed it. The problem was in the code.
In the "void modeklok()" I jump back to the loop if the counter "i" is zero. I assumed that the next time the "void modeklok()" is called from the loop, it would just run the "void modeklok()" from the beginning, but it doesn't! It will enter "void modeklok()" at the point where it left the void the last time. The counting of "i" is now totally off and it goes below zero, what isn't possible and makes the sketch crash. The simple command "return;" fixed the thing and I'm very happy with it now.
Thanx to everybody who helped me finding the problem! I learned a lot from you. Especially from Steve, so although I fixed it myself, Steve will get the "best answer".
dirkaturok6 years ago
I have a lot of PS laying around. higher A didn't help me.

but as stated before, it could also be a sofware glitch.
kenyer (author)  dirkaturok6 years ago
Well I already tried to change the code and made the memory consumption a lot less, and "REMd" out a lot of code by using, /* */ but that doesn't seem to help, so I still guess it is a hardware thing.
dirkaturok6 years ago

I had a similar effect on my Arduino mega with a 16*2 lcd.

It flipped when the arduino turned low some 6V relays that were fed by the same power supply as the Arduino. used a higher voltage power supply and gone it was.
a 7,5v instead of a 5,5 or 6V, I don't remember.

kenyer (author)  dirkaturok6 years ago
I tried a 12 V (thats the max an Arduino can have) but that didn't help. But your answer made me think and perhaps it is not the V, but the A that needs a boost, so I'm now trying a bigger, stronger power supply. (it is only 6V and I know it should be higher, but I don't have anything else laying around)
I will keep you posted.
kenyer (author)  dirkaturok6 years ago
Ok, I'm trying that, so we will see.