Monday 24 November 2014

Hangman Game - Using Atmega328 and Nokia 5110 LCD

Have you ever wanted to make your own video game? This project tutorial will help you do just that!


Components Required:
  • AVR usbasp programmer                                    X 1
  • Atmega328                                                          X 1
  • Push Buttons                                                       X 5
  • Resistors
    • 1 K ohm                                                    X 11
    • 2.2 K ohm                                                 X 7
    • 10 K ohm                                                  X 1
  • Capacitors
    • 22nF                                                          X 2
  • 16 Mhz Crystal Oscillator                                  X 1
  • Nokia 5110 LCD Module                                   X 1
  • Male Header strip                                               X 1
  • Female header Strip                                            X 1
  • Buzzer (optional)                                                X 1 
  • Vero board                                                          X 1
  • Wire  
Circuit Diagram:

Solder the above shown circuit on a vero board. You could also make the circuit on a breadboard. However, due to the large number of connections, it is advisable to use a vero board.

Use the male headers for the programmers pins, and use female headers for the LCD Display pins.

If your LCD module does not have male headers soldered to it, go ahead and solder that too. Your LCD module should look something like this-


You can also connect a buzzer to the Atmega328.We have connected the buzzer between pin 15 and ground.

Code:
Once the circuit is ready, it is time to burn the code. We have written the code in programmer's notepad. You can follow the steps to burn the program from the following link-

http://avrlogic.blogspot.in/search/label/4.%20Programming%20Atmega16%20-%20LED%20Blink

However, take care to change the atmega chip from atmega16 to atmega328 in all steps. Rest of the procedure remains the same. 



After saving the code, we now place the header files. These can be downloaded from the following link:

Header files

Extract the files and place them in the same directory as your code.

Compile and build the program. Then burn it to the atmega chip.

Your Hangman game should start working!

Notes:
If you want to change the graphics, or make your own pictures, run the FastLCD Program. Design your desired image, and follow the steps given in the word file.
Include these header files in your program, and call them using the
<object name>.printPictureOnLCD(<name of  header file>);    command.


No comments:

Post a Comment