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

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.