Connecting Nokia 3310 LCD to USB using AVR Using Atmega

nokia lcd

What do you do with an old phone, a microcontroller and lots of time?
You hook the old phone’s LCD screen to the computer USB of course!

In this project we’re going to communicate with a Nokia 3310 LCD display over USB! How are we going to do that? We’re going to connect the LCD display to an Atmel ATmega8 micocontroller and talk to it using the SPI, then connect the ATmega to a PC using V-USB.
The Nokia 3310 LCD display is easy to find, and has a very well documented interface, so it’s perfect for hobby use! Not only that, but we’re going to use V-USB (Formerly AVR-USB) as our USB driver on the AVR chip. This makes the project very easy to pull off the ground.
V-USB is very slow, so you cannot do any fancy animations this way, but is perfect for updating the display with text! Also, when using USB, you can use this on pretty much any computer. It does require libusb though, but libusb is cross platfrom, so that shouldn’t be a problem. Or, if you’re really hardcore, you can write your own driver for this project (This is way out of the scope of this instructable)!
What uses does thing have?
As I mentioned, V-USB is pretty slow, so it’s best for sending text. Even through this is a little drawback, there is still a lot of stuff you can do with it!
Display RSS feed, Twitter updates, weather, temperature, free disk space, unread e-mails.
You are not limited to just display text though. If you’re feeling really fancy, you can make a 1-bit picture slideshow!
Only your imagination (And the slow speed of V-USB) limits you 🙂
What features does the code have?
With the code you get from this Instructable, you get:
* Built-in font and support for writing ASCII characters
* Character wrapping (Prevents characters from being printed over 2 lines if end of display is reached)
USB connected
 and powered
* Easy to expand
The code is open source (Both firmware and host software), so you’re free to do whatever you want with it. (This only includes the software I have written. See the license for V-USB for further use of that, same goes for libusb. Both licenses are included in the source files.)
This project is loosely based on Raphnet’s Multiuse PCBV-USB’s PowerSwitch and DharmaniTech’s Nokia 3310 LCD routines library.
If you have problems downloading the attached files, I have mirrored them here: Atmega8_LCD.rar and LCD_Screen.rar

nokia lcd

Step 1: This instructable

In this instructable, our main focus is the programming of the decive and host software.
What we’ll cover in this instructable:
* Circuit and components
* Processing the data using V-USB on the AVR
* How to communicate with the LCD screen, and what you can tell it
* Transferring data through USB using libusb on the host
* Make a custom font for the display

We will not cover setting up V-USB or libusb, as these are included in the sources!
This instructable is a little advanced, but I assume you know the following:
* Can read datasheets and schematics
* Can solder decently
* Is familiar with programming in C/C++
* Uses Visual C++ 2008 (For the host software, no platform depended code used, so can easily be ported)
* Knows how to burn AVR chips and the programs needed to do so
* Knows the basics of AVR programming
* You use Windows (This can be done on any OS, but I currently only have Windows at hand)

If you have little or no programming experience and is very new electronics, this is not a good way to start. Have you tried making a LED blinker yet? Yes? How about a music box with a piezo element? That might keep you busy for quite some time 🙂
The concepts in this instructable might be very confusing to one who have little programming experience, and I do not go into too deep details in the concepts.
If you absolutely want to do this instructable even though you are a beginner, I have commented the source code as good as I can. If something still is unclear, drop a comment and I’ll try to help you.

Step 2: What you need

For this project, you need some components, this include:
* IC1 – Atmel ATMega8
* LCD1 – PCD8544 (Nokia 3310 LCD display)
* ZD1, ZD2 – 3,6v Zender dioes
* C1 – 10uF capacitor
* C2, C3 – 20pF capacitor

* R1 – 1,5K ohm resistor
* R2, R3 – 68ohm resistor
* Q1 – 12MHz crystal
* D1 – LED diode (Optional)

You also need an USB cable, your standard soldering tools and thin wires. (As thin as possible. I used IDE cable wires, works pretty well.)
I did not have 3,6v zener diodes or 68ohm resistors available, but I had 3,2v zener diodes and 33 ohm resistors, so I used those instead. However, I highly recommend using the listed components! If you gamble like I did, the device might not be correctly recognized and might show up as “Unknown Device”.
The LED diode is only needed if you want to know when there is activity and for debugging purposes, but it doesn’t serve any other purpose and can be omitted if you like.
If you have trouble finding parts, may I suggest old broken electronic devices? Not only can you find most parts you need in old electronic devices, but you’re also being “green” by recycling! All the parts I have used in this project comes from recycled components (Except for the ATMega8).

Datasheet for Atmel ATMega8 can be found here.

Datasheet for PCD8544 LCD display can be found here.

Step 3: Soldering it together


This should be pretty straight forward.
Just follow the schematic, and everything should work just fine.

If your soldering skills are a bit rusty, of you’re a beginner, there are a lot of good How-To-Solder guides here on Instructables! Be sure to check them out if you’re unsure about soldering. Don’t let bad soldering ruin this (awesome) project for you.
When you’re soldering, be sure to note the D+ (Green) and D- (White) on the USB cable. It’s very important not to mix those!
Here’s the pinouts for various USB connectors.
Also, if you do I like I did and solder the wires directly onto the LCD display, be very careful to not make any bridges between the connections! The connections are very small, and trust me, it’s not fun when you realize the only problem with your circuit is a bridged connection on the display.

Here’s a bigger version of the schematic.
Again, here is the datasheet for ATmega8.

Step 4: Programming the ATmega

If you have followed the schematic, this should be a real quickie.

Download the source code or hex files attached to this instructable, compile and upload to your chip. If you’re not sure how this works, please check out this very good instructable on how to get started with AVR. It should cover everything you need in regards to programs and SPI interface through parallel connection.

Once you’ve uploaded the firmware to the microcontroller, detach the programming cable. If you’ve done everything correctly, the display should now say “Display Initialized” and your computer should notify you that an USB device has been plugged in.

Read more: Connecting Nokia 3310 LCD to USB using AVR

Leave a Comment

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