Wednesday, December 28, 2011

5 Minutes of Introspection

I recently discovered a website called Penny Arcade. In an episode of their weekly video series "Extra Credits" James Portnow, Daniel Floyd and Allison Theus share a list of "Games you might not have tried or even heard of but definitely should".

I tried some of the Flash based (or downloadable) games and I liked all of them. They can all be a bit depressing but offer a fair amount of introspection if you have the right mindset.



To sum it up, you will probably invest not even half an hour to play all 4 games through and still I feel changed afterwards. Give it a try!


Tuesday, December 20, 2011

Modding: Sony Ericsson Headset for Samsung Galaxy S 2 / iPhone

A couple of years ago Sony Ericsson had the genius idea to create a mobile headset where customers can plug in their own pair of headphones. No other company (that I owned a mobile of) ever picked up this idea and copied the concept, which is bad. Even worse is the fact that Sony Ericsson uses a proprietary plug to connect headset to mobile which makes it useless for other brands.

I recently returned the company iPhone and got myself a new Samsung Galaxy S 2 smart phone. Well, and since there was no need to use iTunes any more to perform a simple "somehow get some of your music to your smart phone - if you are lucky"- task, listening to music from smart phone was an option again.

To be honest: The headset shipped with the Galaxy is really good but I still do not feel very comfortable with these ear plugs since they all more or less live up to their names and PLUG my EAR. Don't get me wrong, I can imagine uncountable situations (are you married, do you have kids? :P ) where that's exactly what you want but I don't.

To make a short story not longer than it is: Once upon a time I decided to mod my old Sony Ericsson headset to plug it into any phone using a standard 3,5mm 4-pin headphone plug... (I enhanced some of the photos but was too lazy editing out all the shadows and artifacts. But I guess it's good enough to see what's happening)

So, first step was easy: Cut the Sony Ericsson plug from the headset.
Proprietary Sony Ericsson headset plug
Second step was not soooo easy: Figuring out the wiring of both the old and the new headset. After doing some research on the web I found some hints how the Sony Ericsson plug is wired, what wire colors have what function and how the schematics could look like.

I also found some info how this should look like on the Galaxy S 2 and (because I have not returned it yet) on my IPhone 3 GS. It is the same schematics on both. This makes sense because both phones have same 3,5mm, 4-pin headphone plugs/sockets and somebody could have the idea to interchange both headsets (I did, and it workes).

Sony Ericsson headset and wiring:
Copper : Earphone ground (-ve)
Blue: Earphone right side (+ve)
Green : Earphone left side (+ve)
Black : Microphone ground (-ve)
White : Microphone (+ve)
Since I prefer to have proof that my information is right (and I needed it anyway for this project) I bought a 3,5mm, 4-pin headphone plug and started to verify my theories. Finding ground and left/right earphone was easily done by playing some music and connecting the wires using banana clips.
3,5mm, 4-pin headphone plug
Tip: Earphone left side (+ve)
First Ring: Earphone right side (+ve)
Second Ring: Ground (-ve)
Sleeve: Microphone (+ve)

Then I plugged some headphones into the Sony Ericsson headset and used my multimeter to read out resistor values for earphones and microphone both for open and closed talk switch (the button used to accept an incoming call or to trigger voice dial). Same with the original Galaxy headset. This is where I found some differences:

Sony Ericsson:
Resistance of microphone: ~777 Ohm - When talk button pressed: 1,6 Ohm
Voltage over microphone (using diode test on my multimeter): 1660mV in one direction 568mV in the other direction. 85mV in both directions when talk button pressed.

Galaxy:
Resistance of microphone: ~1,45k Ohm - When talk button pressed: 96 Ohm
Voltage over microphone: 1875mV in one direction 629mV in the other direction. 81mV in both directions when talk button pressed.

There are three lessons I learned from these results (and some trial and error):
  1. Use a 100 Ohm resistor to correct the resistance when talk button is pressed to avoid (too) high currents
  2. Pay attention to polarity when connecting microphone ground and earphone ground (which must be done to connect 5 wires of Sony Ericsson headset to 4-pin plug)
  3. Don't care about the difference in resistance of the microphones

The IPhone 3 did not mind when I first got the polarity of microphone/earphone ground wrong (I by mistake connected microphone +ve to earphone ground and microphone ground to microphone +ve but on the Galaxy receiving the call by pushing the talk button and talking though the microphone did not work. Switching the two cables did the trick on both phones.


Galaxy headset resistors with open (above) and closed (below) talk switch.



4-pin plug with soldered wires and 100 Ohm resistor

Put everything together, a knot in the cable works as a pull relief

The whole picture: Sony Ericsson headset/microphone, custom 4-pin plug and earphones of MY choice ;-)
Please leave me a comment if you like this or built something similar to this.

Have fun and let the music take control! ;-)


Thursday, December 15, 2011

Apple vs Google

Due to my job change (I only had a company phone) I got myself a brand new mobile contract including a Samsung Galaxy S II.

So I was facing the challenge to migrate my data from company IPhone to private Android phone with no knowledge about how to do that - at all.

But thanks to Chris Moor at Talk Android and a nice app called iSMS2droid my contacts and sms got migrated in minutes. Adding music and pictures to an Android is simple as can be, the memory system is open an can be accessed like a USB-Stick. Even moved photos made on IPhone to the Galaxy photo gallery.

On the other hand, I still have some mp3's and pictures left on the IPhone that I don't even know how to delete. Me and ITunes will never become friends, even loose aquaintance is a PITA.

Open systems are not easier to learn but are quite more fun to get used to.

Wednesday, November 2, 2011

XOut Clone - Shop System

I am working on a clone of the pretty old (1990) amiga game "X-Out" for quite some time now. It intended to be an exercise to get comfortable with XNA Framework.

The most current features I am working on is "some kind of laser beam system" (I should trademark that) and a shop system. Here is a first "design":
A basic "design" how the shop should look like
The basic idea is to use the normal in-game ship movement/rendering to perform the shop tasks (buy/sell items). This is be done by adding items (buttons) that can shot at with the ship's cannon. Player can navigate up/down through items owned to sell them and items offered by the shop to buy them.

To the bottom of the screen "some kind of laser beam system" shields a testing area from the rest where the user can "test use" the recently purchased items.

In-game graphics of the shop
Yes, I know, the colors are pretty nasty. But for testing I need clearly distinguishable colors to place buttons and other visual elements correctly.

So far, navigation through items is working, buy/sell is still a to-do. But the laser already works (but is not yet included in collision detection tests). Also, I'm in need of some ideas for some more extras (especially for the visual design part of it) and how to integrate them in the game configuration files - up to now, pretty much everything (levels, ship design, weapons, enemies,...) is configurable in various XML files.

Tuesday, October 25, 2011

Koch Snowflake - Reloaded

As stated in my last post I played around a bit with Koch Snowflakes and a variation of it.

After figuring out a way to calculate the triangle-count of the next iteration based on the current count it was possible to prevent program crashes due to vertex-/index-buffer overflows.

Another thing made possible is to "merge" the two generation algorithms, i.e. use one method for iteration x and the other for iteration x+1.

The "classic" Koch snowflake algorithm should look something like this:

  1. Start with a triangle (or a tetrahedron made of 4 triangles) and divide every edge in half.
  2. The 3 new points form 4 smaller triangles with half the size.
  3. The triangle in the middle is the base of a new tetrahedron.
  4. Do steps 1 and 3 for every triangle until desired complexity is reached (which is pretty fast).

"Classic" Koch Snowflake subdivision

The variation I (and some others on the web) used nearly does the same, except the smaller tetrahedron is turned that the edges of the smaller base triangle are parallel with the bigger one:


Now I can combine the two different methods to create interesting new patterns. For example:

  1. Start with the initial tetrahedron, then use classic algorithm (C)
  2. Then use variation (V)
  3. Repeat alternations to create the pattern CVCVC
The pattern CVCVC
And some more...
The pattern VCVCV
The pattern CCVVC
The pattern VVCCV
Many more patterns are possible, I was too lazy generating them all. Maybe on personal request...?

Thursday, October 20, 2011

Winter? - Snowflakes!

As the weather suggests it's pretty much winter here. And what's winter without snow?

So I decided yesterday that it would be fun to bring the Koch Snowflake into the third dimension using the XNA Framework and some libraries I'm working on.

Since the result was a bit too regular (see the images on Wikipedia) and I found a nice video on YouTube with something similar but better looking, I changed my code a bit. And voila: Here it is! My version (of many) 3d Koch Snowflakes...

Be prepared, there is (maybe) more to come...

Initial state
After one iteration
After six iterations
If you are interested in the code, feel free to email me at: f(dot)heinz(at)gmx(dot)net

EDIT:
As my girlfriend stated correctly yesterday, this does not look like like a snowflake since I started from a single triangle. So I changed it to a four faced pyramid. This is the result:
After six iterations

Thursday, October 6, 2011

Better living with(out) solid state drives

Well there is this "new" technology. Solid state disks. Pretty much the same as those neat little usb-sticks dangling off your keychain for some years now.

Anyways, they're faster than conventional hard drives, in the same proportion they're more expensive.

So there is this new solid state drive that costs about 10 times as much as an old hard disk which makes it at reasonable prices chronically too small for almost any application.

And then there is this reliability thing: It breaks!
I thought one of the key features of solid state is, that there are no moving parts involved and therefore nothing can happen to your data. In theory. And then there is reality where lots of people in various forums and blogs tell their story about lost data. One guy lost his data ~4 months after purchase, got it replaced and the replaced drive broke again after about half a year.

In conclusion solid state drives are fast.

Use solid state drives if you want to...
...run out of disk space. Fast.
...loose money. Fast.
...loose data. Fast.