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

LCDKeypad 16x2 HD44780 Shield


  • Please log in to reply
11 replies to this topic

#1 adi

adi

    New Member

  • Members
  • Pip
  • 4 posts

Posted 06 September 2010 - 09:27 PM

Hi This is a Clock / Calendar application on a 16 x 2 LCD Keypad shield. I was hoping to use all the keys to configure the date, but I quickly ran into the 5v / 3.3v analog issue with the keypad, rendering the keys useless without modification to the board. However I noted from one of the posts that it was ok to use the analog input as a 5v digital input, which then responds to the right button key press. The challenge was then to create an application which could be configured with one key! My application starts with a welcome screen demonstrating static, moving text and custom characters. The Clock / Calendar is displayed and updates each second. After pressing the right button, it enters setup mode. Pressing the button again increments the currently selected item ( indicated by a blinking cursor ). Not pressing the button for 4 seconds moves the menu on to the next item. The first item toggles the back light and is indicated by a 'Bulb' custom character. The bulk of the LCD keypad shield driver can be found elsewhere..(FEZ), but I have also added my own enhancements to make it easier to use as well as custom character storing method based on a heap of reasearch and experimentation :rolleyes: Attached File  LCDKeypad.jpg   28.51KB   384 downloads Source Files Attached File  LCDKeypadShield_Clock.zip   43.86KB   232 downloads

#2 Ben's HobbyCorner

Ben's HobbyCorner

    New Member

  • Members
  • Pip
  • 1 posts

Posted 21 November 2010 - 09:39 PM

Works very good. Thanks for sharing. Ben Zijlstra

#3 bill.french

bill.french

    Advanced Member

  • Members
  • PipPipPip
  • 260 posts
  • LocationPrinceton, NJ

Posted 21 November 2010 - 10:17 PM

Can you elaborate on the keypad/analog input issue?

#4 adi

adi

    New Member

  • Members
  • Pip
  • 4 posts

Posted 02 December 2010 - 05:12 PM

Hi Bill, The four direction buttons + select share one analog channel and they are distinguished in code by the voltage they return. however they are using 5v supply and Netduino expects 0 - 3.3v for analog, so most of the buttons return the same value. To make it work you could cut the track and give it a 3.3v supply or make a voltage divider to change the output voltage...i think that's it?? Shame for such a handy shield, i wonder if the fez shield is 3.3v and all the buttons work?

#5 Shaw

Shaw

    Member

  • Members
  • PipPip
  • 14 posts

Posted 03 December 2010 - 04:13 AM

Hi guys, I have this shield also and have found the buttons to be troublesome (read: broken) due to the 5v problem. I've looked at the schematic (http://www.robotshop...d-schematic.pdf) and the actual board. The way the board is designed it looks really hard to break the power track coming from the 5v to the analog circuit - but it might be possible to do something at the point where the tracks come back to the Analog input pin. Would it be as simple as adding a series resistor here to drop the voltage from 5.0 to 3.3? or would I have to use something like this: http://en.wikipedia....Voltage_divider Shaw

#6 elf

elf

    New Member

  • Members
  • Pip
  • 1 posts

Posted 09 January 2011 - 08:52 AM

Has anyone found a way to use all of the buttons on this DFRobot LCD & Keypad shield?

#7 entropi

entropi

    New Member

  • Members
  • Pip
  • 5 posts

Posted 10 January 2011 - 03:08 PM

I think a voltage divider circuit is probably the way to go, and using only 2 resistors, should be the most affordable. I'm a decade or so out from that last time I used any of this EE knowledge, so hopefully I'm getting this correct (been breaking out my old circuits textbook at night to refresh my memory). Hopefully someone can chime in if I'm off on any details here...

I think using a 12k and an 18k resistor should get you the correct ratio (~1.5 ) to divide 5v down to 3.3v. With the 12k resistor in series on the analog line of the shield buttons, and then after that parallel out the 18k resistor to ground...



lcdboard ----> 12k R ----------> Netduino analog in
                       |
                       |
                    18k R
                       |
                  Ground



(Hopefully that shows up right..the 18k resistor line is split out after 12k R, before netduino in.)

#8 entropi

entropi

    New Member

  • Members
  • Pip
  • 5 posts

Posted 10 January 2011 - 03:16 PM

...and I suppose 1.2k/1.8k would work just as well.

#9 Steve Hall

Steve Hall

    Member

  • Members
  • PipPip
  • 26 posts

Posted 07 February 2011 - 12:25 AM

I managed to get this project working using a Sparkfun Logic Level converter.

However, while debugging I noticed that the voltage levels didn't appear to be in the "expected' range.

From the original code in LCDKeypadDriver.cs

const int ERROR = 15; // may also be 15 or 50

if (i > 1024 - ERROR)
return Keys.None;

if (i < 0 + ERROR)
return Keys.Right;

if (i < 180 + ERROR && i > 180 - ERROR)
return Keys.Up;

if (i < 390 + ERROR && i > 390 - ERROR)
return Keys.Down;

if (i < 580 + ERROR && i > 80 - ERROR)
return Keys.Left;

if (i < 780 + ERROR && i > 780 - ERROR)
return Keys.Select;

return Keys.None;
}


I found my range was 0, 110, 230, 360, 510, 630

Not sure why these are so inconsistant either. I would have expected these to be "scaled" evenly in the 0-1023 range

#10 Jan Olof

Jan Olof

    Advanced Member

  • Members
  • PipPipPip
  • 41 posts
  • LocationSweden

Posted 07 February 2011 - 12:40 AM

Hi The level converter is not supposed to scale a signal. It is just converting the high logic level to another voltage. Sparkfun says this: "Does not work with an analog signal." /Jan Olof

#11 Steve Hall

Steve Hall

    Member

  • Members
  • PipPip
  • 26 posts

Posted 07 February 2011 - 04:06 AM

Hi

The level converter is not supposed to scale a signal. It is just converting the high logic level to another voltage.

Sparkfun says this: "Does not work with an analog signal."

/Jan Olof


From the schematic there are both Tx and Rx channels. The Rx channel is a simple voltage divider (although it is a 2:1)

#12 Mike P

Mike P

    Advanced Member

  • Members
  • PipPipPip
  • 41 posts
  • LocationAuckland, New Zealand

Posted 17 July 2011 - 11:41 AM

Hi All,
I've documented a simple mod to this DFRobot LCD Keypad Shield (DFR0009)
The mod gets the keypad working as intended.
http://forums.netdui...-keypad-shield/

I put the appropriate analog values into the code provided at the beginning of this thread.
The thresholds are chosen to be about mid way between one expected value and the next and are typically 90-100 counts from the expected values so it should be quite reliable.

            /// <summary>
            /// Gets an enumeration of the key press at the current time.
            /// Can only be used if the LCD has been initialised with the true parameter.
            /// </summary>
            /// <returns></returns>
            public static Keys GetKey()
            {
                if (!analogInitialised) throw new Exception("Analog input is not Initialised");

                int i = AnKey.Read();

                if (i > 910)//expected value = 1024
                    return Keys.None;

                if (i < 90)//expected value = 0
                    return Keys.Right;

                if (i < 290)//expected value = 184
                    return Keys.Up;

                if (i < 490)//expected value = 397
                    return Keys.Down;

                if (i < 690)//expected value = 578
                    return Keys.Left;
                //expected value = 796
                return Keys.Select;

            }





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.