Interfacing matrix keyboard with AVR

Keypad is most widely used input device to provide input from the outside world to the microcontroller. The keypad makes an application more users interactive.  The concept of interfacing a keypad with the ATmega16 is similar to interfacing it with any other microcontroller. Much application requires large number of keys connected to a computing system which 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 because it will eat up precious i/o line and MCU to Keypad interface will contain lots of wires. The rows R0 to R3 are Input to the Microcontroller. They are made input by setting the proper DDR Register in AVR. The… Continue reading

Sensing Temperature Using AVR


In this new tutorial, we will be interfacing a LM35 based temperature sensor with ATMEGA32. The 3 main types are thermometers, resistance temperature detectors, and thermocouples. All three of these sensors measure a physical property (i.e. volume of a liquid, current through a wire), which changes as a function of temperature. In addition to the 3 main types of temperature sensors, there are numerous other temperature sensors available for use. However the LM35 based sensors are precision-integrated temperature sensors, with an output voltage linearly proportional to the Centigrade temperature. The main advantage is these types of sensors don’t require any external calibration. They are internally calibrated and simply generate the output with respect to the temperature they detect. The device is used with single power supplies, or with plus and… Continue reading

Interfacing Ultrasonic Rangefinder with AVR

HC-SR04 sensor

In this tutorial, we are going to interface ultrasonic rangefinder with the all popular ATMEGA8. Ultrasonic rangefinder is used to find range of an obstacle or a wall from the sensor. However, when there are cheap methods available to find range like the IR sensor or even a combination of LED’s and LDR would do but the question is why we use a more costly sensor. The reason is:- IR sensors are not accurate Result varies from object to object Calibration is required Works good only for shot range Normally the IR sensors have a range from 30-80 cm or even less depending upon the manufacturer and also the LED’s used. However for an ultrasonic rangefinder, the distance can be measured accurately up to 400cm with an accuracy of 1cm.… Continue reading

Interfacing analog Joystick with AVR

In this tutorial we are going to learn something interesting which is already sued by many people to play games. Yes, the analog joystick which is used to control the motion of a vehicle or a character. They are also used to control the motion of a RC car or maybe a RC helicopter. Normally all the joysticks are two axis joysticks. The ‘y’ axis is used to move the object forward or backward while the ‘x’ axis is generally used to move the object left or right. These joysticks are available both in digital and analog outputs. The digital joystick gives pulse width modulated output but is more costly than the analog output joystick. In this tutorial, we will get the input from the joystick from both the ‘x’… Continue reading

Interfacing shift register with AVR

74HC595 shift register

Shift register is one of the important thing to learn while designing any embedded system. Using shift registers one can increase the number of input as well as output pins available in any microcontroller. There are situations, where you want to interface many peripherals together and also keep the system low cost as well as reliable. This is where shift register come into picture. For example, in a joystick used to play games, instead of running all the pins from the console to the joystick buttons, he used a shift register which reduces the number of pins almost by half.  This not only increases the reliability of the joystick, but also has helped in saving a lot of money in the long run. Another advantage of using shift register is… Continue reading