Lance Grover

Lance Grover

RFID Kyber Crystals and Holocrons post 1

Posted date:


Well…. You can’t blame me and the other people like me, if you make cool toy that has a cool technology you can’t blame us for checking it out and figuring it out…..

Well, I took my previous project using a RDM6300 and a raspberry Pi and I added some 5050 LED strip lights…..I planed on making the lights do something different based on the RFID that was detected….so I needed some EM4100 RFIDs to read and mess with….so I found certain Kyber Crystals from the big D place just happened to have EM4305 RFID chips in them that could be read as EM4100s. I did similar wiring to this page here. But I specifically used GPIO pins 23, 24, 25 to control the RGB of the 5050 led strip. Then I hacked up this python code here (I borrowed some of it from the link in the last post about using the RDM6300):

import time
import serial
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
 
Tag1 = str('0000000C000C')
Tag2 = str('0000000C0804')
Tag3 = str('0000000C010D')
Tag4 = str('0000000C0905')
Tag5 = str('0000000C0A06')
Tag6 = str('0000000C0D01')
Tag7 = str('0000000C313D')
Tag8 = str('0000000C030F')
Tag9 = str('0000000C0B07')
Tag10 = str('0000000C0408')
Tag11 = str('0000000C0C00')
Tag12 = str('0000000C323E')
Tag13 = str('0000000C060A')
Tag14 = str('0000000C0E02')
Tag15 = str('0000000C070B')
Tag16 = str('0000000C0F03')
Tag17 = str('0000000C333F')
Tag18 = str('320012A026A6')
GPIO.setup(23,GPIO.OUT)
GPIO.setup(24,GPIO.OUT)
GPIO.setup(25,GPIO.OUT)
GPIO.output(23,True)
GPIO.output(24,True)
GPIO.output(25,True)
PortRF = serial.Serial('/dev/serial0',9600)
PortRF.reset_input_buffer()
while True:
    ID = ""
    read_byte = PortRF.read()
    if read_byte=="\x02":
        for Counter in range(12):
            read_byte=PortRF.read()
            ID = ID + str(read_byte)
            print hex(ord( read_byte))
        print ID
        if ID == Tag1:
            print "White - Ashoka"
            GPIO.output(23,False)
            GPIO.output(24,False)
            GPIO.output(25,False)
            PortRF.reset_input_buffer()
            time.sleep(5)
        elif ID == Tag2:
            print "White - Chirutt"
            GPIO.output(23,False)
            GPIO.output(24,False)
            GPIO.output(25,False)
            PortRF.reset_input_buffer()
            time.sleep(5)
        elif ID == Tag3:
            print "Red - Vader"
            GPIO.output(23,False)
            GPIO.output(24,True)
            GPIO.output(25,True)
            PortRF.reset_input_buffer()
            time.sleep(5)
        elif ID == Tag4:
            print "Red - Sidious"
            GPIO.output(23,False)
            GPIO.output(24,True)
            GPIO.output(25,True)
            PortRF.reset_input_buffer()
            time.sleep(5)
        elif ID == Tag5:
            print "Red - Dooku"
            GPIO.output(23,False)
            GPIO.output(24,True)
            GPIO.output(25,True)
            PortRF.reset_input_buffer()
            time.sleep(5)
        elif ID == Tag6:
            print "Red - Maul"
            GPIO.output(23,False)
            GPIO.output(24,True)
            GPIO.output(25,True)
            PortRF.reset_input_buffer()
            time.sleep(5)
        elif ID == Tag7:
            print "Red - Vader 8 ball"
            GPIO.output(23,False)
            GPIO.output(24,True)
            GPIO.output(25,True)
            PortRF.reset_input_buffer()
            time.sleep(5)
        elif ID == Tag8:
            print "Yellow - Temple Guard"
            GPIO.output(23,False)
            GPIO.output(24,False)
            GPIO.output(25,True)
            PortRF.reset_input_buffer()
            time.sleep(5)
        elif ID == Tag9:
            print "Yellow - Maz"
            GPIO.output(23,False)
            GPIO.output(24,False)
            GPIO.output(25,True)
            PortRF.reset_input_buffer()
            time.sleep(5)
        elif ID == Tag10:
            print "Green - Qui-gon"
            GPIO.output(23,True)
            GPIO.output(24,False)
            GPIO.output(25,True)
            PortRF.reset_input_buffer()
            time.sleep(5)
        elif ID == Tag11:
            print "Green - Yoda"
            GPIO.output(23,True)
            GPIO.output(24,False)
            GPIO.output(25,True)
            PortRF.reset_input_buffer()
            time.sleep(5)
        elif ID == Tag12:
            print "Green - Yoda 8 ball"
            GPIO.output(23,True)
            GPIO.output(24,False)
            GPIO.output(25,True)
            PortRF.reset_input_buffer()
            time.sleep(5)
        elif ID == Tag13:
            print "Blue - Old Ben"
            GPIO.output(23,True)
            GPIO.output(24,True)
            GPIO.output(25,False)
            PortRF.reset_input_buffer()
            time.sleep(5)
        elif ID == Tag14:
            print "Blue - Old Luke"
            GPIO.output(23,True)
            GPIO.output(24,True)
            GPIO.output(25,False)
            PortRF.reset_input_buffer()
            time.sleep(5)
        elif ID == Tag15:
            print "Purple - Mace 2"
            GPIO.output(23,False)
            GPIO.output(24,True)
            GPIO.output(25,False)
            PortRF.reset_input_buffer()
            time.sleep(5)
        elif ID == Tag16:
            print "Purple - Mace"
            GPIO.output(23,False)
            GPIO.output(24,True)
            GPIO.output(25,False)
            PortRF.reset_input_buffer()
            time.sleep(5)
        elif ID == Tag17:
            print "Black - Snoke"
            GPIO.output(23,False)
            GPIO.output(24,True)
            GPIO.output(25,True)
            PortRF.reset_input_buffer()
            time.sleep(5)
        elif ID == Tag18:
            print "nothing really"
            GPIO.output(23,False)
            GPIO.output(24,True)
            GPIO.output(25,True)
            time.sleep(1)
            GPIO.output(23,False)
            GPIO.output(24,False)
            GPIO.output(25,True)
            time.sleep(1)
            GPIO.output(23,False)
            GPIO.output(24,False)
            GPIO.output(25,False)
            time.sleep(1)
            GPIO.output(23,True)
            GPIO.output(24,False)
            GPIO.output(25,False)
            time.sleep(1)
            GPIO.output(23,False)
            GPIO.output(24,True)
            GPIO.output(25,False)
            time.sleep(1)
            GPIO.output(23,True)
            GPIO.output(24,False)
            GPIO.output(25,True)
            time.sleep(1)
            GPIO.output(23,True)
            GPIO.output(24,False)
            GPIO.output(25,True)
            PortRF.reset_input_buffer()
            time.sleep(1)
        else:
            GPIO.output(23,True)
            print "Access Denied"
            GPIO.output(24,True)
            GPIO.output(25,True)
            PortRF.reset_input_buffer()
            time.sleep(5)

My kids have actual Holocrons that work with the Kyber Crystals so they weren’t supper impressed….but heck I made this one from scratch. Now I just need to put it all in a fancy box or something….maybe…