We have now more or less finished, so here is an overview of the prototype
Arduino connected to:
3x Infrared based proximity sensors
1x Ultrasound based proximity sensor
1x Piezoelectric sensor
The Arduino is interfaced with a library for gesture recognition via the serial port. Test applications use this library to demonstrate functionality.
6 actions based on gestures are supported:
Scroll left
Scroll right
Scroll up
Scroll down
Zoom in
Zoom out
For the scrolling gestures, information from the IR sensors is used.
The zooming gestures are detected based on information from the ultrasound sensor.
The piezoelectric sensor is used to detect a tap on the actual watch. This information is used to switch between detecting scrolls and zooms, as the pattern resulting from tilting the hand up on the IR sensors is the same as the pattern for scrolling right. (This concession has to be made because we don’t know the start and end point of a gesture).
We also have a standard Map and Menu applications for testing all this!
Here is the final video that we’ve produced to submit along with a CHI work in progress paper.
It looks like we won’t be able to get the start and end position of a gesture. All attempts to detect a tap on the hand reliably have failed. The piezoelectric sensor readings are t0o noisy, and doing things like moving the hand can produce the same response as tapping. Because of this, we decided to abandon using the $1 recognizer. Now we look at the gradient of the X (proximity value from the sensors) to detect right and left, and the Y (the position of the sensor with the smallest distance). This introduces many fiddle factors as we are not doing direct pattern matching, but it is looking promising. This also means that we won’t be looking at multi-touch gestures any more.
To make up for that, we’ve decided to use the ultrasound sensor to detect the user tilting their hand up or down. These tilts can then be used for zooming in or zooming out, for example.
Zooming in by tilting the hand forwards.Doing nothing.Zooming out by tilting the hand upwards
As you can see from the picture, when the use is tilting the hand down, there is nothing in front of the infra-red sensors but something in front of the ultrasound sensor. Conversely, when the hand is tilting up, there is something in front of the proximity sensor and nothing in front of the ultra sound sensor. This gives us two distinct states that we can use.
Since we were still having issues with gesture recognition (all thanks to not knowing a start and end point), I decided to write a small application that allowed us to visualise the data coming from the three sensors as a bar chart updating in real-time. This will allow us to see whether there are any patterns we may have missed that we could exploit in our quest to detect horizontal and vertical scrolls separately (they work adequately individually).
The following video shows the output of the sensors when an object moves towards all three (for horizontal scrolling).
The following videos shows the output of the sensors when performing vertical scrolls.
And finally, here is a video of running the visualiser on test data for no good reason.
As per the previous post, we were able to recognize horizontal scrolls using the $1 recognizer. The next step is to detect vertical scrolls. We created some training data for the $1 recognizer, and the recognition worked surprisingly well!
There is a very clear difference in the pattern when scrolling up compared to scrolling down. They are basically going in the opposite direction.
The y axis represents the sensor to which the finger is the closest. (0 is sensor 1, 50 is sensor 2, and 100 is sensor 3)
Unfortunately, combining the horizontal and vertical scrolls was not so successful. Since we still don’t have the ability to detect when a user is about to perform a gesture and when the gesture stops, we are using a queue of sensor readings and running the detection every time a new reading arrives. This means that the queue may contain readings from previous gestures, or the queue may contain half a gesture, etc. This basically breaks everything..
We were having some difficulty getting the $1 recognizer to work correctly, and we thought it might be because we were using ideal data as the training data for the recognizer. To remedy this, I wrote a quick application to grab data from the sensors and create an XML file appropriate for the $1 recognizer.
The application GUI
I decided on a GUI based application rather than a console application because it is easier to simply press tab to go to the start or stop button and press enter. Being able to do that quickly meant that we only captured the data points that were part of the gesture.
The application receives data from the Arduino and creates an XML file in the following format:
This training data is then loaded into the $1 recognizer for gesture recognition.
Once some training data was created, we ran the $1 recognizer again and it was still not very successful. During debugging, I discovered that the $1 recognizer assigned almost identical weights to all the gestures (i.e. the recognizer thought a right gesture was equally as likely to be a left as a right). After much head-scratching and discussions with the members of BIG, we discovered that this was probably because the number of samples in the training data was too low (each gesture had roughly between 5 to 10 data points). To combat this issue, we increased baud rate of the serial port and therefore the number of times we were receiving data from the Arduino. This resulted in a 3x increase in the number of data points, and the recognizer was no longer confused!
Unfortunately, we discovered that pattern for scrolling left and scrolling right were very similar without knowing the start and end points.
Pattern for scrolling left against the pattern for scrolling right. The pattern is very similar. There is displacement in time, however this was not consistent enough across multiple iterations to be useful.
To combat this issue, we created new training data where when performing the left scroll gesture, we would stop in front of the sensor momentarily. This resulted in the pattern for left and right being more distinct and so gesture recognition was more successful. While this means that you have to perform the gesture in a particular way to get it to work, it is a compromise we must make to make up for not knowing the start and end point of the gestures.
The pattern for scrolling left is now very different to that for scrolling right.
This workshop was a while ago, but I haven’t been able to post anything on the blog for a while. I’m going to make a series of posts from now on that will deal with the things we’ve done so far and how we have got to the stage where we are now.
In this workshop, we continued trying to use the $1 recognizer to recognise left and right gestures based on input from one of the IR sensors. It wasn’t working very well so we need to investigate creating training data for it based directly from the readings from the Arduino rather than using the values we expect (and therefore ignoring any possible noise).
Since eventually we want to be able to detect multi-touch gestures like pinch, we also discussed using the $N recognizer – this is a variant of the $1 recognizer that supports multi-touch. However, we’ll cross that bridge when we get there.
Another issue with using the $1 recognizer is that it takes in a list of points and tries to detect a gesture on those points. This means that we must know a distinct start and end point for the gesture. That is information we currently do know have since we have no means to detect touch. Chris and Chee have been looking at using various sensors for achieving this using a microphone and a piezoelectric sensor. I believe they found the microphone to not be sensitive enough and the piezoelectric sensor to be too sensitive… They’ll carry on working on it. Meanwhile, we have a system where we keep a queue of a last x number of sensor readings and every time we get a new reading, we add it to the queue and remove the oldest one. We then perform gesture recognition on the queue to see if a gesture was performed. If a gesture is recognised, we empty the queue and start again. As mentioned previously, this doesn’t work fantastically well, so there is still a way to go.
In this workshop, we focused on gesture recognition and connecting all of the sensors o the Arduino.
The sensors mounted on the wrist using an iPad Nano wrist strap and attached to the Arduino.
The three proximity sensors are now attached to a piece of plastic, which is then inserted into an iPod nano wrist-strap. The proximity sensors and the acoustic sensor have been connected to the Arduino with some long wires.
We had not previously tested the acoustic sensor. It’s unclear whether we’ll be able to detect touch using it. We are able to detect a tap when the sensor is placed on the wrist cavity. The tap causes an instantaneous drop in the output of the sensor (indicating a loud noise) followed by the output returning to pre-tap levels. This means we can potentially only detect a tap, not tap and hold.
The acoustic sensor
On the gesture recognition front, we integrated the $1 Unistroke Recognizer into our project, although I now realise we probably need to use $N Multistroke Recognizer to recognise the pinch gestures. Anyways, we created training data for a horizontal scroll and were able to detect the gesture on some test input. We just need to corroborate this with data from the Arduino in the next lab session, but I am fairly confident that this will work correctly as our testing system generates test inputs in a similar format to that which we would expect from the Arduino.
For the communication between the Arduino and the gesture recognition software, we decided on the following protocol:
Tapped | Ambient1 | Proximity1 | Ambient2 | Proximity2 | Ambient3 | Proximity3.
This stream of data can be parsed by splitting the string at the ‘|’ character and separating all of the components. The Tapped section is a 1 or a 0 to indicate when a tap is detected. This is when we start looking at the rest of the data for gesture recognition. Once a gesture is recognised, we stop looking at the data until another tap is received. Since we have not yet got the acoustic sensor to work correctly, we are simulating the Tapped behaviour by detecting a big change in the proximity (i.e. when there is nothing close to the sensors and then there is).
Currently the Ambient light values from the proximity sensors are not being used, but we may incorporate them in the future to improve the accuracy.
In the next workshop, we shall test the gesture recognition with real data from the Arduino and train the recogniser to detect the other gestures.
To realise the smart watch, we needed to obviously have some software that takes in the inputs from the hardware, does gesture recognition and so on. We also needed some test applications to show off the capabilities of our device. As the official “System Designer”, I am responsible for designing and structuring the software back-end for the project. When I set about doing this, there were multiple issues that needed to be considered:</P
We have a group of 5 people, so everyone should have something they can start doing as soon as possible.
There is limited time so the system must allow for concurrent development.
We do not know exactly what sensors we will be using.
We may want to try multiple types of sensors.
We don’t want to write separate test applications and gesture recognition for every combination of sensors we try.
To overcome all of these issues, the system had to be modular with each module being independent and interacting with each other through well-defined interfaces and abstractions.
What I ended up with is a solution with a core project with an interface that all test applications (i.e. PrintGetures, Menu and Maps in Figure 1 use).
Figure 1 – Solution components
Within the Core, we have the Gesture recognition that implements the IGestures interface. This defines a set of events that the gesture recognition engine can raise once it detects a gesture. Figure 2 shows the dependencies for the interface – these are only the parameters for the various gesture types. These are well-defined so any application can use them without worrying that they will change.
Figure 2 – Gesture recognition subsystem
Figure 3 shows a slightly higher level view of the solution and takes away the detail from Figure 2. All the test applications rely only on the IGestures Interface. As previously mentioned, this interface defines a set of events so the test applications can subscribe to the ones they are interested in. For example, the Menu application only subscribes to the HorizontalScroll and VerticalScroll event, whereas the Maps application subscribes to all of the events. Notice that the applications have no knowledge whatsoever of the internals of the gesture recognition system or what kind of sensors it uses. This means that we can start writing the test applications without having to wait for the gesture recognition to be complete. We can also test these applications with mock gestures.
Notice also that ProximitySensors.GestureRecognition interacts with the Arduino through an abstraction layer. This means that the engine can define what inputs it wants from the Arduino. This potentially allows us to use the same recognition engine regardless of the absolute values the sensors report to the Arduino as these can be mapped to whatever the gesture engine requires outside of it. This means we can test out different sensors without worrying about the gesture recognition breaking.
Figure 3 – Solution heirarchy
Figure 4 shows in picture form what I have written above. We can have any device input any kind of data to any kind of gesture recognition engine. As long as all the test applications use the IGestures interface, they will continue to function. Similarly, as long as the Arduino layer provides the desired data to the gesture engine, it will continue to function. No malfunction in the system requires any of the other modules be changed. This means that some of us can work on the Arduino layer, some of us can work on the gesture recognition and some of us can work on creating test applications, all at the same time without having to worry about a messy integration process later on.
Figure 4 – System overview
In fact, using this system, I was able to create test applications even before we received any of the equipment. Once we got the equipment and started working on the gesture recognition, none of those applications had to be changed.
Supported Gestures
The framework currently supports the following gestures.
Pinch in
Pinch out
Horizontal scroll
Vertical scroll
Diagonal scroll
Additional gestures can added to the framework very easily. Recognising them is another matter, though, something we are currently working on J
Test applications
I wrote a few sample applications that are discussed briefly below. Note that the screenshots show these applications running with a mock gesture source which uses a random number generator to raise the gesture events and create their parameters.
Print Gestures
This is a simple utility that simply prints out the gesture that is recognised and its parameters.
Figure 5 – PrintGestures application with some sample output
Menu
This is a simple menu simulation that responds to horizontal and vertical scroll events.
Figure 6 – Menu simulation in the middle of scrolling horizontally to the right.
Map
The test applications wouldn’t be complete with a map application.. This application currently listens for Pinch in and Pinch Out gestures and zooms in or out accordingly. It will be extended soon to support panning as well.
Figure 7 – Map application just after zooming in after receiving a Pinch In gesture event
There was another workshop yesterday and we made a surprising amount of progress!
We split the group into subgroups. The proximity sensors (we ordered one based on ultrasound and one based on infrared) have arrived, so one group (Chee and Chris) was testing them both out to see which one would be suitable. They found that the ultrasound sensor was just too big to be wrist-worn and the infrared sensor worked well enough that they decided to buy two more of those to form the complete array for gesture detection. They also bought an iPod wrist strap and cut up some acrylic to mount the sensors on, as well as an acoustic sensor to detect touch.
The infrared based proximity sensor we will be using.
Another group (which was just Jiawei) was looking at detecting gestures based on the Arduino input. I was responsible for showing how his components integrate into the software stack(since I designed it). Had to spend quite a bit of time trying to explain to him how that worked and convince him that he could define whatever kind of data he wants as the input to his gesture recognition system and that the Arduino software layer can do any mapping that may be required. That was a tough sell.
Tom and I spent some time thinking of what kind of parameters each gesture we want to recognise might have. For example, a pinch gesture has two start and two end points whereas a scroll gesture only has a start point and an end point, where each point is a set of x,y coordinates. This meant that I had to change the test applications I had written (another blog post on that later) to take into account these new parameters, but by the powers of git and modular design, that was not a problem.
Finally, I also connected the Arduino via a serial connection to our C# project. Chee and Chris were programming the Arduino using the Arduino IDE, but of course eventually it needs to be interfaced with our software so that the data from the sensors can be passed in to the gesture recognition system and the applications. This turned out to be surprisingly easy!
Our testing rig.
In conclusion, we now have a complete software stack going from the Arduino to test applications. The individual modules just need to be fleshed out. We have decided on the type of sensors we are going to use, the equipment we will use to mount all the sensors and have almost got the ability to recognise a horizontal scroll using a single sensor!
There was another workshop this Tuesday where we were meant to start thinking about the implementation of our idea. Since we had recently changed it to the Smart Watch, we decided to spend some time brain storming exactly what this Smart Watch was, what it would entail and how we could go about implementing it.
In attempting to define the hardware, we started by listing the features of the watch. What we came up with was:
Extend the interactive surface on to the back of the hand
Project the display onto the hand
Enable interaction with touch
The board
We quickly figured out the projection could be done by a pico projector mounted onto the wrist and some mirrors. For touch detection, there were a few more options to choose from:
Acoustic sensor
Leap motion
Proximity sensors
While we were doing this, it was suggested that we think of some use cases to get a more specific hardware requirement. I thought this was an amazingly simple and effective idea that it seems a bit silly to not have thought of it before. Anyways, as we thought of use cases, it became clear that we would have to think of the sensitivity of the touch (i.e. whether we would divide the hand into a 3 x 3 grid or a 4 x 4 grid) to support finer, continuous gestures and whether we would just detect gestures performed in mid-air or actually detect touch on the hand. In the end we have decided to just detect mid-air gestures for now, using three proximity sensors. If we have time, we’ll add support for touch too, perhaps using Acoustic sensors.
We then quickly set up a circuit to test a proximity sensor with the Arduino (the proximity sensor was taken off of the car Chee and I designed last year – we were using it to measure the speed). The sensor was working correctly, except it turned out that the range of the sensor was only 3mm. That is clearly not going to cover the entire hand. I actually knew the range of the sensor, but in a moment of obliviousness I let the rest of the group carry on with the soldiering (in all fairness, they seem to be having fun!). We’ve ordered some more appropriate sensors now that should be delivered next week.
After the workshop, we divided up the work. I was appointed the “Systems Designer”. My job involves figuring out how all the different components (like the Arduino, the gesture recognition and the applications that use the gestures) are going to interact and defining strict interfaces between them so everyone can get on with their bits and have everything come together magically. I also have to ensure that any test applications we write continue to work regardless of the low-level implementation details of the input detection.
In conclusion, Tuesday was quite a big step towards the realisation of the device. Things are getting more interesting and more concrete. I’m very excited now!