Playing with Ardunio

With college classes done for the summer, I’ve gotten back in tinkering with electronics a little. I had trouble with my Basic Stamp 2 after bouncing around Alaska and being boxed up for a couple of years, so I decided to try tinkering with an Ardunio, something I’ve looked at for a while but never had time. I’m currently in the process of cycling a 55 gallon freshwater aquarium (something else I’m very excited about!), and have some cool ideas for building a basic monitoring system that can keep track of water temperatures, control lights, and provide a status report and XML feed or something for use elsewhere. So, I picked up a cool Arduino Uno.

I bought a 16×2 LCD from Adafruit which helpfully included the header pins, along with an i2c/SPI backpack which allows easier connection to the Arduino and uses less pins. After remembering which end of the soldering iron to hold, I got the header connected and the backpack attached (though I really need to clean up my soldering job…):

i2c LCD backpack

Using a modified LiquidCrystal library for using the i2c connection made it pretty straightforward to write out to the LCD. Using two analog input pins along with the 5V and GND made it really quick to hook up the board too. The basic code for displaying two lines of text is:


#include < Wire.h >
#include < LiquidCrystal.h >

LiquidCrystal lcd (0); // Initialize a single i2c LCD

void setup() {
lcd.begin(16, 2); //Set up our 16x2 LCD
lcd.print("Line 1 text");
lcd.setCursor(0,1); // Set our cursor to character 0, line 1
lcd.print("Line 2 text");
}

void loop() {
}

Which should display something a little like this:

Arduino and 16x2 LCD

This was all based on the awesome tutorials from Ladyada on connecting the i2c backpack and writing characters to an LCD. There’s a wealth of awesome info and tutorials, and a great starting place for components and code ideas 😀 I’m looking forward to playing around with the temperature sensors and battery powered real time clock over the next week or so.

About

Senior Content Development for Microsoft writing about Azure virtual machines. Occasionally I play video games.

Posted in ardunio, my projects

Leave a Reply

Your email address will not be published. Required fields are marked *

*

About Me

Iain Foulds, 32 years old. Originally from England, now living in Seattle, WA. I currently work as a Senior Content Developer for Microsoft writing about Azure VMs. Gamer. Very passionate about photography. Comments and opinions expressed here are my own. More...

Categories

Archives