Sometimes, we have so much wires and modules, we don't dispose enough free pins to connect other modules. To prevent overcharge Arduino board, there is a good way to do it wirelessly to transmit a data from one board to another. Basically, I am using almost the same approach as in my old "instructables", but I would like to incorporate an LCDI2C 16X02. Even if I have some free pins for this component, I would like to display the physical door state somewhere else, not necessary attached to the same board. To make this project we need:
-Arduino boards (2xUNO)
-Small breadboards (2x)
-LCDI2C 16x02 (I tried to connect this one to mega 2560 it didn't really worked)
-RFID RC522 (with a tag/card)
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Connexions for Arduino UNO (receiver)
Arduino UNO (receiver)________LCDI2C 16x02
for LCDI2C you need a library:LCDI2C1602
if A0,A1,A2 with bridge:LiquidCrystal_I2C lcd(0x20, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
if A0,A1,A2 with no bridge:LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
Arduino UNO (receiver)________Receiver(433MHz)
3V3_______________________ 3V3 (orange wire)
GND_______________________GND (blue wire)
A0_______________________DATA (violet wire)
Step 2: Connexions for Arduino UNO (transmitter)
Arduino pins (trans)_______RFID |Arduino pins (trans)__Pushbutton pins
D9____________________RST | D8_____________pin#1
D10___________________SDA | GND_____________pin#2
D11___________________MOS |(Use it to wipe out EEPROM to write a new ID
D12___________________MSO *Arduino pins (trans)____________RGB LED
D13___________________SCK *A0_____________pin#1 (red)
3.3V___________________3.3V *A1______________pin#3 (green)
GND__________________GND *A2______________pin#4 (blue)
For each action RGB will blink dependably
RFIDDoorLockTransmitter sketch also have integrated L298N (motor driver) partition. const pinMA1=2; const pinMA2=3; and Enable1=A3; may be used if you connect L298N to Arduino and to motor. Use schematic from here:https://www.instructables.com/id/RFID-RC522-and-normal-DC-motor/
Step 3: Conclusion
You can use a Serial monitor to follow the instructions. This is pretty easy. If you want to erase data from EEPROM you have to keep the push button 5 seconds after uploading the sketch. After that, you can scan you tag/card on RFID 1 step) to write to EEPROM, 2 step) is identification it displays you your ID number in HEX, 3 step) if you pass your tag/card for third time and RFID recognizes it, the pins MA1 and pins MA2 will turn on and off sequently to run a motor forward and backward and displays the message.
In function void openDoor(setDelay); you are welcome to adjust the timing of the open door, before it closes. The motor will run exactly for the same delay of time as specified. While the door is open, the signal from a transmitter will get HIGH and will be send to receiver. Once the receiver gets the signal, the sketch compares it. If signal is above the upperThreshold the motor A (you can connect 2 motors A and B) will run forward and displays a message "door open" If the signal is beyond the lowerThreshold the motor A will run backward and displays a message "door closed".
This project was done with Arduino programmer v.1.0.5 for MAC