element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum 16*2 LCD getting weird characters
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 34 replies
  • Subscribers 401 subscribers
  • Views 9699 views
  • Users 0 members are here
  • lcd
  • arduino
Related

16*2 LCD getting weird characters

jrcs
jrcs over 9 years ago

Hi all.

 

This is my first post so I hope it is at the right place.

 

I'm working on a project whose objective is to control two ac loads (one ac fan, controlled by phase angle control and one ac motor controlled by a 5V relay) and output to an LCD the room temperature and the % of fan speed.

 

 

The code I wrote seem to work fine without the AC loads connected. I tested it for long periods of time (+12 hours) and everything is ok.

 

The problem is when I connect both (or just one) AC loads, I always end up with my LCD info corrupted like this:

 

image

 

https://1drv.ms/i/s!Ah12lhUG5VG8g9FOhR9Y0ccFTsq2Rg

 

Sometimes past 2 minutes, sometimes past 10 minutes... It's random but it always end up like this.

 

 

I'm guessing it's noise problems due to the loads switching TRIAC/Relay. The TRIAC its connected trough a optocoupler but the relay it's directly connected to the arduino.

 

 

First, I put the lcd.clear() function in my code to "rebuild" the info from time to time but it doesen't work 100% and it's not a "clean" solution for the pourpose.

 

 

The AC loads are connected to the grid but the arduino is powered from my computer's usb port. Already put an EMI filter into AC main input of my loads but no solution.

 

Is there a solution to this problem? Any help?

Sorry for my poor english but I'm a little bit rusty.

 

Regards

  • Sign in to reply
  • Cancel

Top Replies

  • niko.vicencio
    niko.vicencio over 8 years ago +3
    Hi I had the same problem, the lcd showed random characters when the electromechanical relay commutated. I solved this problem, changing the relay by a ssr (Solid state relay). I hope that my answer help…
  • WarrenW
    WarrenW over 9 years ago +2
    How are you driving the relay from the arduino? Direct off the micro or via a transistor? Does the relay have a snubber cap across the coil and a back emf diode? Does the arduino have a filter capacitor…
  • Robert Peter Oakes
    Robert Peter Oakes over 9 years ago +2
    Can you please provide a schematic of your setup and also a full picture (Cant see all your connections in the one provided. You can upload them right into this community post. I have done what your describing…
  • neilk
    neilk over 9 years ago in reply to jrcs

    Hi jrcs The way you are driving the relay looks very dodgy.

     

    I think you should be driving it through a transistor and feeding it from a supply which is independent of your Arduino supply. You also need a reverse biased diode across the relay coil.

     

    Have a look here: http://www.electroschematics.com/8975/arduino-control-relay/

     

    Hope this helps

     

    Neil

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • jrcs
    jrcs over 9 years ago

    Hi neilk

     

    I'm sorry I haven't made myself clear. The relay is a module driven by a transistor. A module like this: http://www.elecfreaks.com/store/images/BK_SRD.jpg

    You can see it in the photo of the system itself.

     

    The arduino is not directly driving the relay coil. I'm using the module. I'm sorry for my mistake.

     

    Regards

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • neilk
    neilk over 9 years ago in reply to jrcs

    Understood. However, is the module being powered from the same supply as the Arduino?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • jrcs
    jrcs over 9 years ago in reply to neilk

    Yes. The module's VCC and GND are the same as the Arduino (laptop usb port or usb charger. I have tried with both solutions)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • mcb1
    mcb1 over 9 years ago in reply to jrcs

    The simpliest way to verify which part is causing it is to eliminate one item at a time.

     

    You can remove the lamp, then the ventilator.

    I suspect that the mains side is not the issue, so move to the control side.

     

    I'd suggest removing the 5v power feed to the relay first as this is likely to cause a spike, which drops the volts and upsets the LCD.

    As you have said it's quite likely this is the cause.

     

    In order to provide isolation you could try feeding the power to the relay via a diode.

    Add a 470uF (preferably bigger) on the relay side of the diode.

    This will help keep the spikes away from the Arduino supply.

     

    The rule of thumb for filter caps is 1000uF per amp.

    Because these are spikes something around 10,000uF is going to help along with a 0.1uF cap as well.

     

    Mark

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • dougw
    dougw over 9 years ago in reply to jrcs

    That relay module has a built-in snubber diode. It takes about 80 mA at 5V so be sure your supply is okay with that.

    The noise you show is definitely switching noise, not just ac coupling. You can isolate the display and MCU (separately) by placing a small resistor or inductor in the power supply wire and low ESR capacitor on the digital side. It may be useful to feed the digital side through a Schottky diode and also the relay power through a separate diode. You could add an LDO regulator if all else fails.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • mcb1
    mcb1 over 9 years ago in reply to mcb1

    Just a thought.

    You appear to have a zero crossing detector.

    The purpose is to switch the load when it is at zero, which is fine.

     

    I don't suppose the relay output is being switched ON/OFF as it goes past the zero cross point.??

    In theory it should just switch ON when the zero point is detected and stay ON.

     

    The easist way to prove it is to short the pin to ground and recheck for switching noise.

     

     

    Mark

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • jrcs
    jrcs over 9 years ago

    Hi all.

    Thanks in advance for your help. I'll try to answer to all of you clearly but I know my english it's not very good (nor technical).

     

    mcb1 When I disconnect just the ac motor from the relay (and keep the relay coil connected and controlled by the Arduino) the noise disappears. Could it be the AC motor producing the spikes?? I added a snubber circuit just to be sure but didn't help.

     

    The lamp (is actually a AC Fan) is not the problem. It is controlled by phase angle control and being connected or not doesn't change the spikes.

     

    If I remove the 5v power to the relay coil I have no spikes... but the motor obviously doesn't turn on so...

     

    I've put a flyback diode directly into the relay coil aswell but didn't help.

     

     

    The zero crossing detector is just to trigger the triac and power the AC Fan (Ventilador).

    The AC motor connected to the relay is turned on for a few seconds (3 to 10 seconds) and off for 40 seconds regardless of zerocross detected or not... but I can try to change the program to only switch the relay when zerocross is detected.

     

     

    dougw the supply on the laptop's usb port can give 500mA and the usb charger can give 2A. I tried both ways and got the same result.

     

    A small resistor/inductor and a capacitor in the power supply wire ? In the whole system supply wire or just the relay supply wire?

    I'll try to learn how to feed the digital with the Schottky diode.

     

     

    Thank you all for your time.

    Regards.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • mcb1
    mcb1 over 9 years ago in reply to jrcs

    Cheers for checking.

    You could try using a 230/240 lamp instead of the motor as a test.

    A lamp is resistive (rather than inductive like a motor) and it will help prove it.

     

    Rather than change software, if you short the output of the zero cross, it will always think its at zero.

    You could then put the power onto the 5v relay when it suits and see if the LCD corrupts.

     

     

    The picture you provided shows a lot of wires.

    The mains is fed back onto the board for the zero cross and the Triac.

     

    My concern is that you may have the neutral and the ground connected somehow.

    It could be via the power supply

     

    You could connect a switch across relay contacts and see if pressing it (which will make the motor run) also corrupts the LCD.

     

     

    Two other minor observations.

    1. The filter caps you have are close to the LCD, but they are quite a way from the Arduino. One across the 5v and ground plugged on top of the proto board wouldn't hurt.

    2. The schematic shows the base of the zero cross output transistor floating. I've found that a 47k between the base and emitter stops any issues.

     

     

    Your english and explanations are fine ... much better than mine in your language ...

    Mark

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • jrcs
    jrcs over 9 years ago

    Hi mcb1

     

    I don't have any lamp available so I didn't test it with a lamp.

     

    I've been reading around and I found that adding a capacitor in the relay's output connections would help. The thing is when the relay latches and delatches creates an electric arch strong enough to mess up with the coil and the 5V supplying it!

     

    I add a 0.33uF capacitor and I get better. I didn't have any LCD problem for 20 minutes (way more time than before!) and this is what I've got on the scope with the capacitor plugged in:

     

    image

    Now, I don't know if this is an "acceptable" spike. I don't think so but I'm not and expert. It obviously isn't a perfect solution though.

     

    Another thing, when I turn on/off the system's 230V connection, I get some noise too. (Just by turn the 230V switch on). Is there any easy way to get rid of this "switch on noise"?

     

    Thanks in advance

    Regards

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
<>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube