Mateya oyo ezali eteni ya: Ko contrôler Relais Na kosalelaka Arduino
Oyo eza ba vidéos ya ba groupes nionso etali relais. Ba liens ya ba vidéos misusu ezali na se ya article oyo.
Kosalela na module ya touch TTP223B mpe relay mpo na kokamba ba charges ya AC/DC na Arduino.
Na boyekoli oyo, tokotalela ndenge ya kosalela module ya kosimba TTP223B elongo na relay mpo na kokamba ba charges ya AC to DC na Arduino. Esika oyo epesaka nzela na boyokami ya kosimba mpo na kofungola ba appareils lokola ba ampoules to ba composants électriques mosusu. Okoyekola ndenge ya kokanga ba composants, kokoma code ya Arduino, mpe kobongisa ntango ya ndenge load etikali na fonction après kosimba. Oyo ezali projet malamu mingi mpo na ba débutants mpe ba utilisateurs expérimentés oyo balingi kokola ba compétences na bango.




Na boyokami oyo mobimba, tokotambola na yo na ba composants essentiels, ba instructions ya câblage, mpe programmation oyo esengeli mpo na projet oyo ebanda kosala. Okoyekola mpe ndenge ya kobongisa ntango ya activation ya charge kolanda préférences na yo (na vidéo na 10:15). Tala vidéo oyo elandi mpo na démonstration visuelle ya processus oyo.
Matériel Explicado
Ba composants clés mpo na projet oyo ezali module ya kosimba TTP223B, relay, mpe Arduino. Module TTP223B emonaka ba entrées ya kosimba mpe ebandaka signal na Arduino, oyo ekoki kokamba relay. Relay esalaka lokola interrupteur, oyo epesaka yo nzela ya kokamba ba charges ya AC to DC na voltage ya likolo na sécurité.
Puce TTP223B esalemi na Taiwan Semiconductor (TONTEK) mpe module esalaka na voltage ya alimentation ya 2.2V to 5.5V mpe ezali na ba pins misato: VCC (puissance), GND (terre), mpe SIG (signal). Ntango touchpad efungwami, pin SIG ebandaka signal ya likolo na Arduino. Tala datasheet mpo na ba détails complets. Relay, na ngambo mosusu, esengaka signal ya contrôle longwa na Arduino mpo na kokamba charge na fonction to na arrêt. Contrôle oyo esalemaka na nzela ya pin ya sortie digitale oyo esangani na relay.
Ba Détails ya Datasheet
| Fabricant | Taiwan Semiconductor (TONTEK) |
|---|---|
| Numéro ya pièce | TTP223B |
| Voltage ya logique/IO | 2.2 - 5.5 V |
| Voltage ya alimentation | 2.2 - 5.5 V |
| Courant ya sortie (na canal) | 20 mA max |
| Courant ya pointe (na canal) | 50 mA max |
| Guidance ya fréquence PWM | N/A |
| Ba seuils ya logique ya entrée | 0.3 * VCC (bas), 0.7 * VCC (likolo) |
| Chute ya voltage / RDS(on) / saturation | N/A |
| Ba limites thermiques | N/A |
| Paquet | TO-220 |
| Ba notes / ba variantes | Mpe eyebani lokola BA6 |
- Tiká ete grounding ezali malamu mpo na kokima déclenchement ya lokuta.
- Salela condensateur mpo na kolongola bruit na ligne ya signal ya kosimba.
- Vérifie ba spécifications ya relay mpo na kokokana na ba exigences ya charge.
- Keba na ba connexions AC—tika ete insulation mpe ba mesures ya sécurité ezali malamu.
- Bongisa ntango na code mpo na durée ya activation ya charge oyo olingi.
Ba Instructions ya Câblage
Mpo na kokanga module ya kosimba TTP223B mpe relay na Arduino, landa ba étapes oyo:
Liboso, kanga pin VCC ya TTP223B na source ya puissance ya 5V, ezala longwa na Arduino to na alimentation externe. Na sima, kanga pin GND ya TTP223B na terre. Pin SIG esengeli kokangama na pin 2 na Arduino, oyo ekotanga entrée ya kosimba.
Mpo na relay, kanga pin VCC na yango na source ya puissance ya 5V yango moko, mpe kanga pin GND na terre. Pin ya signal ya contrôle ya relay esengeli kokangama na pin 10 na Arduino. Tika ete relay ekangami malamu na charge oyo olingi kokamba, na nsinga moko oyo ekendeke na pin commune (COM) mpe mosusu na pin normalement ouverte (NO). Esika oyo epesaka nzela na relay mpo na kobongola charge na fonction mpe na arrêt kolanda signal ya contrôle ya Arduino.
Ba Exemples ya Code & Explication
Code oyo elandi ebandisaka configuration mpo na module ya kosimba TTP223B mpe relay. Ezali kotia ba modes ya pins mpo na entrée mpe sortie, oyo epesaka Arduino nzela ya kotanga ba signaux ya kosimba mpe kokamba relay.
void setup() {
Serial.begin(9600);
pinMode(10, OUTPUT); // Pin ya contrôle ya relay
pinMode(2, INPUT); // Pin ya entrée ya kosimba
Serial.println("Robojax Test: TTP223B touch");
}
Na configuration, tozali kokabola pin 10 lokola sortie mpo na kokamba relay mpe pin 2 lokola entrée mpo na kotanga signal ya kosimba. Moniteur ya série ebandisami mpo na ba fins ya débogage.
Boucle principale ya programme etalaka soki bouton ya kosimba epresé. Soki epresé, relay efungwami, mpe charge oyo esangani ebandaka kosala.
void loop() {
if(digitalRead(2)) {
Serial.println("Bouton Esimbami");
digitalWrite(10, LOW); // Fungola relay
delay(LD);
} else {
digitalWrite(10, HIGH); // Fongola relay
}
}
Code oyo etangaka ntango nyonso état ya pin 2. Soki capteur ya kosimba efungwami, efungolaka relay mpo na durée oyo ekatami na variable LD. Soki capteur esimbami te, relay efungwami.
Démonstration / Nini Okoki Kozela
Sima ya kosilisa câblage mpe kotia code, okomona charge oyo esangani (lokola ampoule) ebandaka kopelisa ntango okosimba module TTP223B. Durée oyo charge etikalaka na fonction ekolamelaka na variable LD na code. Soki olingi charge etikala na fonction mibu mingi, kaka mata valeur ya LD na durée oyo olingi na millisecondes.
Ba erreurs ya mbala mingi ezali câblage ya mabe, oyo ekoki kosala ete relay efungwama te to capteur ya kosimba eyanola te. Tika ete ba connexions nyonso ezali ya libende mpe ete ozali kosalela ba pins ya malamu lokola ekatami na code. Na libanga, keba ntango ozali kosala na ba charges AC mpo na kokima choc électrique to dégâts.
Ba Horodatages ya Vidéo
- 00:00 - Libosoli ya projɛ́
- 02:30 - Botali ya ba fils
- 05:15 - Ndimbola ya code
- 10:15 - Emoniseli ya ebongiseli
Mateya oyo ezali eteni ya: Ko contrôler Relais Na kosalelaka Arduino
- Code Arduino mpe Vidéo ya Relay ya Ba-Chaine mibale ya 5V
- Kokamba ya 5V Relay na Arduino mpo na kokamba AC to DC lokola ampoule to moteur
- TTP224 4-Channel Touch Sensor ya Kopela Misala ya AC/DC na Relais
- Kosalela module ya relay ya 5V (Low-Trigger) na Arduino
- Kosakola na MAX6675 K-Type Thermocouple na Relay mpe Display
- Kosalela Switch ya Reed mpo kontrolé ya Relay mpe ba charges ya AC/DC na Arduino
- Kosalela ya Arduino ya kobenda bouton mpo na kobongola relais mpe ampoule ya AC
/*
* This is the Arduino code for TTP223B capacitive touch switch with relay
* The output pin 10 is connected to the relay
* By touching the touch pad TTP223B or TTP223N-BA6, the relay will be turned ON
*
* Written by Ahmad Nejrabi for Roboja Video
* Date: December 4, 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.
*
*/
int LD = 200; // Loop Delay. Controls how long after release the bulb is ON
void setup() {
Serial.begin(9600);
// output pins
pinMode(10, OUTPUT);// LED for button 1
// input pins
pinMode(2, INPUT);// Button 1 input pin 2
Serial.println("Robojax Test: TTP223B touch");
}
void loop() {
// button 1 action
if(digitalRead(2)){
Serial.println("Button Touched");
digitalWrite(10, LOW); // Turn the LED ON
delay(LD);
}else{
digitalWrite(10, HIGH);// Turn OFF the LED
}
}// loop
/*
* This is the Arduino code for TTP223 Capacitive Touch switch with relay to turn AC or DC load
// December 13, 2017
// Written for Robojax.com video
// Using TTP223 Touch module to turn AC (or DC) load ON or OFF.
// When the touch pad is touched the light on the relay will turn on and the COM and NO pin will be connected
* watch video for details https://youtu.be/YSI1PdSLbt0
*
*
* Written by Ahmad Nejrabi for RoboJax Video
* Date: December 4, 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.
*
*/
// December 12, 2017
// Written for Robojax.com video
// Using TTP223 Touch module to turn AC (or DC) load ON or OFF.
// When the touch pad is touched the light on the relay will turn on and the COM and NO pin will be connected
int touchPin = 2;// connect output from TTP223 to this
int val = 0;
int relayPin = 10;// Connected to relay
void setup() {
Serial.begin(9600);
pinMode(touchPin, INPUT);
pinMode(relayPin, OUTPUT);
}
void loop() {
digitalWrite(relayPin, HIGH);
val = digitalRead(touchPin);
if(val ==1){
Serial.println("Touched");
digitalWrite(relayPin, LOW);
}
delay(100);
Serial.println();
}
/*
* This is the Arduino code for TTP223 Capacitive Touch switch with relay to turn AC or DC load with delay
// December 13, 2017
// Written for Robojax.com video
// Using TTP223 Touch module to turn an AC (or DC) load ON and waits for 5 seconds before it goes OFF
// When the touch pad is touched the light on the relay will turn on and the COM and NO pins will be connected
* Watch the video for details: https://youtu.be/YSI1PdSLbt0
*
*
* Written by Ahmad Nejrabi for RoboJax Video
* Date: December 4, 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.
*
*/
// December 12, 2017
// Written for Robojax.com video
// Using TTP223 Touch module to turn an AC (or DC) load ON or OFF.
// When the touch pad is touched the light on the relay will turn on and the COM and NO pins will be connected
int touchPin = 2;// connect output from TTP223 to this
int val = 0;
int relayPin = 10;// Connected to relay
int wait = 5;// wait for 5 seconds
void setup() {
Serial.begin(9600);
pinMode(touchPin, INPUT);
pinMode(relayPin, OUTPUT);
}
void loop() {
digitalWrite(relayPin, HIGH);
val = digitalRead(touchPin);
if(val ==1){
Serial.println("Touched");
digitalWrite(relayPin, LOW);
delay(wait*1000);
}
delay(100);
Serial.println();
}
Mokili na bisika
Pas encore de ressources.
Fichiers📁
Fiche technique (pdf)
-
TTP223 datasheet by Taiwan Semiconductor (TONTEK)
TTP223_datasheet.pdf0.27 MB
Mabala a mangwe
-
TTP223B Mmanual ya mtumiaji
robojax-TTP223B_manual.pdf0.15 MB