أنت هنا:إصنعها»أردوينو»مشاريع أردوينو»قفل آلي لأبواب المحلات

قفل آلي لأبواب المحلات

كتبه مشاريع أردوينو 48116 1
آخر تعديل في الأربعاء, 09 كانون1/ديسمبر 2020 13:16
قفل آلي لأبواب المحلات
قيم الموضوع
(3 أصوات)

الفكرة من هذا المشروع هي التحكم بقفل آلى عن طريق بطاقة الأردوينو.

 


تقديم

أحاول هنا تحويل قفل كهربائي يعمل بالمحرك إلى قفل آلي أتحكم به من مسافة بعيدة. ومن الممكن أن يكون تنفيذ هذه الفكرة في المنزل يحتاج إلى دارة تحكم مركزية، ولكن سأقوم بتنفيذها الآن على باب واحد ومنزلق مثل أبواب المحلات والمتاجر.

  


القفل الآلي

 

  • الوظيفة الأولى هي فتح وإغلاق القفل عند الضغط على زرار التحكم.

 

الوظيفة الثانية هي إيقاف القفل بعد أن يتم فتح الباب أو غلقه بشكل كامل.

 

الوظيفة الثالثة هي إيقاف الباب عند الضغط على زر التحكم للتوجيه للأعلى في الوقت الذي ينزل فيه الباب للأسفل.

 

الوظيفة الرابعة هي إيقاف الباب عند الضغط على زر التحكم للتوجيه لأسفل في الوقت الذي يصعد فيه الباب لأعلى.

 

 

 


المبدأ

 

الفكرة العملية هي أن بطاقة الأردوينو تقوم بحساب الفراغات بين ألواح الباب المنزلق عن طريق حساس الأشعة تحت الحمراء، ثم تقوم بتحديد موقع الباب المنزلق بالضبط. واستخدمتخيطين من الصنف LAN لتوصيل بطاقة الأردوينو بالحساس.

 

ملاحظة: تستخدم في الاتصال بالشبكة العنكبوتية.

  


الدارة الكهربائية

1

إذا كانت الدارة الكهربائية غير واضحة بالنسبة لك فقم بتحميلها من الرابط التالي:

الدارة الكهربائية

 

تم تركيب المؤقت NE555 كمتعدد الإهتزاز غير قار، ويقوم بتوليد مموجة مربعة بتردد 38 كيلوهرتز من أجل تشغيل باعث الأشعة تحت الحمراء.

مستقبل الأشعة تحت الحمراء هو المركب TSOP1138 مزود بمصفاة داخلية للتردد 38 كيلوهرتز. بالنسبة للإشارة الناتجة فيمكن إيصالها مباشرة بالمعالج المصغر (Microprocessor). ومن أجل سلامة بطاقة أردوينو فقد تم إيصال المخارج بعازلين كهروضوئيين (opto-isolator) رغم أنهما ليسا مهمين في الحقيقة.

 

في النهاية قمت باستعمال محركين باستعمال مرحلين 14 فولط (Relay, Relais) وبعض المركبات الأخرى القليلة كمقحلين (ترنزستورين) من صنف 2N1711، وصمامين ثنائيين ومزود كهربائي 12 فولط.

3

2


البرمجة

قم بتحويل الشيفرة البرمجية التالية إلى قلب بطاقة أردوينو عن طريق الحاسوب وبرنامج أردوينو:

 

// costants:

const int sm = 2;            // moviment sensor

const int buttonPin_t3 = 5;     // button up

const int buttonPin_t2 = 4;     // button down

const int ledPin = 13;             // LED for check buttons

const int d1 = 11;        // motor UP

const int d0 = 12;    // motor DOWN

 

// variables

int ContatoreSensoreMovimento = 0;   // counter move sensor

int Contatore_t3_t2 = 0;

int RegistroOutputd1 = 0;

int RegistroOutputd0 = 0;

 

// variables sm:

int State_sm = 0;     // state

int lastState_sm = 0; // last state

// variabili t3:

int buttonState_t3 = 0;            // state

int lastButtonState_t3 = 0;      // last state

// variabili t2:

int buttonState_t2 = 0;           // state

int lastButtonState_t2 = 0;     // last state

void setup() {

// initialization input pin:

pinMode(sm, INPUT);

pinMode(buttonPin_t2, INPUT);

pinMode(buttonPin_t3, INPUT);

// initialization output pin:

pinMode(d1, OUTPUT);

pinMode(d0, OUTPUT);

pinMode(ledPin, OUTPUT);

// iinitialize serial communications at 9600 bps:

Serial.begin(9600);

}

 

void loop() {

// sm

// read pin:

State_sm = digitalRead(sm);

// compare the buttonState to its previous state

if (State_sm != lastState_sm) {

// if the state has changed, increment the counter

if (State_sm == LOW) {

  // if the current state is LOW then

  // wend from off to on:

           if (RegistroOutputd1 == 1) {

         ContatoreSensoreMovimento++; 

           }  

            if (RegistroOutputd0 == 1) {

         ContatoreSensoreMovimento--; 

           }

          Serial.println("on_sm");

  Serial.print("ContatoreSensoreMovimento:  ");

  Serial.println(ContatoreSensoreMovimento, DEC);

}

else {

  // wend from off to on:

  Serial.println("off_sm");

}

}

// save the current state as the last state

// for next time through the loop

lastState_sm = State_sm;

if (ContatoreSensoreMovimento % 4 == 0) {

digitalWrite(ledPin, HIGH);

}

else {

digitalWrite(ledPin, LOW);

}

 

// t3

// read pin:

buttonState_t3 = digitalRead(buttonPin_t3);

// compare the buttonState to its previous state

if (buttonState_t3 != lastButtonState_t3) {

// if the current state is HIGH then:

if (buttonState_t3 == HIGH) {

  // if counter is  <1:

  if (Contatore_t3_t2 < 1) {

     // increment the counter

     // wend from off to on:

Contatore_t3_t2++;

Serial.println("on_t3");

Serial.print("Contatore_t3_t2:  ");

Serial.println(Contatore_t3_t2, DEC);

  }

}

else {

  // if the current state is LOW then

  // wend from on to off

  Serial.println("off_t3");

}

}

// save the current state as the last state

// for next time through the loop

lastButtonState_t3 = buttonState_t3;

//valore massimo contatore 1

 

// t2

// lettura del pin:

buttonState_t2 = digitalRead(buttonPin_t2);

// compare the buttonState to its previous state

if (buttonState_t2 != lastButtonState_t2) {

// if the current state is HIGH then:

if (buttonState_t2 == HIGH) {

  // if counter is >-1:

  if (Contatore_t3_t2 > -1) {

     // increment the counter

     // wend from off to on:

     Contatore_t3_t2--;

Serial.println("on_t2");

Serial.print("Contatore_t3_t2:  ");

Serial.println(Contatore_t3_t2, DEC);

  }

}

else {

  // if the current state is LOW then

  // wend from on to off:

  Serial.println("off_t2");

}

}

// save the current state as the last state

// for next time through the loop

lastButtonState_t2 = buttonState_t2;

 

if (ContatoreSensoreMovimento < 35 && Contatore_t3_t2 == 1) {

digitalWrite (d1, HIGH);

           RegistroOutputd1 = 1;

}

else {

digitalWrite (d1, LOW);

           RegistroOutputd1 = 0;

if (ContatoreSensoreMovimento == 35 && Contatore_t3_t2 == 1) {

  Contatore_t3_t2 = 0;

}

}

if (ContatoreSensoreMovimento > 0 && Contatore_t3_t2 == -1) {

digitalWrite (d0, HIGH);

           RegistroOutputd0 = 1;

}

else {

digitalWrite (d0, LOW);

           RegistroOutputd0 = 0;

if (ContatoreSensoreMovimento == 0 && Contatore_t3_t2 == -1) {

  Contatore_t3_t2 = 0;

}

}

}

 

  

 


بعض الصور من المشروع

  


تأليف

 

المؤلف: robertodelle

ترجمة: عبد الله سعد عبد الستار فراج (الجيزة – مصر)

{jumi [*3]} 


المراجع

 

http://blog.makezine.com/projects/automatic-shutters/

التعليقات  

ahamd
+1 # ahamd 2013-06-22 20:51
رائع جدا
ممكن أعرف نوعية المحركات المستخدمة ؟؟
وهل يمكن استخدام محركات السيرفووو في هذا المجال ؟
رد | رد مع اقتباس | اقتباس | تقرير إلى المدير

أضف تعليقا


إصنعها يريد أن يتأكد أنك لست روبوتا، لذلك أحسب ما يلي:

كود امني
تحديث