Uncategorized

THM3060 RFID reader setup issues

THM3060 RFID reader setup issues

Ask QuestionAsked 16 days agoActive 13 days agoViewed 69 times2

I got the following rfid reader from a colleague 

I have connected it to my raspberry pi 4 module b using the following pinout;

  • raspberry pin 2 (5V)– reader module pin VDD
  • raspberry pin 6 (GND)– reader module pin GND
  • raspberry pin 19 (MOSI) –reader module pin MOSI
  • raspberry pin 21 (MISO)– reader module pin MISO
  • raspberry pin 23 (CLK) –reader module pin SCLK
  • all other pins left unconnected

I have followed the setup steps described in this video https://www.youtube.com/watch?v=evRuZRxvPFI

My problem is that the reader is not reading data. I confirmed that the system does power up using an LED and (a resistor) in series connected to the VDD. The reader was pulling 0.46mA using a 3.3V supply, and 0.74mA using a 5V supply (measured using a multimeter).

When I fire up the raspberry and run the code, the reader does not seem to be reading any data from the rfid chips I have. I did confirm that the chips contain data using an other reader module.

I did go through the documentation but I havent found anything useful.

http://read.pudn.com/downloads567/ebook/2333609/THM3060_UM.pdf?fbclid=IwAR1y0qh-cUdnnL9wfk-ZVLEcNVTvyHoviiM6Qsg6VQggS1zu8OVPTPRnPrU

I tried connecting pins RSTN and STDBY to ground but it made no difference. I have no contact with the seller unfortunately(wasnt the one who made the order), so i cant get any more information about the reader. Has anyone had any luck with these specific types of readers? How else could I trouble shoot the system? Continuity tests have confirmed that there are no damaged traces on the reader board itself.

How can I get it to read/write data?raspberry-pirfidshareedit  follow  flag asked Aug 20 at 0:50Malcommand2133 bronze badges

  • #Malcommand, Welcome and nice to meet you. Ah, let me see. Your RFID thing uses the 522 chip, and your tutorial is Pi My Life Up. I once used both a well, and found everything OK. Let me see if I can find my old posts and let you know. In the mean time I am drafting an answer. Please feel free to comment, suggest, or ask newbie question. Cheers. – tlfong01 Aug 20 at 1:15    
  • Please let me know more about your Arduino/Rpi/IT background, such as, do you know how to use Rpi to blink a LED? or read a button? or used Rpi UART, I2C, SPI before? I will then try to tailor my answer gearing up to your knowledge and skills. Take your time, not urgent at all. Cheers. – tlfong01 Aug 20 at 1:36   
  • (1) I read the user manual which says that the optimum power to the module is 3.3V~ 3.6V. If you power 5V to the module, you might have a problem. Please read Part 2 of my draft answer for more details. (2) Please let me know you project time frame. If you have a tight schedule, then I would try to give a short answer, without the TLDR explanation. But if your main objective is to learn NFC/RFID and Rpi SPI, then I can be more long winded. I will let you clarify and confirm, before I move on. Cheers. – tlfong01 Aug 20 at 2:30   
  • BTW, I have been hopping among a couple of forums and have been answering questions about NFC/RFID, sometimes both at the same time. Perhaps you might like to skim References 3~5 helpful, at least the long list references on RFID/NFC/532/522. – tlfong01 Aug 20 at 3:16   
  • I have found my old lab notes and draft a quick answer in Part C of my answer. Please try it and let me know you can make it. BTW, I might not be responding your comments over the weekend. So see you on Monday. Have a great RFID project. Cheers. – tlfong01 Aug 20 at 3:40   

add a commentstart a bounty

1 Answer

ActiveOldestVotes1

Question

How to set up the THM3060 RFID reader?

The OP’s RFID module wiring is show below.

rfid 1

Answer

Contents

Part A – Schematic

Part B – User Manual Reading Notes

Part C – Pi My Life Up Library Testing Notes


Part A – Schematic

Introduction

The AliExpress product sheet says the OP’s RFID module is RC522 based, but the user guide only mentions THM3060, nothing about RC522. So I need to study carefully if the two chips are 100% compatible, and if standard RC555 wiring is used. Therefore I need to read the schematic very carefully, to find any incompatibility.


rfid module schematic

Part B – User Manual reading summary notes

  1. The user manual is dated 2009. This might be a problem. I need to check if it is updated with current version of RC522.
  2. his might be a problem. I need to check if it is updated with current version of RC522.
  3. The features section says operation voltage is 3V to 5V, with a foot notes saying the optimum power supply is 3.3 ~3.6V. This might be another problem. If the OP uses 5V power, the modules PI logic signals might be 5V, and this might be a serious problem, because Rpi’s SPI signals are definitely 3V3 logic. Even if Rpi 3V3 SPI can talk to the module’s 5V SPI, there is a very small risk of Rpi’s SPI circuit latching up, frying the SPI or complete SBC, or shortens Rpi’s working life.

Part C – Pi My Life Up Library Testing Notes

Introduction

The OP says that he is following the Pi My Life Up tutorial. So I search my old files to find a similar test I did for his reference. It is not clear if he has already done the basic test of SPI loop. So I also include the loopback test, as shown below. The details is described in Ref 4.


Setting Up

rfid 3

SPI Loopback Test

rfid 4

RC522 Pi My Life Up Test using CLI Commands

rfid 5

RC522 Pi My Life Up Library Test Using Python

rfid 6

/ to continue, …


References

(1) AliEXpress THM3060 13.56MHz RC522 RFID Module – US$5

(2) How to setup a Raspberry Pi RFID RC522 Chip – Pi My Life Up, 2019oct28 11,578 views

(3) THM3060 Multiple Protocols Contactless Reader IC Version 1.1 – 2009Aug Beijing Tsinghua Tongfang Microelectronics

(4) How can Rpi SPI python read the MFRC522 NFC module? – Rpi SE 2020mar28

(5) How can Rpi read a PN532 NFC Module? – SO 2020apr12

(6) Problem with detecting badge with PN532 and Raspberry Pi – SO 2020mar23

(7) SPI setup/loopback/repeat send byte utilities and MCP3008/3201/M208 ADC Python Test Programs – Rpi SE 2020aug

(8) 淘宝 THM3060, 兼容 RC522 RFID 模块 – 中国集成电路店 ¥16 (~= US$2)

(9) RC522 RFID Module Testing Program V0.3

/ to continue, …


Appendices

/ to continue, …


End of answershareeditdeleteflagedited Aug 23 at 7:51answered Aug 20 at 1:22tlfong0167544 silver badges77 bronze badges

  • 1Hi and thank you for the detailed answer. Firstly I will clarify a few of your questions. I am experienced with arduinos and raspberry pi, although it is the first time I need to use SPI communication. Secondly, Im not a tight schedule but I would like to pin down the source of the problem as quickly as possible. Currently the project is a bit of a pilot, and future developments are based on the success of its proper functioning. – Malcommand Aug 20 at 7:34
  • 1Regarding the 5V power supply concerns. I was confident in the 5V supply due to the product description on aliexpress, as well as the two voltage regulators on the board. I did initially try the system with 3.3V supply but with no success. I will definitely try the SPI loop test you suggested. Regarding your setup, which pin should I connect the SPI CS0 to, on my board? Thanks in advance! – Malcommand Aug 20 at 7:34 
  • Ah, thank you for your reply. Now 4 quick suggestions. (1) Read Part C of my answer and do the CLI SPI loopback test. It is important to first make sure the SPI wiring is OK, (2) Then again use CLI to test SimpleMFRC522. If you have difficulty using CLI commands, I can try to find old python to test in Thonny IDE. (3) I would suggest to power your RIFD moudle with 3V3, that is what I did last time. (4) I was playing with both RC522 and PN532, using UART, SPI, and I2C at the same time, and I forgot which module is using which, so I might have mixed up things. So compare my screen captures. – tlfong01 Aug 20 at 7:39   
  • 1What do i connect the SPI CS0 pin to on my board? I dont seem to have any more SPI related pins (as shown on the second image) – Malcommand Aug 20 at 7:53
  • Ah, thank you for clarification and confirmation on the 5V power supply. So I quickly conclude the the user guide V1.1 (which says 3V3 ~ 3V6 is optimum) or something is out of date, because they have V1.2 or V1.3 (Note 1), I forgot. Just now I looked at my RC522 module and did not find any 3 pin 5V to 3V3 regulator, so I always use 3V3 for testing. As the old smart guy Warren Buffett says: There “aren’t just one cockroach in the kitchen“. So should expect more misinformation. Already mentioned that their chip is NOT 522 but might not be 100% compatible chip. – tlfong01 Aug 20 at 7:58   
  • About the CS pin, because they are using the same board with UART, I2C and SPI, so they are using one or two pins for more than one function. Let me check and report back. – tlfong01 Aug 20 at 8:00   
  • 1Also, is the SPI loopback test conducted with the reader connected to the raspberry, or is it only connecting the MISO pin of the raspberry to the MOSI pin of the raspberry directly? – Malcommand Aug 20 at 8:04
  • You might like to look at my photo above. My SPI colour coding is this: CLK = purple, MOSI = orange, MISO = yellow (some time might be swapped). But CS0 should be GREEN in the picture (sometimes I also use blue, brown, grey etc for more CSn, but green is 99% sure the CS pin.) I remember there are two versions of RS522 boards, so you need to look at the labeling at the reverse time of the PCB. – tlfong01 Aug 20 at 8:06   
  • Ah, yes, when testing SPI loopback, you put the RFID module aside and just test this loopback thing. Procedure (1) connect/short MOSI to MISO, then do the test. (2) There is a slight complication. SPI loopback only makes sure MOSI writing out can be read back by MISO, *** CS pin is NOT tested.***. So you need to use a python program to read the module’s register (sort of pinging) to make sure CS0 is also working. Another thing is that you should not use wiring of longer than 30~60cm, the shorter the better, – tlfong01 Aug 20 at 8:11   
  • Also you might like to lower SPI speed to 100k, 50k or even 10kHz, just for testing. – tlfong01 Aug 20 at 8:12   
  • Too many comments messed up this space, let us go to the chat room. – tlfong01 Aug 20 at 8:13   
  • Let us continue this discussion in chat. – tlfong01 Aug 20 at 8:13   

add a comment

A: THM3060 RFID reader setup issues

tlfong01Question How to set up the THM3060 RFID reader? The OP’s RFID module wiring is show below. Answer Contents Part A – Schematic Part B – User Manual Reading Notes Part C – Pi My Life Up Library Testing Notes Part A – Schematic Introduction The AliExpress product sheet says the OP’s RFID module i…

Malcommand

MalcommandHi and thank you for the detailed answer. Firstly I will clarify a few of your questions. I am experienced with arduinos and raspberry pi, although it is the first time I need to use SPI communication. Secondly, Im not a tight schedule but I would like to pin down the source of the problem as quickly as possible. Currently the project is a bit of a pilot, and future developments are based on the success of its proper functioning.Regarding the 5V power supply concerns. I was confident in the 5V supply due to the product description on aliexpress, as well as the two voltage regulators on the board. I did initially try the system with 3.3V supply but with no success. I will definitely try the SPI loop test you suggested. Regarding your setup, which pin should I connect the SPI CS0 to, on my board? Thanks in advance! 

tlfong01

tlfong01Ah, thank you for your reply. Now 4 quick suggestions. (1) Read Part C of my answer and do the CLI SPI loopback test. It is important to first make sure the SPI wiring is OK, (2) Then again use CLI to test SimpleMFRC522. If you have difficulty using CLI commands, I can try to find old python to test in Thonny IDE. (3) I would suggest to power your RIFD moudle with 3V3, that is what I did last time. (4) I was playing with both RC522 and PN532, using UART, SPI, and I2C at the same time, and I forgot which module is using which, so I might have mixed up things. So compare my screen captures. 

Malcommand

MalcommandWhat do i connect the SPI CS0 pin to on my board? I dont seem to have any more SPI related pins (as shown on the second image) 

tlfong01

tlfong01Ah, thank you for clarification and confirmation on the 5V power supply. So I quickly conclude the the user guide V1.1 (which says 3V3 ~ 3V6 is optimum) or something is out of date, because they have V1.2 or V1.3 (Note 1), I forgot. Just now I looked at my RC522 module and did not find any 3 pin 5V to 3V3 regulator, so I always use 3V3 for testing. As the old smart guy Warren Buffett says: There “aren’t just one cockroach in the kitchen“. So should expect more misinformation. Already mentioned that their chip is NOT 522 but might not be 100% compatible chip.About the CS pin, because they are using the same board with UART, I2C and SPI, so they are using one or two pins for more than one function. Let me check and report back. 

Malcommand

MalcommandAlso, is the SPI loopback test conducted with the reader connected to the raspberry, or is it only connecting the MISO pin of the raspberry to the MOSI pin of the raspberry directly? 

tlfong01

tlfong018:13 AMYou might like to look at my photo above. My SPI colour coding is this: CLK = purple, MOSI = orange, MISO = yellow (some time might be swapped). But CS0 should be GREEN in the picture (sometimes I also use blue, brown, grey etc for more CSn, but green is 99% sure the CS pin.) I remember there are two versions of RS522 boards, so you need to look at the labeling at the reverse time of the PCB.Ah, yes, when testing SPI loopback, you put the RFID module aside and just test this loopback thing. Procedure (1) connect/short MOSI to MISO, then do the test. (2) There is a slight complication. SPI loopback only makes sure MOSI writing out can be read back by MISO, *** CS pin is NOT tested.***. So you need to use a python program to read the module’s register (sort of pinging) to make sure CS0 is also working. Another thing is that you should not use wiring of longer than 30~60cm, the shorter the better,Also you might like to lower SPI speed to 100k, 50k or even 10kHz, just for testing.Too many comments messed up this space, let us go to the chat room.Are you there? 

Malcommand

MalcommandHiI understand the loopback test. I will manage with that. But I still dont understand what you mean by the CS0 pinBased on my pinout diagram I dont have a CS0 or any other CS related pins whatsoeverAlso, you mentioned that I should try out the rfid reader test using CLI commands. Is there a difference between using CLI commands or just calling a script? I basically have the exact same lines of code in my script and that didnt make the reader read 

tlfong01

tlfong018:38 AM(1) Good that you understand the SPI loopback test, (2) CS0 pin is the SPI Chip Select pin for SPI port 0.0. (3) CS0 is the chip select pin for SPI port 0.1. (4) Ah, if you know bush scripts of course it is better than typing terminal commands one by one. (5) You board seems to have a 9 pin connector, but me only 8. I always miss/lose count, you better compare the pictures.So you can import the library OK, reader.write(‘123’) returns no errors, but reader.read() returns not the same thing ‘123’?(6) And if SPI loopback test OK? 

tlfong01

tlfong018:55 AMYou might like to read Reference 7 of my answer to find a program to do two things: (1) SPI loopback, (2) MCP3021 ADC testing. You might like to see if you can use the program is do loop back (Never mind the MCP3201 part, which is not irrelevant to your project.) The program is workable, and just plug and play, no library is required. 

Malcommand

MalcommandYes my board has 9 pins, which was also odd for me. Basically the process is as follows;
1-I do the wiring
2-I execute the write script
3-The script runs, no error codes come up, but It does not write onto the chip. I know this, because the script itself contains error checking. So if the write process was successful, the script would continue and print a confirmation message. But that doesnt happen. 

tlfong01

tlfong01Ah, time for jogging and eating. So see you late this evening or tomorrow. Good luck and cheers. 

Malcommand

MalcommandIf I execute the read script, then I also get hung up on the read procedure. The device is waiting to read the chip details, but it doesnt sense the chip. Again, error checking in the script confirmed this.My wire lengths are not an issue. I use quite short wires, and I also had that issue in the past so i specifically take care of that on all my projects. One more thing I can imagine is that perhaps the manufacturer used lower capacitors than indicated in the design document, which could lead to a brown-out on the reader side. I also had this issue in the past on other projects.

Enjoy the run. Speak to you later 

tlfong01

tlfong01I see. I am glad to know that you have lots of troubleshooting experience and also fluent in bush scripts. So if you are going a play with python SPI project, there are no harm doing the basic SPI loopback tests. By the way, my test program consists of two python programs (1) SPI utility, (2) MCP3201 ADC tests, which imports SPI utility.The SPI utility can run and test loopback by itself, and has newbie friendly sample outputs. It would be nice if you can try it and let me know it is user friendly and any thing to improve. See you later. 

Malcommand

Malcommand9:15 AMWhere do i find your test program?  2 hours later…

tlfong01

tlfong0111:40 AMAh, I wrote too fast: tlfong01 3872 16:55
You might like to read ***Reference 7 of my answer*** to find a program to do two things: (1) SPI loopback, (2) MCP3021 ADC testing. You might like to see if you can use the program is do loop back (Never mind the MCP3201 part, which is not irrelevant to your project.) The program is workable, and just plug and play, no library is required.  9 hours later…

Malcommand

Malcommand9:05 PMI will give it a try. I have also received the documentation from the manufacturer. Im beginning to think that the issue might be software related 

tlfong01

tlfong0112:49 AMHow nice to get the updated documentation. (1) The user guide we are reading is V1.1, 2009, which is outdated, because it says optimum power for module is 3V3~3v6, not according to your test results. (2) The user guide never mentions RC522, so I guess you cannot use PiMyLifeUp’s library. Hopefully they will give you a link to the library. Good luck and cheers.  3 hours later…

tlfong01

tlfong013:23 AMBy the way, there is another wiring thing you might like to confirm: (1) for UART wiring, we cross over one side of Tx to other side of Rx, and vice versa. (2) Now for SPI, not all developers/vendor follow this rule of thumb: they direct Tx to Tx, and Rx to Rx. Would you like to comment, or counter suggest anything? Please also read the little note at left bottom of the following schematic.

user image

  7 hours later…

Malcommand

Malcommand10:10 AMYeah the connection was from Mosi to Mosi and Miso to Miso. No crossover, as you have said. Only serial requires that kind of tx to rx connections. I have found a c based code which i think is very similar to the arduino c code examples for rfid reading. I will give that a shot next week

tlfong019:02 AMMany thanks for your confirmation on the direct SPI connection. I vaguely remember that I did have cross over wiring for SPI wiring, ie, MOSI to MISO, MISO to MOSI, and that makes sense, Input/terminal signal on one side to output terminal/signal other side, and vice versa. So your Arduino confirms that. BUT DO YOU HAVE OTHER SPI DEVICES EXAMPLES?  5 hours later…

tlfong01

tlfong011:57 PMYou said the following: “If I execute the read script, then I also get hung up on the read procedure. The device is waiting to read the chip details, but it doesn’t sense the chip.” You seem to misunderstand one thing: “reader.Write(…) and reader.Read() is NOT write/read on the chip, BUT write/read to the Blue tag of White card. You must place the blue tag or white RFID card on top or near the chip, which is the reader.

I have also written a little Rpi4B Thonny python 3.7.3 function to do reader.write(…) and reader.read() and got the same results as using CLI terminal commands as shown in my old answer. I know you are are Circuit python. Perhaps you can try your luck with circuit python. Good luck and cheers.  4 hours later…

tlfong01

tlfong018:02 AMI have tidied up my little program: penzu.com/p/f77f0034. (Ref 9 of my answer’s reference list). It is a copy/paste/run program, with sample output. You might like to try it and let me know any problems. Nothing urgent though. Have a nice weekend. 

Malcommand7:57 PMHi, I dont have any other SPI devices examples. I understand that the read/write process will require the tag itself. I was describing an unsuccessful read/write process using a tag. I will try your program as soon as I have some time. Currently Im still trying to get through the documentation from the manufacturer.If I sent you the documentation do you think you would have time to have a look at it as well? Perhaps you are quicker with it then me. Problem is the entire documentation is in chinese and I need to use google translate for everything first.

tlfong0111:53 PM@Malcommand Sorry to have missed your last message. I have not come back to this chat room for a while. Next time you want me to immediately be notified, you can (1) send me a message outside the chat room (which might be closed, if not active for 14 days) with @tlfong01 at the very beginning of your message, (2) reply to my message, or I will think that your message is for everybody, so might miss it.@Malcommand Yes, I am interested to have a look of the Chinese documentation. I vaguely remember that the user guide I read last time seems not updated, and there are some critical discrepancies between the outdated user guide and your board. My native language is Chinese, so I have no problem reading Chinese.

lfong0112:02 AMIt was just by chance that yesterday I answered another RFID question mentioning your THM3060 board and reminded me to check out if your have already solved your problem. BTW, I have also updated my python RFID program. As in earlier version, it is CPR – Copy, Paste, Run, no library to import. Ref (1) Can RFID read stacked cards?
https://electronics.stackexchange.com/questions/519993/can-rfid-read-stacked-cards@Malcommand This chat room might be closed in one or two days. I will save this chat record for later reference. You might like to ask me if you have lost your record. Cheers.

.END

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.