<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>wuetender-junger-mann.de</title>
	<atom:link href="http://wuetender-junger-mann.de/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://wuetender-junger-mann.de/wordpress</link>
	<description>Der Freiheit eine Gasse</description>
	<lastBuildDate>Tue, 07 Sep 2010 05:58:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Contemporary LaTeX Resource</title>
		<link>http://wuetender-junger-mann.de/wordpress/2010/08/contemporary-latex-resource/</link>
		<comments>http://wuetender-junger-mann.de/wordpress/2010/08/contemporary-latex-resource/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 13:03:18 +0000</pubDate>
		<dc:creator>felix</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://wuetender-junger-mann.de/wordpress/?p=1021</guid>
		<description><![CDATA[I am currently using LaTeX to produce PDF output for a multilingual (polish characters anyone) business application. I hope to write a proper post about this once I am done. But I have to post the url of this blog which deals with doing nice contemporary typesetting with LaTeX.]]></description>
			<content:encoded><![CDATA[<p>I am currently using LaTeX to produce PDF output for a multilingual (polish characters anyone) business application. I hope to write a proper post about this once I am done. But I have to post the url of this <a href="http://www.cv-templates.info/">blog</a> which deals with doing nice contemporary typesetting with LaTeX.</p>
]]></content:encoded>
			<wfw:commentRss>http://wuetender-junger-mann.de/wordpress/2010/08/contemporary-latex-resource/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Gospel</title>
		<link>http://wuetender-junger-mann.de/wordpress/2010/08/the-gospel/</link>
		<comments>http://wuetender-junger-mann.de/wordpress/2010/08/the-gospel/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 20:06:16 +0000</pubDate>
		<dc:creator>felix</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://wuetender-junger-mann.de/wordpress/?p=1017</guid>
		<description><![CDATA[Today&#8217;s lesson is from the book of stackoverflow 65,35-21: It&#8217;s a well known fact, that Oracle treats empty strings as null. I knew about that, but somehow I forgot&#8230;]]></description>
			<content:encoded><![CDATA[<p>
Today&#8217;s lesson is from the book of <a href="http://stackoverflow.com/questions/653521/oracle-converts-empty-string-to-null-but-jpa-doesnt-update-entity-cache-correspo">stackoverflow 65,35-21</a>:
</p>
<blockquote><p>It&#8217;s a well known fact, that Oracle treats empty strings as null.</p></blockquote>
<p>
I knew about that, but somehow I forgot&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://wuetender-junger-mann.de/wordpress/2010/08/the-gospel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Train Build Monitor</title>
		<link>http://wuetender-junger-mann.de/wordpress/2010/08/the-train-build-monitor/</link>
		<comments>http://wuetender-junger-mann.de/wordpress/2010/08/the-train-build-monitor/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 12:52:13 +0000</pubDate>
		<dc:creator>felix</dc:creator>
				<category><![CDATA[Mechanik]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://wuetender-junger-mann.de/wordpress/?p=1003</guid>
		<description><![CDATA[On our current project we came up with a model train build monitor. The objective was to have the train move, while the build is green and to stop, when it goes red. The whole thing looks some what like this: As a USB interface we chose to go for the Velleman K8055, which is [...]]]></description>
			<content:encoded><![CDATA[<p>On our current project <a href="http://clipboarded.blogspot.com/">we</a> came up with a model train build monitor. The objective was to have the train move, while the build is green and to stop, when it goes red. The whole thing looks some what like this:</p>
<p>
<a href="http://wuetender-junger-mann.de/wordpress/wp-content/uploads/2010/08/train.jpg"><img src="http://wuetender-junger-mann.de/wordpress/wp-content/uploads/2010/08/train.jpg" alt="" title="Build Monitor" width="770" height="451" class="aligncenter size-full wp-image-1005" /></a>
</p>
<p>
As a USB interface we chose to go for the  <a href="http://www.velleman.eu/distributor/products/view/?country=be&#038;lang=en&#038;id=351346">Velleman K8055</a>, which is available for about forty pounds and provides eight digital and two analogue outputs as well as two analogue and five digital inputs. The analogue outputs are provided as <a href="http://en.wikipedia.org/wiki/Pulse-width_modulation">pwm</a> signal.<br />
The outputs are all open-collectors. Being a good developer I did of course anticipate a few more use-cases and hence designed the controller, so we could actually control the speed as well as the direction in which the train in moving. Essentially it uses a transistor to switch the train (using the pwm) and a relay to reverse the direction (yes this is somewhat lame). Also there is two free-wheeling diodes to protect the electronics from the high inductivity of the relay and the trains motor. This is the circuit diagram of the controller that goes between the K8055 and the train:
</p>
<p><a href="http://wuetender-junger-mann.de/wordpress/wp-content/uploads/2010/08/circuit-diagram.jpg"><img src="http://wuetender-junger-mann.de/wordpress/wp-content/uploads/2010/08/circuit-diagram.jpg" alt="" title="circuit diagram" width="818" height="531" class="aligncenter size-full wp-image-1004" /></a></p>
<p>
The K0855-board ships with a DLL to control the IO. Apparently there is a linux driver, which is much better than the windows version, but we are in a bit of a windows shop, so we went with the DLL. It turned out wrapping a DLL in a ruby script is fairly trivial:
</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'Win32API'</span>
&nbsp;
<span style="color:#CC0066; font-weight:bold;">open</span> = Win32API.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;K8055D&quot;</span>, <span style="color:#996600;">&quot;OpenDevice&quot;</span>, <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'L'</span><span style="color:#006600; font-weight:bold;">&#93;</span> , <span style="color:#996600;">'L'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
outputAnalog = Win32API.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;K8055D&quot;</span>, <span style="color:#996600;">&quot;OutputAnalogChannel&quot;</span>, <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'L'</span>,<span style="color:#996600;">'L'</span><span style="color:#006600; font-weight:bold;">&#93;</span>,<span style="color:#996600;">'V'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
outputDigital = Win32API.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;K8055D&quot;</span>, <span style="color:#996600;">&quot;WriteAllDigital&quot;</span>, <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'L'</span><span style="color:#006600; font-weight:bold;">&#93;</span>,<span style="color:#996600;">'V'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
inputDigital = Win32API.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;K8055D&quot;</span>, <span style="color:#996600;">&quot;ReadAllDigital&quot;</span>, <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>,<span style="color:#996600;">'L'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
<span style="color:#CC0066; font-weight:bold;">open</span>.<span style="color:#9900CC;">Call</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
outputAnalog.<span style="color:#9900CC;">Call</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">1</span>, <span style="color:#006666;">10</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#008000; font-style:italic;"># setting DA channel 1 to 10</span>
outputDigital.<span style="color:#9900CC;">Call</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">128</span><span style="color:#006600; font-weight:bold;">&#41;</span>    <span style="color:#008000; font-style:italic;"># reversing</span></pre></div></div>

<p>Future plans include figuring out where the train currently is to stop in the station. The original plan was to use a reed switch, but that proved to be a bit unreliable, so the current thinking involves using a camera and something like <a href="http://www.wedesoft.demon.co.uk/hornetseye-api/files/HornetsEye-txt.html">hornetseye</a> to get the exact position of the train.</p>
]]></content:encoded>
			<wfw:commentRss>http://wuetender-junger-mann.de/wordpress/2010/08/the-train-build-monitor/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
