
LCD interface
#1
Posted 09 August 2010 - 06:41 PM
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
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
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
Posted 09 August 2010 - 08:05 PM
#5
Posted 10 August 2010 - 05:43 PM
#6
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
Posted 11 August 2010 - 07:46 AM
#8
Posted 11 August 2010 - 08:22 AM
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.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?
#9
Posted 12 August 2010 - 07:59 AM
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
Posted 12 August 2010 - 08:37 AM
#11
Posted 12 August 2010 - 08:44 AM
#12
Posted 24 August 2010 - 02:03 AM
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.


#13
Posted 24 August 2010 - 02:07 AM
#15
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
Posted 03 June 2012 - 11:30 PM
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