Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

LCD interface


  • Please log in to reply
15 replies to this topic

#1 dodgyrabbit

dodgyrabbit

    Member

  • Members
  • PipPip
  • 12 posts

Posted 09 August 2010 - 06:41 PM

I would like to interface with an LCD display. At this point, simplicity would be my preference.
I know there are several ways to do this with Arduino.

What would be a good approach with netduino?

It looks like a serial enabled LCD like this should be quite easy: Serial Enabled 16x2 LCD

Would I require any more circuitry or could I hook up the TX line, power and ground appropriately and start sending it some characters?

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 09 August 2010 - 07:23 PM

It looks like a serial enabled LCD like this should be quite easy: Serial Enabled 16x2 LCD


That should work...but you'll want to get one of the 3.3V LCDs instead. SparkFun has about a dozen 3.3V options. As long as you just need to send it character data to get it up and running, you can hook it to either of the UARTs (D0/D1 or D2/D3) and GND and you should be be up and running!

Please let us know how this works out for you...so we can add it to the "supported accessories" list that we're working on. And in the unlikely case you have any troubles, let me know and we'll play with it as well.

Chris
  • Ralph likes this

#3 dodgyrabbit

dodgyrabbit

    Member

  • Members
  • PipPip
  • 12 posts

Posted 09 August 2010 - 08:03 PM

That should work...but you'll want to get one of the 3.3V LCDs instead. SparkFun has about a dozen 3.3V options.


Hi Chris,

Can you elaborate a bit on the requirement for 3.3V version? The netduino has a 5V power output, right?(from the screenshots). If I provide power to the unit via power jack (as opposed to USB), could I then connect the LCD to this 5V supply and the transmit line directly to the digital IO?

Pieter.

#4 dodgyrabbit

dodgyrabbit

    Member

  • Members
  • PipPip
  • 12 posts

Posted 09 August 2010 - 08:05 PM

Sorry to answer my own question - but I just realized that LCD requires 5V TTL and the digital IOs on the netduino are 3.3V Thanks!

#5 phantomtypist

phantomtypist

    Advanced Member

  • Members
  • PipPipPip
  • 142 posts
  • LocationNew York, NY

Posted 10 August 2010 - 05:43 PM

I'm still confused. If someone could please elaborate if I should be using 5V and/or 3.3V LCD 16x2 displays?

#6 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 10 August 2010 - 06:31 PM

If someone could please elaborate if I should be using 5V and/or 3.3V LCD 16x2 displays?


You should use 3.3V LCD displays.

Chris

#7 krst

krst

    New Member

  • Members
  • Pip
  • 6 posts

Posted 11 August 2010 - 07:46 AM

An option would be to use some kind logic gate optocoupler or fet, or would it even be possible to use an pull up resistor? It said in the spec that the i/o ports can handle up to 5v? Would be nice to be able to use the old hardware 5v stuff... :-)

#8 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 11 August 2010 - 08:22 AM

An option would be to use some kind logic gate optocoupler or fet, or would it even be possible to use an pull up resistor? It said in the spec that the i/o ports can handle up to 5v?

All the I/O lines are 5V-tolerant, which means that the I/O line can drive voltage level according to Vddio (3~3.6V), but can be driven with a voltage of up to 5.5V. In other words, it can safely handle 5V inputs, but you need a level converter for 5V outputs - this can be simple resistor voltage divider, or for example an bipolar NPN transistor (have a look at Sparkfun's Logic Level Converter), optocoupler, Darlington array etc.

#9 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 12 August 2010 - 07:59 AM

I remembered two interesting articles about interfacing character LCDs with .NET Micro Framework by Pavel Bánský:

It may require some additional changes to get it work with Netduino (e.g. different IOs to handle voltage levels, code updates for the latest MF version), but IMHO it is a great learning material (source code included).

#10 Szymon

Szymon

    Advanced Member

  • Members
  • PipPipPip
  • 108 posts
  • LocationPoland, Krakow

Posted 12 August 2010 - 08:37 AM

I'm going to try to fit Netduino in Adafruit's Arduino Enclosure http://www.adafruit....products_id=271 I think it would fit nicely and only need to do one more cut out for micro USB. And I plan to add LCD display and buttons for debugging of my device.

#11 Szymon

Szymon

    Advanced Member

  • Members
  • PipPipPip
  • 108 posts
  • LocationPoland, Krakow

Posted 12 August 2010 - 08:44 AM

Here is one more LCD interface that might work. It runs on 3.3V but uses I2C instead of Serial. http://shop.jeelabs....oducts/lcd-plug

#12 dodgyrabbit

dodgyrabbit

    Member

  • Members
  • PipPip
  • 12 posts

Posted 24 August 2010 - 02:03 AM

FYI: I received the LCD from SparkFun today and I had it up and running in minutes, so I can confirm it's perfectly compatible out the box. Right baud rate and everything.

I made sure I ordered the 3.3V one - please note the SerLCD daughter board still shows a 5V label on it, but SparkFun acknowledges this and can safely be ignored.

I hooked up the ground wire on LCD to Gnd, 5V (mislabeled) to 3.3V power and RX to Digital I/O 1 on netduino. Open COM1 on netduino and started writing some text.


Attached File  IMG_0662.JPG   95.22KB   381 downloads
Attached File  IMG_0663.JPG   103.27KB   321 downloads

#13 dodgyrabbit

dodgyrabbit

    Member

  • Members
  • PipPip
  • 12 posts

Posted 24 August 2010 - 02:07 AM

If others are interested, this is the exact model I bought:
http://www.sparkfun....roducts_id=9067

#14 Niels R.

Niels R.

    Member

  • Members
  • PipPip
  • 28 posts

Posted 27 August 2010 - 07:29 AM

You can find a SerLCD class here to quickly get started with the SparkFun SerLCDs.

If you improve the code, let us know!

Cheers,
Niels

#15 dodgyrabbit

dodgyrabbit

    Member

  • Members
  • PipPip
  • 12 posts

Posted 27 August 2010 - 08:08 PM

You can find a SerLCD class here to quickly get started with the SparkFun SerLCDs.

If you improve the code, let us know!

Cheers,
Niels


Niels, thanks I used parts of your class to get going.

One small change I would recommend - make the brightness a method take a percentage value, as it is not quite clear from the method signature (unless you read the code) what the valid range is.
Even though I know this LCD doesn't really support that many increments, you could proportion it accordingly as shown below.


            /// <summary>
            /// Sets the brightness of the LCD display from 0 (darkest) to 100 (brightest)
            /// </summary>
            public void SetBrightness(int percentage)
            {
                if (percentage < 0 || percentage > 100)
                {
                    throw new ArgumentOutOfRangeException("percentage", "Value of brightness must be between 0-100.");
                }
                int offset =  percentage * (157 - 128) / 100;
                Write(new byte[] { 0x7C, (byte)(offset + 128)});
            }

I suppose one could go one step further and add some code that if brightness is set to 0%, then it actually turns the display off.

#16 dodgyrabbit

dodgyrabbit

    Member

  • Members
  • PipPip
  • 12 posts

Posted 03 June 2012 - 11:30 PM

Dusted this LCD off yesterday and started using it again. Did not get very far - this time with NetDuino Plus.

I turns out there is a "known issue" that if you don't sleep for a couple of milliseconds after setting the brightness, you will end up hanging the display and nothing will show up. Wasted a couple of hours on this today so if anyone is having trouble with their SerLCD - add a Thread.Sleep right after sending the brightness instruction.

 public void SetBrightness(int brightness)
    {
        if (brightness < 128 || brightness > 157)
            throw new ArgumentOutOfRangeException("brightness", "Value of brightness must be between 128-157.");

        Write(new byte[] { 0x7C, (byte)brightness });
        Thread.Sleep(10);
    }





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.