wh1p
Posts: 29
Joined: Tue Jul 03, 2012 11:00 pm
Location: South East UK
Contact: Website

16 x 2 LCD case screen

Mon Aug 06, 2012 9:49 pm

So i wasn't sure whether to post this in interfacing or screens and displays so sorry in advance move this post if you wish mods.

I was on the adafruit youtube channel when i saw a icon for a video showing a one of their 16x2 LCD displays and it reminded me of the server room i went in on my work experience where the servers had similar displays showing system info such as ip address etc... So i went on the adafruit website and found the following device:

https://www.adafruit.com/products/181

Now i have decided that if i can get access to an acrylic laser cutter or 2D rinter or can be bothered to going to the effort of taking the dremel to some acrylic but i would like to make a case incorporating this screen and also storing my raspberry pi which i have decided for the time being will solely going to be used for server tasks for this time being so now i have the problem of making it work.

I am planing on purchasing the display linked above and adafruit have created the following tutorial on how to get it wired up:

http://learn.adafruit.com/character-lcds/overview

Now i see myself having two problems which i require the help of the amazing people on here:

1. The tutorial is using an arduino board to make the display work, now i would like to eliminate the the need for this extra board and instead connect the display to the GPIO connectors on the pi and then provide 5v power by cuttong my current power suply cable and adding an extra connector and having an extra case mounted power connector to provide full 5v to the display would any of this be possible?

2. There is going to be a problem for me getting the software side of things working now if i can use GPIO then i am going to need someone to help me big time with getting the display to show regularly updating data and if i have to use some sort of extra board to get the display working how to provide the regularly updating data to the display. Now i have decided what i would like to start off with then change the data as i learn more about what i doing but here as follows shows what i would like to show in each of the 16 blocks on each of the 2 llines the display supports:

- Line 1:
IP: 192.168.0.00 - this shows exact amount of current static ip being used.
- Line 2:
CPU:98% RAM:124M - exactly 16 digits if a space is between % and RAM and no spaces after each (:) symbol.

I have absolutely no coding experience other than HTML and a little PHP so i will need either a lot of help or an existing tutorial to teach me what to do and i am hoping that the wonderful people on this forum are able to help me :)

User avatar
joan
Posts: 14843
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: 16 x 2 LCD case screen

Mon Aug 06, 2012 10:09 pm

On the software side I'd use C and the wiringPi library. For the wiringPi library see https://projects.drogon.net/raspberry-pi/wiringpi/

The wiringPi library has code to drive a display such as the one you propose to buy.

You could power the device from the gpio 5V line.

forenbenutzer
Posts: 148
Joined: Thu Aug 02, 2012 7:08 pm

Re: 16 x 2 LCD case screen

Mon Aug 06, 2012 10:14 pm

I bought this
http://www.bitwizard.nl/catalog/product ... ucts_id=85
and this
http://www.bitwizard.nl/catalog/product ... ucts_id=69
and used this
http://www.bitwizard.nl/software/bw_rpi ... 120616.tgz
to write text to the LCD display (I2C).

I wrote a simple script which "scrolls" the current webradio channel and song beeing played, so no problems for even longer texts than 16 digits.
Just ask me if you need further help.
Pitendo - Case And Emulator Project - http://edv-huber.com/index.php/problemloesungen/12-pitendo

User avatar
joan
Posts: 14843
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: 16 x 2 LCD case screen

Mon Aug 06, 2012 10:26 pm

A serial or i2c interface certainly makes things simpler.

BeJay
Posts: 32
Joined: Mon Aug 06, 2012 1:52 pm
Location: Western Australia

Re: 16 x 2 LCD case screen

Mon Aug 06, 2012 10:32 pm

I got a normal 5V HD44780 working without any troubles using the Rpi GPIO library for Python and the demo script I found on here somewhere (sorry I can't remember who, as it's not in the comments!)

Code: Select all


#!/usr/bin/python

import RPi.GPIO as GPIO
from time import sleep

class HD44780:

    def __init__(self, pin_rs=24, pin_e=23, pins_db=[4, 17, 21, 22]):

        self.pin_rs = pin_rs
        self.pin_e = pin_e
        self.pins_db = pins_db

        GPIO.setmode(GPIO.BCM)
        GPIO.setup(self.pin_e, GPIO.OUT)
        GPIO.setup(self.pin_rs, GPIO.OUT)
        for pin in self.pins_db:
            GPIO.setup(pin, GPIO.OUT)

        self.clear()

    def clear(self):
        """ Blank / Reset LCD """

        self.cmd(0x33) # $33 8-bit mode
        self.cmd(0x32) # $32 8-bit mode
        self.cmd(0x28) # $28 8-bit mode
        self.cmd(0x0C) # $0C 8-bit mode
        self.cmd(0x06) # $06 8-bit mode
        self.cmd(0x01) # $01 8-bit mode

    def cmd(self, bits, char_mode=False):
        """ Send command to LCD """

        sleep(0.001)
        bits=bin(bits)[2:].zfill(8)

        GPIO.output(self.pin_rs, char_mode)

        for pin in self.pins_db:
            GPIO.output(pin, False)

        for i in range(4):
            if bits[i] == "1":
                GPIO.output(self.pins_db[::-1][i], True)

        GPIO.output(self.pin_e, True)
        GPIO.output(self.pin_e, False)

        for pin in self.pins_db:
            GPIO.output(pin, False)

        for i in range(4,8):
            if bits[i] == "1":
                GPIO.output(self.pins_db[::-1][i-4], True)

        GPIO.output(self.pin_e, True)
        GPIO.output(self.pin_e, False)

    def message(self, text):
        """ Send string to LCD. Newline wraps to second line"""

        for char in text:
            if char == '\n':
                self.cmd(0xC0) # next line
            else:
                self.cmd(ord(char),True)

if __name__ == '__main__':

    lcd = HD44780()

lcd.message(" I'm Raspberry Pi\n Take a byte!")

It works really well, I just have to re-jig it to get my internet radio happening ;)

Cheers

Bj
Attachments
Pi-lcd-sml.jpg
picture of LCD screen working
Pi-lcd-sml.jpg (16.99 KiB) Viewed 16129 times

wh1p
Posts: 29
Joined: Tue Jul 03, 2012 11:00 pm
Location: South East UK
Contact: Website

Re: 16 x 2 LCD case screen

Mon Aug 06, 2012 11:32 pm

Thanks for all the fast responses and help so far you guys are AWESOME :) and once i have found a UK based distributor selling the items you guys suggested then i will be back...probably within the next 24 hours :P

User avatar
MattHawkinsUK
Posts: 538
Joined: Tue Jan 10, 2012 8:48 pm
Location: UK
Contact: Website

Re: 16 x 2 LCD case screen

Tue Aug 07, 2012 10:14 am

For anyone reading this thread and wondering about 16x2 LCD modules ...

I wrote up my experiences of using a display with the RPi.GPIO library in Python :
http://www.raspberrypi-spy.co.uk/2012/0 ... ng-python/

Image

plus an updated version with backlight control :
http://www.raspberrypi-spy.co.uk/2012/0 ... ht-switch/

I went for the standard displays which I operate in "4 bit mode". With a GPIO pin for the backlight control it uses a total of 7 GPIO lines. I've got a 20x4 LCD on its way and I intend on trying that. I think it will use the same code with a few tweaks.
My Raspberry Pi blog and home of the BerryClip Add-on board : http://www.raspberrypi-spy.co.uk/
Follow me on Google+, Facebook, Pinterest and Twitter (@RPiSpy)

wh1p
Posts: 29
Joined: Tue Jul 03, 2012 11:00 pm
Location: South East UK
Contact: Website

Re: 16 x 2 LCD case screen

Tue Aug 07, 2012 7:25 pm

Thanks for all of your help I'm just wandering if any of you helpful people could link me to 16 x 2 display which either rs component or maplins in the UK sell which you know is definitely compatible or if you live in the UK and have setup a display on your raspberry pi where did you buy your component from? also just wandering if anyone is aware of a UK based seller who is selling the Raspberry Pi serial BoB circuit board?

Thanks to all those who have already provided me with information :)

furyfire
Posts: 25
Joined: Wed Aug 08, 2012 10:54 am

Re: 16 x 2 LCD case screen

Wed Aug 08, 2012 11:05 am

I got an old Batron I2C display working without much hazzle - Was a farnell product but it's discontinued now apprently.
Image

I also suggest you check out LCDproc - Automates handling of most LCD devices so you can focus on the data.
Writing an LCDproc driver turned out not to be so hard after all (Even with my terrible skills)
Still got some kinks to work out (Strange Ascii chars, flashing on reboot, progress bars)

Instruction and working code for my PCF2119x display
http://bitbucket.org/furyfire/raspi/ (Look under hw/pcf2119x/)
LCDproc
http://lcdproc.org
Need accessories?
Checkout my verified list of cheap DX.com accessories.
http://furyfi.re/raspberrypi/accessories.pdf

YodaTheCoder
Posts: 14
Joined: Fri Jul 27, 2012 5:02 pm

Re: 16 x 2 LCD case screen

Wed Aug 08, 2012 9:16 pm

Same as most of the above. LCD with HD44780 driver from eBay for a few quid, wired mine to an old null modem cable for portability. Used the wiringPi library. It started life as an Arduino project so there's no wiring detail in my write-up but it has a pretty box!

Image

kghunt
Posts: 383
Joined: Sun Mar 04, 2012 9:28 am

Re: 16 x 2 LCD case screen

Wed Aug 08, 2012 9:39 pm

wh1p wrote:Thanks for all of your help I'm just wandering if any of you helpful people could link me to 16 x 2 display which either rs component or maplins in the UK sell which you know is definitely compatible or if you live in the UK and have setup a display on your raspberry pi where did you buy your component from? also just wandering if anyone is aware of a UK based seller who is selling the Raspberry Pi serial BoB circuit board?

Thanks to all those who have already provided me with information :)
I got mine off eBay for £1.67 delivered free from china. Took 3 weeks though. But I have since bought 10 of them. I can sell you one for £4.50 (enough to cover import tax p & p etc plus small profit for my trouble :-) )

I got it working with the mentioned about no troubles. Although I modified it slightly to allow me to choose which line to write to.

Nearly all of the so called character displays you find around are hd44780 compatible.

kaos
Posts: 108
Joined: Mon Mar 26, 2012 8:14 pm

Re: 16 x 2 LCD case screen

Sun Aug 12, 2012 2:23 pm

Farnell, and also RS I presume, carry a selection of these displays. You can find Farnell's search engine at http://export.farnell.com/displays-lcd_alphanumeric.

A few points to consider when selecting these displays:

1) Serial vs. parallel. Parallel is much more common, but serial displays also exist, and can be I2C, UART and possibly SPI. The serial displays may be somewhat easier to get working on the Raspi, but, as shown in previous posts, the spadework is already done for the parallel displays. Also, serial displays will usually be somewhat more expensive. Most parallel displays will, as kghunt said, be hd44780 compatible, which means they can be operated in nibble mode, transferring half a byte of data at a time. This means that a minimum of 6 gpio pins will be required (4 for data, 1 for command/display data selection, and 1 that acts as a clock or write signal).

2) Operating voltage. 5V is by far most common, but I was surprised at the range of 3V displays when I checked Farnell just now. Using 3V displays with the Raspi means that no level conversion should be needed. Note though that 3.3!=3, so check the datasheet to make sure 3.3V is within normal operating parameters (it usually will be). You can try connecting the Raspi to a 5V parallel display without level conversion and, depending on the display, it may work, but it will be uncertain. Note that this is ok to try in this case because all the lines are outputs from the Raspi; never connect a 5V signal to a Raspi *input* without some kind of level conversion. Another thing to check is that the display is "single supply". Some may be dual supply, which means they require a negative bias voltage for the display. Avoid those, unless you want to get into more complicated power supply technologies.

3) Baklight. You can get reflective displays with no backlight, and those may actually be superior for sun-or-other-bright-light-viewing, beside being less power hungry and slightly cheaper. Most backlit displays will use LEDs. I have seen EL backlit displays, but these require more complicated power supply, so I would stick with LED or no backlight. Note that, AIUI, the 3.3V rail on the Raspi is near capacity, so I would not try to power the backlight from there. Rather, use the 5V rail (or a separate power supply) with an appropriate series resistor (check the datasheet; some displays may already incorporate a series resistor appropriate for the supply voltage). You may also want to control the backlight from the Raspi. This is possible, but requires a transistor buffer, due to the relatively high current draw of the backlight. By using the pwm pin of the Raspi, you should even be able to dim the backlight under program control.

4) Size. You mention 16 characters x 2 lines, which is fine, but be aware that you can get these displays in various sizes from 8x1 to 40x4.

--
Best regards, Kári.

wh1p
Posts: 29
Joined: Tue Jul 03, 2012 11:00 pm
Location: South East UK
Contact: Website

Re: 16 x 2 LCD case screen

Sun Aug 12, 2012 8:46 pm

Thanks for all your help guys was in a serious car collision the other day and have been visiting family in the hospital and am happy to say they got off with minor injuries, in a hotel until they are discharged will be getting back to this project within the next few days.

Thanks,
Angus

User avatar
RaspberryPiBeginners
Posts: 219
Joined: Fri May 11, 2012 6:54 am
Location: Soham, Cambridgeshire
Contact: Website

Re: 16 x 2 LCD case screen

Sun Aug 12, 2012 8:52 pm

Hope your getting better fast mate! :)
Click here for my unofficial YouTube Channel > http://goo.gl/oFYBD

wh1p
Posts: 29
Joined: Tue Jul 03, 2012 11:00 pm
Location: South East UK
Contact: Website

Re: 16 x 2 LCD case screen

Sun Aug 12, 2012 9:00 pm

Thanks and just wandering has anyone in the UK ever ordered from ad fruit as i am going to order the following product just wanted to get an idea of your experience of the time their products take to ship (from them to you)?

I will be ordering the following product and maybe a few other products they sell:

http://adafruit.com/products/914

Any information would be nice but I don't mind if you guys don't have any experience with them.

texy
Forum Moderator
Forum Moderator
Posts: 5161
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 16 x 2 LCD case screen

Wed Aug 15, 2012 11:45 am

Never used them or the cobbler. It looks nice, but its so easy to make your own. There was a thread about it a month or so ago.

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

wh1p
Posts: 29
Joined: Tue Jul 03, 2012 11:00 pm
Location: South East UK
Contact: Website

Re: 16 x 2 LCD case screen

Sat Aug 18, 2012 10:41 pm

just wandering if there is any chance you could guide me in the direction of making my own cobbler will certainly save me time and money :).

User avatar
adafruit
Posts: 71
Joined: Sat Apr 28, 2012 3:32 pm
Location: NYC, USA
Contact: Website

Re: 16 x 2 LCD case screen

Sat Aug 18, 2012 10:45 pm

wh1p wrote:Thanks and just wandering has anyone in the UK ever ordered from ad fruit as i am going to order the following product just wanted to get an idea of your experience of the time their products take to ship (from them to you)?

I will be ordering the following product and maybe a few other products they sell:

http://adafruit.com/products/914

Any information would be nice but I don't mind if you guys don't have any experience with them.
we have resellers in the UK as well :)

cheers!

texy
Forum Moderator
Forum Moderator
Posts: 5161
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 16 x 2 LCD case screen

Sun Aug 19, 2012 8:30 am

wh1p wrote:just wandering if there is any chance you could guide me in the direction of making my own cobbler will certainly save me time and money :).
http://www.raspberrypi.org/phpBB3/viewt ... o+breakout

That should help.
T.
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

Return to “Interfacing (DSI, CSI, I2C, etc.)”