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)
Step 1: Welding the connection pins for RC522 module
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.
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.
8 pins on RC522 module.
You plug the cord into these 7 pins.
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.
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.
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.
You connect DC + wires to 5V pins, DC wires - to GND pins, IN wires to pin 2.
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.
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.
After downloading the library, click on Sketch then select Include Library and select Add . Zip Library .
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 ("........ . ");
}
Press V to translate the code.
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.
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
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.
Swipe with PET plastic card.
So we're done.
You can put it into your wallet.
With a PET card, you can put it into your wallet like this.
Insert a PET card into your wallet.
The card still works normally when inserted into the wallet.
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
- 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
May be interested
- Decipher the mystery behind the 'water bottle flipping' trick that is causing the world 'storm'in this game, you have to toss the water bottle onto a given plane so that it lands in a standing position that is definitely not shaken or spilled.
- The terrible truth behind the hand dryer in the toiletif you choose to dry your hands with a dryer, you will be startled to learn that this is the reason for the increase in the ability to spread viruses up to 1,300 times. these include bacteria, flu viruses, fungi, herpes, hepatitis ...
- The paper airplane folding tips can hover nearly 70mdesigner john collins, who set a world record for the 69-meter-longest paper-jet flying machine in 2012, recently shared his flight-plotting trick in a video.
- 17 images depicting the lives of girlslet's take a look at 17 funny pictures that portray the girls' lives below!
- Quick and accurate mental arithmetic tips make you surprisedmath is a logical and logical science subject, but even so there are many tips to simplify the problem as if it is super hard and troublesome. the logic of mathematics sometimes takes us by surprise!
- The way to teach children fast mental arithmetic of Japanese peopledare to say that you will never find such interesting mental math or math rules in textbooks!