Wednesday, August 21, 2013

Real Time Switch - Final Year Project Electronics



We have implemented a real time switch which will allow the user to put on/off his circuitry according to his requirement. In almost every industry, household appliances, agricultural activities, the use of this system proves advantageous. In this project the user needs to enter the on time and the off time. hence the micro-controller will automatically switch on and off accordingly. if the power is disconnected, the entered data need not to be re-entered. if the power is disconnected between the on-off time, the micro-controller will switch on the output circuitry immediately after the power is supplied…this feature is important in case of electrical devices which requires starters such as motors, actuators etc. as this whole circuitry works as a switch which operates on real time (24hrs/12hrs) hence it is named as real time switch. Thus this project will help in automation of industries, agricultural activities and home appliances and hence will reduce the efforts.
Specifications
Circuit specifications
·         It displays 24 hours clock on switching on the circuit.
·         It allows the user to enter the switch on time and the switch off time.
   
Electrical specifications
·         IC’s   rtc-ds1307 operates on +5volts supply and +3.5volts battery backup, at89c51 operates on +5 volts
·         relay used operates on 5 volts and is normally open in nature.
·         transformer ratings are:
·         230 volts primary.
·         9 volts secondary.
·         1.5 A current capacity.
·         25:1 turns ratio.


I/O specifications
·         input: real time (on and off time)
·         output: 7-segment clock display and lamp through relay.
There are six main blocks which play an important role in performing the operation. The blocks are as follows-
·         Microcontroller.
·         Real time clock (rtc).
·         Input switches
·         Seven segment display
·         Power supply circuit
·         Relay driver circuit.

Microcontroller
This is the brain of the whole system which controls and gives commands to the rtc and the other circuitry. it will switch on &off the output relay circuitry according to requirement of user. it will also display current time on 7-segment display. Here we are using at89c51 microcontroller which is compatible with intel 8051 instruction set. The microcontroller will generate the at commands, which are required by the user to monitor the system. It will also check the status of the rtc and take the decisions accordingly. the communication between microcontroller and computer is through serial communication.
Real time clock
It is the ic which gives 12/24 hrs clock output to the microcontroller so that microcontroller can operate on this time. Here we are using rtc-ds1307 manufactured by dallas semiconductors. Real time clock counts seconds,   minutes , hours, date of the month, month, day of the week, and year with leap year compensation valid up to 2100.it has56 byte nonvolatile ram for data storage .


Operation
The ds1307 operates as a slave device on the serial bus. Access is obtained by implementing a start condition and providing a device identification code followed by a register address. Subsequent registers can be accessed sequentially until a stop condition is executed. When vcc falls below 1.25 x vbat the device terminates an access in progress and resets the device address counter. Inputs to the device will not be recognized at this time to prevent erroneous data from being written to the device from an out of tolerance system. When vcc falls below vbat the device switches into a low current battery backup mode. Upon power up, the device switches from battery to vcc when vcc is greater than vbat +0.2v and recognizes inputs when vcc is greater than 1.25 x vbat. the block diagram in figure 1 shows the main elements of the serial real time clock.
Power supply
The voltage required to operate is +5v (regulated). The regulated +5v is generated using ic7805. the input for this regulator ic is rectified and the filters from full wave rectifier and capacitor filter. The output is obtained and is given to the microcontroller and the sensors.

Input switches
Here we have used five input switches as
·         time set switch
·         on time switch
·         off time switch
·         hours adjust switch
·         minutes adjust switch
 We have used push buttons here.
7-segment display
In the circuit, we are using common anode type 7-segment display with a driver ic uln2803 which will make 7-segment display compatible with microcontroller output.

Relay driver section
The relay driver circuit is build up to get the output. A 12volt relay along with a output lamp forms the output part. This lamp glows in the time span given by the user i.e it gets on at the on time and gets off when off time is reached.
modulewise description

·         The block diagram of the real time switch can be classified as follows
·         There are 6 main blocks in the system
·         Microcontroller section
·         rtc section
·         Input switches section
·         Seven segment display section
·         Relay driver section
·         Software section
·         Power supply section
Microcontroller section
Starting with the crystal which has the clock frequency of 11.0592 mhz has been used along with the capacitor of 33pf. the crystal generates the clock pulses which are fed directly to the pins 18 and 19. Capacitor c of 10µf and the resistance r of 10kΩ are used to reset the microcontroller by pressing the switch connected in parallel with the capacitor. So baud rate of microcontroller is 9600. rtc is interfaced to microcontroller using wires.scl and sda pins of rtc are connected to port pins 26 and 25 respectively. Microcontroller initiates rtc and make it work. the data from rtc memory is accessed using i2c bus protocols. Switches are connected to port1 of microcontroller. Common anode seven segment display is interfaced to port0 of controller. thus we are getting output at port pin 27 i.e. we have connected relay circuit at this pin. Microcontroller is continuously accessing current time from rtc & displaying it on 7-segments. It is controlling relay circuitry according to on/off times entered through switches.  


rtc section
ic ds1307 is a real time clock. It is a 6 pin ic. The ds1307 serial real time clock is a low power, full bcd clock/calendar plus 56 bytes of nonvolatile SRAM. Address and data are transferred serially via a 2-wire bi-directional bus. The clock/calendar provides seconds, minutes, hours, day, date, month, and year information. the end of the month date is automatically adjusted for months with less than 31 days, including corrections for leap year. the clock operates in either the 24-hour or 12-hour format with am/pm indicator. the ds1307 has a built-in power sense circuit which detects power failures and automatically switches to the battery supply. When vcc falls below vbat the device switches into a low current battery backup mode. upon power up, the device switches from battery to vcc when vcc is greater than vbat +0.2v and recognizes inputs when vcc is greater than 1.25 x vbat.
scl (serial clock input) - scl is used to synchronize data movement on the serial interface.                                             sda (serial data input/output) - sda is the input/output pin for the 2-wire serial interface. the sda pin is open drain which requires an external pull-up resistor.
Clock and calendar
The time and calendar information is obtained by reading the appropriate register bytes. The time and calendar are set or initialized by writing the appropriate register bytes. The contents of the time and calendar registers are in the binary-coded decimal (bcd) format. Bit 7 of register 0 is the clock halt (ch) bit. When this bit is set to a 1, the oscillator is disabled. When cleared to a 0, the oscillator is enabled.



Inputs switch section
Using this section the user can enter the span to get the output from the relay driver circuit.the operation of the switches is illustrated below.
Time set switch
This switch is required to set the current time initially.
On time switch
By using this switch the user can enter his on time. For this purpose this switch has to be pressed and the time is then set by adjusting the hours and mins switch.
Off time switch
By using this switch the user can enter his off time. for this purpose this switch has to be pressed and the time is then set by adjusting the hours and mins switch.
Hours adjust switch
This switch is used to adjust the hours in the time displayed .by pressing this switch once the hours get incremented by one and this is the only way to set the hours.
Minutes adjust switch
This switch is used to adjust the mins in the time displayed. By pressing this switch once the mins get incremented by one and this is the only way to set the mins.
Seven segment display section
The four seven segments used will display the real time clock in 24hr format with hours and mins. on pressing the respective switches it will display the data associated with it. For example if we press the on time switch then it will display the on time given by the user. 
Software section
The i2c bus protocol:
The i2c bus physically consists of 2 active wires and a ground connection. The active wires, called sda and scl both are bi-directional. sda is serial data line and scl is serial clock line. Every device hooked up to the bus has its own unique address, no matter whether it is an mcu, lcd driver, memory, or asic. Each of these chips can act as a receiver and/or transmitter depending upon functionality. Obviously an lcd driver is only a receiver, while a memory or i/o chip can be both transmitter and receiver. The i2c is a multi master bus. This means that more than one ic capable of initiating a data transfer can be connected to it. The i2c specifications state that the ic that initiates data transfer on the bus is considered as bus master. Consequently, at that time, all other ics are referenced as bus slaves.

Relay driver section
Using a relay driver circuit since it acts as a switch. So to demonstrate the real time switch we have put a lamp with the relay driver circuit as the load. This lamp will glow only in the time duration given by the user .by using relay driver circuit input and output circuits are isolated. it allows to drive a higher voltage load with a lower voltage at the relay input.
Power supply section
Designing a +5volt power supply using 9:0:9 step down transformer and regulator ic 7805.this +5 volt supply is then given to all the blocks of the circuit.
Algorithm
Start
Accept time, day and date from r.t.c.
Read time.
Display the current time
Compare the r.t.c time with the on/off time entered through switches                                                                                                                                                         if time does not match then return to the program and check it again and again.  If time matches, switch on/off relay circuit.
Display the time
Display regular clock
Return to start.
End

Applications of the system
                       
Agriculture sector to reduce man efforts and time
The institutes like colleges and companies to operate lights, fans, acs, alarms at working time
Home appliances
Manufacturing industry i

0 comments:

Post a Comment