Getting Things to Talk: Arduino + LCDs
I spent the better part of the day on Saturday doing some more basic research into connecting an Arduino and LCD for this ongoing project. For the most part, it’s pretty basic and following the wiring diagrams and tutorials online is fine.
I ran into a problem with getting text on two lines, which I’ll detail below. Next on the to do list is to order a different LCD, maybe a 4×20 display and maybe something even smaller and then do some work on the text processing part of this whole thing.
Overall, it was a good start and I’m anxious for later this week when I’ll have a block of time to continue with the next steps in this early research.
First thing after pulling this stuff out again, I followed the wiring diagrams and I connected the data wires, leaving the power and ground until the end.
An initial sketch. Really, really basic “hello, world!” program. However, this was before I installed the newest version of Arduino, which is why that error came up.
Installing version 0017 helped and I finished connecting the LCD.
It’s not ideal, but quick and dirty. Also, it seems like there are better screens out there in terms of connections.
The arduino side of things.
I figured that it would be better to not be so tightly tethered to the Arduino, so I used the breadboard.
Trying to make connections a little cleaner.
My first program, working!
All the wires, still a mess, but I was just too anxious to get something on the screen.
BROKEN CITY LAB!
Then I worked on another program that would flash different texts.
This one switched between BCL and make things happen!
Here’s the code, trying also to change the position of the cursor, which didn’t work as anticipated because I didn’t initialize the screen with lcd.begin().
I switched the wiring around to try to figure out how to get text on two lines.
I also connected the backlighting.
Lots of confusion, I just couldn’t get two lines to work, so I went back to one line. I had momentarily wondered why I couldn’t get any decent contrast on the screen when trying to use two lines and the lcd.begin() line in my code.
I wondered if it was just my poor connections, so I tried a bit of soldering, but it didn’t help.
I went back to the drawing board, trying different wiring set up again.
Still not the effect I wanted.
I can’t seem to get the correct contrast when using the lcd.begin() line, that is to say that at a very severe angle it’s possible to read the screen, but under normal viewing it’s no where near what it should be (as pictured above). I didn’t post a picture of that because it basically just looks like the backlight is on with nothing on the screen itself. I couldn’t find an answer online, so I’m going to try this again with a different LCD. Although it could be a number of other things, this seems to be the simplest way to move forward. All these screens are based on the Hitachi HD44780 LCD, so it shouldn’t be an issue, but I’m not sue what else could be causing the problem at the moment… As frustrating as it can be sometimes, I think troubleshooting is where I learn the most.
Here’s a bit of an annotated bibliography :
http://www.arduinoprojects.com/node/13 (for whatever reason, this was the most successful wiring setup, though I have my suspicions that I messed up the contrast at some point due to my shoddy and impermanent wiring)
http://arduino.cc/en/uploads/Tutorial/lcd_schem.png (a diagram for the wiring setup recommended on the Arduino site)
http://www.jamie.net/tag/arduino/ (a quick example of using the 4-bit LCD library, I haven’t tried it)
http://dawes.wordpress.com/2009/12/23/twitter-to-lcd/ (interesting project connecting twitter and Arduino)
http://blog.tinyenormous.com/2008/12/02/arduino-based-rss-reader-with-lcd/ (lots of interesting projects, hooking up Arduino + Twitter and Gmail + Arduino using Python)
http://www.alfonsomartone.itb.it/kwztcq.html (some helpful troubleshooting stuff)
http://www.arduino.cc/en/Reference/AnalogWrite (analog write, I used this to correct the contrast problem I had)
http://arduino.cc/en/Reference/LiquidCrystal (LCD library for Arduino)
























![Deinstallation of Alive & Well Alive & Well, our 350 ft long message painted on the city-owned parking lot for the 2011 AGW Biennial and recently captured by Google Maps, is in the process of being torn up to make way for an Aquatic Centre. We’ll be actively looking for a new parking lot, field, or rooftop to do another [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2012/03/IMG_7252-bw-150x150.jpg)
![Physics Club + Making Paper It’s been a busy last week, getting back from Victoria, and launching the Text In-Transit Call For Submissions, but we still had time to meet for our weekly Office Hours and continue working with the Massey Physics Club. Our adventures in paper making for an upcoming planters project we have in mind, and in learning [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/03/img_3378-150x150.jpg)
![WordPress Plugin (notifying users tagged in comments) I wrote a plugin by hacking together some ideas based on the Notify on Comment plugin. Essentially, I was looking for a plugin whereby someone mentioned or tagged in a comment (using the familiar @username syntax from Twitter) would be notified. They wouldn’t have had to have made the post being commented on, nor would [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2012/01/Screen-Shot-2012-01-22-at-1.17.49-PM-150x150.png)
![Border Interviews: Kero To get a jump start on laying the groundwork for our upcoming How to Forget the Border Completely project, we have decided to interview a small group of individuals who may be considered “experts” of the Windsor-Detroit border in some way. Kero, a musician/graphic designer/video artist, was our first candidate for a video interview. He [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2011/02/04-copy-150x150.jpg)
![Monday Night Research: Lightbulbs & Lists We spent another Monday night at BCL HQ planning out this Windsor-Detroit hyper-local tourism idea and doing some basic research for another upcoming project. We all have some homework to do, but things are moving along nicely on a number of projects, and with the semester winding down, things should be able to push ahead [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/11/IMG_5412-150x150.jpg)
![Projector Tests: Day 2 of 2 We met to do another round of projection tests, this time outside. While we still only had two projectors to work with for the test, we definitely verified an increase in brightness on outdoor surfaces (both with ambient light and without), though this increase is not equal to the amount of light we’re throwing at [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/09/IMG_9933-150x150.jpg)
![LEDs in Action The 10mm LEDs I ordered from Evil Mad Science came in and I went out today to get a CR2032 3V battery to start testing. I got 100 super white and 100 blue LEDs. This is the CR2032 battery, I got 6 of them for $2 from the Dollar Store. It would be interesting to [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2008/12/img_0997-150x150.jpg)
![Errands! The Next Steps for Two Tales of a City Equipped with a vehicle, Michelle and I spent a few hours on Wednesday out and about in the city gathering materials to further the process on our upcoming project in Hamilton. Our first visit was to The House, a thought factory of sorts where Jodi has been fruitfully working on our collection of sewn squares [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2012/01/Screen-Shot-2012-01-28-at-11.58.23-AM-150x150.png)
![Visiting Detroit Danielle and I went over to Detroit yesterday to meet with Aaron Timlin (from the Contemporary Art Institute of Detroit) at the LadyBug Gallery to discuss some potential collaborative projects over the summer. After getting a quick tour of the gallery and some of the other studios and workspaces in the building (which we unfortunately didn’t get [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/02/img_2819-150x150.jpg)
![Call for Participation: Regret & Resolve With the start of the new year, we wanted to take stock of the regrets we have about the city or our roles within it, and the resolutions we might make to change this place for the better. We want to ask two questions: What are the things that we know we should be doing, [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2013/01/tshirt-crop-150x150.jpg)
![…and then the city, a book A little while ago, we were trying to think through how to wrap up Save the City with a pair of billboards. We spent an evening really working through some ideas and came up with two statements that we felt articulated the end of a certain way of thinking about Windsor. Something about those statements [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2010/07/IMG_2247-150x150.jpg)

![Fence Text + LED Soldering Broken City Lab Office Hours last night were hugely productive due, in no small part, to the many amazing people around the table last night. We completed a test with the flagging tape at Lebel (as you can see above) for the EC Row project and continued working on the LED sign. There’s lots of [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/01/img_2316-150x150.jpg)
![Text In-Transit Test Panel I picked up five test panels on Friday from the printers and got a test shot of them installed on the buses. These first five panels were made up internally at BCL (we still haven’t had the chance to start going through all the submissions yet). I’ll be going back to the downtown terminal this [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/03/img_3773-150x150.jpg)
![First Friday of 2011: Back in Action!!! Our first Friday back was great. Unfortunately, Rosina couldn’t make it, but everyone else was around the table for the first time in almost a month. We’ve learned some things about how we work together over the last two and a half years, and we’re set to make more things happen this year than ever [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2011/01/IMG_2176-150x150.jpg)
![Welcome to the Neighbourhood Recap of Awesome Psychogeographic Exploration!!! Welcome to the Neighbourhood took five groups of brave explorers on an adventure around West Windsor on Monday in order to highlight the potential to pay particular attention to the many things that usually go unnoticed in such a transient area. Given that the neighbourhood surrounding the University of Windsor is made up mostly of [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2009/09/DSCF1055-150x150.jpg)
![Finishing Up Our Homework (late assignment) Above, Homework Artists-in-Residence presenting their work, Photo by Eduardo Aquino It’s a week later than we had hoped to be making this kind of wrap-up post, but we also know this is just the beginning of a larger conversation that will span far beyond this space. Homework: Infrastructures & Collaboration in Social Practices hosted over 120 [...]](http://d1ugx41kvdwavn.cloudfront.net/wp-content/uploads/2011/10/yes_no_9-3-150x150.jpg)
Sweet writeup, I’ve been looking for a good intro to working with LCDs and my Arduino, because I’ve been having the same issues. I’ll be watching to see if you figure it out, yeah? And thanks for the links!
Jeff, glad the post was helpful … I’ll definitely be keeping an ongoing list of links in this series of posts as I figure things out. Goodness knows the Internet has already helped me out huge with this, so hopefully I can contribute back with some knowledge too.
You mentioned that you had a problem with the contrast. How are you controlling the contrast pin?
On my boards I use a pot and the contrast is quite good. Your LCD looks very similar to the Optrex 51505 that I use. The schematic of my board is in the datasheet at http://tinyurl.com/9mv2cs
I tried it two ways — I grounded the contrast pin and I also used analogwrite from pin 5 (if I remember correctly) to do a variety of tests (I figured this was more accurate than using a pot for troubleshooting).
The problem only appears when using lcd.begin(), regardless of trying to put text on two lines … so, I’m not sure what the problem is with that command (or with how I’ve tried to set things up).
The analog write is a digitally generated voltage. You need a filter cap to generate a stable DC value. As you draw current from the pin the voltage will drop. With a decent size cap the voltage drop probably would not be much in an LCD application.
Not sure how lcd.begin() could cause a constrast problem.
Thanks for the help with this … I’ll try the contrast pin with a pot.
I’m sure it’s a silly mistake on my part somewhere, but it’s really strange, because I can set up an Arduino sketch that simply says write “test”, and it works perfectly fine, good contraste totally legible. Then I’ll add the line lcd.begin(16,2) in the setup and the contrast will be so weak that it’s illegible.
That line is the only change I make, and whether I ground the contrast pin or try the analog write, it’s results in the same problem.
you own
I have the same problem…
One line – working perfect
Two lines – bad contrast…
The next try will be to use a negative contrast voltage, hope this will solve the problem…
Hi justin!
For the 2 line contrast thing I have run into similar issues before. I recommend using a pot to control the contrast line. Also, depending on how your script is written if you don’t have enough delay() then it will be constantly flickering on and off as it rewrites itself.
Lastly, as toaster mentioned, some lcds want to have a neg voltage for contrast. That’s never fun to work out. Check the data sheet, and if it does want that I’d just buy a different lcd!
Hey,
Nice post and was really helpful.
But I am having a very serious problem:
I tried a couple of example codes, with the respective schematics, and the LCD just doesnt work. NOTHING comes on, absolutely no dark spots!
I tried out with 2 LCDs.
Can u think of any reason?
I did try Grounding the contrast pin throught a pot. It also didnt work.
Bob
Is your LCD backlit? Maybe the first thing to try would be just connecting the power and ground for the LCD, then the same for the backlight, without having the Arduino programmed. Grounding the contrast pin, and avoiding the pot might also be a good place to back up, simplifying things is probably the best way to problem solve with this.
Sorry I couldn’t be of more help.