Homemade ultra-light light switch, only you can turn it on
What do you think if your lights are on, can you only turn them on / off?
In the previous tutorials, we instructed you to make devices that turn on and off the lights like: turn on and off the lights by clapping, turning on and off the lights with a smartphone. In today's tutorial we will guide you to make an extremely interesting turn-off light device. With this device you can turn on and off the light with a purse or key chain. And especially only you can turn on / off the light.
Operation video of the device.
Prepare:
- A broad Arduino UNO R3 (cost about VND 180,000)
- RFID RC522 Module (Price about VND 90,000)
- A Module 5v Relay costs about (VND 25,000)
- Male-female and female-female strings (cost about VND 14,000)
Homemade ultra-light light switch, only you can turn it on Picture 1
Step 1: Welding the connection pins for RC522 module
Homemade ultra-light light switch, only you can turn it on Picture 2
If the RC522 RFID module is purchased, it will not be soldered. In order to use it, we must proceed to connect the welding pins.
Homemade ultra-light light switch, only you can turn it on Picture 3
Step 2: Connect the RC522 RFID Module with Arduino
The pinouts are as follows:
- RST pin plugs into pin 9 on Arduino
- SDA pin plugs into pin 10 on Arduino
- MOSI pin plugs into pin number 11 on Arduino
- MISO pins plug into pin number 12 on Arduino
- SCK pins plugged into pin number 13 on Arduino
- The 3.3V pin plugs into the 3.3v digital pin on the Arduino
- GND pins plug into GND pin number on Arduino
On RC522 module there are 8 pins but we only need to use 7 pins. Including 2 source pins and 5 signal pins.
Homemade ultra-light light switch, only you can turn it on Picture 4
8 pins on RC522 module.
Homemade ultra-light light switch, only you can turn it on Picture 5
You plug the cord into these 7 pins.
Homemade ultra-light light switch, only you can turn it on Picture 6
Then connect to the Arduino according to the diagram above.
Step 3: Connect Relay Module with Arduino
Relay module works to help us control devices with large voltages such as 220V, if directly controlled with devices running 220V, the Arduino circuit will be damaged.
Homemade ultra-light light switch, only you can turn it on Picture 7
The Replay module will have 6 pins, DC + DC - is the 2nd pin supplying small voltage from Arduino output, IN is the input signal pin.
Homemade ultra-light light switch, only you can turn it on Picture 8
COM and NC NO are pins for us to use to switch off electrical devices. COM is the middle foot. NC stands for Normal Close which means normally closed. NO is Normal Open meaning normally open.
Homemade ultra-light light switch, only you can turn it on Picture 9
You connect DC + wires to 5V pins, DC wires - to GND pins, IN wires to pin 2.
Homemade ultra-light light switch, only you can turn it on Picture 10
On the other side of the Relay, you connect 1 wire of the power to the COM port. The remaining power cord is connected to the light bulb. The other end of the light bulb is connected to the N0 pin.
Homemade ultra-light light switch, only you can turn it on Picture 11
So we are done connecting. Now we will proceed to load the code.
Step 4: Load the code to get the ID of the card
Since Arduino does not have the MFRC522 library available, we need to add it to Arduino. You download the MFRC522 library here.
Homemade ultra-light light switch, only you can turn it on Picture 12
After downloading the library, click on Sketch then select Include Library and select Add . Zip Library .
Homemade ultra-light light switch, only you can turn it on Picture 13
A new window will appear. Select the library file you just downloaded and then click Open. The library will be added to Arduino.
After adding the library, copy this code into Arduino on your computer.
#include
#include
const int LED1 = 2;
const int LED2 = 2;
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522 (SS_PIN, RST_PIN);
unsigned long uidDec, uidDecTemp;
byte bCounter, readBit;
unsigned long ticketNumber;
void setup () {
pinMode (LED1, OUTPUT);
pinMode (LED2, OUTPUT);
Serial.begin (9600);
SPI.begin ();
mfrc522.PCD_Init ();
Serial.println ("GenK Arduino / Hay quits the ID test .");
}
void loop () {
if (! mfrc522.PICC_IsNewCardPresent ()) {
return;
}
if (! mfrc522.PICC_ReadCardSerial ()) {
return;
}
uidDec = 0;
Serial.println ("********************************************* *** ");
Serial.println ("ID of the la:");
for (byte i = 0; i
uidDecTemp = mfrc522.uid.uidByte [i];
uidDec = uidDec * 256 uidDecTemp;
}
Serial.print ("[");
Serial.print (uidDec);
if (uidDec == 3828924583) {
digitalWrite (LED1,! digitalRead (LED1));
delay (1000);
} else {
}
// --------------------------------
if (uidDec == 1506337237) {
digitalWrite (LED2,! digitalRead (LED2));
delay (1000);
} else {
}
Serial.println ("]");
Serial.println ("........ . ");
}
Homemade ultra-light light switch, only you can turn it on Picture 14
Press V to translate the code.
Homemade ultra-light light switch, only you can turn it on Picture 15
Click on the arrow icon to load the code.
After successfully loading the code, press Ctrl Shift M to open the Serial Monitor port on the screen.
Homemade ultra-light light switch, only you can turn it on Picture 16
ID of the card after scanning.
If you swipe the card via the RC522 ID card, it will display on the screen. When buying RC522 module, you will be given a PET plastic card and a key tag.
Step 5: Fill in your card ID into CODE
Homemade ultra-light light switch, only you can turn it on Picture 17
Replace your card ID here.
After having the ID of the card then you change this ID into 2 lines with the arrow above and proceed to reload the code into Arduino.
Homemade ultra-light light switch, only you can turn it on Picture 18
Swipe with PET plastic card.
So we're done.
Homemade ultra-light light switch, only you can turn it on Picture 19
You can put it into your wallet.
With a PET card, you can put it into your wallet like this.
Homemade ultra-light light switch, only you can turn it on Picture 20
Insert a PET card into your wallet.
The card still works normally when inserted into the wallet.
Homemade ultra-light light switch, only you can turn it on Picture 21
Swipe with a tag.
With the tag you can hook into the key, very convenient.
Good luck!
- Instructions for making devices turn on and turn off lights automatically when the light / dark is super simple with only 50,000 VND
- Instructions for making backup batteries from an orange, charging nearly 40% of the battery for iPhone
- Instructions for making sophisticated fresh water pumps like in the shop with only VND 100,000
You should read it
- What color is the turn signal light? It's easy to think but 90% of people answer wrong
- Instructions on how to make devices that turn on / off lights and fans in Vietnamese
- The brightest LED lamp in the world, if projected into the blind's eyes temporarily
- OliLight climbing lamp sends an alarm signal when disaster strikes
- How to Test Trailer Lights
- Japanese youths make emergency lights from smartphones and bottles of water for temporary use during a power outage due to a super typhoon
- What is the effect of the lights on the wings, tail... of the plane?
- Cosmo's bicycle helmet lights will warn others when you fall
- How to sabotage lights in Among Us
- How to Hook Up a Tow Dolly and Lights to a Car
- Differentiate indicator lights in Cisco Switch
- How to turn on and off the keyboard lights for laptops Dell, HP, Asus, Acer, Vaio, Lenovo, Macbook
May be interested
Decipher the mystery behind the 'water bottle flipping' trick that is causing the world 'storm'
The terrible truth behind the hand dryer in the toilet
The paper airplane folding tips can hover nearly 70m
17 images depicting the lives of girls
Quick and accurate mental arithmetic tips make you surprised
The way to teach children fast mental arithmetic of Japanese people