Arduino Projects    |   Raspberry Pi  |     Electronic Circuits    |    AVR    |    PIC    |    8051    |    Electronic Projects   |   Free TI Design & Simulation Tools 

Servo Motor control through Keypad using 8051 Microcontroller (AT89C51)

Summary

Developed By: 
Himanshu Choudhary
The basic operations of servo motor control have been discussed in interfacing servo with 8051. This project allows the servo motor to move to an angle specified by the user. The pulse train required to rotate the servo is produced by AT89C51 microcontroller. The desired angle of rotation is provided through a 4x3 keypad interfaced to the microcontroller. A 16x2 LCD is also connected with the microcontroller to display the angle of rotation entered by the user.
 
8051 Microcontroller based Servo motor control project

Description


For basic operations and control of servo motor, refer interfacing servo with 8051. The first pin of port P1 (P1^0) of AT89C51 microcontroller is set as the output pin to provide control signal to the servo motor. Ports P0 and P2 are used to interface keypad and data pins of LCD, respectively. Ports P1^3, P1^4 and P1^5 are connected to RS, RW and EN pins of LCD, respectively. (For more details, refer LCD interfacing with 8051)
 
 
Before connecting to the control wire of servo, the output from the microcontroller (P1^0) is fed through a comparator IC (LM324) so that the signal is protected from any loss due to overloading.
 
When the circuit is powered, the LCD prompts the user to enter the angle of rotation. The user can enter the angle in degrees through keypad. The angle entered by the user is also displayed on the LCD screen. As the user presses ‘*’ button of keypad, the angle of rotation is accepted by the microcontroller and the servo moves to the user defined angular position. If an angle greater than 180° is entered, the difference of the input with 180° is considered as the angle of rotation.
 
The program uses one of the 8051 timers to generate a 50 µs delay. A timer function is written which produces delay in multiples of 50 µs. A variable is taken as the argument to this function that determines the multiples. Initially when the microcontroller executes program, a pulse with ON time of 700 µs (14 x 50 µs) followed by OFF time of 18 ms is generated. This shifts the servo horn to 0° angle.
 
The angle entered by the user is stored in a variable whose value is added to the argument of the timer function. For example, if the user enters 90, the argument of the timer function is increased by 90 and becomes 104 (90 + 14). The ON time for the next train of pulses then corresponds to multiple of 50 µs. In this case the ON time of the next train of pulses will be 5200 µs (104 x 50 usec) followed by OFF time of 18 ms. This maintains the servo at 90° angle until the user enters the next angle.

 

Circuit Diagram


Video

Code

This Code is only visible to Registered users. Please Login/Register

Code2

This Code is only visible to Registered users. Please Login/Register

Components

LM324 | LM324N Datasheet
IC LM324

LM324 is a 14pin IC consisting of four independent operational amplifiers (op-amps) compensated in a single package. Op-amps are high gain...

AT89C51 Microcontroller, Atmel 89C51 Controller Image
AT89C51 Microcontroller

AT89C51 is an 8-bit microcontroller and belongs to Atmel's 8051 family. ATMEL 89C51 has 4KB of Flash programmable and erasable read only memory (...

16 x 2 LCD | 16x2 Character LCD Module
LCD

 

LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and is very commonly used in various devices and circuits. These modules are preferred over seven segments...

Free Circuit Design & Simulation Tool by TI

Free Powerful Circuit Design & Simulation Tool by Texas Instruments

TINA-TI is a powerful circuit design and simulation tool. TINA-TI is ideal for designing, testing, and troubleshooting a broad variety of basic and advanced circuits, including complex architectures, without any node or number of device limitations.

Download It Here

Features:

Tina TI

TINA is an easy-to-use, powerful circuit simulation tool based on a SPICE engine. TINA-TI is a fully functional version of TINA, loaded with a library of TI macromodels plus passive and active models.

TINA-TI's new version 9 has changes from Version 7.0 in the following areas:

  • Schematic Symbol Editor (useable with the Macro Wizard) is included, so you can create your own symbols for imported SPICE macromodels.
  • Macros do not have to be from TI - you can import anyone's SPICE model now!
  • Does not require active or non-linear components for analysis (so you can now run a circuit using just passives).
  • TINA-TI includes Initial Condition and Nodeset components
  • TINA-TI includes Linear and nonlinear controlled sources (VCVS, CCVS, VCCS, CCCS), and the Controlled Source Wizard.
  • TINA-TI now allows WAV files to be used as stimulus (signal sources). You can play calculated waveforms on PC's multimedia system, and export calculated waveforms as a *.wav file.
  • TINA-TI has Multi-core processor support; this along with other optimizations makes simulations run 2-20 times faster.
  • Schematic file import/export in XML format
  • Block Wizard included for making block diagrams
  • TINA-TI has more SPICE models and example circuits included.
  • Circuits developed in TINA-TI 9 will work with TINA Industrial version 9.
  • TINA-TI Version 7.0 is forward compatible with Version 9, and version 9 supports saving schematics in version 7.0 format.
  • Available in English, Traditional and Simplified Chinese, Japanese, and Russian versions.

Download The Tool Here Free

You are here