Tag Archives: lcd

AVR Project – ATmega8 Based Smart Code Lock

Here is a project for beginners using Atmel AVR ATmega8. The project uses some techniques that are very useful for designers to learn and utilize. Alphanumeric LCD Module Interfacing. 4×4 Keypad interfacing. PWM Control of LED (Used to dim the back-light of LCD, like in some Nokia Phones) Basic Circuit design for AVR MCUs Connecting relays and other current demanding devices. AVR Studio and project management. compiling using free avr-gcc compiler. Using eXtreme Burner – AVR to burn hex code to AVR MCU. NOTE: Don’t waste time finding each part running from shop to shop. Get all the parts with exact specification in a ready to use kit! Purchase ATmega8 based smart code lock KIT.   Fig.: ATmega8 Based Code Lock Fig.: ATmega8 Based Code Lock Project     Functions of the Project. This device can be used to code protect any electrical device (like an electronic door, lock or safe). The user must enter a correct password to gain access. The password is entered using the built in 4×4 keypad matrix. The main LCD Module is used to display messages to the user. As soon as correct password is entered the relay is activated. This is indicated by a LED which is placed near the relay. The relay remains on as long as the user wishes. You just need […]

4×3 Matrix Keypad Interface – AVR Tutorial

Many application requires large number of keys connected to a computing system. Example includes a PC keyboard, Cell Phone keypad and Calculators. If we connect a single key to MCU, we just connect it directly to i/o line. But we cannot connect, say 10 or 100 keys directly MCUs i/o. Because :- It will eat up precious i/o line. MCU to Keypad interface will contain lots of wires. Buy Matrix Keypad We want to avoid all these troubles so we use some clever technique. The technique is called multiplexed matrix keypad. In this technique keys are connected in a matrix (row/column) style as shown below. Matrix Keypad Basic Connection The rows R0 to R3 are connected to Input lines of Microcontroller. The i/o pins where they are connected are made Input. This is done by setting the proper DDR Register in AVR and TRIS Register in PIC. The column C0 to C3 are also connected to MCUs i/o line. These are kept at High Impedance State (AKA input), in high z state (z= impedance) state these pins are neither HIGH or LOW they are in TRISTATE. And in their PORT value we set them all as low, so as soon as we change their DDR bit to 1 they become output with value LOW. One by One we make each […]

Interfacing RFID Reader with AVR MCUs – AVR Tutorial

Hello Friends!, RFID is a great technology, has may uses and become very cheap and easy to implement these days. Very interesting and useful project can be made by using RFID technology. In our tutorial series on RFID we will get introduced to this magical technology and practically create RFID based solutions. In RFID or Radio Frequency Identification their is a tag (or label) which has a unique ID stored on it. We can read this ID by using a RFID reader. Not much fun yet? Well the features which makes magical are :- The RFID tag does not need to make any electrical contact with reader (Wow!) The RFID Tag is an active device which has a chip and antenna but does NOT need any power and are low cost!(Some tags need battery) RFID tags are very small, don’t need battery so can be put in cards (looks like a credit/ATM cards) or key chains. By reading the features offered by RDIF technologies you may be wondering that the application would be much sophisticated or costly. But the good news is that we have done enough research to find the best RFID solution and they are available from our online shop. And with the help of our beginner friendly tutorials you can easily get it to work in no […]

Interfacing Graphical LCD with AVR MCU – Part III

Hello Friends, Welcome Back. This is the continuation of our tutorial series on Graphical LCD Programming. Till now we have made the hardware for testing and setup avr studio project for graphical development. Now as our hardware and software is ready, its time to get our hands dirty by digging deep into ProGFX graphical programming. Introduction The graphical LCD is made up of a grid of pixels. Common resolution is 128×64. That means that their are 64 horizontal lines and each line has 128 pixels. These displays are monochrome that means each pixel can either be ON or OFF. ON pixels looks dark while OFF pixels are nearly invisible. The glcd has a graphic RAM where each bit in ram corresponds to one pixel on screen. You write to the graphic RAM to modify its contents and the screen will change accordingly. The LCD module offers just that much functionality. You can’t do much with that. Pixel Matrix of Graphical LCD You need a graphic library that takes high level commands like Graphic primitives like line,circles, rectangle etc Text Drawing Image/Icon drawing. Double buffering. and changes the graphic memory accordingly. These operation requires some advance algorithms (at least from beginners point of view!). So the graphic library will help you generate complex graphical output very easily. Pixel Addressing The horizontal […]

Interfacing Graphical LCD with AVR MCU – Part II

This tutorial deals with downloading and installing ProGFX graphic engine. ProGFX is a free and easy to use embedded graphic library that can control several display modules and can run on AVR, PIC and ARM MCUs. In this tutorial we will make a ProGFX graphical application with Atmel AVR ATmega32 MCU using AVR Studio and WinAVR (C Compiler). So lets begin. Downloading ProGFX engine. Please download the ProGFX engine from the following link. Download ProGFX v1.0 Installing ProGFX Engine. You need WinZIP to extract the files to your hard disk. Please extract it to root of any drive like "C:". Following Folders will be created. C:\progfx\include C:\progfx\lib Folders Created after extracting the ProGFX package Note that core of the engine is contained in two folders named "include" and "lib" but there may be some others folders too, like "Help" depending on your version of ProGFX engine. Creating a Graphical Project using AVR Studio. The basic tools required for developing with AVRs are Atmel Studio (Integrated development environment with integrated C compiler) eXtreme Burner AVR (to transfer program files to chip) These tools must be installed and set up correctly as described in the following tutorial. Creating "Hello World" project with Atmel AVR. Start AVR Studio and you will be presented with the following screen. Atmel Studio 6 Startup Screen The […]

Making “The LCD Expansion Board” for PIC18F4520

In this tutorial I you show you how to make a very useful expansion board for our PIC development board. It will be a Do It Your self (DIY) LCD Expansion board. The expansion board can be plugged into the PIC development board to add 16×2 Alphanumeric LCD Support to it. Since LCDs are required in many projects and experiments it will be a very helpful board. I recommend you to read the LCD Interfacing Tutorial before you proceed. It will give you an Idea how LCD is connected to PIC Microcontrollers. So lets start! Schematic for LCD Expansion Board. Fig.: LCD Module Interface with PIC Microcontroller. The board is very easy to make as the MCU core unit is already done for you. So you need to just care about the LCD part. It consists of the 16×2 LCD Module and A variable resistor (10K) only! Optionally you can add a 47ohm series resistor with the LED backlight of the LCD Module, to enable the backlight. The variable resistor is used to adjust the contrast of the module. If NO text is displayed adjust this pot. All I/O ports and power supply is available at the top of expansion board. Fig.: A blank expansion. As you can see the top row in the board lists all I/O port of […]

AVR Project – Relay Timer with ATmega8 AVR MCU

Timers are widely used in industrial and domestic application for automating tasks. Microcontrollers can be used to design versatile and accurate timers with ease. Here I present a simple timer that can be used to turn on/off a load after user specified time. The Timer uses a standard 16×2 lcd module for user interface (UI). User can set the time using a 3 button keypad. After that Timer is started. While count down is in progress, the time left is displayed on screen. The program use our LCD driver library more details of which can be found in here. Use avr-gcc + AVR Studio to compile. The prototype was developed using xBoard MINI, a low cost easy to use ATmega8 development board. The program was burned to the MCU’s flash memory using eXtreme Burner – AVR Software and Hardware. A basic knowledge of working with different tools of AVR development is required, so please refer to following articles. Note: Fuse Must be set as follows, HIGH FUSE=C9 LOW FUSE=FF (Very Important) If display is blank please adjust RV1 Part List 01 ATmega8-16 PU U1 02 16×2 LCD Module LCD1 03 16 MHz Crystal X1 04 BC548 Transistor Q1 05 1N4007 Diode D1 06 4.7K Resistor R1,R2 07 10K Variable Resistor VR1 08 22pF Disk Capacitor c1,c2 09 0.1uF Disk Capacitor […]

AVR Project – Digital Stop Watch with ATmega8

Hello Friends, In this tutorial we will make a "Digital Stop Watch" using an AVR ATmega8 Microcontroller. This will help you learn many concepts like Multiplexed Seven Segment Display Interfacing Using AVR Timers Using Interrupts And many others too. The code is written in C language for avr-gcc (WinAVR) . Fig.: Digital Stop Watch Prototype Steps to Build the "Digital Stop Watch" using AVR ATmega8 MCU Make the circuit according to the schematic on general purpose PCB or a BreadBoard. Make a project in AVR Studio and add a new file to the project. Copy/paste the "c" code. Set optimization as "o2" and CPU frequency as 16000000Hz. Save and Build the project. You will get a HEX file. Burn this HEX file to an ATmega8 MCU using a tool such as eXtreme Burner AVR. Set High Fuse = C9(Hex) Low Fuse = FF(Hex). How to do this depends on you programmer software. I have use a xBoard MINI development board for fast and easy prototyping. The Displays+Transistors+Key are on the Veroboard while the Core CPU unit + power supply is in the xBoard MINI. It can be programmed "In System" over USB Port using eXtreme Burner – AVR software toolkit. Fig.: Digital Stop Watch made using xBoard MINI   How to Use the "Digital Stop Watch" When initially powered up […]

Using IR remote with AVR MCUs – Part II

Hello Friends, Welcome back. In previous tutorial I introduced my IR remote decoding library. In this tutorial I will continue our discussion and show you how to add IR remote controls support to your AVR projects. Step I Download the library files and unzip them in a folder. Step II In AVR studio create a new AVR-GCC project. Then copy the following files to the project folder. IR remote related. Source Files remote.c Header Files remote.h rckeys.h LCD Related Source Files lcd.c Header Files lcd.h myutils.h Note: Include file from the \lib\ATmega8 if you are using ATmega8 \lib\ATmega16 if you are using ATmega16 or ATmega32 After The files have been copied add them to your project by right clicking project view and selecting “Add Existing Source File(s)…” and then select the “lcd.c”. Similarly add other source files. In the same way add the header files by selecting "Add Existing Header File(s)…" Adding files to projects.   If instead of AVR Studio you use Makefiles then add all the source files names in the source section of the makefile along with your main c file (which has same name as your project and has the main function). Step III. In your main C source file include the following files #include "remote.h" in addition to standard files in your main() function initialize […]

Using IR remote with AVR MCUs

Hi Friends, Welcome to my AVR tutorial Series. In this article I will describe my Infrared Remote Control Library. Hope you will enjoy it. I was very much amazed my remote controls since long. The simple circuits described in magazine were just operated like a switch and can only switch on and off an application. That means only single channel. That was of not much use. What I wanted was access to each key on remote control. I wished I could decode the signals generated by common remotes controls found in our homes. This way I could make multi channel remote controls for any project. So I went on and after some web research, coding and debugging I finally succeeded ! Actually I completed that more than one and half year ago (in may 2007). And now I thought I should also make it available to others who are in need of it so that they can use it in their projects. So I went on to make it more "clean" and also to make it more "easily portable" so that it can be used with different devices operating at different frequency. And now the result is here, a very easy to use library that can add remote control feature in any of your AVR project ! Using a IR […]

Timers in Compare Mode – Part II

Hello and welcome back to the discussion on the TIMERs in compare mode. In the last article we discussed the basics and the theory about using the timer in compare mode. Now its time to write some practical code and run it in real world. The project we are making is a simple time base which is very useful for other project requiring accurate computation of time like a digital clock or a timer that automatically switches devices at time set by user. You can use it for any project after understanding the basics. We will have three global variable which will hold the millisecond, second and minutes of time elapsed. These variables are automatically updated by the compare match ISR. Look at the figure below to get an idea how this is implemented. Fig – Using AVR Timer to generate 1ms Time base.     Complete Code #include <avr/io.h> #include <avr/interrupt.h> #include "lcd.h" //Global variable for the clock system volatile unsigned int clock_millisecond=0; volatile unsigned char clock_second=0; volatile unsigned char clock_minute=0; main() { //Initialize the LCD Subsystem InitLCD(LS_BLINK); //Clear the display LCDClear(); //Set up the timer1 as described in the //tutorial TCCR1B=(1<<WGM12)|(1<<CS11)|(1<<CS10); OCR1A=250; //Enable the Output Compare A interrupt TIMSK|=(1<<OCIE1A); LCDWriteStringXY(0,0,"Time Base Demo"); LCDWriteStringXY(0,1," : (MM:SS)"); //Enable interrupts globally sei(); //Continuasly display the time while(1) { LCDWriteIntXY(0,1,clock_minute,2); LCDWriteIntXY(3,1,clock_second,2); _delay_loop_2(0); […]