Here we are in my very second development entry! Take a breath for we have entered this great moment for history and discovery! Haha just kidding...kind of :D So this week I was focus on getting some biometrics actually functioning in the digital world of my computer. The main biometrics I zoned in on was tools that could track heartbeat and eye pupil diameter. I received a wireless MIO Link Heart Rate monitor that goes on your wrist - no chest strap required! Also, I acquired a Tobii EyeX eye tracking controller through my school.
The journey in getting the heartbeat sensor to send feedback back to my computer was not an easy one. For the general use of MIO Link and most other ANT+ technologies, its mostly used in the mobile environment. So if someone goes out for a run and wants to track their heartbeat, then they strap on the Link and turn on the mobile app. The app then tracks the heartbeat data and then users can analyze their data as they please. That wasn't my purpose of getting the device. I needed this device working in the Unity engine for the biometric tool that I was building. Luckily when I reached out to that really cool game company Flying Mollusk, I got a nice tip to look into ANT+ protocol in getting this sensor to work with Unity. According to www.thisisant.com (the author and holder of ANT+ technologies), I needed to create a development account and then find the appropriate device profile for my device. Explanations of device profiles can be found here: https://www.thisisant.com/developer/ant-plus/ant-plus-basics/ Next I would need to obtain the ANT+ Network Key appropriate for my device. I wasn't exactly sure where I would use this key yet, but all I knew was that I would need it. I also went through the documentation for Mio Link Complete User Guide and the ANT+ Device Profile for ANT+ enable heartbeat devices. All this was great, but I still needed to figure out how I was going to get this working with Unity. After reading some forums, I realized I needed to get access to their ANT+ SDK. I found this on their website in the developers section that had different software tools I could download. Downloading the SDK and importing it into Unity wasn't going to be enough. I actually had to dive into the code and customize it for my purpose. The variables I needed to define in code was USER_ANT_CHANNEL, USER_DEVICENUM, USER_DEVICETYPE, USER_TRANSTYPE, USER_RADIOFREQ, USER_CHANNELPERIOD, USER_NETWORK_KEY, and USER_NETWORK_NUM. I deciphered what I needed from the device profile and tried building the code to see if I could receive feedback from the heartbeat sensor. At this point, I had pair it over bluetooth to my computer. I still had no successful feedback at this point. Then, I learned about an ANT+ SDK that I could import from the Unity Asset Store. So in hopes that this would work out the box, I downloaded and imported that particular SDK into a new Unity project. I still had no feedback and it was time for debugging. I started looking more into the API and trying to understand what it was doing. I was able to breakdown the code and find that the SDK was designed to gather information through two port types - USB and COM. There was no communication for bluetooth. So I thought about two things I could do- expand the functionality to handle bluetooth OR the easier route is to somehow get this heartbeat data to translate through one of these ports. After much research on the internet, I somehow found out about this USB ANT+ STICK. This wasn't something I found on the official ANT site either. It had to be some place in the dark webbzzz, just kidding, but it was some offbeat forum that I stumbled across and the site to buy it from was too sketchy to me. But thankfully they can be found right on Amazon! I ordered the piece, Cycplus ANT+ Stick Adapter. Plugged it in and still didn't work for Unity. Then I applied the needed network key and double check the other variables in the SDK that
I listed before, and it finally worked. YAY!
The Eye Tracker
The first step was to import the Tobii eye tracking package from the Unity store. Then I realized I needed the necessary drivers, and then tell Unity through its Tools option to use the Tobii SDK. This got the basic eye tracking working. But what I was really after was figuring out how to measure the pupil diameter of the eyes through this hardware. I learned that I would need the Tobii Pro SDK which is where most of my time was spent. It took a while to find a version of this Pro SDK after I finally found out that’s what I needed. Once I get their pro API into Unity, I needed to search in the code to figure out how I would actually get the pupil diameter, since out of the box it wasn’t giving me this analytic. Finally, I found that I need information out of their GazeData class. I wrote some code to test out some of these tools but the major issue though- I don’t have the proper license for this. I needed to contact the sales department of Tobii pro to get special permission to use the eye tracker’s analytics features. The email has been sent out.