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 movement of an RC car or maybe an RC helicopter. Usually, all the joysticks are two-axis joysticks. The ‘y’ axis moves 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’ and the ‘y’ axis, convert the analog data into a digital value, and then display the data into LCD.  Before starting the tutorial, I will recommend you to read the LCD tutorial, if you haven’t, which can be found in the AVR tutorial section. Also, before displaying the data, there will be some minor calculations…

Continue reading

Interfacing shift register with AVR

74HC595 shift register

The shift register is one of the vital things to learn while designing an embedded system. One can increase the number of input and output pins available in any microcontroller using shift registers. There are situations where you want to interface many peripherals together and keep the low system cost and reliability. This is where the shift register comes into the picture. For example, in a joystick used to play games, a shift register reduces the number of pins almost by half instead of running all the pins from the console to the joystick buttons.  This increases the joystick’s reliability and has helped save a lot of money in the long run. Another advantage of using shift register is that only three pins, mainly control, latch and serial input/output, can drive virtually any number of outputs or take inputs from a large number of the device. You might have seen different led cubes available in sizes of 4×4 or 6×6. The LEDs in those cubes are all driven by using shift registers.

Continue reading

Controlling servo motor with AVR

Servo motor

Servo motors are a type of electromechanical actuators that do not rotate continuously like DC/AC motors. They used to position and hold some object. They are used where continuous rotation is not required, so they are not used to drive wheels. In contrast, they are used where something is needed to move to a particular position and then stopped and held there. The most common use is to position the rudder of aircraft and boats etc. Servos can be used effectively here because the rudders do not need to move full 360 degrees, nor they require continuous rotation like a wheel. Servos are DC motors with built-in gearing and feedback control loop circuitry. Most servo motors can rotate about 90 to 180 degrees. Some rotate through a full 360 degrees or more. Servos that can rotate 360 degrees are required mainly for building RC helicopters. Most commonly available servos have a three-wire connector. One wire supplies positive DC voltage – usually 5 to 6 volts. The second wire is for voltage ground, and the third wire is the signal wire. The receiver…

Continue reading

Accelerometer Interfacing with AVR

ADXL335 size

The article covers how to interface an accelerometer with the atmega32/atmega16. Before proceeding, the user must know the basics of ADC (Analogy to digital converter) of the AVR. An accelerometer is an electromechanical device that measures acceleration forces. These forces may be static, like the constant force of gravity pulling at your feet, or they could be dynamic – caused by moving or vibrating the accelerometer. Accelerometers are of two types Analog and Digital. In this post, we will be discussing Analog accelerometers. They give voltage as output which is proportional to acceleration. The digital one gives the PWM output or direct binary digital data

Continue reading