Saving electricity is a major concern for domestic and industrial units. We always try hard to save electricity in many ways to reduce our electricity bills, but due to some unknown and unforeseen circumstances our efforts do not normally transform in saving electricity. Adding to our woes, we may at times forget to switch off electrical gadgets when we are not using them, especially the AC’s. This not only results in mounting electricity bills, but we also forget the fact that a resource of National Importance is being wasted. To overcome the above shortcomings, a prototype model is created which doesn’t hurt our pockets too. The name of the project is “Coin Operated Timer Control Power Supply Box to Control AC Appliances”.
It is assumed that the reader has gone through the project How to get started with AVR and Interface LCD with AVR.
Fig. 1: Prototype of Coin Operated Prepaid Power Supply System
Prototype View of Coin Operated Timer Control Power Supply Project
Block Diagram
Fig. 2: Block Diagram of AVR ATMega16 based Coin operated Prepaid Power Supply System
Block Diagram Description
Power supply for the complete unit can be derived from the mains using a step-down transformer of 230V AC primary to 0-12V, 500mA secondary. A full- wave rectifier followed by a capacitor filter is the output voltage and feeds it to the 5-volt regulator (LM7805) whose output is used for the power supply requirements of microcontroller circuit, other IC’s.
Fig. 3:
Circuit Diagram of AC to DC Power Supply Unit
Fig. 4: Prototype of AC to DC Power Supply
4) Relay
Fig. 5: Circuit Diagram of SPDT Relay
A relay is an electro-mechanical switch that opens and closes under the control of another electric circuit. When current flows through the coil of the relay, a magnetic field is created which causes the armature to move, either making or breaking an electrical connection. When current is removed from the relay coil, the armature returns to its rest position. It is important to place a diode across the coil of the relay because a spike of voltage is generated when the current is removed from the coil due to the collapse of the magnetic field. This voltage spike can damage the sensitive electronic components controlling the circuit.
Fig. 6: Circuit Diagram of Transistor based Relay Driver
(*NOTE:In this project, I am using 12V DC relay)
5) IR Sensor
Fig. 7: Circuit Diagram of IR Sensor Module
(NOTE*: For more details, please refer to the tutorials on web or Engineer’s Garage website)
Working Principle
Circuit Diagram
For circuit diagram please click on crcuit diagram tab
Working Principle
Fig. 8: Image showing display panel of coin operated Prepaid DC Power Supply
Fig. 9: Image showing display panel in action on Prepaid Dc Power Supply System
Fig. 10: Image showing duration of power supply charged by coins on Prepaid DC Power Supply System
(*NOTE: If you are not aware of TIMER Functions, please go through its tutorials which are easily available on web or visit a technical tutorial website.)
This marks the completion of the project, where the desired end result is successful. For your benefit I have a video of the working and another clip of the Proteus Simulation for better understanding of the project.
Project Source Code
###
#include<avr/io.h> #include<util/delay.h> #include "lcd_lib.h" #include "adc_lib.h" #include <stdio.h> #include<avr/interrupt.h> #include<timer0.h> char A[20]="" ,ms=0,sec=0,min=0,hr=0; unsigned int i,j,k; unsigned char B[16]; unsigned char C[16]; main (void) { ADCinit(); LCDinit(); LCDclr(); LCDcursorOFF(); DDRB=0xf0; DDRD=0xff; while(1) { PORTB=0x0f; i=read_adc(0); i=i/2; if(i>200) { k++; LCDclr(); LCDGotoXY(0,1); sprintf(C,"No of Coins= %d",k); LCDstring(C,strlen(C)); _delay_ms(1000); } else if(bit_is_clear(PINB,PB1)) { set_timer0_normal(); set_timer0value(0); set_timer0_prescalar(5); enable_timer0_overflowint(); sei();// enable interrupts PORTD=1; } else if(min==k) { stop_timer0(); PORTD=0; LCDclr(); LCDGotoXY(0,0); LCDstring(" Welcome ",15); LCDGotoXY(0,1); LCDstring("Plz insert Coin",15); _delay_ms(1000); } }} ISR(TIMER0_OVF_vect){ set_timer0value(10); ms++; if(ms>10){ ms=0;sec++; if(sec>59){ sec=0;min++; if(min>59){ min=0;hr++; if(hr>23){ hr=0; } } } sprintf(A," <<<%d:%d:%d>>> ",hr,min,sec); LCDGotoXY(0,0); LCDdisplay(A); } }###
Circuit Diagrams
Project Datasheet
Project Video
Filed Under: Electronic Projects
Filed Under: Electronic Projects
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.