Sunday 23 February 2014

Teensy 3.0 I2C LCD Screen

I'm getting back into Electronics after a long time away.

A long time ago I backed the Teensy 3 project and now I've got the time I'm looking into how to use.

So here it is:

A really basic I2C LCD display being driven by the Teensy.





As a noob it took me some time to work it out so I thought I would share what little I worked out.

So with the Teensy it really quite simple, wire the GND to the GND and VIN to VCC, then wire pin 18 to SDA and 19 to SCL. Finally Wire the 2 pull up resistors (4.7k) from 18 and 19 to the VCC.

It should look like a better version of this:

Now to program the Teensy, I would read their guide as I can't do it justice.

In order to write to the screen you need to know what address to send the commands too.

Again I found a great resource that looks for any I2C devices connected and tells you the address it's available on. Check out Ardunio Playgroud for the sketch.

My address was 0x27 so that's what I'm going to use.

Now to write our own sketch:
 #include <Wire.h> //Read in the librries  
 #include <LiquidCrystal_I2C.h>  
 // Set the LCD address to 0x27 for a 16 chars and 2 line display  
 LiquidCrystal_I2C lcd(0x27, 16, 2);  
 void setup()  
 {  
  //Basic Variable Setup  
  lcd.begin();  
  lcd.home();   
  lcd.print("Hello World");  
 }  
 void loop()  
 {  
 }  

That's it! Next I'm going to start adding a button and then moving onto reading information from USB to display.

No comments:

Post a Comment