Arduino Uno freezing when using Relay, LCD i2c, and Rotary encoder

Hi Everyone,

i have issues arduino uno freezing program when i using Relay with controlling Relay using rotary switch 11 steps and the from step can be show with LCD i2c.

At first everything worked normally, then after switching the LCD several times, the text was unclear and then the LCD went blank. and arduino cannot be controlled by rotary switches. Below I have attached the control diagram of the Arduino Uno.

How do you power all that?
Is a load on the switching relay?

yes, there is a load on the switching relay

What kind of load? It may need a flyback diode.

You need pull up resistors on the I2C bus. What you have shown are series resistors.

1 Like

There are a few simple tests to narrow down this type of problems

  1. Disconnect the load from the relays.
    • If the problem persists, it's not (or not only) the load.
  2. Disconnect the relays from the Arduino.
    • If the problem disappears, check how you power your setup.

I've worked on a project with a clone Nano, a LCD and two relays. Power was just USB during the development.

Switching one relay on and I could see a slight dimming of the display. Switching the second one on as well and I could see a significant dimming of the display. So the question asked above in post #2 (about power) is very relevant.

The question in post #4 is also relevant: what kind of load. Because it can cause interference causing your Arduino to crash.

i used selenoid valve as a load

I have tried removing pins a4 and a5 as lcd pins. and when it was removed everything went normally

what value should the resistor be used? then what are the 2 leg resistors, one to VCC and the other to pins A4 and A5

Like this:

use a value between 2k and 4.7k for each resistor and the +V represents the +5V positive rail of the Arduino.
SCL is pin 5 of the Arduino and SDA is pin 4. Together they form the I2C bus.

I used this method, but it didn't work. is there another solution?

Then you did not do it correctly. Did you leave the origination series resistors in your circuit? These need to be removed.

Otherwise make the changes in your schematic and post again in a new reply.

There is NO other solution.

1 Like

Have you a real electronic circuit or are you simply using what looks like a Proteus simulation?
Show the code you are using.
Test each component individually with a small sketch starting with the screen.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.