Wednesday, June 22, 2016

Turn a smartphone into a microscope for free?

A while back I found a neat idea for turning a smartphone into a microscope. The idea was you 3D-print a clip to house a minute glass bead (around 1-3 mm across). This essentially acts as an objective lens, considerably magnifying the object in front of the lens (supposedly up to 1000-fold, though I remain sceptical).

Problem is... who has glass beads lying around?

As a nice hack, you can get a little way towards recreating the effect with just a drop of water or oil right in front of the lens (best do this on an old phone, people).



1) Kyocera KC01 (budget JP smartphone) with a blob of water over its lens (circled red to give an idea of the extent of the water droplet). The droplet is a little too large and slightly off centre, but illustrates the general idea.


The problem with water is that it evaporates very quickly, and so the magnification strength is lost very quickly. Vegetable oil was much better; I made one application and it lasted for several dozen minutes.

So, demonstration photos:
2) Photograph of thyme leaf broken at the petiole (leaf stem), showing detail of bristles. Taken using a Aquos Crystal with a droplet of vegetable oil approx. 1 mm across. Backlit using a single 100-yen-shop LED light.



 
3) Photograph of thyme leaf, showing detail of spots on the leaf. Taken using a Aquos Crystal with a droplet of vegetable oil approx. 1 mm across. Backlit using a single 100-yen-shop LED light.
For (2) and (3), Much of the blur around the edges is due to the droplet not filling the entire field of view. The clarity isn't exactly great elsewhere, possible because it was a real pain trying to keep my hand still.

The thing I like most about (3) is that I didn't notice those spots until I looked at the magnified image, so even these relatively poor images do help bring your awareness down to the micro level.

4) Photograph of human hair against paper. Taken using a Aquos Crystal with a droplet of vegetable oil approx. 1 mm across.

5) Photograph of Japanese bill at minimum focal distance of Aquos Crystal without modifications. The letters in the white area are around 2 mm across.
6) Photograph of Japanese bill taken using a Aquos Crystal with a droplet of vegetable oil approx. 1 mm across. Backlit using room light (approx. 3000 lux, according to lux meter)

I took (6) to get a rough idea of the magnification. On my computer screen the character extends 7 cm across my display without too much blurring (though, this may be more of a problem of my hand shaking, rather than the optics), which would suggest a magnification of around 70 mm / 2 mm = 35 fold. However, I should also account for the fact the unmodified camera produces characters of about 1 cm across on my screen, which in itself corresponds to a magnification of 10 mm / 2 mm = 5 fold. So in fact, the oil droplet was only 7 times more powerful than the unaided device.

Nonetheless, the patchiness of the printing is a feature that is almost impossible to detect with the naked eye, and yet became very prominent on using the oil droplet.

But, at only ~7 times better than the standard smartphone lens, I guess dishing out for a cheapo magnifying glass would give better results.

Unsurprisingly, seems people have already thought of this approach, here. Seems that by using polymers instead, you can bake them into permanent lenses. Cool!

I'd be thrilled to hear of any improvements to this. My first thought is to attempt producing a bead by melting clear plastic to flow along a wire into some cold water, which should hopefully solidify the bead in a... bead shape. I don't expect it to work, but it would be better than buying a box of 15000 beads and having 14999 spare beads...

Unless I can think of a use for 14999 glass beads...

EDIT: So, some obvious improvements:
1) You can buy a screen protector -they are clear and don't interrupt with the light getting to the lens too much-, which means you can use oil without worrying about damaging the lens.
2) You can apply PVA glue to this screen protector. When it dries, it becomes transparent, and you can indeed get a lensing effect from it! Decidedly more of a permanent solution that water and oil..

Saturday, January 16, 2016

Swiftkey vs Google vs Swype for Japanese input

Summary:

SwiftKey
  +Fastest for Japanese input
  +Switching languages is easy
Google Japanese input
  +Almost as fast
  +Excellent dictionary
  -English support is poor - but you can switch input methods
Swype
  +Still excellent for handwriting input - possibly useful for beginners to Japanese
  -Considerably slower for Japanese

So, every once and a while, I look through the Google play store and try and find a better way of typing Japanese on my mobile, because frankly, I do a lot of that, and a couple of minutes investigating which method is fastest will pay off in the long run.

Previously, I compared the Swype, Google, and Wnn keyboards. Since then, I've changed phones twice (once to an Aquos Crystal, then to a Kyocera KC01). The increased processing power of these more modern devices makes switching keyboard methods easier, so for a long time I was switching between the Google methods, which still provide excellent predictions for both languages*.

More recently I have been using the Swiftkey keyboard, and despite the fact they have done away with the 12-key keyboard (which works really well with Japanese input), I have increasingly found that it is quicker than Google Japanese Input.

To be sure, I conducted a small test using the following text:

"17日は前線を伴って低気圧が九州に近づくでしょう。九州は昼頃から雨が降り始める見込みです。中国、四国も午前は広く雨で、夜は近畿でも雨が降り出すでしょう。東海、北陸、関東も夜はところどころで雨や雪が降る見込みです。東北と北海道は日本海側で雪のところがありますが、晴れ間の出る所もあるでしょう。18日月曜日の朝は関東の内陸部でも雪の積もるところがありそうです。"

I should probably have used a shorter text... My thumb aches... But this should hopefully make differences between the different methods more apparent.

So, this is how long it took to type with each method:
6:06 with SwiftKey
6:20 with Google Japanese Input in 12-key format
7:49 with Swype keyboard in qwerty format, tapping, not swyping.

These results tally fairly well with my more qualitative observations; Swiftkey is only slightly better at Japanese than Google, but both of these methods are superior to Swype. I would point out that swyping is still not particularly usable for Japanese, but the word prediction is just about sufficient to make tapping viable.

As well as being the fastest method for inputting Japanese, switching to English in SwiftKey is faster than changing input methods with Google (again, footnote*), and the English prediction for SwiftKey is fairly capable. Nonetheless, for words with unusual characters, my gut feeling is that Google performs much better. Additionally, my main gripe with Swiftkey is that it is very easy to mis-press the vowel extension "ー" key instead of "a", and SwiftKey's programming isn't intelligent enough to reinterperet the extension as an "a" depending upon the rest of the word. Then of course, Swype has an excellent integrated handwriting recognition system, which might be worth it for those who need to input characters they don't know the pronounciation for (I imagine, however, that this is mostly going to be in the context of looking words up in a dictionary, for which aedict offers a fairly good method that isn't keyboard-dependent. Plus, free handwriting alternatives now exist).

The bottom line, however, is that SwiftKey is faster and more convenient when switching languages, and for me, these are the deciding factors.

*As I've mentioned before, despite being able to type English using "Google Japanese Input", the prediction is awful, and so I rely on changing input methods.

Sunday, January 10, 2016

The Tokyo Train Tech-crusher, and lightening the load for presentations with the Amazon Fire TV Stick

Sometimes I have to make presentations. Back in the UK, this was never a huge problem; even on those occasions when I had to take the train, the trains were always roomy enough that I could find a safe spot for my bag.

Having started work in Tokyo, the main problem I have with giving a presentation is the crush of rush hour. Usually, its at least tolerable; however, on occasion, often due to a delay of some sort*, people will cram themselves into the train until the passengers become compacted into a solid wall, making it impossible to add further bodies. Personal space is limited to whatever clothes separate you from your neighbour... Then again, the jostling, elbows and corners of bags poking into me almost makes it feel as though my personal space is limited to my head, which tends to rise at least a little way into the little breathing space that is left at the top of the carriage**.

The first few times I was caught in this situation, I found my bag pulled off my shoulder as people flowed around me from the door like sand filling every gap at the bottom of an hourglass. Another time, the zip of my bag got itself caught on the belt straps of some poor salaryman's trousers. Some simple solutions to this is to have a backpack (usually worn at the front, presumably to keep the nearest person in front at least a bag's width out of one's face), or to press your shoulder-bag hard into your front. There are luggage racks, but count yourself lucky if the Brownian motion of people into the carriage happens to afford you a space near one (and lucky again if you find a space to put your arms once you've finished stowing your bag).

If you have to take something fragile with you, you certainly have a few options, of course. Firstly, you can try leaving earlier, and simply wait for a carriage that doesn't happen to be packed. This is particularly good if you don't need to be somewhere during the rush hour; jams during the day generally are due to accidents etc., and tend to clear up before too long. If that isn't an option, you might reserve a seat (if there are green cars on the train). Otherwise, you could just bring a reinforced case for that laptop.

The latter option strikes me as the one that offers the greatest flexibility and convenience; however, laptops are heavy enough, without buying bulky casing, and the increased size of the baggage is also bound to be another headache. So, instead of thinking bigger, stronger, better, I decided to go the opposite direction.

The Amazon Fire TV Stick is essentially an Android computer that plugs into an HDMI port. I was at first put off by its name, which sounded less functional to me than the "Chromecast" by Google; however, the Fire Stick has one very potent advantage for what I had in mind: onboard apps. While chromecast would probably be my main choice if I intended to stream media from one of my smaller devices to a bigger screen, I don't own (or desire) a TV***, and given my experience with wifi connections, I suspect that if the system functions better in isolation, it will be more practical for applications on-the-go.

Of course, my second-hand monitor has no HDMI port, so I had to buy an HDMI-VGA adapter to actually ensure the presentation setup works beforehand (the adapter works surprisingly well, and has audio output too, just in case I want to use the Stick for recreation). On the bright side, this will come in handy if I happen to present somewhere without HDMI.

The next obstacle to abusing the device into doing work, rather than play, was the lack of any decent office software on the Fire Stick's app store. Luckily, there is plenty of information on how to install standard Android software, WPS office being my suite of choice.

Excellent. And WPS office plugs straight into Dropbox, letting me pull down presentations in no time. The problem, however, is that WPS office requires a touch screen or mouse. I managed to get as far as linking WPS with dropbox, downloading, and opening a presentation file, but the Fire Stick's remote just wouldn't let me select the "play" button. There are a number of mobile-to-TV apps that I could have used to solve this problem; however, I wanted to be sure that the device will function even if my phone batteries die and the wifi has exploded. This is where Mouse Toggle for Fire TV comes in. It lets you double press the play button on the remote to summon a cursor that can be controlled by the up/down/left/right keys on the remote. Not exactly elegant, but better than buying a bluetooth mouse (after all, I won't actually be producing any content on the Fire Stick*4), and the remote will double as a slide-changer which I can use without being tied to a laptop.

So, I found myself in a position where I can actually give a presentation. Lovely. Especially considering the entire kit could fit inside my pocket. The only problem is that the Fire Stick wont show non-native apps in its main menu. Every time you want to open the app you have to go to Settings>Applications>Manage Applications>[Application name]>Launch. Ye gads. The Fire Stick isn't the sprightliest of devices, and add in that you might need to enter a pin to use the Manage Applications menu (depending on your security settings), this takes too much time; what if I need to switch applications, perhaps to open a paper I reference in the presentation, in response to a comment?

Thankfully, there is a friendly group of arsonists programmers that have developed "Firestarter", which is basically an app tray that loads automatically, leaving the original system intact, but doing away with its annoyances. Now, I can switch between apps at a reasonable pace, and set up in a much more reasonable order of time (you can download it here).

Of course, I can control the device using my mobile, if needs be, and it also supports miracasting; however, in my opinion its ability to run as a standalone device is its greatest strength. Even if it needs a little persuading.

On the day of the presentation, I was happy to have a lighter load on the 1-hour, standing train journey, and not have to worry about the device imploding (the box it comes in is fairly sturdy). Moreover, set-up was simple using the seminar room's HDMI input, and the device was responsive enough for a smooth presentation.


*Japanese trains are generally pretty punctual, but I think the massive throughput of the Tokyo railway system means even a small delay can cause a pretty jam. Longer delays are nightmarish.

**I regularly complain about how annoying it is being tall, and its rare I get through a day in the city without knocking my head on a hand-strap; however, when the big squeeze occurs, I'm only too happy to have my head as far away from the seething mass of shoulders and elbows below. I can only imagine what that must be like for a shorter person...

*** Yeah, Amazon Fire TV Stick... Ironic, I know. I should also point out that I don't think the Chromecast is bad; for a home set-up or anywhere you have good control over possible show-stopping factors, the Chromecast would be an excellent (and marginally more economical) choice.

*4 That's what proper computers are for... Though I find it ironic that I have a beast of a machine in the laboratory, and giving a presentation just a few feet away requires a far less functional device.