An advanced energy saver project with DTMF capabilities to use electricity efficiently by reducing the unwanted uses.
- INTRODUCTION: A lot of electricity is wasted due to ignorance or fault of the user. Sometimes a person in the room turns on all the electric equipments which is of no use to them. As an example, supposedly a person enters in the hall or conference hall (where a large number of tube lights or fans are available). In the default scenario, all the equipments would be turned on which is just wastage of electricity or what if the number of people is not up to the capacity of the hall and the whole lot of equipment is being fed unnecessarily by the current. Also what if all the people went out leaving the switches on, consuming the energy until any one sees and turns them off.
- PROJECT DESCRIPTION:
In this project what I have done is the:
- Counting the no. of persons present in the room and providing automation according to the number of people present inside.
- Providing a remote control (DTMF) to the people inside which will allow them to choose which set of equipments to turn on for their comfortability.
Two Opto-Sensors have been used to sense the entry or exit of the people inside the hall.
Here, we have provided a password control for the authorized entry of the persons inside the room. In case the wrong password is provided, the lcd displays an “UNAUTHORIZED ENTRY” to the gatekeeper (an alarm can be triggered), who will take the necessary actions.
Once the authorized entry is made, the counter starts counting the number of people going inside the room. The moment the count starts from one – first row lights and fans are turned on. This row is turned on until the count reaches 4. (This number is in accordance to the no of seats in the first row).
When the count increases from 4 to 5, second row lights and fans are switched on. Similarly at 9, third row is on.
In a similar fashion, the count decreases also and the count if decreases to 8, the third row is turned off. If it becomes zero then all the switches are turned off. Thus automation takes place according to the no of persons.
DTMF control is provided for the persons willing to change their seats according to their comfort. The lights can be controlled by the mobile.
Keypad numbers Actions
> 1 Row1 lights on
> 2 Row1 lights off
> 3 Row2 lights on
> 4 Row2 lights off
> 5 Row3 lights on
> 6 Row3 lights off
- COMPONENTS USED:
- DTMF module:- IC 9170, crystal-3.579 MHz, Capacitor- 0.01 uF, Resistors-100K, 300K, 470, leds
- opto sensors module: optosensors, Resistance-330, 100K, IC 40106
- Relay module- IC uln 2003, 12V supply, Resistance-2K2, leds
- lcd with shown connections
- Kepad of 13 push-buttons
- Atmega 16 with the connections shown in figure.
- CIRCUIT DIAGRAM:
NOW COMES THE IMPORTANT PART…
- Interfacing of various modules with atmega16:
- DTMF module interfacing:
Dtmf ic 9170 is used to decode the dtmf signals coming from the mobile. The mobile is connected via an earphone, whose positive end is connected to pin 2 of 9170 through capacitor. The capacitor just filters out the unwanted dc components. Refer to its datasheet for its working.
The output of this decoder is obtained at pins 11-15 in the corresponding binary form.
Algorithm:
1. These pins are constantly checked for their values:
DDRD=0x0F; // output from dtmf => higher nibble as input
Void check()
{ unsigned char input;
> Input = PIND&0xF0
> While(1) {
> Switch (input)
> {
> Case 1: (light 1 on)
> Case 2: (light 1 off) , and so on…
> }}}
2. OPTO-SENSORS Interfacing:-
Whenever anything comes b/w the two ends of the opto sensors, a high is sent to the pin1 of ic 40106. The 40106 invert the logic of pin1 and produces low at pin2. Similarly for pin 3 input..
The output at 2&4 is connected to interrupt pin of ATMEGA16.
So ultimately, whenever any intrusion is detected, interrupt is sent to the ATMEGA16 controller.
Corresponding c function would b:
ISR (INT0_vect)//entry
{
. entry_flag=1;
. if(exit_flag==1)
. { number++;
. exit_flag=0;
. entry_flag=0;
. lcd_show_string(“no of persons-”);
. dis_cmd(0xC0); //change the line
. _delay_ms(1);
. buf[0]=number;
. buf[1]=”;
. lcd_show_string(buf);
. _delay_ms(500);
. lcd_clear(); _delay_ms(2);
. }
. }
ISR (INT1_vect)//exit
{
. exit_flag=1;
. if(entry_flag==1)
. { number–;
. entry_flag=0;
. exit_flag=0;
. lcd_clear();_delay_ms(2);
. lcd_show_string(“no of persons”); _delay_ms(2);
. dis_cmd(0xC0); _delay_ms(1);
. lcd_show_string(number_per);
. buf[0]=number;
. buf[1]=”;
. lcd_show_string(buf);
. _delay_ms(500);
. lcd_clear();
. _delay_ms(2);
. }
. }
NOTE: main( ) function will have sei( ) called to activate interrupt; and <interrupt.h> included in the header file list.
3. INTERFACING KEYPAD :
Columns are connected to higher nibbles and rows to lower. Each column one after another is made to ground after from their high Impedence states and the corresponding rows are checked. Or vice versa too.
suppose 3rd button is pressed. Now as per routine, col1 is grounded and row[1-4] is checked for ground, which will return false here. Similarly for col2. For col 3 grounded, when rows are checked, row 1 will return true as key3 is pressed shorting row1 and col3. And thus, corresponding key pressed can be detected.
Code:
KBPORT is the key-board port.
KBDDR= 0x0f; //higher nibble – input, lower nibble – output
KBPORT= 0xff; //pull-up enabled for higher nibble
static unsigned char pos;
static unsigned psswrd[5];
. while(1)
. {
. HigherNibble = 0xff;
. for(i=0; i<3; i++)
. {
. _delay_ms(1);
. KBPORT = ((0b11111110) << i);
. HigherNibble = KBPIN | 0x0f;
. if (upperNibble != 0xff)
. {
. _delay_ms(20); //key debouncing delay
. HigherNibble = KB_PORT_IN | 0x0f; //higher nibbles are selected
. if(HigherNibble == 0xff) //checking whether any button pressed
. goto OUT;
. keyCode = (HigherNibble & 0xf0) | (0x0f & (0b11111110 << i));
. //ORing the upper nibble for column, and lower nibbles for rows.
. while (HigherNibble != 0xff)
. HigherNibble = KBPIN | 0x0f;
. //once keycode is obtained, this will check for the release of button. and while is exited only at release.
. _delay_ms(50); //key debouncing delay to settle
. switch (keyCode)
. {
. case (0b 0011 1110): store_print(1); break;
. case (0b 0101 1110): store_print(2); break;
. case (0b 0110 1110): store_print(3); break;
. case (0b 0011 1101): store_print(4); break;
. case (0b 0101 1101): store_print(5); break;
. case (0b 0110 1101): strore_print(6); break;
. case (0b 0011 1011): store_print(7); break;
. case (0b 0101 1011): store_print(8); break;
. case (0b 0110 1011): store_print(9); break;
. case (0b 0011 0111): passwrd_check();
. break;
. case (0b 0101 0111): key = ’0′; break;
. case (0b 0110 0111): key = ’12′;
. goto again; // go to some label defined in main function
. break;
. }//end of switch
. lcd_show_string(“*”);
. OUT;
. }//end of if
. }//end of for
. }//end of while(1)
. }
4. RELAY INTERFACING:
Relays require high current for their operation. But micro-controllers work at lower currents (few mA). So a darlington pair ic ULN2003 is used to provide the heavy current and provide isolation between these two.
When the pin 1 of ULN2003 is provided high input from the microcontroller, correspondingly pin 12 goes to ground (see the circuit diagram for pin connections)and current flows in the relay which make it move from NC to NO.
video for the password and counter part:
for the dtmf part:
Hope you people liked this project.. Comments plzzzzz..
great work :D
ReplyDeletethanx alot :)
ReplyDelete