I'm trying to do an assignment for my class which requires me to use a keyboard as input through a microcontroller to a LCD screen, nothing fancy , I just need to show that when I press characters on keyboard , it will show on a small LCD. I tried to google it but couldnt find any tutorial or something close to that, only thing I found is http://www.youtube.com/watch?v=L1BXhAvQmaw or http://www.youtube.com/watch?v=xoMtwhj-zCg which is exactly what I want to do. I think I can combine codes from msp430+keyboard and msp430+LCD but my main problem is I don't know how to wire up the circuit or I don't even know if msp430G2553(pins and output voltage) is capable of doing this. Any help? Thank you. P.S. I am using Energia.
-
\$\begingroup\$ Pins & output voltage are electrical characteristics in the data sheets for the various parts. \$\endgroup\$– John UCommented Nov 28, 2013 at 11:57
-
\$\begingroup\$ How did it go? What was the solution to the keyboard part (if there was one)? Thanks! \$\endgroup\$– Sz.Commented Aug 29, 2014 at 16:13
-
1\$\begingroup\$ I used a keypad. \$\endgroup\$– CagurtayCommented Aug 29, 2014 at 20:47
1 Answer
Let us break this into parts:
MSP430 --> LCD display
This is the simple one: Look for an LCD display that supports 3.3 Volt logic. To minimize pin usage on the microcontroller, I2C or SPI support would be ideal.
A character LCD display, e.g. a 16 character x 2 row LCD, is easiest to handle. This example from eBay supports both I2C and 4-wire SPI serial interfaces. The seller provides links to documentation as well, something few eBay sellers seem to do.
Less expensive modules can be found too, with some searching.
A graphic (dot matrix) LCD display is somewhat more complicated to deal with, as the required display buffer for building up an image for display will tax the rather limited FLASH memory on the MSP430G2553. However, again a search for options reveals several options, including this 3.3V compatible, 240 x 320 pixel, 2.2 inch, SPI controlled LCD display. Unfortunately no documentation links on that page.
The MSP430g2553 is quite capable of driving both these LCD display modules. For wiring them up, you need to understand how to interface any I2C or SPI device with the MSP430, for which there are tutorials and discussions available, such as on 43oh.
Summary: It's easy with the right display.
MSP430 --> Keyboard
Now that's a tougher task.
(1) Matrix keypad, easiest to do.
If your requirement can be simplified to a 4x4 matrix keypad, such as this one, then there are enough tutorials out there for the purpose - and these matrix keypads don't much care whether they are running on 3.3 Volts or 5 Volts.
Again, there are enough tutorials on wiring up a matrix keypad with the GPIO pins of a microcontroller: Mapping this to the MSP430G2553 specifically is a simple enough task.
For actually reading the keypad inputs, this discussion on the TI forum might help.
(2) USB keyboard, not really an option
If, however, the requirement mandates the use of a USB keyboard, the MSP430 by itself is not an option: While many MSP430 microcontrollers do have USB device mode support, this one does not (and, as Lior Bilia points out, none of the MSP430 MCUs support USB host mode or OTG mode).
However, "not recommended" does not mean "can never be done": See this forum discussion for an upcoming bit-banged, low speed USB device mode implementation using the MSP430G2 family. It is not ready for prime time yet, nor does it offer USB host mode or OTG mode (which will be needed for interfacing with a USB keyboard), but is just an illustration of what can be done with sufficient persistence.
(3) PS/2 keyboard: Speculative option, no personal experience.
Using a PS/2 keyboard might work if you can source one: There is at least one project that claims to interface both a PS/2 keyboard, and a 1602 LCD display, with an MSP430.
However, it might not be a very simple deal: The keyboard generates scan codes, which would need to be translated to key codes using a lookup table. This library for the Teensy++, and this thread on the 43oh forum may serve as a useful references.
Summary: Don't try it with an USB keyboard, use a matrix keypad instead - or, if you are willing to experiment, try using a PS/2 keyboard.
Conclusion: Consider a more capable microcontroller, with built-in USB PHY and host mode, or an external USB interface part such as the ones from FTDI, to achieve the desired results.
-
\$\begingroup\$ I think one can still get ps/2 keyboards. \$\endgroup\$ Commented Nov 28, 2013 at 9:50
-
\$\begingroup\$ Can't i use something like that? opengears.blogspot.com/2011/12/… or playground.arduino.cc//Main/PS2Keyboard and use a USB to PS/2 converter? \$\endgroup\$– CagurtayCommented Nov 28, 2013 at 10:28
-
\$\begingroup\$ Also i find out that there is a 5V output in msp430, its at about 22:50 , youtube.com/watch?v=QRlVQWmIGgM. \$\endgroup\$– CagurtayCommented Nov 28, 2013 at 10:34
-
\$\begingroup\$ There are currently no MSP430 MCUs with USB host capability. \$\endgroup\$ Commented Nov 28, 2013 at 10:38
-
\$\begingroup\$ @LiorBilia Thanks, incorporated this into the answer. \$\endgroup\$ Commented Nov 28, 2013 at 11:36