 Good afternoon, everyone. I hope you all had a nice lunch. I'm going to be talking about how to detect phone falls and fall shakes or jerks in Android. Basically, I'm going to take you through what process we went through to detect a phone fall and what we came across as hurdles. Basically, there are no libraries which actually take care of phone falls or shakes or even to that extent, talk about orientation with phones. You'll have to use the sensors and write them. There are various sensors, though. They're like accelerometer, this gyroscope, and orientation sensor, and magnetometer that Android provides, wherein gyroscope is not very common with low-end devices and stuff. But the rest of them are pretty handy when you're doing something like this. What we started by doing was we started by using the accelerometer. We were like, how hard can it be to detect phone fall? We were like, OK, there are certain principles of gravity and there are certain principles of fall. So what is that? That is like when an object is at rest, it's like 1G and when it's in free fall, it's 0G and there'll be a surge in stopping. So we just started with that and we started by using the formula for accelerometer and minus the gravitational pull and stuff. We were like, yeah, it's very simple. We'll be finishing it in a few days or something like that. Then we see that phone is detecting every small jerk. It's detecting every shake. It's not detecting just falls. We're like, OK, what's wrong? We went back and we saw we were looking at a lot of papers. We were reading on a lot of things on how accelerometers react to various scenarios, when people are walking or when they're sitting down or when they're simply tapping the phone and stuff. And we saw this graph. We saw surges in acceleration even when you're doing this normal stuff. And while sitting down, though, we saw a big surge. We're like, what do we do now? Then we read about what happens in case of a fall. We try to understand what happens in the case of a fall. We got to know that when a fall happens, it's a huge surge. And then it goes down to a certain level. Depending on the sensor, it goes down to a certain level. And then it remains constant at that level. So we use this. We change the endpoint. We change it from just detecting the accelerometer to showing a zero G to this, where we saw a huge surge. And we also kind of found that the noise that is acceptable in case of Android was four. We were like four in terms of the acceleration. If you use this as a delta, there is higher chances of reducing the noise that is shown by sitting down or walking up or doing anything else. So we did that. And we changed the endpoint. We monitored what happens after a surge occurs. And we kind of did this whole exercise. And finally, we narrowed it. We were like, OK, now this solves it. But no, it doesn't solve it. What happened was that small jerks were eliminated. Small distances were eliminated. But still we had shake. Like if I did something like this, it's still showed as a phone fall. And then if I threw my phone horizontally, it's still showed as a phone fall. So these were the two things that happened for us. We were like, how do we solve this? And that's when we thought of a gyroscope as an additional sensor. The issue with, sorry, gyroscope theories dictates that it gives you the direction of movement. And it should give you a zero value. But most Android gyroscopes are not calibrated. Plus, they do not give you this because there is something called as drift in Android. The gyroscopes, because they're not the same physical form as they're available otherwise, they have something called as drift. And we were wondering how to remove this drift and get the exact rotation values. Why we used gyroscope is to just see if the phone orientation is parallel to the ground orientation. So that is why we used gyroscope. So how do we eliminate the drift? And we read a lot. And there was this company called SensorFusion who have been working on this particular sensor, gyroscope, especially in Android for about two years or something. So we went there and looked at this whole module of using accelerometer and then the gyroscope values to remove that drift and to get a neutralized value. And we used that research basically. And we eliminated the drift. This was good. This was good when it came to high end phones, which had gyroscopes. But what do we do when there are no gyroscopes? Because we wanted our solution to be reaching people who have low end phones also. So we read a little bit more. We came across this technique called a subsequence matching. So basically in data mining, it's one of the most used techniques wherein they collect patterns and they do an analysis of how the pattern changes. And they have an acceptable range in which you can detect phone call. But it was too much for us. It was too much analysis, too much data for a small Android app to do. So we went ahead, started looking at things, and we found out that if you use a magnetometer and if you use a gravity sensor along with it and if you use an accelerometer, you could essentially get what a gyroscope gives. That's the orientation with some variations. So what we did was we went ahead, used these values, and wrote a virtual sort of a gyroscope thing. And finally, we ended up getting the values of the role and pitch and everything. And how we solved this shake in the end was basically we kind of found the orientation of the device once a surge happens. How is it? Whether it's flat or whether it's like this vertically or something like that. So based on that, we chose to give a margin of error with the orientation around 15 degrees of margin of error. And then we eliminated the shake right now. We have, with all this put together, we are able to detect phone falls. We're able to very, so with conviction, we can say it's a phone fall and not a phone shake or a phone jerk. I would like to show this. Yes, so, oh, sorry. OK, I can show it to you outside. It's just that I have a toast message. I should have written an alert. It's a different thing. So by the time I'm putting it from here to there, I'm not able to show it to you. But you can definitely come and find me a soft surface and I'll show you how this works. Yes, now the question of are we there yet? We're almost there. We're like 80% there, except for probably the case where you are pushing your phone on this horizontal surface. The rest of the cases are eliminated in terms of shakes and jerks. And we can easily recognize phone fall as such. And we have our code open at the GitHub. You can go have a look. It's dirty. It's buggy, not optimized, but it works. Yes, that's basically what I had to talk about. Any questions from any of you? Which phone is this library tested with? We've tested with Nexus One. We've tested with DOS, yes. Samsung DOS, yes. OK. Yeah. Any other device, some low-end device? No, not it, not it. How are you using sound sensor in falling? Sound? Yeah, you're using something sound threshold or something, like the phone falls? Noise, that's not a sound. Yeah, noise, yeah. Noise is basically all the, so I was showing you the graphs wherein there were surges which were not as evident as a fall surge. Actually, I also created something with that. And my problem was that sound threshold is different for different devices. So how you, like? So with a lot of reading, we kind of came up with that value. So you have a static sound threshold value? Can you, like? Yeah, we tried with three, we tried with four and five. And we also read through a lot of people who've tried this thresholds with three, four and five. And we kind of found four to be optimal last search. OK, thank you. Any more questions? So I actually got a little confused with this question. I just wanted to clarify. By noise, you meant signal noise or the ambient noise? Signal noise, not that. I think he meant, he meant ambient noise. No, I was talking about the signal noise. And so this app, basically, when you open it, it runs, right? So any idea about battery implications when it's running in the background? We have not optimized it for battery. No, I get it. Yeah, obviously. As far as I see it, major part is because all the sensors are on. So there is not much optimization that can be done. Maybe you can poll it at a different frequency or something. Correct. So we have not handled that part of the thing, to be very honest. OK. Any other apps you know that which are doing it? If you have come across something? There is one or two apps. I do not remember the names. So I think I have one or two installed also to show. OK. So my question is, OK, you've detected the phone fall. So what is the app is doing after that, I mean? So you can use it as a trigger mechanism for anything. We are using it. So we are a security-based company, personal security-based company. So we are using it for one of our use cases. You could use it for something else. Can you give an example if it's not perhaps? No. The most common use of phone fall, not phone fall, fall, is among elderly when they're like ill and stuff. Phone falls are used as a mechanism to alert for medical emergencies. So yeah. OK. Thank you, Chinmay. Thank you.