#34 RFID Reader/Writer (Mifare MFRC522) with a Logic Level Shifter

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 พ.ค. 2016
  • Secure access is often controlled with a credit card sized security pass, such as the Mifare RC522 Classic, available for just a few dollars (or pounds).
    Here I show you the basics of how to read and write data from and to the RC522 Mifare card (or fob) and discuss what we're going to do about encryption to protect personal data stored on that card.
    And if you have an Arduino UNO or other 5v board then you WILL need to use a Logic Level Shifter to convert the 5 volts on the GPIO pins down to 3.3 volts for the RFID read (and back again - bidirectional). Cheap as chips and easy to wire up.
    HERE ARE THE LINKS TO MATERIAL MENTIONED OR DEMONSTRATED IN THE VIDEO:
    -----------------------------------------------------------------------------------------------------------
    MiguelBalboa's excellent RFID library:
    github.com/miguelbalboa/rfid
    Look at the numerous examples in that library (which we have explored just a couple of items in the video).
    -----------------------------------------------------------------------------------------------------------
    The MFRC522 data sheet: (covers other hardware too)
    www.nxp.com/documents/data_she...
    (Note: this should be V3 and dated 3rd March 2014)
    It covers everything you wanted to know (and plenty you probably don't care about) but makes for interesting reading nonetheless.
    -----------------------------------------------------------------------------------------------------------
    A great utility to convert hex to ascii (and back) and to many other formats such as ROT13, Binary, BASE64 etc):
    www.asciitohex.com/
    which we used in the video to convert the hex format personal data on the card to ascii (and back again)
    -----------------------------------------------------------------------------------------------------------
    As always Thanks For Watching and please subscribe if you find these videos useful - new ones weekly (ish).
    And my channel is here:
    -----------------------------------------------------------------------------------------------------------
    / ralphbacon
    -----------------------------------------------------------------------------------------------------------
    How can I remember this? Memory tip: "See" Ralph Bacon, geddit?
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 134

  • @wekaman9815
    @wekaman9815 4 ปีที่แล้ว

    Great vid I learnt a lot, I use a fob for the gym, a card for door/gate access and have had them for time clock at work and to open computers.
    Can employee ID numbers be added to the cards and show on the serial monitor like the first and last names do with serial read?

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      I'm afraid each card can only carry one unique ID so you will need a card for the gym and one for the gate.

  • @ice2642
    @ice2642 6 ปีที่แล้ว +1

    Good video :)

    • @RalphBacon
      @RalphBacon  6 ปีที่แล้ว

      Thanks for that, marcio esper, glad you liked it, nice to hear from you again.

  • @Asim2846
    @Asim2846 7 ปีที่แล้ว

    Hey Ralph :) I'm trying to read and write using a Arduino nano , it seems to support 3v? do you know if that will work, and do you have any advice? i just recently started using arduino, i am very unfamiliar but very excited and patient , but i am really trying to figure out how to set up this NANO with the RFID chip- RC5222.. I kinda need some help;)

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว

      Hi Norman! The Nano is designed to run at 5 volts (although it might run right down to 2.7 volts, but not by design). However, you can get Pro Micro devices that run at 3.3 volts (watch out, there are both 5 volts and 3.3 volts versions -get the right one!). These will require an FTDI USB-to-Serial converter to program them (I have videos on this). But if you are trying to use a 3.3 volt device just so you don't have to voltage shift the 5 volts down to 3.3 volts then that's the wrong approach, in my opinion. Use a Nano at the voltage it was intended and voltage shift the GPIO outputs. Watch my video #89 out later this week for an alternative method of voltage shifting.
      The best advice I can give you is to not try and run before you can walk. Make sure you understand how to upload the "blink" sketch to your device. Make sure you know (most of) the Arduino C++ language (it's specific to the Arduino). Follow my demo sketches to the letter (download them), use *exactly* the same hardware and then you will get it to work. Once you have a working proof-of-concept you can "do your own thang" as the "yoof" of today might say (but probably don't). You can do it, but do it slowly. Good luck.

  • @SeanSciberras
    @SeanSciberras 7 ปีที่แล้ว

    Another thing, I recently tested the rfid_write_personal_data file found on github but I get an error saying:
    error: invalid conversion from 'byte {aka unsigned char}' to 'MFRC522::StatusCode' [-fpermissive]
    This error occurs on pretty much every line of code that contains "mfrc522".
    The code has likely been altered since its use in your video, but I'm not sure what changes to make to fix this supposed conversion issue. Do you know what has been altered, and/or what would need to be changed to fix this? Thanks!

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว

      Mmm, tricky one this. Not my code so I'm not familiar with it. I'll try and take a look over the weekend to see if I can what the issue is.
      In fact I've just had a look at this code and it would appear you might have a problem with the underlying MFRC522 library rather than the example sketch. I'll take a look over the weekend to see whether I can find the problem. I'm assuming you're using his library too and not trying to mix and match.

    • @Srlancelot39
      @Srlancelot39 7 ปีที่แล้ว

      I believe I am using his library (might be wrong - will check), and yeah that sounds like it might be the issue rather than the main program. Thanks again!

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว +1

      I've just downloaded the example sketch from here:
      github.com/miguelbalboa/rfid/blob/master/examples/rfid_write_personal_data/rfid_write_personal_data.ino
      And it compiled just fine without me having to anything which means it used the library I used in my video - all without amendment. I therefore can only assume that you have a different library (or the IDE is picking up a different one to the one you think you are using!).
      Check your libraries (and/or download Miguel's library again and place it in your libraries folder) and try again!

    • @Srlancelot39
      @Srlancelot39 7 ปีที่แล้ว

      Alright, good to hear! That should solve it. Thanks!

  • @pushkinmania
    @pushkinmania 6 ปีที่แล้ว

    what kind of compiler do you use ,which allows you to enter commands directly from the keyboard ?

    • @RalphBacon
      @RalphBacon  6 ปีที่แล้ว

      I think you must be referring to the Serial Monitor, Pushkinmania, which allows two-way communication between the Arduino and your PC. Normally we'd be receiving data sent from a Serial.Print statement, but in this case we are also sending back data to the Arduino via the USB port, which the Arduino receives via a Serial.Read() statement. It's built into the Serial Monitor (aka Debugging Window) on the Arduino IDE (as well as the IDE I was using). Make sense?

  • @SeanSciberras
    @SeanSciberras 7 ปีที่แล้ว

    What version/model of UNO do you have in the video? I have a Genuino UNO, and it has both a 5V and 3.3V pin. I am connecting my MIFARE RC522 to the 3.3V instead and it seems to be working fine so far. Also, my MIFARE reader is red, not blue, and the pin labels and their order are slightly different. Could this possibly cause me trouble since most walkthroughs/resources refer to the "typical" blue version? If so, I wouldn't mind buying the blue version as well to make life easier. lol
    The red one I have says "RFID-RC522 Funduino" on the board. It came in a LinkSprite box with a UPC sticker that said "MIFARE RC522 CAARD...RD PROXIMITY MODULE New"
    Btw, I'm "XORduino" on the Arduino forums :)

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว

      Hi XORduino! I have a "ddCduino" as my UNO clone but that is purely by luck than judgement - that is, I ordered it from the Far East via eBay and this is what I got (amongst several others). It was very good value (IIRC GBP 3-4 which is about $4.50 - 6.00) and has worked very well. It too has a 5v and a 3.3v pin.
      I also use a Nano on an expansion board as that gives me a +ve, -ve and the GPIO pin for each and every pin on the board. Plus a few others. Developers' dream board, really.
      As far as your Mifare reader goes I will have to check up tonight to see if there are different versions around or whether the board colour is just cosmetic.
      OK, I've now checked the Mifare reader (blue board) and the chip on it has had its identification marks removed (allegedly, they are not present now, perhaps they never were). In any case I can't tell what the chip is so there is no way of determining whether this reader is the same as yours or not now. Frankly, for the price of a 'blue' classic reader you might as well get one and join the merry crowd of working readers!

    • @SeanSciberras
      @SeanSciberras 7 ปีที่แล้ว

      Awesome, thanks!

  • @sondangdebora5205
    @sondangdebora5205 7 ปีที่แล้ว

    Halo Ralph S Bacon :)
    Thank you so much for your video, its helps me to doing my final project. And I have a questions that makes me confuse.
    How I can connect the arduino with the database? Do you ever try it? I want the data in tag will be appear in database every time you swiped tag to the reader.

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว

      Hi there Sondang Debora, nice to hear from you! An interesting question you ask too. Arduinos are not really database machines but you can easily create a small (encrypted?) file on an SD card to record card swipes (in, out, who they are). However, you need to keep it simple. Space is not the issue (on a 32Gb card, for example) but speed of processing may be.
      Let's assume a user swipes her card. The Arduino has to read a (serial) file, line by line, until it finds a match - thus indicating the user is authorised. Then it might want to write out the date & time to a different file to record that swipe. Not difficult but as I say, you need to keep it simple. And secure!
      If you really want a *proper database* then the simplest way of doing this is to use a PC, attached to the Arduino. You might want to use an Arduino that emulates a keyboard so that the Arduino can send the card info just as though a user had typed it in, such as a Pro Micro or Leonardo. The PC can then access any type of database you want, quickly, store data, and send a response back very quickly to the Arduino. In this case the Arduino merely acts as a peripheral to the PC.
      I hope these ideas help you. There are videos here on this channel that deal with keyboard emulation and Sparkfun Pro Micro Arduino boards, which are fairly easy to use. The Arduino playground also has information.
      Good luck with your project and do look at other videos here to see whether they might help you.

    • @thepvporg
      @thepvporg 6 ปีที่แล้ว

      I am sure that Ralph has done something about HTTP with an arduino.

  • @arduino2000
    @arduino2000 4 ปีที่แล้ว

    Отличное видео. Спасибо.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว +1

      Спасибо за просмотр! Рад снова Вас слышать. It's a small world after all!

  • @roberteliassen5020
    @roberteliassen5020 7 ปีที่แล้ว +3

    Here's my plan for RFID: My cat has an RFID-chip in his neck. He comes and leaves our house via a cat-door. The door has a 3-way switch; locked, let everyone in, and let everyone out (where "everyone" is cat-sized animals). Now, we have neighbours and they have cats, some of them (the cats) seems to think our cat food is more tasty than their own.
    So, my plan is to make a selective cat door which lets everyone out, I don't want to trap cats that accidentally get in, and only let my cat in. That should be easy enough. Well, my cat is 13 years old and would probably not live to tell the story of an automated cat door because his owner can't ever finish a project... But that's the plan anyway. :-)

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว +1

      Hold your horses (or cats) there Robert, I'm not certain this will work with the setup in my video.
      The frequency for pet chips is different. In the US it's pretty much standardised on 125kHz and in Europe (including the UK) it could be any one of 125 kHz, 128 kHz and 134.2 kHz. You may have to research the frequency used in your part of the world (your vet may be able to confirm).
      Anyway, that all said, my Mifare RFID project uses 13.56Mhz absolutely no good for your cats (but great for office door locks). But 125kHz readers are available, they are just a bit more money (see here for a random example I found: www.seeedstudio.com/125Khz-RFID-module-UART-p-171.html). Research the whole thing well before committing but I think this is very doable (and my Google search shows that, funnily enough, you are not the only one wanting to do this. Who would have thought?)
      If you proceed do post back here as I'd be interested in how/what you achieved...

    • @roberteliassen5020
      @roberteliassen5020 7 ปีที่แล้ว

      Oh, I forgot to mention I've already ordered (and received) a 125kHz unit from eBay for $2,50. First I have to make a little test rig and try to read the chip. Could be a challenge as my cat inspects any new items with his teeth (after a bit of smelling).
      Edit: Search for "RDM630 EM4100 RFID Card Read Module" on eBay. I'm not sure if that will work though.

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว

      Oh that's a relief! And thanks for that search term, it worked just fine. For any one else reading this post, here's an example link: www.ebay.co.uk/itm/EM4100-RDM630-RFID-Card-Read-Module-UART-Serial-Output-for-Arduino-125-KHZ-/291656810802?hash=item43e819c132:g:bZkAAOSwT~9WkjFC
      Needless to say, I'm ordering one right now so I can scan not only my cat Benny, but also the stray we've been feeding for nearly a year now so see whether he's chipped. This is a great idea and great collaboration between Arduinites! Maybe others will be tempted to do what you're doing too? Thanks again for sharing this, it's greatly appreciated.

    • @roberteliassen5020
      @roberteliassen5020 7 ปีที่แล้ว

      And if he's chipped, you may charge the owners for each meal. :-)
      Edit: This 125kHz reader is 5V so you don't have to deal with lever-shifting.

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว

      If he's chipped I want to know why he was underfed and looking very sorry for himself a year ago. Now he's a porky little thing, due to the 4 to 6 packs of food per day we've fed him plus the vitamin powder. I even put a cat flap into my shed so he had somewhere warm to sleep (which he uses only occasionally). Anyway, this talk is making Benny very jealous so back to Arduino world! I've ordered the component so once the slow boat from China has delivered it I'll add it to my backlog. Very useful that it's 5v, just makes life simpler. It will be interesting whether this works on UK chipped cats... Thanks for that info too!

  • @danhcong5234
    @danhcong5234 7 ปีที่แล้ว

    Hi, thanks you so much for sharing this video! I have a couple questions to finish my project: Our team are making a vehicle tracking system, and RFID reader is a part of this system. The RFID reader has to read information (driving license and driver 's name) and sent them to "black box" to active car. Could you help me how to:
    1. How to write these information to tags (block and sector could be choosen);
    2. How to read these information again and send them to UART port;
    3. Have you ever try using STM32 with this library;
    Thank you for your reading!

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว

      Well Danh, I'm happy you like the video but there's only so many hours in the day and what you're asking is a lot. What you need to do is read up the spec sheets in more detail (after getting my demo to work) so you know how to address the memory correctly and then how to send the data to the device. General questions on "how to" are best answered by the Arduino forum (forum.arduino.cc/index.php) but do avoid asking them to do your work and research - they will help with roadblocks but not do your homework! Good luck!

  • @grahammidgley401
    @grahammidgley401 7 ปีที่แล้ว +1

    Hi Ralph
    Another great video, well done, just a quick question, Which Arduino IDE are you using in this video.
    Thanks
    Graham

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว +1

      Hi Graham! Needless to say this question has been asked many times (even though I try to hide the fact I don't often use the standard Arduino IDE. I say "hide", I mean "not mention".)
      So I'm using the Eclipse IDE. In fact, I've just upgraded from v3 (Toddler) to v4(Sloeber) which contains the Arduino plug-in all nicely built in. He asks for a donation but it's totally optional.
      Now this is quite a complex IDE but for me works just right as I use Microsoft's Visual Studio every day and this is probably as powerful. Caveat: some sketches will not compile as the libraries being used contain errors or syntax constructs that Eclipse (quite rightly) rejects. It's then a matter of either correcting the library (yup, just done that not 5 minutes ago for a project I'm working on) or contacting the author(s) asking them to make it compile under Eclipse. If you can get hold of them they are usually keen to get it working. If the authors have "moved on" to pastures new then you're on your own. Doesn't happen often but is frustrating when it does. The workaround is to go back to the Arduino IDE or use another one, such as the Sublime Text Editor (see video #69).
      Perhaps the Sublime Text editor is more than enough for you. Better than the standard IDE (eg it has intellisense) but it's not as complex as Eclipse. Check it out, video #69!
      I might copy this entire answer to the Channel Messages so I can direct others to it, as it's a common question! But thanks for asking as it has at least made me think of doing this!

  • @jeffmoye
    @jeffmoye 6 ปีที่แล้ว +1

    RFID is also used for security patrols: put picc’s in key locations that a patrol must visit, or on the door frame of a door that must be checked periodically. The guard then had an app on his phone that reads the picc’s when he does his patrol. Instant proof in an audit log of the time and date that the patrols were completed.
    I have also seen them used in adverts on trains - “ hold your phone here”: the picc stuck behind the advertising poster gives out a url and the phone navigates to the page.
    Qr codes could achieve the same thing in both cases, but they tend to rely on cloud-based decoding, which is not required for rfid.

    • @RalphBacon
      @RalphBacon  6 ปีที่แล้ว

      The security patrol thing is spot on, Jeff. More years ago than I am alive my dad did just that (although I suspect it was not RFID and he certainly didn't have any kind of smartphone, they were still using valves (tubes) in those days. But the principle still stands. Interesting about the "hold your phone here", I've not seen that; it must work on NFC or something?

    • @jeffmoye
      @jeffmoye 6 ปีที่แล้ว

      android.appstorm.net/how-to/hardware/what-are-nfc-tags-and-how-do-you-use-them/

    • @RalphBacon
      @RalphBacon  6 ปีที่แล้ว

      Interesting indeed. Thanks for the link. I shall read up on them to see how they can have a place in our Arduino or Pi projects.

  • @tonyweavers4292
    @tonyweavers4292 5 ปีที่แล้ว +1

    I have just bought a couple of SureFeed cat feeders that only allow each cat access to their own feeder. They each come with an rfid disc for the cat's collar in case your pet is not micro chipped. I cloned a couple of extra blue rfid discs as spares and use them to open the feeders while I put their food in, to save groping for the button round the back. They also prevent the food drying out a bit too. An idea for Benny perhaps? Like you, I'm not sure what else to do with them. I did manage to clone my door access card for work too! Not really useful, but I had to do it. :)

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว +1

      Sounds good, but Benny scoffs his food in one sitting so no need for him to have one! But cloning your oh-so-secure work access card is a good idea in case you forget it one day - keep the spare in the glove compartment! Not that I would ever do such a thing...

  • @imanzahurin7227
    @imanzahurin7227 4 ปีที่แล้ว

    can we just use several pins from RFID connected to level shift converter and the rest we just connect directly to Arduino? Or is it required to connect all used pins through level shift converter?

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว +1

      The MiFare board is only 3,3v tolerant so any wires going to it must be level shifted.

  • @haynesjr34
    @haynesjr34 7 ปีที่แล้ว +1

    Hi Ralph, how can I write to a specific sector and block? I need to write data to Sector: 1 Block: 4

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว

      +Fred Haynes
      Thanks for posting this interesting question! Even though I can't quite remember what sector/block I wrote to in the demo video, the library (MFRC522) that I included in the video description has an example sketch call "ReadAndWrite.ino" which it says:
      This sample shows how to read and write data blocks on a MIFARE Classic PICC
      BEWARE: Data will be written to the PICC, in sector #1 (blocks #4 to #7).
      I don't know why it says BEWARE but I'd have a good look (and a read-up perhaps) on why this might be a bit dangerous. I do know that writing to sector 0, Block 0 can be done (to change the ID of the card), but actually should not be allowed. Our Far Eastern friends have determined, however, that we should not be prevented from bricking our own cards so have left it wide open!
      That's the best I can do right now, I hope it gives you a pointer, at least, to the answer you're looking for!

  • @craxyvirux
    @craxyvirux 7 ปีที่แล้ว +1

    Hi Sir, can you help with printing only the uid and family name, first name added in the card? thanks in advance!

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว

      Hi Crazy Virux! If you inspect the code where the information is extracted you just need to identify the variables that you are interested in and write those out (either to the Serial Monitor or probably better an LCD display). Look at the examples that came with the library, they will give you a starting point - start simply and work up to your goal :)

  • @billbobby461
    @billbobby461 17 วันที่ผ่านมา

    hi, i have a project to put on a 24v system, I need to sense when a 24v relay switches with an arduino to then signal to another relay to work a solenoid valve on a timer set by the arduino. I was wondering could i use a optocoupler isolator module to give me the signal that the relay has turned on.
    plan would be to connect the 24v side of the isolator module into the coil circuit for a relay that turns on a hydraulic solenoid valve, to signal to the arduino to turn on another relay which works another solenoid valve(basically there is an existing system that i want to piggyback on as a signal to perform another task as i don't want to interfere with it). my question is how much current could an opto isolator handle could i wire it straight to the relay circuit or even the solenoid valve circuit? or is there another way to wire it that limits the current through the module?

    • @RalphBacon
      @RalphBacon  14 วันที่ผ่านมา

      You want to know when a relay from an external system has been switched on?
      Yes, ensure the GROUND connections of both systems are connected together and put the opto LED in the same bit of the external circuit as the relay WITH a suitable resistor. Normally, the opto LEDs are designed for 5v (or less, if bare components), not 24v, so you want to drop 19v at say 20mA. Using Ohm's law that is 19 divided by 0.02 = 950 ohms. Call it 1KΩ to be safe.
      So your external circuit is now powering both the relay and your new opto LED. What you do with the output of the opto coupler is now up to you.

    • @billbobby461
      @billbobby461 14 วันที่ผ่านมา

      @RalphBacon thanks for the reply. Just made that circuit up on tinkercad a few nights ago and looked good but still unsure.
      Just to clarify when you say jojn thr grounds you mean the opto LED coupler and the relay I'm "sensing" correct?

    • @RalphBacon
      @RalphBacon  14 วันที่ผ่านมา

      Well really I mean the ground connection of both systems PSU but the bits you mentioned are two parts of the two systems, so would do fine.

  • @cliant1
    @cliant1 6 ปีที่แล้ว +1

    Hi, i'm getting this error frequently when i write the cards "RFID ERROR: PCD_Authenticate() failed: Timeout in communication"
    what should i do??

    • @RalphBacon
      @RalphBacon  6 ปีที่แล้ว +1

      I don't know the answer, adi, but I found a thread that _might_ help you:
      forum.arduino.cc/index.php?topic=489286.0

    • @paulradford4100
      @paulradford4100 3 ปีที่แล้ว

      I had this with corrupt cards. If you have a smartphone, you can get mifare tools. Using nfc on the phone , you can use this app to do a factory reset and fix the card.

  • @robertpoynton9923
    @robertpoynton9923 4 ปีที่แล้ว

    I have a fog for my gym membership and a card for work. How do I merge the cards so I only need to carry one on me without changing the ID with my gym or work?

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      Short answer: you can't combine the two. Each card has a UNIQUE ID so your work and gym cards cannot be merged, sorry.

  • @SeanSciberras
    @SeanSciberras 7 ปีที่แล้ว +1

    Hey again Ralph, now that I am successfully writing data from the servo to the RFID card(thanks to you!), I need to do the reverse and read this data from a block on the card and then have it used by the servo.
    What I am having difficulty with is how to copy/read data from a specific block (and store it in a buffer/variable). So far, all the examples I've seen only display the data via Serial Monitor, and even then they make use of MFRC522 library functions such as PICC_DumpToSerial().
    I've tried using MIFARE_Read(), but the function returns a message saying that the card returned a NAK. I have made the assumption that this is because I did not perform any authenticity checks that the card may require. My new solution is to make my own modified version of the MFRC522 library that returns the buffer instead of displaying it in Serial Monitor. I hope you can tell me that this is a ridiculous idea and that there is a much simpler approach. :P
    P.S. Please tell me if you'd like me to start posting these questions elsewhere instead of filling your comments, haha

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว

      +Sean Sciberras
      Hi again Sean, it's great that this has got you fired up with your project! The bad news is that unless I were to actually try doing the 'read from specific block' myself I can't actually point you in the right direction. However, your idea of modifying the library (or copying the method used in the library to your own code and modifying it there) is a great idea and one I do all the time.
      Regarding your questions, you would probably get better (and quicker) responses if you posted technical questions on the arduino forum (forum.arduino.cc/index.php) as there are many, many experts available there. Just be sure to read the forum rules (eg about posting code using the code tags) and being concise and explicit about the problem and what you have already done to solve it. When they see you have made efforts but have hit a brick wall they will be quick to help. You may see me lurking in the shadows there too!
      I will, however, keep this query in my backlog as I have really only scratched the surface of RFID reader/writers so I may do a more in-depth future video where I can demonstrate this technique too. Thanks for your continued support of my channel and good luck going forward with your project.

    • @Srlancelot39
      @Srlancelot39 7 ปีที่แล้ว

      Alright, library modifying it is then! I understand that you only know so much on the topic, and I have posted these questions on the Arduino forums as well, but quite often your advice is the most relevant and to the point.
      Thanks for all your help so far! I hope many more people like me come across your channel, as your videos are a pleasure to watch and you are excellent at giving advice.

  • @SeanSciberras
    @SeanSciberras 7 ปีที่แล้ว

    The rfid_read_write_personal_data sketch is designed to receive text from Serial Monitor and store it to a buffer as type byte * (as seen by the variable declaration: byte buffer[34];). I need the sketch to instead take data from one of my own integer variables (an analog sensor reading, as used in Knob.ino). How would I go about converting an integer value such as 180 into the same type as the buffer? The itoa function comes close, but still isn't quite what the buffer is looking for and so I still get an error.

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว

      Without knowing the detail I can suggest this: the integer value can hold a far greater range than a single byte (because an integer is two bytes big). If your integer value is larger than 255 then you may have a problem as that's as large as a single byte allows (before resetting back to zero, no error is given).
      That said, it looks like he is expecting one digit per character so if you have "180" you store that into the buffer as three separate characters, "1", "8" and "0" as if they were alpha. So you can do that by entering String myNumber = String(n); where n is the 180. Try this!

    • @SeanSciberras
      @SeanSciberras 7 ปีที่แล้ว

      The method you described where 180 is stored as separate characters is how I expected to do it, so that's all good. I'm not sure if I implemented your suggested code correctly though. I have:
      byte buffer[34]; //original code
      String analog_servo1_string = String(analog_servo1); //new variable
      buffer = analog_servo1_string; //my attempt at stuffing the "180" into the buffer...is this right?
      That last line of code gives me the error:
      incompatible types in assignment of 'String' to 'byte [34] {aka unsigned char [34]}'

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว +1

      The buffer is an array (so is the String) so you must put each character of the String into the buffer on character at a time, eg buffer[0] = analog1_servo1_string[0] and so on.

    • @SeanSciberras
      @SeanSciberras 7 ปีที่แล้ว

      Ah, right! Wouldn't be the first time I've forgotten that lol

  • @modelmodz
    @modelmodz 7 ปีที่แล้ว

    we use rfid at the airport on security trays.
    when your bags go into the x-ray machine the information is put on to the tags which are on the trays
    when your bag comes out and needs I section, the officer will scan your tray, and an image of that tray will show on the screen

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว +1

      Hi Chloe! A perfect example of RFID use if ever I saw one. I would expect that the RFID tag (on the tray) contains a unique number linked to the scanning machine thus enabling the scanned image to be shown for the tray. I wonder if the RFID is actually built into the plastic of the tray or just attached (eg slotted into a pocket onto the tray)? Great example Chloe, thanks for posting!

    • @modelmodz
      @modelmodz 7 ปีที่แล้ว

      the rfid tags stick on the trays.as they can get damaged so they peel off and get replaced with new ones....I'm guessing the images are stored on the pc data Base and the tag key is linked to that image..so when the tag is scanned the unique key of that tag brings up the image stored on the pc

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว

      I think you are totally correct on how it works, and it's probably a good idea to have replaceable RFID as those trays do get banged about a good deal and you would not want trays to be discarded if the RFID chip failed. So replaceable RFIDs is a sensible idea. An excellent example of an RFID application!

  • @RobertoColi
    @RobertoColi 7 ปีที่แล้ว

    Hi Ralf, you are one of the few that used a voltage level converter to connect the RC522 to Arduino data port.
    There are lots of video samples over youtube that connect the RC522 directly to the 5V SPI data port :( . Unfortunately I found the others examples before yours, and my first reader was destroyed. It simple suddenly stop to work. No smoke, nothing. Dead. :(
    When I saw your I realized my mistake. So I bough a set of level converters, because I have several others 3.3 only sensors (still not used) that I plan to try with Arduino.

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว +1

      Ciao Roberto! Yes, indeed, a (bi-directional) level converter is the best way of doing things although a simple resistor divider works too (but is not optimal and ends up using too many components anyway!) Good luck with the other sensors you have, I might have a video on some of them, take a look. Nice to hear from you.

  • @vuurman312
    @vuurman312 6 ปีที่แล้ว

    So can I use this to scan lets say 500 different cards ?

    • @RalphBacon
      @RalphBacon  6 ปีที่แล้ว

      Yes, it's a generic card reader so if you bought (or had prgrammed) 500 different cards it would read the number in them, just as I show in my video. What you then do with that number Dylano is, well, a different matter but it will read an unlimited number of cards. If you were thinking of matching a card against a person (eg for a door entry system) you would need to store the number and person information in a database - a Raspberry Pi would do this with no trouble at all, using the Arduino as a card-reading front end (and possibly also used to actually unlock a door).

  • @myazemmour9843
    @myazemmour9843 7 ปีที่แล้ว

    how i can cloone a RFID ?
    how i can transforming data from rfid card to another rfid card?
    ?

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว

      The usual way is to *read* one card, store the data within the Arduino sketch and then *write* another card. Note that only the Chinese Mifare cards allow you to clone the actual RFID because they do not adhere to the standard - that area *should* be protected but isn't.

  • @AlvaroGomes
    @AlvaroGomes 6 ปีที่แล้ว

    what is the name of the software you are using in this project?

    • @RalphBacon
      @RalphBacon  6 ปีที่แล้ว +1

      I'm using Eclipse with the Arduino add-on, Alvaro. Since this video was made it's moved on to version "Oxygen 2". I've replied elsewhere about this, I should really do a quick video on it, as I'm getting lots of enquiries.

    • @AlvaroGomes
      @AlvaroGomes 6 ปีที่แล้ว +1

      From what I can see from the program I think they have many interesting features that I would like to try. I try to follow and do several projects with Arduino and so I learn more. Thank you for the answer and yes really should make a video about this program and its features.
      Hugs from Alvaro Gomes

  • @gazzacroy
    @gazzacroy 3 ปีที่แล้ว

    right i got you :)

  • @russellmaguire4316
    @russellmaguire4316 3 ปีที่แล้ว

    Running uno (3.3v output) with multiple RFID and can only get 1 RFID reader to work at any one time. Powering uno from usb from laptop. Any suggestikns?

    • @RalphBacon
      @RalphBacon  3 ปีที่แล้ว +1

      Make sure the Chip Select (CS, sometimes marked SS) is not being held permanently LOW by the RFID reader, as it uses SPI to communicate and sometimes the manufacturers get real sloppy and tie it LOW (on the basis you will only ever use one SPI device!!!)

    • @russellmaguire4316
      @russellmaguire4316 3 ปีที่แล้ว

      @@RalphBacon thanks i will check. The odd thing is if i remove the 3.3v from the RFID that is reading, the other one then comes online and reads??

    • @russellmaguire4316
      @russellmaguire4316 3 ปีที่แล้ว

      @@RalphBacon oh and how do i untie the LOW or its a fixed state?

    • @RalphBacon
      @RalphBacon  3 ปีที่แล้ว +1

      Firstly, ensure you are using separate CS/SS pins for each device?
      Pin 10 seems to be always used as the default SPI pin but that's for the first device only. You need another CS pin (eg GPIO 9) for the next device (one of the downsides of SPI). You then need to ensure you bring pin 9 LOW to talk to the other device whilst pin 10 is HIGH. The SPI device is active when the CS pin is LOW. Don't have two CS pins LOW at the same time.
      So, I suspect that by disabling one RFID reader (by removing VCC) the other one becomes 'active'.

    • @russellmaguire4316
      @russellmaguire4316 3 ปีที่แล้ว

      @@RalphBacon will try that and really appreciate pointers. I was at the end of my troubleshooting ideas. Btw am a mechanical engineer and trying this for 1st time. Thanks again

  • @oncledan282
    @oncledan282 4 ปีที่แล้ว +1

    Hi, Fred .. Jack .. Bob .. NO !! Ralph ! LOL !!
    Yesterday, I got a gift from Santa : 2 x « RFID-RC522 » kits I ordered almost 2 months ago. Since I got those Octal Level Converters two weeks ago, I'll look at this video with the upmost interest, now. Until next comment, have a great day !!
    This comment is to be followed ...

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว +1

      You are going to be busy Daniel!

    • @oncledan282
      @oncledan282 4 ปีที่แล้ว +1

      @@RalphBacon Good day, my Friend !
      I have some issues with this card and I'll explain in more detail in a private mail, since I do not want to bother your viewers with ling comments. Don't get me wrong .. it works, but not exactly how I intend it to .. nor, I assume, as it was intended to.
      Have a great Holiday, my dear Ralph.

  • @djammisaddai
    @djammisaddai 7 ปีที่แล้ว

    Hi I have this error 'class MFRC522' has no member named 'PCD_Init' could you help me please??

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว +1

      +Ammisaddai Arciga
      Are you using the SAME and CORRECT library that I'm using (if any) in your sketch. It sounds like there is something missing from your setup, so double check that the libraries are installed correctly (in the libraries folder). If necessary, download the example sketch and libraries again into a fresh project. I hope this helps you, if not then let me know.

    • @djammisaddai
      @djammisaddai 7 ปีที่แล้ว

      Ralph S Bacon I found that was my IDE version I was using 1.6.0, I changed to 1.6.10 and it works good.
      thanks do you have the code for reading that personal data?

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว

      Well done for finding the error! But I do recommend upgrading to 1.12.0 as other versions (after 1.6) had some problems, now fixed in 1.12.

  • @infoab9158
    @infoab9158 7 ปีที่แล้ว

    rc522 rfid can read 125khz cards?

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว

      Hello infoAB, and welcome!
      The Mifare reader I use in my demo is only for 13.56Mhz - you'd need a different reader (and cards/fobs) for 125kHz. Here's an example of a 125kHz module from Amazon UK that isn't too expensive, but they are doubtless available worldwide (eBay might be a good source): www.amazon.co.uk/Hobby-Components-RDM6300-125KHz-Electronics/dp/B00KCMPIIK
      I hope this helps you in your project and thanks for posting this very pertinent question, which may also help others reading these message.

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว

      Here's an interesting article about the different types of RFID reader/writers - I wish I could afford the UHF version, you can read those from quite a distance but the other two are pretty short range for the most part (a few centimetres at best).
      www.impinj.com/resources/about-rfid/the-different-types-of-rfid-systems/

  • @thepvporg
    @thepvporg 6 ปีที่แล้ว

    PrePaid Bus Passes
    My District Heating uses these cards to charge with credit
    Access to the photocopier at work and door entry via the lobby barriers.
    Library Card
    Till ID and user authority in various places from bars to retail shops.

    • @RalphBacon
      @RalphBacon  6 ปีที่แล้ว +1

      Great suggestions, Mark. I was going to say that some sort of encryption might be necessary for some of your suggestions but I use my swipe card to enter my building and also to use the photocopier (just as you say!) and that information is not encrypted at all (as I showed in the demo) so maybe unless it's finance related encryption isn't as widely used as I might have expected. Great ideas and thanks for posting - and Merry Xmas!

    • @thepvporg
      @thepvporg 6 ปีที่แล้ว

      Well thats just a few uses I know of, my local bus service uses a system like the Oyster card and also use same sort of system for library card, rent card, the local recreation pass for people buying a monthly or annual pass to sports facilities, the recreation ground near to the university (not used it) is remotely controlled via these types of card access.
      I seriously doubt that theirs much in the way of encryption going on because like a lot of systems, too much faith in others not having access to devices to read such things is very much the first and only front-line defence.
      I would imagine that you could if you wanted to, store staff cafeteria credits, when I first left school I worked for a supermarket and it had a staff canteen with subsidised meals, like a full slap up meal for 5-p that in a cafe would set you back £2 or £3 (at that time back in the 80's) So this could be done electronically.
      Hotels use these for door keys (I know door entry) but I believe your hotel consumables are charged electronically these days.
      I am toying with an idea as a simple key to allow a machine to be used by an authorized person or possibly as a way of tagging a package through a warehouse or a product through a repair centre... Plenty of ideas for these things to be used in.
      Oh and store loyalty cards are also RFID.

    • @thepvporg
      @thepvporg 6 ปีที่แล้ว +1

      What I mean by that is if your contactless card (which is also one of these types of devices) is not encrypted by your bank because they do not feel that theirs any significant risk, what hope are you of any kind of encryption with a very basic card system.
      You most certainly would need some sort of checksum for each transaction to verify it was valid and if it involves money then it should be encoded but thats often not the case, checksum can be used to quickly identify if a transaction is valid or not.
      So if your bank aint doing it, then its not likely anyone else is going to do it either.

  • @alanritchie1968
    @alanritchie1968 6 ปีที่แล้ว +2

    starting your car

    • @RalphBacon
      @RalphBacon  6 ปีที่แล้ว

      Hello Arduinite! I'm currently on vacation 5,000 miles away from home so I'll have to be brief with these comments until my return, mid-July.
      Excellent idea, Alan, if you can decrypt how your car is actually started using the key, it's more complicated these days, as it also read the RFID in your car key!

  • @marcoris5891
    @marcoris5891 4 ปีที่แล้ว +1

    i read bacon now i'm hungry xD

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      So now you can get a weekly (-ish) rasher of tasty bacon (or Bacon)!

  • @sascharoelofs2812
    @sascharoelofs2812 7 ปีที่แล้ว +1

    I want to build a drinkdispenser and the people have to pay for their drinks. So they can load some virtual "money" on their card and are able to pay with only one swipe. (Sorry for my bad english :/)

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว +1

      Good project idea sascha! Straightforward enough to write the value of their "money" onto the cards (in a secure place, encrypting the data) and easy enough to remove it again when they have swiped their card to get a drink. Security is important here, so that data is not held in plain text. And some sort of tampering detection will be required too. Good project idea, let us know how you get on.

    • @thepvporg
      @thepvporg 6 ปีที่แล้ว

      Yes, they are called Bar Staff.

  • @lezbriddon
    @lezbriddon 4 ปีที่แล้ว

    just bought 4 of those rc522 boards, 2 red 2 blue and there useless for anything but a demo.
    range with a tag 3-4mm, a card 5-6mm, and those cool rings you can wear, 0.1-1.5 mm....
    thought the ring was faulty, bought 3 more different ring designs from different sellers. all same performance. even bump rc522 upto 4v and 4.5......10% better so not worth the risk.
    suppose being cheap they do 'work' but you can't build them into a door etc

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      The range you're getting, Lez, and which I demoed, is exactly right. We had these at work to unlock the doors (remember, I cloned my work card, shh, keep it between us) and I had to put my card right up to the reader (within 1cm, sometimes even less) before they would unlock.
      If you're thinking of something that will detect you as you walk up to a doorway you would need something very different, probably an _active_ device so that you are sending the signal rather than relying on the reader being able to power the unlock card (at close distance).
      Electronic door locks are normally controlled by your phone's Bluetooth capability as that has a range of 10m or more.
      Sorry you were disappointed with these but I never demoed anything other than _very_ close range communication in the video.

  • @KerryInUtah
    @KerryInUtah 7 ปีที่แล้ว

    Hiya Ralph! I just "discovered" you a few days ago. I'm really enjoying your videos.
    You asked about potential uses for RFID readers. The one I documented on my blog at kerryburton.com/swiping-passwords/ may not be for everyone, but I'm thinking of resurrecting the idea for my own use ... possibly with a smaller, 4-button keypad, because I don't use THAT many passwords on a regular basis.
    The next trick is to work up a way to UPDATE the passwords that the Arduino keeps track of. Since writing that blog post I've gained experience with the Arduino's EEPROM memory; I think I'll try to move the passwords from the code itself (hard-coded) to EEPROM, and work up a method to input and update (and "encrypt") them - subject to RFID card authentication, of course!

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว

      Hi Kerry, and welcome! Yes, you need to get those passwords out of code and into something else; EEPROM or SD Card (suitably encrypted, even simple encryption will stop most people reading it). If you watch my Video #65 on EEPROM basics you'll easily be able to (a) get them into EEPROM and (b) be able to update them on demand via your code. Sounds like you've cracked using the keypad matrix but just in case my (old) video #13 covers this too!
      Good luck, should keep you busy and off the streets for a while! Good to hear from you, and I will read your blog too (are you keeping it up-to-date?).

    • @KerryInUtah
      @KerryInUtah 7 ปีที่แล้ว

      Sadly, my blog has been neglected for a year and a half ... but I've been meaning to write up my most ambitious project yet. It's a simple greenhouse controller that activates remote outlets (with heat sources or fans plugged in) when certain temperature set points are reached. The most labor-intensive aspect of the project was the rotary encoder-driven LCD menu system that lets you update values for various settings (stored in EEPROM).

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว

      Perhaps your enthusiasm for Arduino related projects, Kerry, will also fire you up to update your blog? A rotary encoder controlled LCD was "fun", I bet! I think I might have been tempted to go a different route, such as a touch screen (what a coincidence, my latest video!) or a key matrix pad (assuming you had only numeric values in the menu). But maybe you should blog it all, included false starts, U-turns and, of course, successes and triumphs. Just suggestin'...

  • @gazzacroy
    @gazzacroy 3 ปีที่แล้ว

    8.03ish little puff of smoke youll see what happens lol :) briiant lol

    • @RalphBacon
      @RalphBacon  3 ปีที่แล้ว +1

      Do NOT let the magic smoke escape whatever you do.

  • @mikeriley4230
    @mikeriley4230 5 ปีที่แล้ว

    in hospital restaurants for paying for food

    • @RalphBacon
      @RalphBacon  5 ปีที่แล้ว

      A great suggestion, Mike. Now, if you do succeed in selling idea this to the NHS and become a millionaire remember where you heard about the technology first!

  • @marounat2599
    @marounat2599 7 ปีที่แล้ว

    Try to make your videos shorter ! Too much talking ! very sorry about my comment but you wont succeed like that

    • @RalphBacon
      @RalphBacon  7 ปีที่แล้ว +1

      Hey there, maroun abou tanous, thanks for the feedback. I'm painfully aware that my videos are slightly too long and I'm aiming for a 20 minute maximum going forwards. In the meantime, try and view them as TV programs: grab a cup of coffee, sit back and enjoy! But I will try and get them shorter in the future, promise!

    • @breadboardelectronics2260
      @breadboardelectronics2260 6 ปีที่แล้ว

      I'm sorry but I can't agree with that. I think that is an unfair statement.
      I have been using Arduinos for about five years now and I have most of the items (and more besides) that Ralph is creating little projects with.
      Also I have been developing software from mainframe assembly to C# for nearly forty years, so the code is not an issue for me either
      I watch Ralph's videos to possibly pick up tips and ideas like many others probably do.
      I understand everything that he is talking about and he sometimes inspires me to create something similar.
      I like to teach others how to do things as well and this channel does just that in an informative manner.
      If an inexperienced viewer watched these videos then by the end of it they can reproduce that project quite easily.
      Ralph has a laid back attitude to the projects and I believe that he explains things very well, even if he does need Benny's QA from time to time.
      Teaching takes as long as it takes.

    • @breadboardelectronics2260
      @breadboardelectronics2260 6 ปีที่แล้ว

      I'm sorry but I can't agree with that. I think that is an unfair statement.
      I have been using Arduinos for about five years now and I have most of the items (and more besides) that Ralph is creating little projects with.
      Also I have been developing software from mainframe assembly to C# for nearly forty years, so the code is not an issue for me either
      I watch Ralph's videos to possibly pick up tips and ideas like many others probably do.
      I understand everything that he is talking about and he sometimes inspires me to create something similar.
      I like to teach others how to do things as well and this channel does just that in an informative manner.
      If an inexperienced viewer watched these videos then by the end of it they can reproduce that project quite easily.
      Ralph has a laid back attitude to the projects and I believe that he explains things very well, even if he does need Benny's QA from time to time.
      Teaching takes as long as it takes.