I'm looking for some help, since I can't find anything similar with my issue.
My setup:
-5v power supply
-ESP32 wroom, powered by 5V VIN pin
-2x DS18B20 temperature sensors, powered by 5V, signal 3.3V with 4.7k resistor
-board with 4 relays, inputs from gpio, jumper removed and 5v input on JD-VCC pin
-20x4 LCD display + LCM1602 connected to 5V and SCL/SDA pins to ESP
-12V power supply
-2 valves, operating at 12V, connected to 12V power supply and through relays to operate them (NO pins)
All gnds from 5v all connected together, 12v gnd separated.
I used ESPHome builder to create program for ESP. Everything is working fine - I see data on display, I can get correct temperatures' readings, I can operate relays. But when I turn on 12V power supply and try to close any of valves (disengage relay) my display go crazy. During opening valves no issues. All other stuff still works fine, but on display i see complete mess, some random characters. What can be issue here? I was reading about display I2C connection and it's not designed for long wiring, but my SCL/SDA wires are only about 15cm long. I also tried different pins for SCL and SDA, put new wiring there, but it didn't help. What can i try to fix it? I appreciate any help.
You draw the schematic with a pencil in your fingers. Draw what you actually have connected; do NOT copy from another diagram.
You will also need datasheets and, of course, post ALL the code in code tags, plus any error logs also in code tags.
IF you can repeat the problem with some parts removed, do that as the fewer components will yield a quicker solution.
Also, do you really have benchtop power supplies for 5V and 12V like your photo suggests or something else? If you do have what is in your photo, your V- needs to be connected to GND as well for both of the supplies.
Yes, I have 2 completly separate power supplies for 5v and 12V. Everything connected exactly as in photo. I connected both V- from both power supplies and still same issue. But I think my LCD is just faulty unit - i tried with other one (also via LCM1602, but 16x2) and it is working just fine. Strange thing it happens only when I'm closing valve
The valve likely has a coil, and when the coil is de-energized, guess what happens. You will need to prevent that spike of noise from affecting your other components. A simple Google search of 'how to suppress noise on a coil when the voltage collapses' should give you an answer.
There SHOULD be internal EMI suppression across the valve motor, but apparently NOT. Without knowing anything about the valve's "control circuit" I'm afraid I can't help.
So +12V is always connected to brown wire. when i connect +12 to blue wire it opens. When i disconnect blue wire it closes. So exactly as in description of CR03.
My idea with 2 power supplies was to completly separate power to ESP from power to valves. Only point when they meet is relay, which is isolated by optocoupler. But I still have issues
I tested valve assembled and disassembled, it works fine - opens when i apply +12V on blue and brown, closes when only on brown. I tested with components inside 3d printed enclosure and directly on desktop with longer wiring etc. Whatever i do my display goes crazy when I try to close valve through relay. But only 20x4 display, 16x2 somehow is working fine - thats why I kinda think display is broken.
I also checked for voltage spikes during closing valve at ESP, display etc, but didn't notice any inconsistency. But I only own standard multimeter, I guess if there is any issue it's so short I'm not able to detect it, need more advanced tools.