# Raspberry Pi Internship — W1D1

I guess firstly this blog is going to be rather awful. My competence in writing is on par with my ability to attract females. I am single. So for any unfortunate soul to stumble across this, don’t say I didn’t warn you. Mainly this is just something I feel like I should do because it seems like it might be beneficial in the near/not so near future.

Today I started my internship at the Computer Lab for my Director of Studies, Robert Mullins. I am currently working on two projects, one for the British Geological Survey and the other for the Raspberry Pi, specifically pi land. Both of which are made for educational purposes for adolescents that want to learn how to program with text (so not scratch). The project that I am starting off with is the one for the BGS, where we are given a raspberry pi and a PSoC dev board and several piezoelectric sensors and we are to create a system that can locate taps/knocks on a surface. This project was actually done two years ago by Satyarth Mishra Sharma except his hardware contained discrete components on a bread board and used a rather shady/inefficient algorithm to locate the points.

My partner, Jamie Wood, and I encountered many problems today, one of which is that I am extremely incompetent when it comes to hardware, but he seems to know what he’s doing…which is good. Some other problems include the fact that we didn’t have mice/keyboards/monitors for our raspberry pis, but this was solved by just cannibalizing several computers. The major problems today were that our raspberry pis were not configured to connect to the Computer Lab’s internet, so we couldn’t download anything onto the Pis. The second of which is that there is only an editor for the PSoC in windows and we can’t install anything on the computers in the Intel Lab because we don’t have privilege. We ended up downloaded parallel Desktop which lets us emulate Windows 10 on my mac, but file transfers are very slow through the web) and its just awful to use in general.

We were able to get Satyarth’s project to run, however the device may be obsolete now as it spits out nonsense whenever we test it out. We looked at his algorithm and it appears that he is doing a least square regression on the multilateration of four points. Multilateration is a technique based on the time difference of arrival of a contact points to piezocrystal sensors that pick up on the vibration. For each pair of sensors and their time difference, we know that the point of contact must be on a hyperbola with those two points as the focii, whose eccentricity can be determined based on the time difference. So hypothetically we could just have three sensors and find the intersection of the two hyperbolas mathematically. However, due to errors it is unlikely that the hyperbolas will intersect and this approach may lead to large errors. So instead he introduced four sensors and tried to find the intersection point of many hyperbolas. The increase in accuracy makes it even more unlikely that thy hyperbolas will intersect, so instead we find a point such that the sum of the squares of the distances of the point to the hyperbola is minimized. His implementation was a brute force approach that checked every possible point on the board (within resolution) and returned the lowest valued one. Though this is a simple solution, it is rather slow and inelegant. Initially what I tried to do was have four sensors in a rectangle, with the upper pair creating a hyperbola and the lower pair creating a hyperbola. When then restirct the areas in which we can tap to a fraction of the rectangle side lengths so we can approximate the hyperbolas with their asymptotes and find the intersection of these lines, which is very easy. However, upon several test cases it appears that this is a very very awful method with large errors. Tomorrow I will look up more multilateration techniques, specifically we will probably also have to utilize a least squares regression. But I will attempt to learn the Gauss-Newton (variant of the Newton-Raphson iteration) method to minimize the squared regression. Hopefully it isn’t too bad.

We hope that we can complete this mini-project by Thursday/Friday. If we have spare time we will have a method to calibrate the device such that it is not restricted to a fixed board size (in the beginning we will tell the users to tap where each of the sensors are and to tap in the middle so we can figure out the speed of sound in the medium).

In other news, Tripos results came out today and I got a first :) (kind of unexpected) and came 14/104 first year Computer Scientists. I averaged about 75% on the Computer Science Papers and about 70% on the Mathematics/Physics Papers. I honestly thought I did a lot worse on the Physics paper however.