8-channel dual light ignition system, infrared and pushbuttons
In this tutorial we will put together a dual light ignition system, since we can control the ignition and paid by means of an infrared remote control, and also by means of 8 pushbuttons. We will use an 8-channel relay module, an arduino nano, an infrared receiver module, a pcb made of pcbway, and other electronic components. We will assemble the circuit, step by step analyze the source code and finally test all the operation of the system.
materials
An Arduino nano
The Arduino Nano is a small board, complete and compatible with the test board based on the ATmega328 (Arduino Nano 3.x). It has about the same functionality as the Arduino Duemilanove, but in a different package. It only lacks a DC power connector and works with a Mini-B USB cable instead of a standard one.
microcontrollerATmega328architectureAVROperating voltage5 VFlash memory32 KB of which 2 KB uses the bootloaderSram2 KBClock speed16 MHzAnalog pins IN8Eeprom1 KBDC current by I/O pins40 mA (I/O pins)Input voltage7-12 VDigital I/O Pins22 (6 of which are PWM)PWM output6Energy consumption19 mAPCB size18 x 45 mmweight7g
Pin diagram
Female pins
A socket for the Arduino nano
8-channel relay module
characteristics
Controls the on/off of high-powered equipment (appliances). Works perfectly with Arduino, Pic or any other digital system.
Within the wide variety of projects that we can carry out with Arduino, we may want to control high voltage or high amperage components, such as bulbs or water pumps, which cannot be handled directly with Arduino. In these cases it is necessary to use Relays or Reles, these devices allow to control high voltage loads with a small signal.
The module has 8 high quality relays, capable of handling loads up to 250V/10A. Each channel has electrical insulation by means of an optocoupler and a status indicator LED. Its design makes it easy to work with Arduino, as with many other systems such as Raspberry Pi, ESP8266 (NodeMCU and Wemos), Teensy and Pic. This Relay module activates the normally open output (NO: Normally Open) when receiving a logical ?0? (0 Volts) and deactivates the output with a logical ?1? (5 volts). For Arduino and Relays programming it is recommended to use timers with the ?millis()? function and therefore not use the ?delay? function that prevents the system from continuing to work while a relay is on/off.
Among the loads that can be handled we have: light bulbs, luminaires, AC motors (220V), DC motors, solenoids, solenoid valves, water heaters and a wide variety of other actuators. It is recommended to perform and verify connections before powering the circuit, it is also a good practice to protect the circuit within a case.
Technical data
8 independent channels
8 1-pole relays 2 shots
Relay coil voltage is 5 VDC
Led indicator for each channel (lights when relay coil is active)
Current-activated: the control circuit must provide a current of 15 to 20 mA
Can be directly controlled by logical circuits
Screw connection terminals (clemas)
Logical signal input terminals with 0.1″ male headers.
Can be directly controlled by logical circuits
Food and consumption
The easiest way to power this module is from Vcc and GND of the Arduino board, keeping the Jumper in place, so JD-Vcc Vcc. This connection has two important limitations:
The electrical switching provided by optocouplers is lost, increasing the chance of damage to the Arduino if there is a problem with relay loads.
The current consumed by the relay coils must be provided by the Arduino board. Each coil consumes about 90 mA and the four joints add up to 360 mA. If we add to this the consumptions that other outputs can have, we are very close to the 500 mA that a USB port can supply. In this case the Arduino should be fed with an external source, which increases the current limit to 1 A (in the case of the Arduino UNO).
The safest way is to remove the jumper and power the relay board with two sources: that of the Arduino board connected to Vcc and a second source, with the positive to JD-Vcc and the negative to GND, without being attached to the Arduino board. This connection has as advantages:
There is complete ingessation between the load and the Arduino.
All relay consumption is taken from the second source and not from the Arduino or USB port.
Tickets
The inputs to the board can be connected directly to the digital outputs of the Arduino board. The only precaution to keep in mind is that when Arduino starts when it is fed, the pins are configured as inputs automatically and it can happen that, due to a very short period of time between the start and the correct configuration of these pins as outputs, the control inputs to the relay module are in an undetermined state. This can be avoided by connecting a pull-up with a resistance of 10K to Vcc at each input, ensuring a HIGH state during boot.
Male pins
Ky-022 infrared receiver module
Size: 6.4 * 7.4 * 5.1MM, acceptance angle 90o, working voltage 2.7-5.5V.
Frequency 37.9KHZ, receiving the distance 18 m.
Daylight rejection up to 500LUX, electromagnetic interference capability, built-in dedicated infrared IC.
Widely used: stereo, TV, VCR, CD, set-top boxes, digital photo frame, car audio, remote control toys, satellite receivers, hard drive, air conditioning, heating, fans, lighting and other appliances.
Pinout:
1 …. GND (-)
2 …. + 5V
3 …. Output (S)
Eight pushbuttons
A pcb
Download –> 8-channel infrared light control
source code
//Más proyectos en www.rogerbit.com
#include <IRremote.h>
#define RECV_PIN 2 //indicamos el pin por el que recibimos los datos del
//sensor TSOP1838
IRrecv irrecv(RECV_PIN);
decode_results results;
int estadoBoton11 = 0;
int estadoBoton12 = 0;
int estadoBotonA5 = 0;
int estadoBotonA0 = 0;
int estadoBotonA1 = 0;
int estadoBotonA2 = 0;
int estadoBotonA3 = 0;
int estadoBotonA4 = 0;
int estado11 = 0;
int estado12 = 0;
int estadoA5 = 0;
int estadoA0 = 0;
int estadoA1 = 0;
int estadoA2 = 0;
int estadoA3 = 0;
int estadoA4 = 0;
//Pulsadores
int botonPin11 =11;
int botonPin12 =12;
int botonPinA5 =A5;
int botonPinA0 =A0;
int botonPinA1 =A1;
int botonPinA2 =A2;
int botonPinA3 =A3;
int botonPinA4 =A4;
void setup()
{
Serial.begin(9600);//Velocidad del puerto
//Definimos estos pines como salidas
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
//Ponemos en estado Alto todas las salidas
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);
digitalWrite(10,HIGH);
//Definimos estos pines como entrdas para los pulsadores
pinMode(botonPin11, INPUT_PULLUP);
pinMode(botonPin12, INPUT_PULLUP);
pinMode(botonPinA5, INPUT_PULLUP);
pinMode(botonPinA0, INPUT_PULLUP);
pinMode(botonPinA1, INPUT_PULLUP);
pinMode(botonPinA2, INPUT_PULLUP);
pinMode(botonPinA3, INPUT_PULLUP);
pinMode(botonPinA4, INPUT_PULLUP);
irrecv.enableIRIn(); // Iniciamos la recepcion
}
void loop()
{
//Si tenemos datos de lectura debido a que se pulsa una tecla en el mando
if (irrecv.decode(&results))
{
//Mostramos por puerto serie dicho codigo en Hexadecimal(para depuracion)
Serial.print("Codigo: 0x") ;
Serial.println(results.value,HEX) ;
//Pin 3 arduino IN1 en módulo relay de 8 canales
if(results.value==0x2B||results.value==0x82B)//Apagado
{
digitalWrite(3,HIGH);
estado11 = 0;
}
if(results.value==0x2A||results.value==0x82A)//Encendido
{
digitalWrite(3, LOW);
estado11 = 1;
}
//Pin 4 arduino IN2 en módulo relay de 8 canales
if(results.value==0x23||results.value==0x823)//Apagado
{
digitalWrite(4,HIGH);
estado12 = 0;
}
if(results.value==0x27||results.value==0x827)//Encendido
{
digitalWrite(4, LOW);
estado12 = 1;
}
//Pin 5 arduino IN3 en módulo relay de 8 canales
if(results.value==0xB||results.value==0x80B)//Apagado
{
digitalWrite(5,HIGH);
estadoA5 = 0;
}
if(results.value==0x3D||results.value==0x83D)//Encendido
{
digitalWrite(5,LOW);
estadoA5 = 1;
}
//Pin 6 arduino IN4 en módulo relay de 8 canales
if(results.value==0x30||results.value==0x830)//Apagado
{
digitalWrite(6,HIGH);
estadoA0 = 0;
}
if(results.value==0x2F||results.value==0x82F)//Encendido
{
digitalWrite(6,LOW);
estadoA0 = 1;
}
//Pin 7 arduino IN5 en módulo relay de 8 canales
if(results.value==0x33||results.value==0x833)//Apagado
{
digitalWrite(7,HIGH);
estadoA1 = 0;
}
if(results.value==0x31||results.value==0x831)//Encendido
{
digitalWrite(7,LOW);
estadoA1 = 1;
}
//Pin 8 arduino IN6 en módulo relay de 8 canales
if(results.value==0x21||results.value==0x821)//Apagado
{
digitalWrite(8,HIGH);
estadoA2 = 0;
}
if(results.value==0x20||results.value==0x820)//Encendido
{
digitalWrite(8,LOW);
estadoA2 = 1;
}
//Pin 9 arduino IN7 en módulo relay de 8 canales
if(results.value==0x24||results.value==0x824)//Apagado
{
digitalWrite(9,HIGH);
estadoA3 = 0;
}
if(results.value==0xE||results.value==0x80E)//Encendido
{
digitalWrite(9,LOW);
estadoA3 = 1;
}
//Pin 10 arduino IN8 en módulo relay de 8 canales
if(results.value==0x11||results.value==0x811)//Apagado
{
digitalWrite(10,HIGH);
estadoA4 = 0;
}
if(results.value==0x10||results.value==0x810)//Encendido
{
digitalWrite(10,LOW);
estadoA4 = 1;
}
irrecv.resume(); // Recibimos el siguiente valor del sensor
}
delay(100);//Retardo antirrebote para los pulsadores
estadoBoton11 = digitalRead(botonPin11);//Leemos el pulsador para ver su estado
estadoBoton12 = digitalRead(botonPin12);//Leemos el pulsador para ver su estado
estadoBotonA5 = digitalRead(botonPinA5);//Leemos el pulsador para ver su estado
estadoBotonA0 = digitalRead(botonPinA0);//Leemos el pulsador para ver su estado
estadoBotonA1 = digitalRead(botonPinA1);//Leemos el pulsador para ver su estado
estadoBotonA2 = digitalRead(botonPinA2);//Leemos el pulsador para ver su estado
estadoBotonA3 = digitalRead(botonPinA3);//Leemos el pulsador para ver su estado
estadoBotonA4 = digitalRead(botonPinA4);//Leemos el pulsador para ver su estado
//Llama a una función
if (estadoBoton11 == LOW) {//Si el pulsador está precionado se cumple esta condición
luz11();
}
//Llama a una función
if (estadoBoton12 == LOW) {//Si el pulsador está precionado se cumple esta condición
luz12();
}
//Llama a una función
if (estadoBotonA5 == LOW) {//Si el pulsador está precionado se cumple esta condición
luzA5();
}
//Llama a una función
if (estadoBotonA0 == LOW) {//Si el pulsador está precionado se cumple esta condición
luzA0();
}
//Llama a una función
if (estadoBotonA1 == LOW) {//Si el pulsador está precionado se cumple esta condición
luzA1();
}
//Llama a una función
if (estadoBotonA2 == LOW) {//Si el pulsador está precionado se cumple esta condición
luzA2();
}
//Llama a una función
if (estadoBotonA3 == LOW) {//Si el pulsador está precionado se cumple esta condición
luzA3();
}
//Llama a una función
if (estadoBotonA4 == LOW) {//Si el pulsador está precionado se cumple esta condición
luzA4();
}
}
//Función para encender la luz con el botón
void luz11(){
if(estado11 ==0){//Si la variable estado es igual a 0 se cumple esta condición
digitalWrite(3, LOW);// Encendemos el relay
estado11 = 1;//Asignamos el valor 1 a la variable "estado"
} else{
digitalWrite(3, HIGH);//Apagamos el relay
estado11 = 0;
}
while(estadoBoton11 == LOW){
estadoBoton11 = digitalRead(11);//Se cumple esta condición mientras esté precionado el botón
}
}
//Función para encender la luz con el botón
void luz12(){
if(estado12 ==0){//Si la variable estado es igual a 0 se cumple esta condición
digitalWrite(4, LOW);// Encendemos el relay
estado12 = 1;//Asignamos el valor 1 a la variable "estado"
} else{
digitalWrite(4, HIGH);//Apagamos el relay
estado12 = 0;
}
while(estadoBoton12 == LOW){
estadoBoton12 = digitalRead(12);//Se cumple esta condición mientras esté precionado el botón
}
}
//Función para encender la luz con el botón
void luzA5(){
if(estadoA5 ==0){//Si la variable estado es igual a 0 se cumple esta condición
digitalWrite(5, LOW);// Encendemos el relay
estadoA5 = 1;//Asignamos el valor 1 a la variable "estado"
} else{
digitalWrite(5, HIGH);//Apagamos el relay
estadoA5 = 0;
}
while(estadoBotonA5 == LOW){
estadoBotonA5 = digitalRead(A5);//Se cumple esta condición mientras esté precionado el botón
}
}
void luzA0(){
if(estadoA0 ==0){//Si la variable estado es igual a 0 se cumple esta condición
digitalWrite(6, LOW);// Encendemos el relay
estadoA0 = 1;//Asignamos el valor 1 a la variable "estado"
} else{
digitalWrite(6, HIGH);//Apagamos el relay
estadoA0 = 0;
}
while(estadoBotonA0 == LOW){
estadoBotonA0 = digitalRead(A0);//Se cumple esta condición mientras esté precionado el botón
}
}
//Función para encender la luz con el botón
void luzA1(){
if(estadoA1 ==0){//Si la variable estado es igual a 0 se cumple esta condición
digitalWrite(7, LOW);// Encendemos el relay
estadoA1 = 1;//Asignamos el valor 1 a la variable "estado"
} else{
digitalWrite(7, HIGH);//Apagamos el relay
estadoA1 = 0;
}
while(estadoBotonA1 == LOW){
estadoBotonA1 = digitalRead(A1);//Se cumple esta condición mientras esté precionado el botón
}
}
//Función para encender la luz con el botón
void luzA2(){
if(estadoA2 ==0){//Si la variable estado es igual a 0 se cumple esta condición
digitalWrite(8, LOW);// Encendemos el relay
estadoA2 = 1;//Asignamos el valor 1 a la variable "estado"
} else{
digitalWrite(8, HIGH);//Apagamos el relay
estadoA2 = 0;
}
while(estadoBotonA2 == LOW){
estadoBotonA2 = digitalRead(A2);//Se cumple esta condición mientras esté precionado el botón
}
}
//Función para encender la luz con el botón
void luzA3(){
if(estadoA3 ==0){//Si la variable estado es igual a 0 se cumple esta condición
digitalWrite(9, LOW);// Encendemos el relay
estadoA3 = 1;//Asignamos el valor 1 a la variable "estado"
} else{
digitalWrite(9, HIGH);//Apagamos el relay
estadoA3 = 0;
}
while(estadoBotonA3 == LOW){
estadoBotonA3 = digitalRead(A3);//Se cumple esta condición mientras esté precionado el botón
}
}
//Función para encender la luz con el botón
void luzA4(){
if(estadoA4 ==0){//Si la variable estado es igual a 0 se cumple esta condición
digitalWrite(10, LOW);// Encendemos el relay
estadoA4 = 1;//Asignamos el valor 1 a la variable "estado"
} else{
digitalWrite(10, HIGH);//Apagamos el relay
estadoA4 = 0;
}
while(estadoBotonA4 == LOW){
estadoBotonA4 = digitalRead(A4);//Se cumple esta condición mientras esté precionado el botón
}
}
More information in https://rogerbit.com/wprb/2021/05/8-channel-dual-light-ignition-system-infrared-and-pushbuttons/
My youtube channel is http://www.youtube.com/user/carlosvolt?sub_confirmation=1
8-channel dual light ignition system, infrared and pushbuttons
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
- Comments(0)
- Likes(3)
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by CarlosVolt Tutoriales
- Infrared stepper motor control with speed control More info and updates https://rogerbit.com/wprb/2024/09/motor-paso-a-paso-x-infrarrojo/In this proje...
- Uploading BME280 Sensor Data to ThingSpeak Using ESP32 In this tutorial, we will show you how to connect a BME280 sensor to an ESP32 to read temperature, h...
- Water pump control for irrigation via telegram and esp32 Water Pump Control by Telegram and ESP32 is an automated system that allows you to remotely control ...
- Air conditioning on/off control via telegram and esp32 In this tutorial we will see how to control an air conditioner, with an esp32 and the telegram appli...
- 35 watt stereo amplifier In this video we will see how to build an audio amplifier, with the TDA7377 integrated circuit, and ...
- Laser alarm with RFID module More info and updates in https://rogerbit.com/wprb/2024/08/alarma-laser-rfid/In this project, we bui...
- Control lights by voice commands and keys In this tutorial we will see how to create a device to control lights by voice commands, with a modu...
- Stepper motor control x bluetooth and app In this tutorial we will see a circuit, which controls a stepper motor, with an application made in ...
- DFplayermini x bluetooth mp3 player control More info and updates in https://rogerbit.com/wprb/2022/12/dfplayermini-x-bluetooth/In this tutorial...
- Robot with WiFi control and servos driven by ESP32 More info and updates in https://rogerbit.com/wprb/2023/07/robot-wifi/A robot controlled by Wi-Fi, s...
- How to make a water level meter with uln2803 In this tutorial we will see how to make a water level meter circuit with the built-in uln2803.The p...
- DTMF decoder for handy with arduino, control over several kilometers In this tutorial we will see how to make a circuit to connect to our handy, in this case a Baofeng U...
- Turn on light from thindspeak with esp32 In this tutorial, we will show you how to control lights over the Internet using an ESP32 and the Th...
- MP3 player control with webserver using ESP32 WIFI In this tutorial, you will learn how to build a web server using the ESP32 to control the YX5300 mod...
- Time clock with fingerprint IoT module, uploading data to thingspeak More info in and updates in https://rogerbit.com/wprb/2022/07/reloj-de-control-fingerprint/In this t...
- Make your own logic tip (includes printed circuit board) In this video tutorial we will see how to make a logic tip, on a printed circuit, with the integrate...
- Coil or inductor meter with Arduino and OLED display More info and updates in https://rogerbit.com/wprb/2022/06/medidor-inductores/In this tutorial we wi...
- Turn on Light with Reyax RYLR896 LoRa Modules with Acknowledgement In this tutorial, you will learn how to use the Reyax RYLR896 LoRa modules to wirelessly and reliabl...
-
-
-
-
-
-
3D printed Enclosure Backplate for Riden RD60xx power supplies
154 1 1 -
-