Hi everyone,
Iam trying to come out with a water totalizer, dispenser with preset quantity levels measured in literes, using arduino uno r3 board.
I have a standard 16x2 LCD display, hooked to an Arduino Uno using 4 data pins, as described here,
In short, RW is wired to ground, and RS, Enable, and Data4-7 are connected to Arduino pins, while Data 0-3 are floating.
I have other things (water flow sensor, an optoisolated 5vRelay module, a mains (220v AC) solenoid valve connected to the relay module and some momentary switches) connected to the pins on the Arduino as given below.
LCD PIN No. ARDUINO PIN No.
1 GND
2 +5V
3 TO GND THROUGH 10K POT
4 PIN 9
5 GND
6 PIN 8
7
8
9
10
11 PIN 7
12 PIN 6
13 PIN 5
14 PIN 4
15 +5V THROUGH 330OHM RESISTOR
16 GND
I have connected the sensor to arduino pin 2 and the relay module’s line to pin 3 and three momentary switches to pins 10, 11, 12.
The code I use writes text to the lcd display, the flow rate, total flow and preset quantity, and normally, the display works perfectly.
However, sometimes the LCD becomes garbled. It remains garbled usually after a few more cycles of open/close to reset. The garbling always starts and stops at the same time as the relay either opens or closes.
By "garbled", I mean that every time I write to it following it becoming garbled, rather than writing english characters, I get a string of characters, that I usually cannot identify in the datasheet. This string of garbled characters tends to move left along the screen.
I am confident it's not the Arduino itself getting confused, as I write the same text to the Serial monitor at the same time, and it is not garbled and the code loop works finely even when the lcd remains garbled.
I've since experimented with wiring the RW pin to an Arduino output, and Data0-3 to ground, but this doesn't help. I've powered the whole device with a 9V battery or with USB, and it doesn't help. I've replaced the battery... no change.
I tried to take the load (the solenoid valve) connected to the relay away from the whole setup…no change,
I even tried after disconnecting the load (the solenoid valve) from the relay (but the 220vAC mains remained connected to the relay contacts, without any load)…no change
I can confirm that, the electro magnetic interference caused by the solenoid valve is not the reason for this garbling.
The only thing that seems to work fine is when, I disconnect the 220vAC mains from the relay contacts, but that defeats the purpose :-),
I am confident that the relay is not making any disturbances to the lcd but the 220v AC mains when connected to the relay even without any load, garbles the lcd.
I mean the lcd only, not the arduino.
I don't have a signal analyser or anything more sophisticated than a multimeter, a laptop and an arduino... Does anyone have any hints for helping me debug this?
Kindly help me…
Regards,
Adal.
I have attached the image of garbled text:
i have posted the same in the general lcd forum also.