Archive

Posts Tagged ‘display’

Still alive!

October 6, 2012 Leave a comment

Hey there! Just checking in to make sure that I haven’t abandoned this blog/journal/whatever on my progress into the world of electronics. I have been making great strides indeed, it’s just that documenting that work is quite laborious.

Anyway, there are numerous things that I’m working on simultaneously. I will be getting a fresh new batch of components and tools in the next few weeks (already got them! 🙂 ) so I am looking forward to getting started on actual projects, instead of just tinkering around (although that has been greatly entertaining).

Some of the things that I will be working on are:

[Done!] A clock with a 7-segment led display whose time accuracy will be controlled by the real time clock (also known as a RTC) DS1307.

I already have the RTC DS1337 that I previously purchased, however it is quite different from what I expected. It doesn’t seem to have an easy battery backup like the DS1307, and there really isn’t much hacker community support for it in the way of libraries and tutorials.

Now I could buy a premade module for about $10-15 which would just “plug and play”, but the module is only made up a few passive components – besides the RTC -, and shouldnt be hard at all to make myself. (It wasn’t.)

[Done!] Controlling a 7-segment LED display with a display driver. More specifically, the MAX7219 display driver. I figure it would be a lot easier to get this thing up and running rathar then deal with the hastle of using multiple shift-registers and a whole lot of resistors just to control a 4 or so digit LED display. (And it was, honestly, this thing is like a god send for controlling 7-segment and matrix LED display.)

[Done!] Programming an ATtiny, to start with, and later an ATmega. This is so that I can get away from being dependent on the Arduino being hooked up to my projects all the time, and would reduce the size of my projects as all I would need is the ATmega/tiny, a crystal, a couple of capacitors and something to regulate voltage.

[Done!] Modifying a servo to rotate continuously. This is absolutely necessary for my main project, and there are more then a couple of guides/tutorials online that detail how to do it. (It was ridiculously easy to do this, took no more than 5 minutes start to finish.)

Update (6/Oct/2012): So I started writing this a while back, maybe a month or so, and have accomplished a lot of the things that I had planned. As such, I updated this post and am submitting it now. The detailed posts accompanying each project should be up soon – but knowing my post history I wouldn’t hold my breath waiting for them.

NHD-0216PZ – LDC Display

July 18, 2012 Leave a comment

I have been quite apprehensive towards working with LCDs. They take up nearly half of the digital pins available on my Arduino Uno and require quite a bit of work to set up and get going, or at least so I thought. Nevertheless, I did need some way to get feedback from the Arduino, and I couldn’t rely on the IDE serial monitor forever.

This is why I have purchased the New Haven NHD-0216PZ-FL-YBW-PC LCD display (link to datasheet .pdf).

Component:

The NHD-0216PZ-FL-YBW-PC is a character liquid crystal display module operating on a 5V supply. It is manufactured by Newhaven Display, features 2 rows of 16 characters each, is transflective and also has controllable yellow/green LED backlighting. One thing to note about this particular model is that the backlight pins 15 and 16 are reversed, and there is a 20 Ohm resistor already connected to the backlight.

Circuit:

The first order of business was to solder on some sort of connectors so that I can run jumper wires to the Arduino. I’ve seen many people attach pin headers to the bottom of the LCD so that they can connect the LCD directly into a breadboard, but I preferred to use single row 3M Boardmount Sockets. Ideally, I would have liked to have a 16-pin version of these stackable headers (and now that I think about it I could have just gotten two of them and attached them side by side) so that I could use them both on a breadboard and with jumper wires directly to them.

Note: Make SURE that you know which type of connector you want to use before you start soldering. I found this out the hard way as I neglected to consider the fact you needed a potentiometer and several connections to +5V and ground, it is much more difficult to have a standalone LCD as opposed to having a small breadboard devoted to an LCD. Boardmount sockets are ENORMOUSLY difficult to de-solder, and I nearly destroyed a trace on the PCB of the LCD trying to force it. I ended up having to break apart the socket into smaller sections so that I could de-solder the pins individually.

So, now that we have the LCD fully prepared  for use we can begin hooking it up to the Arduino. We will do that using the datasheet schematic and the pin wiring diagram below:

First thing well do is get the backlight working. Easy enough, connect ground to pin 15 and +5V to pin 16 (Note: my LCD has the+5V and GND pins reversed, and an onboard resistor. Most LCDs will be different, so check your datasheet!).

Next, we have to add a potentiometer so that we can adjust the contrast of the LCD. Connect one side of the pot to +5V and the other to GND. The middle pin of the pot should go to pin 3 of the LCD. We also want to connect power to the LCD itself which we do by connecting GND to pin 1 and +5V to pin 2. You should now be able to adjust the contrast by turning the pot.

The final part of wiring up the LCD is connecting the data lines.

Looking back at the data sheet pin diagram we can see that there are many pins that can connect to the MicroProcessor Unit, in this case, our Arduino. Fortunately, we will only be using six pins on our Arduino. Here is how everything connects:

  • RS Pin [4] – Used to let the LCD know if its being told to receive data or receive a command. – Connects to Pin 7 on the Arduino.
  • R/W Pin [5] – Read/Write select signal. – Wont be using this so connect to GND.
  • EN Pin [6] – Used to enable writing to the registers of the LCD. – Connects to Pin 8 on the Arduino.
  • DB4 Pin [11] – Data – Connect to Arduino Pin 9
  • DB5 Pin [12] – Data – Connect to Arduino Pin 10
  • DB6 Pin [13] – Data – Connect to Arduino Pin 11
  • DB7 Pin [14] – Data – Connect to Arduino Pin 12

Here’s how everything should now be wired up.

That’s it! The hardware part is complete, which was also the most difficult part. Provided you wired everything up correctly, you should now be able to control the LCD with the Arduino. Which brings us to the software side of things…

Arduino:

Lucky for us, most of the work on creating a sketch to control the LCD has been done. If you go to  File > Examples > LiquidCrystal in the Arduino IDE you will see several sketches that are already available, we’ll be using the HelloWorld sketch. Before we run the sketch though, we need to modify the part that determines what pins will be used for what. Doing so is very easy, the sketch uses a function to assign pins, here is the function and its parameters:

LiquidCrystal lcd(RS, EN, DB4, DB5, DB6, DB7);

And this is how we modify it to work with our setup:

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

Now when we run the sketch we should see something like this:

Excellent! Having made it this far we’re able to use an LCD to display any kind of information we like, completely independent of a computer. This capability empowers us to take on a whole new breadth of projects!

If you wish to download the completed sketch you can get it here.

Sources: [Adafruit, Arduino.cc]