Académique Documents
Professionnel Documents
Culture Documents
CHAPTER: 1
INTRODUCTION
1.1 Introduction – Engineering is not only a theoretical study but it is a implementation of all
we study for creating something new and making things more easy and useful through practical
study. It is an art which can be gained with systematic study, observation and practice. In the
college curriculum we usually get the theoretical knowledge of industries, and a little bit of
implementation knowledge that how it is works? But how can we prove our practical knowledge
to increase the productivity or efficiency of the industry?
1.2 Literature Survey – This literature survey extracts information from some of the literature
available on this subject. It does not claim to be complete nor does it take a position towards the
opinions expressed in these articles. The information is grouped along the two discussion lines:
Discussion line 2: Possible solutions and strategies, introduced by some general remarks about
microcontrollers.
CHAPTER: 2
OBJECTIVE OF STUDY
2.1 Components Listing and Description – The components used in this project are as
following:
Capacitor :
Fig 1: Different types of capacitors: From left: multilayer ceramic, ceramic disc, multilayer polyester film,
tubular ceramic, polystyrene, metalized polyester film, aluminum electrolytic. Major scale divisions are in
centimeters.
A capacitor (formerly known as condenser) is a device for storing electric charge. The forms of
practical capacitors vary widely, but all contain at least two conductors separated by a non-
conductor. Capacitors used as parts of electrical systems, for example, consist of metal foils
separated by a layer of insulating film.
A capacitor is a passive electronic component consisting of a pair
of conductors separated by a dielectric (insulator). When there is a potential difference (voltage)
across the conductors, a static electric field develops across the dielectric, causing positive
charge to collect on one plate and negative charge on the other plate. Energy is stored in the
electrostatic field. An ideal capacitor is characterized by a single constant value, capacitance,
measured in farads. This is the ratio of the electric charge on each conductor to the potential
difference between them.
Resistor :
Rectifying Diode :
versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C2051 is a powerful
microcomputer which provides a highly-flexible and cost-effective solution to many embedded
control applications.
Features
Layout Formation
Integrated circuit layout, also known IC layout, IC mask layout, or mask design, is the
representation of an integrated circuit in terms of planar geometric shapes which correspond to
the patterns of metal, oxide, or semiconductor layers that make up the components of the
integrated circuit. IC Layout is done with the aid of editor software, or even automatically
using EDA tools, including place and route tools or schematic driven layout tools. For designing
the layout from the circuit diagram we have used the “EAGLE” software.
Microcontrollers were originally programmed only in assembly language, but various high-level
programming languages are now also in common use to target microcontrollers. These languages
are either designed specially for the purpose, or versions of general purpose languages such as
the C programming language. Compilers for general purpose languages will typically have some
restrictions as well as enhancements to better support the unique characteristics of
microcontrollers. Some microcontrollers have environments to aid developing certain types of
applications. Microcontroller vendors often make tools freely available to make it easier to adopt
their hardware.
Here we have used “MICRO C” compiler and have generated the .hex file.
After the generation of the hex code, the .hex file is burned into the microcontroller using a
burner.
CHAPTER: 3
DETAILS OF TECHNOLOGY –
Clock sources for microcontrollers can be grouped into two types: those based on mechanical
resonant devices, such as crystals and ceramic resonators; and RC (resistor, capacitor)
oscillators. Two examples of discrete oscillators are shown in Figure. Figure shows a Pierce
oscillator configuration suitable for use with crystals and ceramic resonators while Figure 1b
shows a simple discrete RC oscillator.
Crystal and ceramic resonator-based oscillators typically provide very high initial accuracy and a
moderately low temperature coefficient. RC oscillators provide fast startup and low cost but
generally suffer from poor accuracy over temperature and supply voltage, with variations of 5%
to 50% of nominal output frequency. While the circuits illustrated in Figure 1 are capable of
producing clean reliable clock signals, the performance of these can be heavily influenced by
environmental conditions and circuit component choice. Care should be taken with the
component selection and layout of all oscillator circuits. Ceramic resonators and their associated
load capacitance values have to be optimized for operation with particular logic families.
Crystals, with their higher Q, are not so sensitive to amplifier selection but are susceptible to
frequency shifts (and even damage) when overdriven. Environmental factors that influence
oscillator operation include electromagnetic interference (EMI), mechanical vibration and shock,
humidity and temperature. These factors give rise to output frequency changes and increased
jitter and can, in severe cases, cause the oscillator to stop functioning. Many of the problems
described above can be avoided through the use of oscillator modules. These are self-contained
oscillators with a low impedance square wave output and guaranteed operation over a range of
conditions. The two most common types are crystal oscillator modules and integrated RC
oscillators (silicon oscillators). Crystal oscillator modules provide similar accuracy to discrete
crystals. Silicon oscillators are more precise than discrete RC oscillators and many provide
comparable accuracy to ceramic resonator based oscillators.
CHAPTER: 4
4.1 Definition –
BULB
(O/P)
MICROCON PNP
-TROLLER TRANSIS-
TOR
AC TRIAC
TRANSFORMER AT89C2051
SUPPLY
~ 680 kHz
50 Hz
NAND NAND
GATE GATE
WORKING – AC supply through transformer is converted into DC. This DC along with two
other frequencies (generated from the two nand gates), 50 Hz & 680 kHz, is given to the
microcontroller as input. The output from the microcontroller is given to a PNP transistor. And
the output from transistor is again given to the TRIAC. The final output i.e., the bulb glowing, is
obtained on the two legs of the TRIAC.
Circuit Diagram -
Flowchart -
START
LAYOUT
FORMATION
CREATING IMPRESSION
OF LAYOUT ON COPPER
PLATE
ETCHING
DRILLING
MOUNTING
COMPONENTS ON THE
DRILLED PCB
SOLDERING
END
CHAPTER: 5
SOURCE CODE –
#include c:\mc51\8051io.h
#include c:\mc51\8051reg.h
/*-------- turn lamp on/off after reset time to 18:00 ---------*/
#define onHour1 18 /* 18:00 turn lamp on */
#define onMin1 00
#define offHour1 18 /* 18:01 turn off */
#define offMin1 01
/* every day turn on at 19:00 and and off at 22:00 */
#define onHour2 19
#define onMin2 00
#define offHour2 22
#define offMin2 00
/* set clock to 18:00 when press P3.0 */
#define setHour 18
#define setMin 00
/*-------------------------------------------------------------*/
extern register char cputick;
unsigned register char sec25,sec50,sec,sec5,min,hour,flag1,temp,led,blink_rate;
/* variables description
cputick - increments by one every 20ms
sec25 - half second counter, sec50 - 2*25Hz counter
sec - current second, sec5 - 5 second counter
min - current min, hour - current hour
temp - temp register, led - counter for led on duration (times cputick)
blink_rate 0 = high blink rate, 10 low blink rate
flag1 - intertask signaling (mask byte), flag1.0 - set every 1 second (0x01)
}
/*-----------------------------------------------------------*/
}
time ()
/* update real-time clock, date */
{
sec25++;
if (sec25 >= 25) /* now 25 times means half second */
{sec25 = 0;
flag1 |= 0x08; /* set bit 3 every 0.5 s */
sec50++;
if (sec50 >= 2) /* 2 * 25 * 20 ms = 1 s */
{sec50 = 0;
flag1 |= 0x01; /* set bit 0 */
sec++;
if (sec >= 60)
{sec = 0;
flag1 |= 0x02; /* set bit 1 */
min++;
if (min >= 60)
{min = 0;
hour++;
if (hour >= 24)
{hour = 0;
}
}
}
}
}
}
comparetime()
{
if ((flag1 & 0x10) != 0) /* enabled only after P3.2 has been pressed */
{
compareTimeOn_Off();
}
}
compareTimeOn_Off()
{
if ((flag1 & 0x01)!=0)
{
testOnOff();
if(hour == onHour2 && min == onMin2)
asm" CLR LAMP";
if(hour == offHour2 && min == offMin2)
asm" SETB LAMP";
}
}
testOnOff()
{
if ((flag1 & 0x20) == 0)
{
if(hour == onHour1 && min == onMin1)
asm" CLR LAMP";
if(hour == offHour1 && min == offMin1)
{
asm" SETB LAMP";
flag1 |= 0x20; /* disable further test on off */
}
}
}
cpubeat()
{
beat5sec();
livecpu();
}
beat5sec() /* clear P3.7 every blink rate */
{
if ((flag1 & 0x08)!=0)
{
flag1 &= ~0x08; /* clear bit 3 of flag1 */
sec5++;
if (sec5 > blink_rate)
{sec5 = 0;
flag1 |= 0x40; /* set bit 6 of flag1 to signal livecpu task */
asm " clr P3.7"; /* make led on */
led = 2; /* load time on duration times cputick */
}
}
}
livecpu()
{
if ((flag1 & 0x40) != 0)
{
led--;
if (led == 0)
{
asm " setb P3.7";
flag1 &= ~0x40;
}
}
}
settime()
{
if ((P3 & 0x01) == 0) /* reset time to 18:00 if P3.1 low */
{
hour = setHour;
min = setMin;
sec = 0;
sec50 = 0;
flag1 |= 0x10; /* enable compare time on/off */
flag1 &= ~0x20; /* reenable testOnOff after pressing set clock to 18:00 */
blink_rate = 10;
}
}
/*
waithigh()
{
asm" jnb P3.2,*"; pause(2); asm" jnb P3.2,*"; pause(2);
}
pause(j)
int j;
{
int i;
for (i=0;i<j;i++);
}
*/
CHAPTER: 6
Then it is masked or pasted on a copper plate. This is done using a red hot iron.
Fig 3: Ironing
After that, etching is done (to remove the unwanted copper) using FeCl3. The final view of PCB
after etching is as following:
Drilling
Holes through a PCB are typically drilled with tiny drill bits made of solid tungsten carbide.
The drilling is performed by automated drilling machines with placement controlled by
a drill tape or drill file. These computer-generated files are also called numerically controlled
drill (NCD) files or "Excellon files". The drill file describes the location and size of each
drilled hole. These holes are often filled with annular rings (hollow rivets) to create vias.
Vias allow the electrical and thermal connection of conductors on opposite sides of the PCB.
The PCB after drilling looks like:
After all these processes, the components are mounted upon the PCB and are thus soldered upon.
Fig 1: Final View of the Circuit along with testing and measurements
CHAPTER: 7
It is cheaper.
It is easy to use.
It is portable.
Disadvantages :
It gets OFF after a fixed interval of time (not according to our wish).
Applications :
In street lights.
Future Enhancement: In future, the source code can be modified to a certain extent and
can be made more user-friendly. Even the AC supply can also be eliminated. By
generating more frequency, bulbs with larger power capability can also glow.
CHAPTER: 8
CONCLUSION –
Finally in conclusion the NLS (Night Light Saver) is a very useful circuit that can be used by
each and every one. Just imagine a light which automatically turns ON and OFF at a particular
time. It obviously suits the daily routine of a person such that he/she doesn’t need to take care of
the light. This also saves electricity, and hence known as NLS (Night Light Saver). This
microcontroller based project is very useful especially for personal use. It is portable, cheap, easy
to use and it also saves electricity.
APPENDIX I
AT89C2051 Microcontroller
APPENDIX II
MAC97A6 Triac –
APPENDIX III
APPENDIX IV
References –
i) www.kmitl.ac.th/~kswichit/saver5/saver5.htm
ii) www.hobbyprojects.com/quick_circuits_reference/microcontroller_circuits/AT89C2051_night_light_saver.html
iii) www.electronicsweekly.com/blogs/gadget-master/2007/07/sleep-easy-with-the-night-light-saver.html
iv) www.electronicsinfoline.com/CircuitBook/Microcontroller/Microcontroller_Projects/13655.html
v) www.scribd.com/doc/44970819/Night-Light-Saver-V5-0
vi) www.howcircuits.com/at89c2051-night-light-saver.html
vii) www.next.gr/microcontrollers/at89c2051-4051/Night-Light-Saver-II-
viii) Minor Project Report by Hitesh Vijayvargiya and Kundan Rathore (Year 2007-08)