Luka Code

Kokamba ya 5V Relay na Arduino mpo na kokamba AC to DC lokola ampoule to moteur

Kokamba ya 5V Relay na Arduino mpo na kokamba AC to DC lokola ampoule to moteur

Lithuto lino le bontsha mokgwa wa ho sebedisa relay module ya 5V le Arduino ho laola didirisiwa tsa motlakase o phahameng jwalo ka mabone, difene, kapa didirisiwa tse ding. Relay e sebediswang thutong ena ke high-trigger, e bolelang hore e qala ho sebetsa ha pin ya letshwao e fumana motlakase o phahameng (5V).

5V HIGH-level trigger relay module

Relay modules di bohlokwa haholo ho automation ya lapeng le ditsamaisong tsa taolo ya diindasteri, di o dumella ho kopanya microcontrollers le didirisiwa tse sebetsang ka AC ka tsela e bolokehileng.

Khoutu ya Arduino le setshwantsho sa wiring di fumaneha ka tlase ho sengolwa sena.

Relay ya High-Trigger ke eng?

Relay ke sesebediswa sa motlakase se laolvwang ka motlakase. Mofuta wa high-trigger o qala ho sebetsa ha pin ya letshwao e iswa ho HIGH (hangata 5V). E na le:

  • Coil ya motlakase bakeng sa ho fetola

  • Khokahano ya normally open (NO) le normally closed (NC)

    Relay wiring when load is OFF
    Relay wiring when load is ON
  • Dintho tsa letshwao, VCC, le GND

Module ena e dumella Arduino ho laola didirisiwa tse sebetsang ka motlakase o phahameng ho feta oo board e ka o sebedisang ka kotloloho.

 

Ho Hokela Relay Module

Arduino wiring for AC bulb with HIGH-level trigger relay
Arduino wiring for AC bulb with HIGH-level trigger relay

Ho sebedisa relay le Arduino ka tsela e bolokehileng, e hokele jwalo ka ha ho latela:

  • VCC (pin e bohareng) -5V ho Arduino

  • GND -GND ho Arduino

  • IN (Pin ya letshwao) -Digital Pin 2 ho Arduino

  • Dintho tsa ho tswa tsa Relay -Hokela e nngwe ya dintho tseo ka tatellano le lebone, fene, kapa ntho e nngwe le e nngwe e sebetsang ka AC/DC.

 Kakaretso ya Khoutu

Khoutu ya motheo ya Arduino e sebediswang thutong ena ke ena:

cppCopyEditvoid setup() {
  pinMode(2, OUTPUT);     // Set pin 2 as output
}

void loop() {
  digitalWrite(2, HIGH);  // Turn relay ON
  delay(1000);            // Wait 1 second
  digitalWrite(2, LOW);   // Turn relay OFF
  delay(1000);            // Wait 1 second
}

  • Relay e BULEHA ha digital pin 2 e bewa ho HIGH.

  • Relay e KOALWA ha pin 2 e bewa ho LOW.

  • Potoloho ena e pheta ka mora motsotswana o mong le o mong.

Setups ena e sebediswa haholo ho automatize mabone a lapeng kapa taolo ya motlakase ho latela di-sensor kapa dinako tse rerilweng.

 

Dikgaolo Tse Tswang Video

  • 00:00 – Relay e Hlaloswa

  • 03:33 – Wiring e Hlaloswa

  • 04:42 – Khoutu e Hlaloswa

  • 06:10 – Pontsho

 

Images

Relay wiring when load is OFF
Relay wiring when load is OFF
Relay wiring when load is ON
Relay wiring when load is ON
5V relay module
5V relay module
5V HIGH-level trigger relay module
5V HIGH-level trigger relay module
5V HIGH-level trigger relay module
5V HIGH-level trigger relay module
5V HIGH-level trigger relay module - back
5V HIGH-level trigger relay module - back
Arduino wiring for AC bulb with HIGH-level trigger relay
Arduino wiring for AC bulb with HIGH-level trigger relay
45-This is the Arduino code for a 5V relay
Langue: C++
/*
* This is the Arduino code for Dual Channel 5V Relay
* to control turning ON or OFF AC or DC loads
* Watch the video https://youtu.be/58XWVDnB7Ss
*
* Written by Ahmad Nejrabi for Robojax Video
* Date: December 26, 2017, in Ajax, Ontario, Canada
* Permission granted to share this code given that this
* note is kept with the code.
* Disclaimer: this code is "AS IS" and for educational purposes only.
*
*/

void setup() {
  pinMode(7, OUTPUT);// connected to S terminal of Relay

}

void loop() {

  digitalWrite(7,HIGH);// turn relay ON
  delay(3000);// keep it ON for 3 seconds

  digitalWrite(7, LOW);// turn relay OFF
 delay(5000);// keep it OFF for 5 seconds

}

Nko o na nki.

Mokili na bisika

Pas encore de ressources.

Fichiers📁

Aucun fichier disponible.