Search Code

የአርዱኖ ተጫን አዝራር በመጠቀም ሪሌይ እና ኤሲ አምፖልን ለመቀየር

የአርዱኖ ተጫን አዝራር በመጠቀም ሪሌይ እና ኤሲ አምፖልን ለመቀየር

በዚህ ትምህርት ውስጥ፣ የAC አምፖል ወይም የLED መብራትን የገፋ ቁልፍ እና ሪሌይ በመጠቀም እንዴት መቆጣጠር እንደምንችል እንማራለን። የገፋ ቁልፉ መብራቱን ያብራና ያጠፋዋል፣ ቁልፉ ሲለቀቅም ሁኔታውን ይይዛል። ይህ ዝግጅት ተግባራዊ ብቻ ሳይሆን ከሪሌይ እና ከAC ጭነቶች ጋር ለመስራት ጥሩ መግቢያ ነው።

5V LOW-LEVEL trigger relay

ወደፊት ስንሄድ፣ አስፈላጊ የሆኑትን ክፍሎች፣ የሽቦ መገጣጠሚያ መመሪያዎችን እና ይህን ፕሮጀክት የሚያስቻለውን የአርዱኖ ኮድ እንሸፍናለን። ለእይታ መመሪያ እና ዝርዝር ማብራሪያዎች ተያያዥ የሆነውን ቪዲዮ መመልከትዎን ያረጋግጡ (በቪዲዮው 00:00 ላይ)።

5V LOW-Level triggered Relay module

ሃርድዌር ተብራርቷል

ለዚህ ፕሮጀክት፣ የሪሌይ ሞጁል፣ የአርዱኖ ቦርድ እና የገፋ ቁልፍ እንጠቀማለን። የሪሌይ ሞጁሉ እንደ አምፖል ያሉ ከፍተኛ የቮልቴጅ AC ጭነቶችን መቆጣጠር የሚችል ማብሪያ/ማጥፊያ ሆኖ ይሰራል፣ በዝቅተኛ የቮልቴጅ የአርዱኖ ምልክቶች እየተቆጣጠረ። የሪሌይ ሞጁሉ ጭነቱን ለማገናኘት ሶስት ዋና ተርሚናሎች አሉት፡- ኮመን (COM)፣ ኖርማሊ ኦፕን (NO) እና ኖርማሊ ክሎዝድ (NC)።

የገፋ ቁልፉ የሪሌይን ሁኔታ ለመቀየር እንደ ተጠቃሚ በይነገጽ ያገለግላል። በአርዱኖ ላይ ካሉት ዲጂታል ፒኖች በአንዱ ጋር ተገናኝቷል። ቁልፉ ሲጫን፣ ለአርዱኖ ምልክት ይልካል፣ ከዚያም አርዱኖው ሪሌዩን ያጠቃልላል ወይም ያጠፋዋል። ይህ ቀላል መስተጋብር መብራቱን በቀላሉ እንድንቆጣጠር ያስችለናል።

ለሪሌይ የዳታሼት ዝርዝሮች

አምራችSongle
የክፍል ቁጥርSRD-05VDC-SL-C
የኮይል ቮልቴጅ5 VDC
የመቀየሪያ ቮልቴጅAC 250 V / DC 30 V
የመቀየሪያ ኤሌክትሪክ ጅረት10 A ከፍተኛ
የግንኙነት መቋቋም≤ 100 mΩ
የመከላከያ መቋቋም≥ 1000 MΩ
የስራ ሙቀት-40 እስከ +70 °C
ፓኬጅመደበኛ የሪሌይ ሞጁል

  • ሪሌዩ ለሚቀይሩት ጭነት የተመጣጠነ መሆኑን ያረጋግጡ።
  • የሪሌይ ሞጁሉን በ5 VDC ኃይል ያቅርቡ።
  • ለAC ግንኙነቶች ተገቢ መከላከያ ይጠቀሙ።
  • ከAC ኃይል ጋር ሲሰሩ ይጠንቀቁ፤ ለውጦችን ከማድረግዎ በፊት ዑደቱ መቋረጡን ያረጋግጡ።
  • የገፋ ቁልፉን በአርዱኖ ላይ ከተመደበው የግቤት ፒን ጋር ያገናኙ።
  • የውጭ ተከላካዮችን አስፈላጊነት ለማስወገድ ለገፋ ቁልፍ ፒን INPUT_PULLUP ሁነታን ይጠቀሙ።
  • የAC ጭነቶችን ከማገናኘትዎ በፊት የሪሌይ አሰራሩን በዝቅተኛ ቮልቴጅ ይሞክሩ።
  • የአጭር ዑደት እንዳይከሰት ግንኙነቶችን ያረጋግጡ።

የሽቦ መገጣጠሚያ መመሪያዎች

Arduino wiring for AC bulb, LED and push button
Arduino wiring for AC bulb, LED and push button

የሪሌይ ሞጁሉን ለማገናኘት፣ የሪሌዩን VCC ፒን በአርዱኖ ላይ ካለው 5V ፒን ጋር በማገናኘት ይጀምሩ፣ እና የሪሌዩን GND ፒን በአርዱኖ ላይ ካለው GND ፒን ጋር ያገናኙ። በሪሌዩ ላይ ያለው IN ፒን በአርዱኖ ላይ ካለው ዲጂታል ፒን 10 ጋር መገናኘት አለበት። ይህ ፒን ሪሌዩን ለማግበር ምልክቱን ይልካል።

ለገፋ ቁልፉ፣ አንዱን ተርሚናል በአርዱኖ ላይ ካለው ዲጂታል ፒን 2 ጋር ያገናኙ። ሌላኛው ተርሚናል ከGND ጋር መገናኘት አለበት። ይህ ዝግጅት የአርዱኖን ውስጣዊ የመጎተት ተከላካይ ይጠቀማል፣ ስለዚህ ፒኑ በኮዱ ውስጥ INPUT_PULLUP መሆኑን ያረጋግጡ። ቁልፉ ሲጫን፣ ፒኑን ወደ LOW ያመጣዋል፣ ለአርዱኖ ምልክት ይልካል።

ለAC ጭነት፣ አንዱን ሽቦ በሪሌዩ ላይ ካለው COM ተርሚናል እና ሌላኛውን ሽቦ ከNO ተርሚናል ጋር ያገናኙ። ይህ ውቅር ሪሌዩ ሲጠቃለል የAC ጭነቱ እንዲበራ ያስችላል። ሁልጊዜ የAC ግንኙነቶች ደህንነታቸው የተጠበቀ እና የተከለሉ መሆናቸውን ያረጋግጡ።

የኮድ ምሳሌዎች እና ማብራሪያ

የሚከተለው ኮድ አስፈላጊ የሆኑትን ፒኖች ያስጀምራል እና ሪሌዩ መጀመሪያ ላይ ጠፍቶ እንዲቆይ ያደርጋል። የቁልፍ መጫን የሪሌዩን ሁኔታ ይቀይራል እና የመብራት ሁኔታውን በዚሁ መሰረት ያዘምናል።

int pbuttonPin = 2; // የገፋ ቁልፍን ያገናኙ
int relayPin = 10; // ከሪሌይ (LED) ጋር የተገናኘ

void setup() {
  Serial.begin(9600);
  pinMode(pbuttonPin, INPUT_PULLUP); 
  pinMode(relayPin, OUTPUT);
  digitalWrite(relayPin, HIGH); // መጀመሪያ ላይ ጭነቱን ጠፍቶ ያቆዩ
}

በኮዱ ውስጥ፣ pbuttonPin ተለዋዋጭ ለገፋ ቁልፍ ጥቅም ላይ የሚውለው ፒን 2 ተብሎ ተዘጋጅቷል። relayPin ሪሌዩን የሚቆጣጠረው ፒን 10 ተብሎ ተዘጋጅቷል። digitalWrite ተግባር ሪሌዩ በጠፋ ሁኔታ መጀመሩን ለማረጋገጥ ይጠቅማል።

void loop() {
  val = digitalRead(pbuttonPin); // የገፋ ቁልፍን እሴት ያንብቡ
  if(val == HIGH && lightON == LOW) {
    pushed = 1 - pushed; // የመጫን ሁኔታን ይቀይሩ
    delay(100);
  }
  if(pushed == HIGH) {
    digitalWrite(relayPin, LOW); // ሪሌዩን ያብሩ
  } else {
    digitalWrite(relayPin, HIGH); // ሪሌዩን ያጥፉ
  }
}

ይህ የኮድ ክፍል የገፋ ቁልፉን ሁኔታ ያለማቋረጥ ይፈትሻል። ቁልፉ ሲጫን፣ pushed ተለዋዋጭን ይቀይራል። በpushed እሴት ላይ በመመስረት፣ ሪሌዩ ይበራል ወይም ይጠፋል፣ መብራቱን በተሳካ ሁኔታ ይቆጣጠራል። ይህ ዑደት ያለማቋረጥ ይሰራል፣ የመብራት ሁኔታው በቅጽበት መዘመኑን ያረጋግጣል።

ለሙሉ የኮድ ዝርዝሮች፣ እባክዎ ከጽሁፉ በታች የተጫነውን ኮድ ይመልከቱ።

ማሳያ / ምን እንደሚጠበቅ

የገፋ ቁልፉን ሲጫኑ፣ ሪሌዩ ይጠቃለላል፣ የተገናኘውን የAC አምፖል ያበራል። ቁልፉን እንደገና ሲጫኑ አምፖሉን ያጠፋዋል። ተከታታይ መቆጣጠሪያው የሁኔታ መልዕክቶችን ያሳያል፣ መብራቱ በርቷል ወይም ጠፍቷል የሚለውን ያመለክታል። ችግሮች ካጋጠሙዎት፣ ሽቦው ትክክል መሆኑን ያረጋግጡ፣ እና ያልተጠበቀ ባህሪ ሊያስከትሉ የሚችሉ ተንሳፋፊ ግቤቶችን ይፈትሹ (በቪዲዮው 10:00 ላይ)።

የቪዲዮ የጊዜ ምልክቶች

  • 00:00 - መግቢያ
  • 01:30 - የሃርድዌር አጠቃላይ እይታ
  • 03:15 - የሽቦ መገጣጠሚያ መመሪያዎች
  • 05:45 - የኮድ ማብራሪያ
  • 08:00 - ማሳያ

ምስሎች

5V LOW-Level triggered Relay module
5V LOW-Level triggered Relay module
5V LOW-LEVEL trigger relay
5V LOW-LEVEL trigger relay
Arduino wiring for AC bulb, LED and push button
Arduino wiring for AC bulb, LED and push button
5V LOW-LEVEL trigger relay
5V LOW-LEVEL trigger relay
34-Using an Arduino push button to push-on and push-off a relay and AC bulb (toggle)
ቋንቋ: C++
/*
 * This is the Arduino code for a push button to turn ON and OFF a relay and AC bulb.
It toggles the bulb ON and OFF.
 * The output pin 10 is connected to the relay.
 * Watch video instructions on YouTube: https://youtu.be/7CCSRs5bvH0
 * Be careful working with AC; it is dangerous. Disconnect from AC power when working and wear protective gloves when touching AC components.
 
 * Full explanation of this code and wiring diagram is available in
 * my Arduino Course at Udemy.com here: http://robojax.com/L/?id=62

 * Written by Ahmad Shamshiri on December 14, 2017 in Ajax, Ontario, Canada
 * in Ajax, Ontario, Canada. www.robojax.com
 * 

 * Get this code and other Arduino codes from Robojax.com.
Learn Arduino step by step in a structured course with all materials, wiring diagrams, and libraries
all in one place. Purchase my course on Udemy.com: http://robojax.com/L/?id=62

If you found this tutorial helpful, please support me so I can continue creating 
content like this. You can support me on Patreon: http://robojax.com/L/?id=63

or make a donation using PayPal: http://robojax.com/L/?id=64

 *  * This code is "AS IS" without warranty or liability. Free to be used as long as you keep this note intact.* 
 * This code has been downloaded from Robojax.com
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.


*/


int pbuttonPin = 2;// connect output to push button
int relayPin = 10;// Connected to relay (LED)

int val = 0; // push value from pin 2
int lightON = 0;//light status
int pushed = 0;//push status


void setup() {
	// Robojax.com code and video tutorial for push button ON and OFF
  Serial.begin(9600);
  pinMode(pbuttonPin, INPUT_PULLUP); 
  pinMode(relayPin, OUTPUT);
 digitalWrite(relayPin, HIGH);// keep the load OFF at the begining. If you wanted to be ON, change the HIGH to LOW
}

void loop() {
// Robojax.com code and video tutorial for push button ON and OFF
  val = digitalRead(pbuttonPin);// read the push button value

  if(val == HIGH && lightON == LOW){

    pushed = 1-pushed;
    delay(100);
  }    

  lightON = val;

      if(pushed == HIGH){
        Serial.println("Light ON");
        digitalWrite(relayPin, LOW); 
       
      }else{
        Serial.println("Light OFF");
        digitalWrite(relayPin, HIGH);
   
      }     

// Robojax.com code and video tutorial for push button ON and OFF

  delay(100);
}

ምንጮች እና ምንጮች

ፋይሎች📁

አንድ ፋይል የለም።