free 8051 Microcontroller Projects AVR PIC Microcontroller Projects Tutorials Ebooks Libraries, interfacing tutorials, lcd tutorial, stepper motor, dc motor 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems

 
8051 microcontroller 8051 microcontroller
Forums

Rickey's World :: Discussion Forums :: Project Development :: Project Help
 
<< Previous thread | Next thread >>
Building a MCS51 that operates a door
Go to page       >>  
Moderators: Ajay Bhargav, Arun Kumar V, pdi33, Shailesh NAYAK, ۞ TPS ۞, shyam, sashijoseph, ExperimenterUK, DavesGarage
Author Post
IonescuA
Sat May 30 2009, 02:13PM
 User Offline
Registered Member #18920
Joined: Sat May 30 2009, 02:07PM

Posts: 6
Thanked 0 times in 0 posts
Can anyone show me how to design a system that has 3 components : 1. a door bell , 2. a button to open up the door , 3. an electrically controlled lock
The point is to make the system that operates a door , when the door bell is rang u can choose to push the button and open the lock. Must be written in Keil C.
Any suggestions, solution or pointers are much appreciated.
Thanks in advance.



[ Edited Sat May 30 2009, 02:13PM ]
Back to top

rearthur2003
Sat May 30 2009, 06:18PM

 User Offline
Registered Member #10733
Joined: Thu Sep 18 2008, 11:54AM

Posts: 16
Thanked 0 times in 0 posts
is it opening and closing or what
Back to top

IonescuA
Sat May 30 2009, 07:14PM
 User Offline
Registered Member #18920
Joined: Sat May 30 2009, 02:07PM

Posts: 6
Thanked 0 times in 0 posts
yes the button opens the door (basically operates the lock to open) , u have to close the door manually

[ Edited Sun May 31 2009, 02:56AM ]
Back to top

ExperimenterUK
Sun May 31 2009, 12:54PM
 User Offline
Registered Member #9602
Joined: Tue Aug 05 2008, 04:15PM

Posts: 1254
Thanked 199 times in 198 posts
Can you explain why you need to use a microcontroller.

You could just wire the lock to the button.
Back to top


This post has been thanked 1 time
 IonescuA 
IonescuA
Sun May 31 2009, 01:18PM
 User Offline
Registered Member #18920
Joined: Sat May 30 2009, 02:07PM

Posts: 6
Thanked 0 times in 0 posts
It is more or less a didactic example , so i can understand the basics for a more complicated project. And i need to figure out how to create simulation in Proteus Isis for it . Maybe think about it as if it were a basic package where u can add more options later like an alarm, different ringtones for the bell or a fingerprint scanner to open the door etc.
Just the very basic would help me a lot to understand right now .
Thanks for the interest again and waiting for a reply.
Back to top

ExperimenterUK
Sun May 31 2009, 03:51PM
 User Offline
Registered Member #9602
Joined: Tue Aug 05 2008, 04:15PM

Posts: 1254
Thanked 199 times in 198 posts
Connect the button to an input pin of your micro.
Add a pull up resistor(1K) to keep the pin HIGH until the button connects it to ground.

Use a transistor or purpose made driver chip such as the ULN2003 to switch
your door latch.

Door latches are basically relays,so follow any advice given here for switching relays.
IE check that the current is not too high for the driver, and always fit a diode
across the coil.

Connect your driver (transistor or ULN2003) to an output pin of your micro.

Most pins on a micro can be made input or output. (read the data sheet).
It's simplest for now to make all pins on one port IN and all on one port OUT.

Write a very simple program that goes in a loop.

StartLoop:

Read the IN port..
IF the button pin is low (button pressed), set the relay pin of the OUT port high... (open the door).
IF not (ELSE) set the OUT pin low (door locked)
Jump back to StartLoop










[ Edited Thu Jun 04 2009, 02:58AM ]
Back to top


This post has been thanked 1 time
 IonescuA 
IonescuA
Tue Jun 02 2009, 04:17AM
 User Offline
Registered Member #18920
Joined: Sat May 30 2009, 02:07PM

Posts: 6
Thanked 0 times in 0 posts
Thanks a lot ExperimenterUK , i am trying to implement it right now , I really apreciate your help .
I was thinking of a way to make things more interesting , like considering that the door has a spring to keep it locked , I could add a sensor to detect whether the door is closed or being help open , and only when it is closed to automaticly close the door latch.
To this end I was thinking of a timer of something like 5 secs in witch the latch is kept open prior to the button being pressed , giving the person outside a limited time to open the door.
After the person sitting outside the door , opens the door , the system will wait for the sensor to indicate that the door is closed before closing the latch again. Was also trying to think of a smart way to connect the door bell but nothing comes to mind thus far.
So looking forward to seeing your suggestions or possible solutions. Thanks again and waiting on your answers.


[ Edited Tue Jun 02 2009, 05:05AM ]
Back to top

Ajay Bhargav
Tue Jun 02 2009, 06:48AM
Rickey's World Admin

 User Offline

Registered Member #1
Joined: Fri Feb 24 2006, 04:56AM

Posts: 7542
Thanked 1330 times in 1254 posts
You might have came across the doors with magnetic locks.. did you?

they are same as you are trying to make. there is an access system outside and inside the door. outside normally a swipe card or keypad to for code and inside a switch to open the door. door is locked using a high power magnet, magnet deactivates if correct code is entered or if the door open switch is pressed from inside the room. and after the door is closed magnet activates again.

So in your case, are you trying to have any access system or just a simple door open switch on both sides (inside and outside)? you can make use of IR sensors to detect the position of door (close or open).

so pseudo code will be something like this..

button pressed.
open door..
wait for door open or 5 sec timeout..
if 5 sec timeout first then close the latch again, or if door is opened, wait for door close and then active the latch.

www.rickeyworld.info
If you feel satisfied with the user's forum reply please click on the thank button.

Obey forum rules!
Respect others!
Back to top


This post has been thanked 1 time
 IonescuA 
IonescuA
Wed Jun 03 2009, 02:03PM
 User Offline
Registered Member #18920
Joined: Sat May 30 2009, 02:07PM

Posts: 6
Thanked 0 times in 0 posts
Thanks Ajay , magnetic locks seem perfect for what I had in mind.
However i am still new with working in this environments and I am working a bit slow having limited time to dedicate to this .So i am having some problems with making the relay activate as I want it to and also I am sometimes getting a warning that the CPU is too highly solicitated , will post what i have done so far , so you can give me some hints
I uploaded it all here

and btw could i introduce a motor to close and open the door in the simulations in ISIS ?

[ Edited Wed Jun 03 2009, 02:06PM ]
Back to top

DavesGarage
Wed Jun 03 2009, 02:34PM

 User Offline
Registered Member #14254
Joined: Tue Jan 20 2009, 08:14AM

Posts: 621
Thanked 116 times in 112 posts
A word of constructive criticism:

Try and add comments to your software, so it is easier to understand, not only for yourself, but for others that have to read it later...

Here is an annotated version of your code:
CODE:
#include <reg52.h>

// bit definitions...
sbit button1   = P1^0;
sbit button2   = P1^2;
sbit releu     = P1^1;
sbit sonerie   = P1^3;

// function prototypes...
void wait (const unsigned int DELAY);
     
// -----------------------------------------
// function: wait()                        
//                                          
// parameters:                              
//   DELAY - time in milliseconds to delay  
// -----------------------------------------
void wait( const unsigned int DELAY )
   {
   unsigned int x, y;
   for (x = 0; x <= DELAY; x++)
      {
      for (y = 0; y <= 120; y++);
      }
   }

// -----------------------------------------
// function: main()                        
//                                          
// parameters:                              
//   none                                  
// -----------------------------------------
void main( void )
   {
   /* repeat forever... */
   while(1)
      {
      /* check button1... */
      if (button1 == 1)
         {
         /* activate relay... */
         releu = 1;
         wait(1000);
         }
      else
         {
         /* deactivate relay... */
         releu = 0;
         }
     
      /* check button2... */
      if (button2 == 1)
         {
         /* activate alarm... */
         sonerie = 1;
         }
      else
         {
         /* deactivate alarm... */
         sonerie = 0;                          
         }
      }
   }
 
 


Hope this helps,


-Dave
"Basic research is what I am doing when I don't know what I am doing"
Back to top


This post has been thanked 1 time
 IonescuA 
Go to page       >>   

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System

8051 Microcontroller Projects 8051 AVR tutorials PIC microcontroller, 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems