Control IO RFID Example

Hello sir, i would like to know if u have reference guide on RFID using ladder logic because it is the only language that i am familiar of.i am struggling on how to use it. Since i do not have personal experience about this sensor.thank you

1 Like

Give me a bit of time and I will convert to Siemens Ladder for you … can you wait a week or so? This school week is very busy as we deal with reopening the Colleges here in Canada due to Covid-19.
Wayne

Thank you very much Sir.that sounds perfect to me because siemens is what i am using.have a nice day. Thanks

1 Like

I have not forgotten about this. Online Teaching has kept me quite busy these days. I will get the conversion done, just a bit later than expected. Sorry about the delay.

No problem sir, i am also reading your programming tips technique which is very good.

Are you struggling with a particular bit of the process or are you struggling with it in general?

In general since i do not have experience about rfid or training.

Have you read into the documentation?
I would suggest that you try the whole thing in a static environment. Place a part in front of the reader (so it doesn’t move and you don’t have to deal with timing) force the tags of the reader from the simulation (no PLC involved at this stage)

  1. If you have a box correctly aligned (with the small white RFID tag in the red detection zone of the reader) and you set the “Execute Command” on TRUE (with no other tag changed) you should get a “Status” of 0 and the “Command ID” should increment by 1.
    Congrats, you just successfully detected if a RFID tag is in front of the reader!
  2. Now move the box with your cursor so the RFID tag is out of the detection zone. If you now trigger the “Execute Command” from FALSE to TRUE again you should get a “Status” of 1, which indicates that no tag was found and the “Command ID” increments by 1.
    You just detected an error!
  3. Put the box back in blace and change the “Command” integer from 0 to 1 (“Read serial number”).
    Execute the command again and you should now see a number in the “Read Data” tag.
    Congrats, you just read some data from the RFID tag!
  4. Now change the “Command” from 1 to 3 (“Write Data”) and input a number to the “Write Data” tag. Execute the command.
    Don’t panic now, you will see that nothing except the “Command ID” has changed.
    Now change the “Command” to 2 (“Read Data”) and execute the command again.
    You should now see the number you have previously typed into the “Write Data” tag in the “Read Data” tag.
    You have just wrote and read data to and from the Memory of the RFID tag!

If you were paying attention you may have noticed that we haven’t even touched the “Memory Index” tag. You can play around with it and write data to and from different places in the memory of the RFID tag (range for “Memory Index” is 0-127 because you got 128 DWORD of memory). Just repeat step 4 from above with different memory indices and see what results you get.

Feel free to reply to this thread again if you got stuck anywhere.

2 Likes

So @ElectriZero, how’s it looking? Were you successful? Did you figure it out / get it running?

1 Like

Just and update: I have my controlio almost converted to Ladder (been crazy busy teaching this semester with everything online). I wanted to keep the same timing as my original diagram but I think I need to add more comments and explanations so the rungs make more sense. I must admit that it took me some time to remember what my controlio program did … lol … However, the ladder will be much easier to understand. The timing I created is basically just one example I use for training purposes and may not be entirely necessary for the Factoryio RFID to function. Most manufacturers would either provide the routines or more detailed instructions.

1 Like

IMHO the RFID reader is one of the parts that can be a little bit trickier to understand when you encounter it the first time. I think it would make it easier for people to make their first steps with it in a static environment instead of a dynamic one. If you start with a dynamic one you add the complexity of timing and movement in general to it. In a static one you can work with a state based program.

1 Like

Good point … In my example, if you stop the conveyors from running and add buttons to read and reset, you can create a static environment for each station; however, it would probably be better to create a single station that writes to the tag and then switch the station to read mode. BTW, I have the ladder complete from the previous example, just have to fix the comments before posting. Embarrassed to admit that I got hung up on timing and should have known better. The controlio can read the tag much faster then the PLC interface. My original timing waits 100ms before transferring the data read from the tag which was not long enough for the PLC. 150ms seems to work okay. Since I left lot of flexibly in the timing, no other changes needed to be made.

1 Like

If I want to write to/read from more than one memory index, should I execute ‘Execute Command’, toggling from FALSE to TRUE, for every memory index?
Thnx in advance!

1 Like

Generally speaking, I would say that is a correct statement and makes logical sense based on my experiences … although, on real devices, the exact sequence would depend on the RFID manufacturer. However, now that you have asked the question, I have not attempted to leave the Execute command active while incrementing the Memory Index in the simulated environment. Definitely something I need to try.

IMHO leaving the execute flag on TRUE while changing the index would be bad practice, as this could lead to inconsistent data. Process should always be: prepare command -> execute command -> read results -> prepare next command and so on. This also gives you a nice trigger flag && commands executed incr by 1.

You can however prepare multiple commands in a FIFO in your PLC to send them one after the other and store the results in a FIFO buffer and process them later and at a slower speed if your process in the PLC takes too long. But this is a unlikely scenario as you will mostly need the data from the RFID to control some process or some process has influence on the data you want to store on the RFID and you want to write specific data into a specific RFID tag.

2 Likes

Good points overall … totally agree with you.

Sounds, that it is necessary to toggle ‘Execute command’ for every index data,
@wayneschaefer thank u for the quick reply

1 Like

Hi i learn newly factory i o , I want to use RFID for read a code from one of box , but really i do not how can i start , i don’t understand how can i program and configuration this sensor . could you help me with a simple example . thank you

2 Likes

Hi … you will find two examples at the top of this thread. I’ve provided a Read Station and Write Station Scenario using the built-in Controlio Language and also standard PLC Ladder (using the same timing). The coding is also provided in pdf format for those who do have use the Rockwell Platform. A timing diagram is also included. This is certainly not the only way to program an RFID, just one example. I hope reading through the material will help answer your question.

2 Likes

thank you so much , at first time I look at this program , but it was so hard for me , because could not understand exactly how can we use tags for rfid , and what work exactly every tags .

2 Likes