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?

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:

  1. A broad Arduino UNO R3 (cost about VND 180,000)
  2. RFID RC522 Module (Price about VND 90,000)
  3. A Module 5v Relay costs about (VND 25,000)
  4. Male-female and female-female strings (cost about VND 14,000)

Picture 1 of Homemade ultra-light light switch, only you can turn it on

Step 1: Welding the connection pins for RC522 module

Picture 2 of Homemade ultra-light light switch, only you can turn it on

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.

Picture 3 of Homemade ultra-light light switch, only you can turn it on

Step 2: Connect the RC522 RFID Module with Arduino

The pinouts are as follows:

  1. RST pin plugs into pin 9 on Arduino
  2. SDA pin plugs into pin 10 on Arduino
  3. MOSI pin plugs into pin number 11 on Arduino
  4. MISO pins plug into pin number 12 on Arduino
  5. SCK pins plugged into pin number 13 on Arduino
  6. The 3.3V pin plugs into the 3.3v digital pin on the Arduino
  7. 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.

Picture 4 of Homemade ultra-light light switch, only you can turn it on

8 pins on RC522 module.

Picture 5 of Homemade ultra-light light switch, only you can turn it on

You plug the cord into these 7 pins.

Picture 6 of Homemade ultra-light light switch, only you can turn it on

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.

Picture 7 of Homemade ultra-light light switch, only you can turn it on

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.

Picture 8 of Homemade ultra-light light switch, only you can turn it on

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.

Picture 9 of Homemade ultra-light light switch, only you can turn it on

You connect DC + wires to 5V pins, DC wires - to GND pins, IN wires to pin 2.

Picture 10 of Homemade ultra-light light switch, only you can turn it on

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.

Picture 11 of Homemade ultra-light light switch, only you can turn it on

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.

Picture 12 of Homemade ultra-light light switch, only you can turn it on

After downloading the library, click on Sketch then select Include Library and select Add . Zip Library .

Picture 13 of Homemade ultra-light light switch, only you can turn it on

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 ("........ . ");

}

Picture 14 of Homemade ultra-light light switch, only you can turn it on

Press V to translate the code.

Picture 15 of Homemade ultra-light light switch, only you can turn it on

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.

Picture 16 of Homemade ultra-light light switch, only you can turn it on

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

Picture 17 of Homemade ultra-light light switch, only you can turn it on

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.

Picture 18 of Homemade ultra-light light switch, only you can turn it on

Swipe with PET plastic card.

So we're done.

Picture 19 of Homemade ultra-light light switch, only you can turn it on

You can put it into your wallet.

With a PET card, you can put it into your wallet like this.

Picture 20 of Homemade ultra-light light switch, only you can turn it on

Insert a PET card into your wallet.

The card still works normally when inserted into the wallet.

Picture 21 of Homemade ultra-light light switch, only you can turn it on

Swipe with a tag.

With the tag you can hook into the key, very convenient.

Good luck!

  1. Instructions for making devices turn on and turn off lights automatically when the light / dark is super simple with only 50,000 VND
  2. Instructions for making backup batteries from an orange, charging nearly 40% of the battery for iPhone
  3. Instructions for making sophisticated fresh water pumps like in the shop with only VND 100,000
Update 24 May 2019
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile