|
ARDUINO_NANO |
x 1 |
8-channel light control with ps/2 keyboard and arduino
The 8-Channel Lighting Control System with PS/2 Keyboard and Arduino is a project that combines the versatility of the Arduino platform with the convenience of a standard PS/2 keyboard to control lighting on up to eight different channels.
This system allows users to turn individual lights or groups of lights on and off by entering commands from the PS/2 keyboard. Using the Arduino as the brain of the system, the keyboard connects to the microcontroller via a PS/2 adapter and is programmed to interpret user commands.
Each light channel is connected to an output on the Arduino, allowing for independent control over each. Users can assign specific keyboard keys to each channel, making it easy to customize and intuitive to operate the system.
More info and updates in https://rogerbit.com/wprb/2024/02/luces-de-8-x-ps-2/
Additionally, this project is highly scalable, meaning more light channels can be added easily by simply adding more outputs to the Arduino and assigning new keys from the PS/2 keyboard.
The 8-channel lighting control system with PS/2 keyboard and Arduino offers a flexible and affordable solution for controlling lighting in various environments, from home lighting systems to stage and performance applications.
Electronic components
Arduino Nano
female pins
Pines macho
Socket for arduino nano
A 5mm LED diode
eight resistors
Cables Dupont
Printed circuit board (PCB)
Archivo gerber —> pcb
PS/2 connector
Characteristics
Standard PS/2 interface;
The power supply must be 5V DC;
4 screw mounting holes whose diameter is 2.2mm
Easy to use
Interface
Control interface: A total of four pins (GND, VCC, DAT, CLK), GND to ground, VCC is the power supply, DAT is the data input and output pin, CLK is the clock signal pin.
A PS/2 keyboard
8-channel relay module (Optional)
Characteristics
Allows you to control the on/off of high-power equipment (home 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 light bulbs or water pumps, which cannot be managed directly with Arduino. In these cases it is necessary to use Relays, these devices allow controlling 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 isolation by means of an optocoupler and a status indicator LED. Its design makes it easy to work with Arduino, as well as 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) upon receiving a logic “0” (0 Volts) and deactivates the output with a logic “1” (5 Volts). For Arduino and Relay programming, it is recommended to use timers with the “millis()” function and thus not use the “delay” function that prevents the system from continuing to work while a relay is activated/deactivated.
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 make and verify the connections before powering the circuit; it is also good practice to protect the circuit within a case.
Technical data
8 independent channels
8 1-pole 2-throw relays
The relay coil voltage is 5 VDC
LED indicator for each channel (turns on when the relay coil is active)
Current activated: the control circuit must provide a current of 15 to 20 mA
Can directly controlled by logic circuit
Screw connection terminals (clamps)
Logic signal input terminals with 0.1″ male headers.
Can directly controlled by logic circuit
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 isolation provided by the optocouplers is lost, increasing the possibility of damage to the Arduino if there is a problem with the 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 together add up to 360 mA. If we add to this the consumption that other outputs may have, we are very close to the 500 mA that a USB port can supply. In this case, the Arduino should be powered 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: the one from the Arduino board connected to Vcc and a second source, with the positive one to JD-Vcc and the negative one to GND, without this being linked to the Arduino board. This connection has the advantages:
There is complete isolation between the load and the Arduino.
All relay power is taken from the second source and not from the Arduino or the USB port.
Appetizer
The inputs to the board can be connected directly to the digital outputs of the Arduino board. The only precaution to take into account is that when the Arduino starts up when powered, the pins are automatically configured as inputs and it may happen that, for a very short period of time between startup and the correct configuration of these pins as outputs, the inputs of control to the relay module remain in an undetermined state. This can be avoided by connecting a pull-up with a 10K resistor to Vcc to each input, which ensures a HIGH state during startup.
Circuit
#include "ps2_Keyboard.h"//Instalar librería ps2KeyboardHost
#include "ps2_AnsiTranslator.h"
#include "ps2_SimpleDiagnostics.h"
int pin4 = 4;
int pin5 = 5;
int pin6 = 6;
int pin7 = 7;
int pin8 = 8;
int pin9 = 9;
int pin10 = 10;
int pin11 = 11;
int estadoPin4 = 0;
int estadoPin5 = 0;
int estadoPin6 = 0;
int estadoPin7 = 0;
int estadoPin8 = 0;
int estadoPin9 = 0;
int estadoPin10 = 0;
int estadoPin11 = 0;
typedef ps2::SimpleDiagnostics<254> Diagnostics_;
static Diagnostics_ diagnostics;
static ps2::AnsiTranslator<Diagnostics_> keyMapping(diagnostics);
static ps2::Keyboard<3,2,1, Diagnostics_> ps2Keyboard(diagnostics);
static ps2::KeyboardLeds lastLedSent = ps2::KeyboardLeds::none;
void setup() {
Serial.begin(9600);
pinMode(pin4, OUTPUT);
pinMode(pin5, OUTPUT);
pinMode(pin6, OUTPUT);
pinMode(pin7, OUTPUT);
pinMode(pin8, OUTPUT);
pinMode(pin9, OUTPUT);
pinMode(pin10, OUTPUT);
pinMode(pin11, OUTPUT);
digitalWrite(pin4, LOW);
digitalWrite(pin5, LOW);
digitalWrite(pin6, LOW);
digitalWrite(pin7, LOW);
digitalWrite(pin8, LOW);
digitalWrite(pin9, LOW);
digitalWrite(pin10, LOW);
digitalWrite(pin11, LOW);
ps2Keyboard.begin();
keyMapping.setNumLock(true);
ps2Keyboard.awaitStartup();
diagnostics.reset();
//Encendemos el led del teclado(Bloq Num)
ps2Keyboard.sendLedStatus(ps2::KeyboardLeds::numLock);
lastLedSent = ps2::KeyboardLeds::numLock;
}
void loop() {
diagnostics.setLedIndicator<LED_BUILTIN>();
ps2::KeyboardOutput scanCode = ps2Keyboard.readScanCode();
if (scanCode == ps2::KeyboardOutput::garbled) {
keyMapping.reset();
}
else if (scanCode != ps2::KeyboardOutput::none)
{
char buf[2];
buf[1] = '\0';
buf[0] = keyMapping.translatePs2Keycode(scanCode);
if (buf[0] == '\r') {//Se cumple si es la tecla enter
Serial.println();
}
else if (buf[0] >= ' ') { // Se cumple si es un caracter
Serial.write(buf);
//Tecla 1
if (buf[0] == '1'){
if(estadoPin4 ==0){//Si la variable estado2 es igual a 0 se cumple esta condición
digitalWrite(pin4, HIGH);
Serial.println("Relay 1 activado");
estadoPin4 =1;//Asignamos el valor 1 a la variable "estadoPin4"
} else{
digitalWrite(pin4, LOW);
Serial.println("Relay 1 desactivado");
estadoPin4 =0;
}
}
//Tecla 2
if (buf[0] == '2'){
if(estadoPin5 ==0){//Si la variable estado2 es igual a 0 se cumple esta condición
digitalWrite(pin5, HIGH);
Serial.println("Relay 2 activado");
estadoPin5 =1;//Asignamos el valor 1 a la variable "estadoPin5"
} else{
digitalWrite(pin5, LOW);
Serial.println("Relay 2 desactivado");
estadoPin5 =0;
}
}
//Tecla 3
if (buf[0] == '3'){
if(estadoPin6 ==0){//Si la variable estado2 es igual a 0 se cumple esta condición
digitalWrite(pin6, HIGH);
Serial.println("Relay 3 activado");
estadoPin6 =1;//Asignamos el valor 1 a la variable "estadoPin6"
} else{
digitalWrite(pin6, LOW);
Serial.println("Relay 3 desactivado");
estadoPin6 =0;
}
}
//Tecla 4
if (buf[0] == '4'){
if(estadoPin7 ==0){//Si la variable estado2 es igual a 0 se cumple esta condición
digitalWrite(pin7, HIGH);
Serial.println("Relay 4 activado");
estadoPin7 =1;//Asignamos el valor 1 a la variable "estadoPin7"
} else{
digitalWrite(pin7, LOW);
Serial.println("Relay 4 desactivado");
estadoPin7 =0;
}
}
//Tecla 5
if (buf[0] == '5'){
if(estadoPin8 ==0){//Si la variable estado2 es igual a 0 se cumple esta condición
digitalWrite(pin8, HIGH);
Serial.println("Relay 5 activado");
estadoPin8 =1;//Asignamos el valor 1 a la variable "estadoPin8"
} else{
digitalWrite(pin8, LOW);
Serial.println("Relay 5 desactivado");
estadoPin8 =0;
}
}
//Tecla 6
if (buf[0] == '6'){
if(estadoPin9 ==0){//Si la variable estado2 es igual a 0 se cumple esta condición
digitalWrite(pin9, HIGH);
Serial.println("Relay 6 activado");
estadoPin9 =1;//Asignamos el valor 1 a la variable "estadoPin9"
} else{
digitalWrite(pin9, LOW);;
Serial.println("Relay 6 desactivado");
estadoPin9 =0;
}
}
//Tecla 7
if (buf[0] == '7'){
if(estadoPin10 ==0){//Si la variable estado2 es igual a 0 se cumple esta condición
digitalWrite(pin10, HIGH);
Serial.println("Relay 7 activado");
estadoPin10 =1;//Asignamos el valor 1 a la variable "estadoPin10"
} else{
digitalWrite(pin10, LOW);;
Serial.println("Relay 7 desactivado");
estadoPin10 =0;
}
}
//Tecla 8
if (buf[0] == '8'){
if(estadoPin11 ==0){//Si la variable estado2 es igual a 0 se cumple esta condición
digitalWrite(pin11, HIGH);
Serial.println("Relay 8 activado");
estadoPin11 =1;//Asignamos el valor 1 a la variable "estadoPin11"
} else{
digitalWrite(pin11, LOW);
Serial.println("Relay 8 desactivado");
estadoPin11 =0;
}
}
}
//Verifica el estado de los taclas Bloq Num y Bloq Mayús para activarlas o desactivarlas desde el mismo teclado
ps2::KeyboardLeds newLeds =
(keyMapping.getCapsLock() ? ps2::KeyboardLeds::capsLock : ps2::KeyboardLeds::none)
| (keyMapping.getNumLock() ? ps2::KeyboardLeds::numLock : ps2::KeyboardLeds::none);
if (newLeds != lastLedSent) {
ps2Keyboard.sendLedStatus(newLeds);
lastLedSent = newLeds;
}
}
}
8-channel light control with ps/2 keyboard and arduino
*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(0)
- 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
67 1 1 -
-
-
-
Sega Master System RGB Encoder Switcher Z80 QSB v1.2
66 0 0 -
18650 2S2P Battery Charger, Protection and 5V Output Board
91 0 0 -
High Precision Thermal Imager + Infrared Thermometer | OpenTemp
470 0 7 -
Sony PlayStation Multi Output Frequency Oscillator (MOFO) v1
138 0 2 -