tag:blogger.com,1999:blog-9049086495855026612.post1146205286809952456..comments2023-09-13T09:02:58.049-05:00Comments on Arduino CodeDog: Parallax Smart Card Reader Samples for ArduinoJeff Frenchhttp://www.blogger.com/profile/01183375399961647730noreply@blogger.comBlogger51125tag:blogger.com,1999:blog-9049086495855026612.post-32547732214254796552016-09-10T18:45:16.358-05:002016-09-10T18:45:16.358-05:00Yep, and that's the way the sample code from P...Yep, and that's the way the sample code from Parallax is as well. However, I gave you some code to attempt to resolve that problem (with an option to also resolve the authenticate issue). Like I said, I don't have time to revisit this code right now, but when I do, I'll make some changes to allow for unique PSC bytes ... until them, feel free to change the code for your needs (in reality, you could probably change the Authenticate() method in the library code (IS23SC4442.cpp), change the 3 Password bytes to whatever you need, they are all just 0xFF right now since that's what the default blank card values are and there is no way to change them in the library. But like I said, I'd just move those 3 byte (uint8_t) definitions to the class definition, initialize to 0xFF in the construction then create a function to change the 3 bytes as needed before calling the authenticate method (the function I provided also attempted to update the card, but if you remove the Send_Command calls and the Read(), it would just change the bytes for use during authentication ... which should also resolve your problem).Jeff Frenchhttps://www.blogger.com/profile/01183375399961647730noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-25877803180581186662016-09-10T16:33:34.060-05:002016-09-10T16:33:34.060-05:00This comment has been removed by a blog administrator.Ελhttps://www.blogger.com/profile/08626985147654280063noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-57270463033604489322016-09-10T16:33:31.103-05:002016-09-10T16:33:31.103-05:00This comment has been removed by a blog administrator.Ελhttps://www.blogger.com/profile/08626985147654280063noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-45161341240507668702016-09-10T16:33:13.806-05:002016-09-10T16:33:13.806-05:00No the source code have a problem and recgnize onl...No the source code have a problem and recgnize only the FFFFFF<br />Ελhttps://www.blogger.com/profile/08626985147654280063noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-33342395728171392622016-09-07T14:24:07.034-05:002016-09-07T14:24:07.034-05:00how to change the psc (authentication) from FF FF ...how to change the psc (authentication) from FF FF FF to my numbers? I have a 4442 card and the psc I want to be 49 28 32h Ελhttps://www.blogger.com/profile/08626985147654280063noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-35094492982176919372016-07-29T07:24:37.788-05:002016-07-29T07:24:37.788-05:00Thanks for the valuable information and insights y...Thanks for the valuable information and insights you have so provided here... <a href="http://adlockmedia.com/" rel="nofollow">AdLock Media</a><br />historypakhttps://www.blogger.com/profile/12429820414620086221noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-10547729235241837712016-04-28T11:49:51.540-05:002016-04-28T11:49:51.540-05:00Cool ... glad it's (now) working for you.Cool ... glad it's (now) working for you. Jeff Frenchhttps://www.blogger.com/profile/01183375399961647730noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-43012724265839304102016-04-28T11:46:52.629-05:002016-04-28T11:46:52.629-05:00I resolved all my issues the problem was the fact ...I resolved all my issues the problem was the fact that I wasn't placing the card in the right way its all up an running.<br />Seriously thank you one of the best guide i've foundAnonymoushttps://www.blogger.com/profile/02289554185567074845noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-26412559743587397322016-04-28T10:05:01.350-05:002016-04-28T10:05:01.350-05:00Oh and 1 more thing ... when looking at the reader...Oh and 1 more thing ... when looking at the reader (assuming the black plastic cover is on top) ... the chip on the card has to be on the bottom when pushed into the reader. If on top, the Card Detect will work, but it won't go much further than that because it can't read or write to the chip.Jeff Frenchhttps://www.blogger.com/profile/01183375399961647730noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-53181866184687948922016-04-28T09:55:57.020-05:002016-04-28T09:55:57.020-05:00Ok, let's start with a the library error ... i...Ok, let's start with a the library error ... if you download the zip from github, extract the SmartCardReader directory and copy the entire directory into your libraries directory you should have everything needed (I just downloaded and it worked)... there were some new warnings that I hadn't seen before (evidently since I upgraded to latest Arduino IDE), which could be safely ignored, but I went ahead and fixed and uploaded them to github). <br /><br />Now let's move on ... you aren't aren't able to call the read/write/clear memory functions when you go to the serial port. You say the code seems to work perfectly ... the sample is working? It's not clear ... you can or you can't see the results in the serial monitor when ran?<br /><br />I'm just not 100% sure what you mean when you say you 'can't seem to be able to call the read/write/clear memory functions' when you go to the serial port. The program is dumping stuff to the serial port, if you can't see anything in the serial port monitor then it could be because the baud rate is incorrect ... The program uses 9600 baud, but even if you change it, the serial monitor has to match ... I also recommend setting the line ending option to Both NL & CR and also check the AutoScroll option.Jeff Frenchhttps://www.blogger.com/profile/01183375399961647730noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-56147398590548142442016-04-28T08:21:17.045-05:002016-04-28T08:21:17.045-05:00Thank you but that is not what I meant, I have my ...Thank you but that is not what I meant, I have my arduino wired up and everything the code seems to work perfectly find but I can't seem to be able to call the read/write/clear memory functions when I go in the serial port. Also i have tried to use the library for the IS24C16A provided on github but i get the error :"avr-g++: error: missing filename after '-o' ".<br />Thank youAnonymoushttps://www.blogger.com/profile/02289554185567074845noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-72310647321997733842016-04-27T14:46:00.550-05:002016-04-27T14:46:00.550-05:00Well, the reader and card are a good start, but fo...Well, the reader and card are a good start, but for the code that I provided you also need (at a minimum) an Arduino (with power from somewhere) and some patch wires. Once you have those, you should be able to wire it up (as described above in the Blog post) and just build and run the code. Once the sample code works, I would think it would be pretty straight forward. I would recommend that you grab the newer library (the first sentence in the above post has a link to a newer post) that discusses the newer library and allows you to download the latest samples (which are really just the older samples changed out to use the new libraries) ... there is a 32322 card (IS24C16A) sample within those, just like there is a sample provided above ... the nice thing about the library is that it hides the underlying details and lets you focus on building your project. You can Read/Write single characters from/to a specific location on a page of the card or you can read/write a string to/from a page starting at a specific location on a page of the card. I would recommend loooking at the IS24C16A.h file, for the 32322 card so you can determine what the parameters are for each function (the public section is the only thing you need to worry about. Page is the page number (0-7), location is the position on a page (0-255), in the string functions len is the length of the string you are reading, writing or clearing. Hope that helps.Jeff Frenchhttps://www.blogger.com/profile/01183375399961647730noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-37732131323006886782016-04-27T13:26:53.957-05:002016-04-27T13:26:53.957-05:00Hi Jeff,
I'm pretty new to the whole smart car...Hi Jeff,<br />I'm pretty new to the whole smart card thing and i've been trying to gather information for my own project. Your the only source from which I was able to actually have some sort of code I could understand but i can't seem to make it run... Like how do you call the write or read function when you run the program<br />PS. I have the 32320 reader and the 32322card<br />Thank youAnonymoushttps://www.blogger.com/profile/02289554185567074845noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-11003601937853374752015-06-02T07:59:24.510-05:002015-06-02T07:59:24.510-05:00The three sketches are specific to the Parallax Sm...The three sketches are specific to the Parallax Smart Reader and the 3 cars that Parallax sells for it. Although it looks like the SimplyTronics Reader looks to be similar and may work. I can say that the SLE4428 card isn't similar to any of the cards that are supported by the sample sketches. In fact the closest one I see would be the IS23C4442 sketch, since the 32321 card does have the 3-byte protection (as does the SLE4428 card)... but even so, the memory layout/use as defined by the card description is still different. I won't say you can't use my sketches as a starting point and eventually get something working, but I would guess that some significant work will be required.Jeff Frenchhttps://www.blogger.com/profile/01183375399961647730noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-71018227442598134172015-06-02T03:49:56.467-05:002015-06-02T03:49:56.467-05:00Thank you for the reply Jeff. Am still facing the ...Thank you for the reply Jeff. Am still facing the same issue, even after incrementing delayamt up to 5000. <br /><br />1. I am using IDE Version 1.6.2. I had tried lower versions but they also did not work. <br /><br />2. I am using the reader by simply tronics. http://shopsimplytronics.com/smart-card-reader/?page_context=search&faceted_search=0<br /><br />3. I am using SLE4428 Card . http://www.smartcardworld.com/SLE4428.htm<br /><br /><br />4. I am using the example for Card 32322 (IS24C16A)<br />Anonymoushttps://www.blogger.com/profile/06508363833533024662noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-22992722123625483682015-05-29T20:30:53.885-05:002015-05-29T20:30:53.885-05:00And one more thing ... the sample will first write...And one more thing ... the sample will first write to all memory locations (in the case of the IS24C16A, page 1 will be all 1s, page 2 will be all 2s, etc ... up to page 8, Then it will display written values for each written location ... it will then clear all values and again display all memory locations (at that point it will be all zeros) ... are you sure that you aren't just looking at the end result (after the memory is cleared)? It's been awhile since I've looked at this code, but I just tried it with the latest Arduino IDE and it still works fine. So make sure you look at the serial monitor through the entire process).Jeff Frenchhttps://www.blogger.com/profile/01183375399961647730noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-75259865195146994992015-05-29T08:42:15.368-05:002015-05-29T08:42:15.368-05:00Looks like it's actually not WRITING values .....Looks like it's actually not WRITING values ... <br /><br />1. Check your connections. 2. Make sure you are using the right card ... looks like in this case you need the IS24C16A (32322) card. 3. Tweak the int delayamt = 50; (on line 38) to higher values (i.e. increment by 5 or 10 until it starts working, then decrease by 1 to find the lowest value that works). If that doesn't work, my next questions would be things like 1) is the card detected properly (or did you just remove the code that does the check)? 2. What is the device you are trying to get this working on (UNO, MEGA, Official, Clone)? 3. What are using for compiler (Arduino IDE ... what version, etc).?Jeff Frenchhttps://www.blogger.com/profile/01183375399961647730noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-82927341640871729572015-05-29T05:53:24.517-05:002015-05-29T05:53:24.517-05:00Hi jeff, my code writes 00 to all pages. What coul...Hi jeff, my code writes 00 to all pages. What could be causing this? <br /><br />Writing Memory...Page 1<br /> Done.<br />.<br />.<br />.<br />.<br />Read Main...Page 1<br /> [ D A T A ]<br /> * | 0 1 2 3 4 5 6 7 8 9 A B C D E F characters<br /> --+-----------------------------------------------------------------<br /> 0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> 1 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> 2 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> 3 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> 4 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> 5 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> 6 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> 7 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> 8 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> 9 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> A | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> B | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> C | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> D | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> E | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> F | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> --------------------------------------------------------------------<br /> Done.<br />Read Main...Page 2<br /> [ D A T A ]<br /> * | 0 1 2 3 4 5 6 7 8 9 A B C D E F characters<br /> --+-----------------------------------------------------------------<br /> 0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> 1 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> 2 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> 3 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> 4 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> 5 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> 6 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> 7 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> 8 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> 9 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> A | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> B | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> C | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> D | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> E | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> F | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br /> --------------------------------------------------------------------<br /> Done.<br />Anonymoushttps://www.blogger.com/profile/06508363833533024662noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-66132805189817475022013-09-28T11:18:05.607-05:002013-09-28T11:18:05.607-05:00Thanks for the updates and for sharing the changes...Thanks for the updates and for sharing the changes you've made. I'm sure others will find it useful.Jeff Frenchhttps://www.blogger.com/profile/01183375399961647730noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-45351327258544621512013-09-28T09:06:44.899-05:002013-09-28T09:06:44.899-05:00Thanks Jeff, your work helped me a lot.
This is a...Thanks Jeff, your work helped me a lot.<br /><br />This is a software 2 wire bus.<br />The response to the ATR is: A2 13 10 91<br />A = 2 wire bus protocol (Siemens SLE 4432 datasheet p27)<br /><br />These 4 bytes are also the first 4 bytes of the 256-byte memory.<br />The clock runs at 20kHz.<br /><br />First, if you don't have the parallax smart card reader, you need to add pull-up resistors to the lines CLK, IO and RST. The parallax reader has included them.<br /><br />Secondly, to get the ATR ( the 4 bytes after a reset) you need to do some timing modifications to the arduino sketch.<br /><br />Here is a diff of my version:<br />diff --git a/IS23SC4442.ino b/IS23SC4442.ino<br /> <br /> void setup() <br /> {<br />@@ -61,6 +61,15 @@ void setup()<br /> Serial.println("Please insert a Card...");<br /> else<br /> Serial.println("Card was already inserted at startup...Please remove and re<br />+ <br />+ <br />+ Output(CLK); // initialement CLK bas<br />+ Set_Low(CLK);<br />+ <br />+ Input(IO);<br />+ <br />+ Output(RST);<br />+ Set_Low(RST);<br /> }<br /> <br /> void Reset()<br /> {<br />+ uint8_t tmp[4];<br /> Serial.println("Reset.");<br /> Output(CLK);<br />+ digitalWrite(CLK, LOW);<br />+ digitalWrite(RST, LOW);<br /> Input(IO);<br />- Output(RST);<br />- Set_Low(RST);<br />- Set_Low(CLK);<br />+ <br />+ <br /> Set_High(RST);<br /> delayMicroseconds(delayamt); // A little extra wait time for this<br /> Set_High(CLK);<br />@@ -115,7 +133,14 @@ void Reset()<br /> long address = 0;<br /> for (int index = 0; index < 4; index++)<br /> {<br />- Receive_Byte();<br />+ tmp[index] = Receive_Byte();<br />+ }<br />+ clockPulse(); // 33rd clock pulse<br />+ <br />+ // display ATR header<br />+ for(int index = 0; index < 4; index++){<br />+ Serial.print(tmp[index], HEX);<br />+ Serial.println("");<br /> }<br /> }<br /> <br /><br />@@ -325,7 +409,7 @@ uint8_t _ReceiveFromCard()<br /> <br /> Output(CLK);<br /> Input(IO);<br />- Set_High(CLK);<br />+ //Set_High(CLK);<br /> <br /> for (int i = 0; i < 8; i++)<br /> {<br />@@ -380,4 +464,9 @@ void Output(int Pin)<br /> {<br /> pinMode(Pin, OUTPUT);<br /> }<br />-<br />+<br />+void clockPulse(){<br />+ Set_Low(CLK);<br />+ Set_High(CLK);<br />+}<br />+<br /><br />I didn't experience the update commands because I don't have the password.<br /><br />GuillaumeAnonymoushttps://www.blogger.com/profile/05560260472800718044noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-80601209649763174342013-07-29T14:07:56.406-05:002013-07-29T14:07:56.406-05:00Hi Jeff,
Thanks for responding to my inquiry. I r...Hi Jeff, <br />Thanks for responding to my inquiry. I really appreciated it. Answer to your question in regards to how the pulse would get to the Arduino. I would have 3 buttons plugged into pins. Button A would trigger machine 1 and when the button is pressed, I am hoping to count that as 1, then write to card, then when button Button B is pressed for machine 2, the pulse would add that count to the last count recorded and now the write would now read 2, and finally when Button B (for both machines) is pressed, the pulse would add 2 to the arduino and write to the card and now it should read 4 total targets were triggered. That is my goal - visually I see happening, question is making it work physically. I hope the sample you have here will help me towards my goal. And from your response, from my first post, it certainly will work. Thanks again, and I do hope IF I should have any questions, if you wouldn't mind answering them, if so for some reason I get stuck. Right now I am going to work with the sample code - making sure I can get it work just using what you have coded here. Then once I know its good - then I can go ahead and make the necessary mods. Thanks again Jeff! Have a great day! LisaXtreme_tronixshttps://www.blogger.com/profile/12367880585025211861noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-86678426156656405112013-07-12T14:53:30.081-05:002013-07-12T14:53:30.081-05:00Hi Lisa,
Technically from a Card Read/Write persp...Hi Lisa,<br /><br />Technically from a Card Read/Write perspective I don't see a problem with what you are suggesting. The only question I would have would be how that pulse would get to the Arduino, which would then update the count on the card. And if you have that already worked out, you should be good to go and I think you have a very viable idea. The code I provided would be a reasonable place to start in that you will find how to read, write and clear values (which a clear is really nothing more than writing an empty value ... I would typically say write a 0, but you may decide a different value fits your needs). Certainly the cost ... of the Arduino, power supply, card reader, whatever sensor you use to detect the pulse and some wiring ... plus possibly something to put the project in to protect tampering ... would be far less expensive then the systems you say are already available ... also, I don't think you would need a mega ... in fact, you might want to eventually scale it down to one of the Tiny Arduinos or such ... might be even cheaper that way ... but an UNO (or two, since you would need one for the card management portion of the project too I guess) with card readers, wiring, etc to get started should be plenty to get started I would think. Nice Idea, good luck!Jeff Frenchhttps://www.blogger.com/profile/01183375399961647730noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-59073440126142331242013-07-12T14:31:31.557-05:002013-07-12T14:31:31.557-05:00Hi Jeff, I have a question. Here is the project I ...Hi Jeff, I have a question. Here is the project I would like to make. I have the Smart Card Reader/Writer #32320 and smart card #32323 and arduino uno board or I can upgrade to mega is necessary. Here is the situation, a local skeet gun club would like to have a COUNT UP system mounted on 12 of their clay target stations so they can keep track the number of clay targets each shooter is using throughout the day. Here is how I envision this working and wondering if its possible using the hardware I mentioned above. A shooter comes into the shop and is issued a smart card, now this individual would go to lets say, station 1, insert card and leave it inserted. When the release button is pressed on the clay target machine, the arduino would read the pulse, then tell the parallax writer to write 1 to the card indicating one target was thrown. Then when second button is pressed, it write 2 to the card indication 2 targets were used by this shooter and now if a third button is pressed both machines will launch 2 targets at once, so it would write 2 to the card showing so far 4 targets were launched. The shooter can move around to any station throughout the day, so I would need to keep a running total, so now at the end of the day, the shooter brings their card back into the office, the office personnel now slides the card into a reader and for example reads "Number of targets used - 232", then they pay off of that. Once the transactions is done, they can erase the card and reuse it. Is this possible using the hardware and the sample arduino codes you have written? Yes, there are systems already out there that do - do this, but the run anywhere between $8000 - $10,000 and these small ma and pa shops just afford those type of systems and this would be a very very basic setup - only COUNTING UP that is it. Is this possible? Thanks LisaXtreme_tronixshttps://www.blogger.com/profile/12367880585025211861noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-27915585980212525102013-07-02T01:27:53.235-05:002013-07-02T01:27:53.235-05:00Yes you are absolutely right.I use another code an...Yes you are absolutely right.I use another code and i get perfect atr which i want...thanx for helping me.Anonymoushttps://www.blogger.com/profile/14484439045802238292noreply@blogger.comtag:blogger.com,1999:blog-9049086495855026612.post-85289361700315399312013-06-28T08:14:58.688-05:002013-06-28T08:14:58.688-05:00I don't believe you can get to the ATR with th...I don't believe you can get to the ATR with this reader. And if you can, it would be different code that what I am providing. I can tell you that the first 4 bytes of a locked card will return A2 FF FF FF ... and every byte following that all the way to the end of the memory will read as FF ... at least that's my experience.Jeff Frenchhttps://www.blogger.com/profile/01183375399961647730noreply@blogger.com