MICROCONTROLLER BASED DAM GATE CONTROL SYSTEM full report
microcontroller based dam gate control system project.docx (Size: 5.4 MB / Downloads: 984)
Each and every part of our life is somehow linked with the embedded products. Embedded systems are the product of hardware and software co-design. Embedded system is becoming an integral part of Engineering design process for efficient analysis and effective operation. From data analysis to hardware work, everywhere embedded products are the main interest because of its reliability and time bound perfection. Due to time complexity in electronic aspects embedded systems have become a major part of our daily life. This project describes the design of an embedded system for the “MCROCONTROLLER BASED DAM CONTROL SYSTEM”.
Personal Computer based electrical appliances control is an interesting Personal Computer based project, mainly useful for industrial applications, home automation, and supervisory control applications. This project gives exact concept of interfacing a high voltage electrical device or DC / AC motor to high sensitive personal computer system.
We are using RS232 as the communication medium between personal computer and controller. We are controlling the dc motor by sending signals from the personal computer to controller.
This project uses regulated 5V, 500mA power supply, LM7805 three terminal voltage regulators for voltage regulation. Full wave rectifier is used to rectify the ac output of secondary of 230/12V step down transformer.
Water level in a dam needs to be maintained effectively to avoid complications. This is generally performed manually which requires full time supervision by the operators & have fairly large staff complements. Moreover, the quantity of water released is hardly ever correct resulting in wastage of water & it is impossible for a man to precisely control the gates without the knowledge of exact water level and water inflow rate. The main objective of this project is to develop a mechatronics based system, which will detect the level of water and thereby the movement of gates can be controlled in a real-time basis which offers more flexibility. This system consists of a set of sensors connected to a stepper motor through an 8-bit microcontroller (AT89S52). The water level is detected based on the feedback from the mechanism used. Based on this data, the level of dam gate can be controlled using a stepper motor via personal computer.
CHAPTER 1: INTRODUCTION TO MICROCONTROLLERS
1.1 What is a Microcontroller?
A Microcontroller is a computer-on-a-chip or a single-chip computer that contains the processor (the CPU), non-volatile memory for the program (ROM or flash), volatile memory for input and output (RAM), a clock and an I/O control unit. Micro suggests that the device is small and controller tells that the device might be used to control objects, processes or events. Another term is Embedded Microcontroller tells that it support circuits are often built into or embedded in the devices for control.
You find microcontroller in all kinds of things never days. It is used for measures, controls, stores or displays information by placing microcontroller inside any device. The largest single use for microcontroller in automobiles-car manufactured today includes at least one microcontroller for engine control and more to control additional systems. In desktop computer, you may find microcontrollers inside keyboards, modems, printers, and other peripherals. In test equipment, microcontrollers make things easier to store measurement, to create and store user routines, and to display messages and waveforms. Consumer products like cameras, video recorders, compact-disk players, and ovens. And they are so many applications where we use microcontrollers.
A micro controller is similar to the microprocessor inside a personal computer. Examples are Intel’s 8086, Zilog’s Z80. Both microprocessors and microcontrollers contain CPU. The CPU executes instructions that perform the basic logic, math, and data moving functions of a computer. To make a complete computer, a microprocessor require memory for storing data and programs, and I/O interfaces for connecting external devices like keyboard and displays. In contrast, microcontrollers are a single chip computer because it contains memory and I/O interfaces in addition to the CPU. It tends to limit the amount of memory and interfaces that can fit on single chip, microcontrollers tend to be used in smaller system. Examples of popular microcontrollers are Intel’s 8052, 89C052, Motorola’s 68HC11 and Zilog’s Z8.
In January 1975 issue, Popular Electronics magazine featured an article describing the Altair 8800 computer that was the first microcomputer build and programs themselves. The basic Altair included no keyboard, video display, disk drives, or other elements essential for personal computer. Flipping toggle switches on front panel programmed its 8080 microprocessor. Altair’s usability occurred when small company called Microsoft offered a version of different programming languages for it.
Of course, Microsoft has become an enormous software publisher, and a typical personal computer now includes a keyboard, video display, disk drives, and Megabytes of RAM. There’s no longer any need to build a personal computer from scratch. A personal computer like Apple’s Macintosh or IBM’s PC is a general-purpose machine, since you can use it for many applications- Word processing, spreadsheets, computer-aided design and more. But along with cheap, powerful, and versatile personal computers has developed a new interest in small, customized computers for specific uses. Each of these small computers is dedicated to one task or a set of closely related tasks.
At core of many of these specialized computers is a micro controller. The computer’s program is typically stored permanently in semiconductor memory such as ROM or EPROM. The interfaces between the microcontrollers and the outside world vary with the application, and may include a small display, a keypad or switches, sensors, relays, motors, and so on. These small, special purpose computers are sometimes called single-board computers or SBC’s.
Now, micro controllers have become the part and parcel of today’s world. More and more advanced featured microcontrollers.
1.3 A block diagram of the Microcontroller:
Figure 1.1: A basic block diagram of a typical Microcontroller
1.4 Micro-Processor CPU:
The design incorporates all of the features found in a micro-processor CPU: ALU, PC, SP, and registers. It also has added the other features needed to make a complete computer: ROM, RAM, parallel I/O, serial I/O, counters, and a clock circuit.
Like a microprocessor, a microcontroller is a general purpose device, but one that is meant to read data, performs limited calculations on that data, and control its environment based on those calculations. The prime use of a microcontroller is to control the operation of a machine using a fixed program that is stored in ROM and that does not change over the lifetime of the system.
The design approach of the microcontroller mirrors that of the microprocessor: make a single design that can be used in as many applications as possible in order to sell, hopefully, as many as possible. The microprocessor design accomplishes this goal by having a very flexible and extensive repertoire of multi-byte instructions. These instructions work in a hardware configuration that enables large amounts of memory and I/O to be connected to the address and data bus pins on the integrated circuit package. Much of the activity in the microprocessor has to do with moving code and data to and from external memory to the CPU. The architecture features working registers that can be programmed to take part in the memory access process, and the instruction set is aimed at expediting this activity in order to improve throughout. The pins that connect the microprocessor to the external memory are unique, each having a single function. Data is handled in byte, or larger, sizes.
The microcontroller design uses a much more limited set of single and double-byte instructions that are used to move code and data from internal memory to the ALU. Many instructions are coupled with pins on the integrated circuit package, the pins are “programmable”- that is, capable of having several different functions depending on the wishes of the programmer.
The microcontroller is concerned with getting data from and its own pins; the architecture and instruction set are optimized to handle data in bit and byte size.
The pin diagram of the 8051 shows all of the input/output pins unique to microcontrollers:
Figure 1.2: pin diagram of 8051 microcontroller
The following are some of the capabilities of 8051 microcontroller:
• Internal ROM and RAM
• I/O ports with programmable pins
• Timers and counters
• Serial data communication
The 8051 architecture consists of these specific features:
• 16 bit PC &data pointer (DPTR)
• 8 bit program status word (PSW)
• 8 bit stack pointer (SP)
• Internal ROM 4k
• Internal RAM of 128 bytes
• 4 register banks, each containing 8 registers
• 80 bits of general purpose data memory
32 input/output pins arranged as four 8 bit ports: P0-P3
Two 16 bit timer/counters: T0-T1
Two external and three internal interrupt sources Oscillator and Clock circuits.
1.5 Comparing Microprocessors and Microcontrollers:
The contrast between a microcontroller and a microprocessor is best exemplified by the fact that most microprocessors have many operational codes (op-codes) for moving data from external memory to the CPU; microcontrollers may have one or two. Microprocessors may have one or two types of bit handling instructions; microcontrollers will have many.
To summarize the microprocessor is concerned with rapid movement of code and data from external address to the chip. The microcontroller is concerned with rapid movement of bits with in the chip. The microcontroller can function as a computer with the addition of no external digital parts; the microprocessor must have many additional parts to be operational.
1.6 Project steps:
Putting together a microcontroller’s project involves several steps:
1. Define the task.
2. Design and build the circuits.
3. Write the controls program.
4. Test and debug.
Sometimes the steps won’t follow exactly in this order. You may begin writing your program before you build the circuits or you may build and test some of the circuits before you start programming. But however you go about it; each of the above steps is part of the process. To see what’s involved in each step, let’s look at each in more detail.
1. Define the task:
Every project begins with an idea or a problem that needs a solution i.e., how can I monitor light intensity at different locations and times of find the best location for a solar collector? Or how can I automate the process of drilling printed- circuit boards? Or how can I create a computer-controlled, animated display for a store window?
Once you know what to accomplish, you need to determine whether that idea is been required to computer. In general, a computer is the way to go when the circuits must make complex decisions or deal with complex data. For example, a simple AND gate can easily decide whether or not two inputs are both valid logic highs, and will changes its output accordingly. But it require many small-scale chips to build a circuit that stores a series of values representing sensor outputs and times they occurred and display easily.
In this type of applications microcontrollers in comes handy. Inside, microcontrollers are little more than a carefully designed array logic gates and memory cells, but modern fabrication processes allow thousands of these to fit on a single chip. Since basic function microcontrollers are performing arithmetic, logic, data-moving, and program branching functions-commonly useful in many applications.
On the other end, how does u know that this idea is suitable for a microcontroller, or whether you should use a full desktop computer? Then a system with keyboard, full-screen display, and disk drives makes sense. For simpler designs, a microcontroller with perhaps a keypad, small display, and solid-sate memory (no disk drives) can often do the job, with less expense and smaller size.
In fact, recently the two extremes have been meeting. Some 32-bit microcontrollers are as capable as desktop systems, and notebook-size computers are available with solid-state, diskless storage. And also expansion cards, other hardware, and software are now available for those who want to use desktop computer for monitoring and control tasks. So there’s something for everyone.
2. Design and building:
When you’re ready to design and build the circuits for a project, there are several ways to proceed. You can design your circuits from scratch. You can buy an assembled single-board computer, adding only the interfaces and programming your application requires and you can also build yourself, but you can also use a kit or assembled broad as a base.
Choosing a chip:
Does it matter which microcontrollers chip you use? All microcontrollers contain CPU, chance are that you can use any of several devices for a specific project.
Within each device, you’ll usually find ma selection of family members, each with different combination of options. For example, the 8052- BASIC is a member of the 8051 family of microcontrollers which includes chips with program memory in ROM or PRTOM, and with varying amounts of RAM and other features. You can select the version that best suits your system’s requirements.
Microcontrollers are also characterized by how many bits of data they process at once, with a higher number of bits generally including a faster or more powerful chip. Eight-bit chips are popular for simpler design, but 4-bits, 16-bits, and 32-bits architectures are also available.
Power consumption is another consideration, especially for battery-powered systems. Chips manufactured with CMOS process usually have lower power consumption than those manufactured with NMOS process.
All microcontrollers have a defined instruction set, which consists of the binary words that cause the CPU to carry out specific operations. For example, the instruction 0010 0110 tells to add the values in two locations. The binary instructions are also known as operation codes or opcodes for short. The opcodes perform basic functions like adding, subtraction, logic operations, moving and copying data, and controlling program branching.
Control circuits often require reading or changing single bits of input or output, rather than reading and writing a byte at a time. For example, a microcontroller might use the eight bits of an output port to switch power to eight sockets. If each socket must operate independently of others, a way is needed to change each bit without affecting the others. Many microcontrollers include bit- manipulation (also called Boolean) opcodes that easily allows to set, clear, compare, copy, or perform other logic operations on single bits of data, rather than a byte at a time.