HOWTO connect LCD 16x2

Hardware inside and outside of the ECU
Post Reply
Kot_dnz
contributor
contributor
Posts: 29
Joined: Mon Dec 16, 2013 6:12 pm

HOWTO connect LCD 16x2

Post by Kot_dnz »

We have standard low cost 16x2 LCD display based on HD44780.
Image

Ebay cost 3.83 USD
http://www.ebay.com/itm/1pcs-1602-16x2-HD44780-Character-LCD-Display-Module-LCM-blue-blacklight-New-/251049844026?pt=LH_DefaultDomain_0&hash=item3a73bc9d3a

With according datasheet http://www.openhacks.com/uploadsproductos/eone-1602a1.pdf display Power Supply is 5V.

Input High voltage 2,2v allow us send datas 3.3v directly to data pins DB4-DB7.
In our system we use 4-bit mode.

Depend of power of your USB port you can connect Vcc & GND:
  • or directly to DISCOVERY
    or via external supply 5v (in this case Vcc -> external +5v, GND -> LCD GND + -> DISCOVERY GND)
In any case all GND must be connected and have same level!

Working system on final:
Image

General troubleshooting:
1. You can start with connection only first 3 pins and adjust Contrast via 10KOhm adjusted resistor. After see full first string of bars connect others.
2. Adjusted resistor i connect one pin to +5v, second to contrast, third to GND.
3. Some display do not have Back LEDs.
4. With external +5v on RESET some times require reset LCD before reset board.
5. pin #5 - R/W pin - should be connected to GND. So, there should be three GND pins and two +5 pins.

Hope this enough.

P.S. This display can be upgrade by IIC/I2C/TWI/SPI Serial Interface Board Module Port for Arduino 1602LCD Display
http://www.ebay.com/itm/IIC-I2C-TWI-SPI-Serial-Interface-Board-Module-Port-for-Arduino-1602LCD-Display-/141146290709?pt=LH_DefaultDomain_0&hash=item20dcf97a15
Last edited by Kot_dnz on Tue Mar 25, 2014 10:07 pm, edited 1 time in total.
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: HOWTO connect LCD 16x2

Post by AndreyB »

I've updated the pinout document
Image

And my 20x4 has exactly the same pinout
Attachments
20x4 lcd.jpg
20x4 lcd.jpg (88.06 KiB) Viewed 20562 times
20x4.jpg
20x4.jpg (93.79 KiB) Viewed 20562 times
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: HOWTO connect LCD 16x2

Post by puff »

so just six wires needed (including power)?
what does the firmware (current version) display on this screen?
i'll probably give it a try in the end of this month...
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: HOWTO connect LCD 16x2

Post by AndreyB »

The pinout has changed to accommodate Frankenstein board, I've just updated the table in the previous post.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: HOWTO connect LCD 16x2

Post by puff »

argh! broken images!
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: HOWTO connect LCD 16x2

Post by AndreyB »

I use a 2K resistor between GND and 3rd pin for contrast
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
rus084
contributor
contributor
Posts: 678
Joined: Sun Dec 01, 2013 1:40 pm
Location: Russia , Stavropol

Re: HOWTO connect LCD 16x2

Post by rus084 »

I use a 4,7K pot to control contrast.
я думаю что нужно иногда экран полностью перерисовывать - у меня от помех некоторые символы иногда чтото нето показывают
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: HOWTO connect LCD 16x2

Post by AndreyB »

puff, can you please translate your messages to English and stop posting questions in Russian? :)
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: HOWTO connect LCD 16x2

Post by puff »

should it be working right out of the box, without any tinkering with firmware? The thing is my 2x16 panel shows only the upper raw of 16 black fields. With 1K resistor between the third pin and ground it's somewhat faded, with 2K it's hardly visible, when I short the third pin directly to the ground, it's solid black.
I rechecked connections, it seems everything is connected correctly. What could go wrong?
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: HOWTO connect LCD 16x2

Post by AndreyB »

1) try resetting the firmware coupe of times (black button) - the LED code has known reliability issues
2) it is really weird with the contrast resistor - a very narrow range of resistance gives you visible characters. Any chance you can try this with a potentiometer?

so, 3 GND pins. 2 VCC pins. 6 signal wires - validate the pinout with https://svn.code.sf.net/p/rusefi/code/trunk/firmware/config/boards/arro_board.h

external power supply - I believe one USB is not enough.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: HOWTO connect LCD 16x2

Post by puff »

should I power up just the backlight from external power supply? or both of them?
rus084, with shorted pin I get the upper row black, and the lower row faded. no symbols.
where should I find that 10-20K pot?
I rechecked the pinout - it's the same as in this excel file.
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: HOWTO connect LCD 16x2

Post by puff »

okay. tried external power supply for the first two pins, then for the last two pins (common ground both cases), pot, changing black squares from dark black to almost invisible, and still, blank screen… :-(
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: HOWTO connect LCD 16x2

Post by AndreyB »

time for a picture :) show us all your wires where they are connected to the screen
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
Kot_dnz
contributor
contributor
Posts: 29
Joined: Mon Dec 16, 2013 6:12 pm

Re: HOWTO connect LCD 16x2

Post by Kot_dnz »

puff wrote:okay. tried external power supply for the first two pins, then for the last two pins (common ground both cases), pot, changing black squares from dark black to almost invisible, and still, blank screen… :-(
please attention - ground must be the same for both supply
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: HOWTO connect LCD 16x2

Post by puff »

here's what I see in logic analyzer (probably that's what should be there):
Снимок экрана 2014-03-27 в 2.10.45.png
Снимок экрана 2014-03-27 в 2.10.45.png (49.08 KiB) Viewed 20448 times
Снимок экрана 2014-03-27 в 2.11.13.png
Снимок экрана 2014-03-27 в 2.11.13.png (35.25 KiB) Viewed 20448 times
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: HOWTO connect LCD 16x2

Post by puff »

fourth channel - these spikes in the second picture are just 2µs, that's right?
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: HOWTO connect LCD 16x2

Post by puff »

just blew up the pot :D
it smells ugly when burning up
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: HOWTO connect LCD 16x2

Post by AndreyB »

So, a picture of your wires... :)
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
rus084
contributor
contributor
Posts: 678
Joined: Sun Dec 01, 2013 1:40 pm
Location: Russia , Stavropol

Re: HOWTO connect LCD 16x2

Post by rus084 »

I have everything worked from one usb port, but the contrast was too weak. because the Chinese mini usb cable has too much resistance.

I took the adapter usb-wire connector to the computer, and connect the wire to the +5 volt line Discovery. so worked perfectly
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: HOWTO connect LCD 16x2

Post by puff »

here are the wires:
IMG_20140327_225335_1.jpg
IMG_20140327_225335_1.jpg (641.39 KiB) Viewed 20441 times
IMG_20140327_225255_1.jpg
IMG_20140327_225255_1.jpg (603.77 KiB) Viewed 20441 times
IMG_20140327_225150_1.jpg
IMG_20140327_225150_1.jpg (678.89 KiB) Viewed 20441 times
it turns out 'H' in the display model means wide temperature range, therefore it needs negative power supply. I used a mixed pack of NiCd and NiMh batteries for that purpose, which resulted in two distinct rows of black squares…
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: HOWTO connect LCD 16x2

Post by AndreyB »

Is the green wire used to ground pin #5, the R/W pin? I have it constantly ground.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: HOWTO connect LCD 16x2

Post by puff »

fck! spent the whole evening yesterday! why didn't I find any instruction on connecting it to ground? :evil:
IMG_20140327_232102.jpg
IMG_20140327_232102.jpg (650.02 KiB) Viewed 20341 times
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: HOWTO connect LCD 16x2

Post by AndreyB »

russian wrote:so, 3 GND pins
We both see this on the first page, do we? :) Also the datasheet says H for read L for write...

I will go make this more visible.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: HOWTO connect LCD 16x2

Post by puff »

three grounds: power supply, backlight supply, contrast. who reads data sheets nowadays? :D
okay,
so, today we can't control this display from java console? I have to build firmware myself to make any use of it?
the date there is also quite strange)
could you make it start counting from the built time?
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: HOWTO connect LCD 16x2

Post by AndreyB »

I am open to ideas on what should be displayed on this screen.

I have just changed it yesterday and it now shows CLT temperature together with current RPM, which does not really fit on your 16x2 because I am developing it for my 20x4.
The time was only needed for troubleshooting, it's not really needed any more.
I will probably add warning error code or error message display soon, and for now the main purpose is displaying fatal error messages.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
rus084
contributor
contributor
Posts: 678
Joined: Sun Dec 01, 2013 1:40 pm
Location: Russia , Stavropol

Re: HOWTO connect LCD 16x2

Post by rus084 »

i thing , needed 74hc595 or look like adapter chip for pin economy
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: HOWTO connect LCD 16x2

Post by puff »

altogether six wires to discovery board, four wires - power, yet another two - 12 wires in total

so far there are plenty of pins available, and I don't think there would be any significant demands for more pins. at least I hope there will be four pins left for ignition signal pickup
Post Reply