Forum
Register Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
stremblay

Member
Registered:
Posts: 65
Reply with quote  #1 
Hi Jaewon,

I have ML on a touchscreen setup in an enclosure with several free-ranging monkeys who can interact with it. I need a way to load the appropriate ML task given the identity of the monkey sitting at the touchscreen at any given moment. I'm thinking of using RFID collar tags to do so.

Do you have any idea how I could get RFID tagging to work with ML? 


Thanks!
0
Jaewon

Senior Member
Registered:
Posts: 344
Reply with quote  #2 
Interestingly we just planned to use ML for the same purpose and are about to buy hardware for testing. I need to do some research about this RFID thingy, like how the RFID reader can be interfaced with computers and how far it can detect and distinguish individuals, but I am sure we can come up with something. Can you let me know the touchscreen and the RFID solution you are using? Maybe I can buy and test the same models.
0
stremblay

Member
Registered:
Posts: 65
Reply with quote  #3 
Hi,

My touchscreen is an Elo Touch 1937L.

I haven't purchased and RFID module yet. I'm doing my research on readers and tags and range of detections of different technologies. I'm a beginner in RFID tech.

So far, it seems possible to use an Arduino combined with a RC522 RFID Module connected to the PC by USB. However I doubt the range with this module can exceed 5cm. I think I would need 30cm range to properly detect the monkey sitting in front of the screen.

I'm continuing my research on the subject. You can see the attached paper of a group who solved this issue by installing RFID antennas to arm holes leading to the touchscreen. There are some limitations to using such holes, however.

Please let me know if you find something interesting. You are certainly better qualified than me to find the proper technology [smile] 

Best,

 
Attached Files
pdf Anim Cogn 2013 Gazes.pdf (1.11 MB, 4 views)

0
ryklin

Administrator
Registered:
Posts: 241
Reply with quote  #4 
Using RFID is very interesting, and I'd like to get involved. Here attached is a different paper that highlights some of the difficulties we might encounter with RFID. So we should approach this prudently and try to improve upon existing designs.

 
Attached Files
pdf 1-s2.0-S0165027017301140-main.pdf (1.47 MB, 3 views)

0
stremblay

Member
Registered:
Posts: 65
Reply with quote  #5 
Thanks for joining the effort Ryklin!

In the paper you attached, it seems the investigators had reliability issues with their RFID reader; saying they were able to correctly identify the monkey only 80% of the time. They dropped the RFID identification technique in the end to favor isolation of working monkeys. I'm sure we can do better without relying on tunnels (as in this study) or arm holes ( as in the previous study I posted).

Would it be possible, for example, to have the RFID tag embedded in a medallion (such as this one:SureFlap) and have the RFID reader installed on the touchscreen?
My touchscreen is protected by the cage bars, as you can see in the attached picture of my training station, so the reader would be protected.

What do you think?

Attached Images
jpeg IMG_0006.JPG (611.32 KB, 18 views)

0
ryklin

Administrator
Registered:
Posts: 241
Reply with quote  #6 
Hi Stremblay,

That sounds like a good idea. So the medallion would be worn around the neck I suppose? My concerns are 1) proximity that the RFID reader requires and confusion caused by two or more animals paired together, as was the case in one of the studies. I can focus on the ML coding to get it to interface with the RFID system and allow you to actuate tasks.
0
stremblay

Member
Registered:
Posts: 65
Reply with quote  #7 
Hi,

I have done a bunch of research and found two viable and cheap options to add RFID capabilities to our training setups. One option requires training the monkey to touch a RFID reader with his hand to initialize the task. The other option does not.

1) Monkeys trained to touch a RFID reader

It would be possible to implant 125Khz glass-capsule passive tags in the monkeys' hands and to detect the signal when the monkey touches a 125Khz reader hooked to a serial to USB converter to feed the ID signal directly through a USB connection to the MonkeyLogic PC. On the software side, the documentation says the signal can be read using a simple Terminal window, including the serial terminal included with the Arduino IDE.

Pros: cheap solution, RFID signal robust to interference

Cons: Small read distance, monkey training required, single tag can be read at a time.

2) Monkey is not trained

It should be possible to use a UHF Gen2 RFID tag (there are many cheap options) read at a distance of several feet using a UHF RFID Antenna with 6dBi gain coupled to this new simultaneous RFID reader from Sparkfun (other UHF readers are several times more expensive) hooked to an arduino, which is then connected to the Monkeylogic PC through USB. On the software side, there is a Matlab API that allows direct import of arduino data into Matlab, which would make the job of integrating this RFID information to the ML workflow easy (for you, I guess). Please see this example video for proof of concept.

Pros: No monkey training required, Long distance reading. Simultaneous reading enabled.

Cons: Antenna sensitivity to tag orientation, UHF signal interference caused by the monkey body (its not clear to me whether or not the UHF signal could be picked up through the monkey's body if he wears the tag as a medallion on his collar).

I would like to get your input on this guys. You guys are the real engineers!
I would really like to know, for example, if a UHF signal can be picked up by a powerful antenna if it has to go through the monkey's body.

Awaiting your suggestions and comments...
0
stremblay

Member
Registered:
Posts: 65
Reply with quote  #8 
Hey guys,

Since my last post I have figured out how to get the unique identifier information from an RFID tag directly into Matlab to be used by MonkeyLogic.

For this test, I used an Arduino Uno combined with a RFID-RC522 module as my RFID reader and antenna. The hardware and pinout is cheap and detailed here: Arduino Uno ; RC-522 ;Pinout.

On the Arduino side, make sure you download the MFRC522 library.

Then run this little sketch I have written: 
Code:

// This sketch is made to read an RFID tag every second, if present, and send that info to the serial COM port.
// In this example, I used a arduino Uno and a RC-522 RFID reader operating at 13.56 MGHz.
// Make sure you download and install the SPI & MFRC522 arduino libraries before running this script.
//Created by SdT @ MNI 07/2017
#include <SPI.h> // Make sure you have the SPI livrary to enable communication
#include <MFRC522.h> // This includes the library for the specific reader used in this test, the RFID-RC522
#define RST_PIN   9     // Define the reset pin on the arduino
#define SS_PIN    10    // Define the sda pin on the arduino
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
void setup()
{
  Serial.begin(9600);  // Initialize serial communications with the PC at 9600 baud rate
  while (!Serial);     // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)
  SPI.begin();         // Initialize SPI communication between arduino and rfid module
  mfrc522.PCD_Init();  // Init MFRC522 RFID card
  delay(500);
}
void loop()
{
  if ( ! mfrc522.PICC_IsNewCardPresent() || ! mfrc522.PICC_ReadCardSerial() ) { // Look for new cards, and select one if present
    delay(1000); // Set this time parameter to adjust the frequency of RFID scanning
    return;
  }
  for (byte i = 0; i < mfrc522.uid.size; i++) // Read, format and print the unique tag identifier (UID)
  {
    Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
    Serial.print(mfrc522.uid.uidByte[i], HEX);
  }
  Serial.println();
}


After you upload this code to the arduino, run this script on Matlab side:

Code:

%% Reading the uniquer identifier (UID) of RFID tags
% This script will read the unique identifier of a RFID module connected through serial SPI to an arduino
% microcontroller. The serial output is read directly into Matlab using the "serial" command.
% Make sure you first upload the attached sketch on the arduino to initialize the RFID module reading
% Created by SdT @ Montreal Neurological Institute 07/2017
%Clear COM ports first
clear all
if ~isempty(instrfind)
    fclose(instrfind);
    delete(instrfind);
end
%To open communication with Arduino
s = serial('/dev/cu.usbmodem1461'); %type in the correct Port of connection for the arduino. Type instrfind to find yours
s.BaudRate = 9600; %change this to your baud rate of your serial communication
fopen(s); %Open the serial communication
%Read in values for a defined amount of time
tic
while toc < 20 %Run the example code for 20 seconds
    data_str = fscanf(s, '%s');  %read the value sent through the serial Com Port
    data_str %Print it to Command Window.
end
%Remember to close the Com when you're done
fclose(s);



Approach a tag to the antenna of the RC522 RFID reader, and you should see the ID of the tag printed in the Matlab command window. 
The UID is currently formatted as a 8-letter alphanumeric string. 

Guys, I think I have done my part on the hardware side [smile]
It would be nice if you could see how this tag ID could be used to alter MonkeyLogic's internal processes.
Cool alterations could be to load a specific block given a certain ID is read, or simply pausing the task if such a ID is read (if you don't want a particular monkey to interact with your training station for example.)

Looking forward to your comments.
Best,
0
Jaewon

Senior Member
Registered:
Posts: 344
Reply with quote  #9 
Take a look at the userloop examples in the ML2 package. With the userloop, you can flexibly determine the timing file and the stimuli that you want to run in the next trial. I am already using it to run different timing files according to the subject name, so I think it is not difficult to do the same thing with the RFID reading.
0
Jaewon

Senior Member
Registered:
Posts: 344
Reply with quote  #10 
I attach an example task for you. Let me know if you have any question.

 
Attached Files
zip tasks by subjects.zip (2.73 KB, 2 views)

0
ryklin

Administrator
Registered:
Posts: 241
Reply with quote  #11 

Jaewon,

Using this approach in which we switch the task to run on the next trial, do you think that we should have a "Blank" ML task running, and then when an RFID is detected, ML switches to a "Real" task that corresponds to the RFID number? In other words, ML should be running a task with no stimuli and a timing file that only looks for the RFID but does nothing else. Once it detects the RFID, it switches its arguments for the next trial. My main point is that ML is running trials while looking for the RFID. Hope this makes sense, thanks.


0
Jaewon

Senior Member
Registered:
Posts: 344
Reply with quote  #12 
See the example above. The next trial doesn't start until an RFID is detected. There is no need of a "blank" task.
0
ryklin

Administrator
Registered:
Posts: 241
Reply with quote  #13 
We run tasks_by_subjects_userloop.m which "stalls" by using the matlab pause command until a subject_id is found based on an RFID tag, and then chooses the appropriate task to run (task_for_subject1 or task_for_subject2). 

After task_for_subject1/2 completes will ML go back to running tasks_by_subjects_userloop.m to repeat the entire cycle?

0
Jaewon

Senior Member
Registered:
Posts: 344
Reply with quote  #14 
Yes, it will. You can run the example in ML2 and see how it works yourself.

What makes MATLAB stall is the while command. The pause is there to yield the CPU. It also controls the reading interval.

The tasks_by_subjects example preloads/preprocesses the stimuli and the timing files, but you can return just the stimulus list and the timing filenames, as in the "dms with userloop" task.

It is not difficult to display some useful information while "stalling", such as how long the task has been stalling, who completed how many trials, etc. They are not included to keep the example simple.
0
ryklin

Administrator
Registered:
Posts: 241
Reply with quote  #15 
Okay thanks for the entire explanation. I will give it a full test today and will try to display information while stalling. This sounds great.
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation: