<?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>Gotbadger &#187; Open Source</title>
	<atom:link href="http://www.gotbadger.org.uk/category/open-source/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gotbadger.org.uk</link>
	<description>The adventures of Philip Hayton</description>
	<lastBuildDate>Sat, 31 Jul 2010 14:22:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Arduino controlled EPSON TM-T88P Printer Part1</title>
		<link>http://www.gotbadger.org.uk/2010/06/20/arduino-controlled-epson-tm-t88p-printer-part1/</link>
		<comments>http://www.gotbadger.org.uk/2010/06/20/arduino-controlled-epson-tm-t88p-printer-part1/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 16:27:10 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programing]]></category>

		<guid isPermaLink="false">http://www.gotbadger.org.uk/?p=160</guid>
		<description><![CDATA[The EPSON TM-T88P is a parallel controled printer. It came to be in my possession after going along to a kind of computer jumble sale 5quid got me this: Centronics Handsake It turns out there are a number of ways to communicate with printers and the Epson supports a number of these methods. I decided [...]]]></description>
			<content:encoded><![CDATA[<p>The EPSON TM-T88P is a parallel controled printer. It came to be in my possession after going along to a kind of computer jumble sale 5quid got me this:</p>
<div class="wp-caption aligncenter" style="width: 160px"><a href="http://twitpic.com/19sj14"><img title="Epson printer at #bcne3" src="http://twitpic.com/show/thumb/19sj14.jpg" alt="" width="150" height="150" /></a><p class="wp-caption-text">Epson printer at #bcne3</p></div>
<h2>Centronics Handsake</h2>
<p>It turns out there are a number of ways to communicate with printers and the Epson supports a number of these methods. I decided to go with the Centronics standard AKA Compatibility Mode since its about as basic as you can get. Heres a diagram from the excellent <a href="http://www.beyondlogic.org">http://www.beyondlogic.org</a></p>
<div id="attachment_167" class="wp-caption aligncenter" style="width: 387px"><a href="http://www.beyondlogic.org/spp/parallel.htm#3"><img class="size-full wp-image-167" title="Centronics Handshake" src="http://www.gotbadger.org.uk/wp-content/uploads/2010/06/parallelport_img_0.jpg" alt="" width="377" height="253" /></a><p class="wp-caption-text">Centronics Handshake Diagram from beyondlogic.org</p></div>
<p>Think of the handshake as; you wait for the printer to be free (busy low) enter the number you want to send (set the 8 bits of your byte on the data lines) then pull the send lever old cash register style  (strobe low wait stobe high). Its not a partuclay dificult concept but I found the diagram hard to understand becuase for some reason I thought it had to be more complicated than it actualy was.</p>
<h2>Wiring Up</h2>
<p>Nothing too complex here the table below show the Socket to Arduino linkup:</p>
<table>
<tbody>
<tr>
<th colspan="2">Socket</th>
<th colspan="2">Arduino</th>
</tr>
<tr>
<th>Pin</th>
<th>Name</th>
<th>Pin</th>
<th>pinMode</th>
</tr>
<tr>
<td>1</td>
<td>Strobe</td>
<td>13</td>
<td>OUTPUT</td>
</tr>
<tr>
<td>2</td>
<td>D0</td>
<td>2</td>
<td>OUTPUT</td>
</tr>
<tr>
<td>3</td>
<td>D1</td>
<td>3</td>
<td>OUTPUT</td>
</tr>
<tr>
<td>4</td>
<td>D2</td>
<td>4</td>
<td>OUTPUT</td>
</tr>
<tr>
<td>5</td>
<td>D3</td>
<td>5</td>
<td>OUTPUT</td>
</tr>
<tr>
<td>6</td>
<td>D4</td>
<td>6</td>
<td>OUTPUT</td>
</tr>
<tr>
<td>7</td>
<td>D5</td>
<td>7</td>
<td>OUTPUT</td>
</tr>
<tr>
<td>8</td>
<td>D6</td>
<td>8</td>
<td>OUTPUT</td>
</tr>
<tr>
<td>9</td>
<td>D7</td>
<td>9</td>
<td>OUTPUT</td>
</tr>
<tr>
<td>10</td>
<td>ACK</td>
<td>10</td>
<td>INPUT</td>
</tr>
<tr>
<td>11</td>
<td>BUSY</td>
<td>11</td>
<td>INPUT</td>
</tr>
<tr>
<td>25</td>
<td>GND</td>
<td>GND</td>
<td>n/a</td>
</tr>
</tbody>
</table>
<p>You only need to wire up one of the ground lines since they will all be connected to ground in the printer anyway (lazy method) <img src='http://www.gotbadger.org.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>Programming</h2>
<p>Its worth pointing out at this stage that you might want to make up some kind of parallel port debuger so you can get an idea of whats actualy happening at a low level and that your program is producing the expected output.</p>
<p>First lets setup the pins as in the table above we will also setup a serial connection so we can do debugging.</p>
<pre class="brush: c;">int strobe = 12;
int busy = 11;
int ack = 10;

void setup()   {
  pinMode(strobe, OUTPUT);
  //setup stobe high
  digitalWrite(strobe, HIGH);
  //setup handshake listeners
  pinMode(busy, INPUT);
  pinMode(ack, INPUT);
  for(int i=2;i&lt;10;i++){
     pinMode(i, OUTPUT);
     //setup inital condition
     digitalWrite(i, LOW);
  }
  Serial.begin(115200);
  Serial.println("READY:");
}
</pre>
<p>To start with we can actual simplify the handsake further by ignoring the ACK since BUSY should always go low when we are OK to send more data. With this in mind we end up with 3 main steps:</p>
<ol>
<li>Wait for not busy</li>
<li>Set Data</li>
<li>Strobe</li>
</ol>
<p>For the wait not busy function i decided to go with a simple poll, every 100 iterations it prints a &#8216;.&#8217; so we can see in the terminal if its got stuck.</p>
<pre class="brush: c;">void pollWait(int port){
  int i = 0;
  while(digitalRead(port) == 1){
    i++;
    if(i&gt;100){
      i=0;
     Serial.print(".");
    }
  }
}
</pre>
<p>Strobe function is nice and simple. Suposidly you can have any value greater than 0.5 microseconds for the strobe and it will work. To keep it simple i just went with 1ms.</p>
<pre class="brush: c;">void doStrobe(){
    digitalWrite(strobe, LOW);
    delay(1);
    digitalWrite(strobe, HIGH);
}
</pre>
<p>Setting the datalines we use i+2 as the first bit is written to pin 2 etc.</p>
<pre class="brush: c;">void setLines(byte out){
  //loop over data lines
  for(int i=0;i&lt;8;i++){
    //check and set
   if(bitRead(out, i) == 1){
     //write to pint we start at 2 so +2
     digitalWrite(i+2, HIGH);
   }else{
     //bit is 0 so set low
     digitalWrite(i+2, LOW);
   }

  }
}</pre>
<p>Now we use all these functions to send a byte to the printer</p>
<pre class="brush: c;">void dataHandShake(byte a){
    pollWait(busy);
    setLines(a);
    doStrobe();
}
</pre>
<p>Finaly we can make a small program to print somthing. Its worth making sure things only happen once&#8230; you dont want your printer spewing paper while you try and turn it off!</p>
<p>Add the following global:</p>
<pre class="brush: c;">    boolean go = true;
</pre>
<p>Then quick and dirty hello world:</p>
<pre class="brush: c;">void loop()
{
 //so we dont end up with a constant stream
 if(go){
     dataHandShake('H');
     dataHandShake('e');
     dataHandShake('l');
     dataHandShake('l');
     dataHandShake('o');
     dataHandShake(' ');
     dataHandShake('W');
     dataHandShake('o');
     dataHandShake('r');
     dataHandShake('l');
     dataHandShake('d');
     //send Line feed so it prints the line
     dataHandShake(0x0A);
     go = false;
     Serial.println("DONE");
   }
}
</pre>
<p>We now end up with somthing that looks like this:<br />
<div id="attachment_197" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.gotbadger.org.uk/wp-content/uploads/2010/06/2010-06-20-16.53.29.jpg"><img src="http://www.gotbadger.org.uk/wp-content/uploads/2010/06/2010-06-20-16.53.29-300x225.jpg" alt="" title="Physical Output" width="300" height="225" class="size-medium wp-image-197" /></a><p class="wp-caption-text">Hello World!</p></div></p>
<p>Thats all for now in a future post (hopefully!) I will be looking at more advanced printing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gotbadger.org.uk/2010/06/20/arduino-controlled-epson-tm-t88p-printer-part1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flicked; Flicker Plugin For Media Portal</title>
		<link>http://www.gotbadger.org.uk/2009/02/11/flicked-flicker-plugin-for-media-portal/</link>
		<comments>http://www.gotbadger.org.uk/2009/02/11/flicked-flicker-plugin-for-media-portal/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 13:17:14 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[Media Portal]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programing]]></category>

		<guid isPermaLink="false">http://gotbadger.co.uk/?p=48</guid>
		<description><![CDATA[Meant to post infos about this a few weeks ago.  Its a plugin for media portal that lets you view all your photos, groups and contacts just as you would on your flicker homepage. This plugin also uses the flickr api so any photos you have marked private etc will be viewable though this plugin. [...]]]></description>
			<content:encoded><![CDATA[<p>Meant to post infos about this a few weeks ago.  Its a plugin for media portal that lets you view all your photos, groups and contacts just as you would on your flicker homepage. This plugin also uses the flickr api so any photos you have marked private etc will be viewable though this plugin.</p>
<p>The plugin reached its first milestone and has been released here;<a href="http://forum.team-mediaportal.com/plugins-47/flicked-flickr-plugin-mediaportal-53103/"> http://forum.team-mediaportal.com/plugins-47/flicked-flickr-plugin-mediaportal-53103/</a></p>
<p>Currently im awaiting the release of media portal 1.0.1 before moving on with development due to the plugin/skin revamp.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gotbadger.org.uk/2009/02/11/flicked-flicker-plugin-for-media-portal/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Media Portal RC4 Soft Subs and EPG Woes</title>
		<link>http://www.gotbadger.org.uk/2008/12/17/media-portal-rc4-soft-subs-and-epg-woes/</link>
		<comments>http://www.gotbadger.org.uk/2008/12/17/media-portal-rc4-soft-subs-and-epg-woes/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 20:43:10 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[Media Portal]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Site]]></category>

		<guid isPermaLink="false">http://gotbadger.co.uk/?p=42</guid>
		<description><![CDATA[Ive recently setup a nice media pc PVR type thing. It took some digging but eventualy I decided to settle on the sublime media portal its a great program, open source with good comunity and half decent documentation. I had a couple problems that I thought I should post a solution to Soft subs I [...]]]></description>
			<content:encoded><![CDATA[<p>Ive recently setup a nice media pc PVR type thing. It took some digging but eventualy I decided to settle on the sublime <a href="http://www.team-mediaportal.com/">media portal</a> its a great program, open source with good comunity and half decent documentation. I had a couple problems that I thought I should post a solution to <img src='http://www.gotbadger.org.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>Soft subs</h2>
<p>I watch a bit of anime now and again a needed to use softsubs however media portal dosent really support this out of box. Bit of searching I came across <a href="http://forums.animesuki.com/showthread.php?t=55053">this thread</a> even though its for an older version the solution still works.<a href="http://forums.animesuki.com/showthread.php?t=55053"></a></p>
<h2>DVB-T EPG</h2>
<p>This really annoyed me because I was stuck for so long and the solution was so simple! I was getting absolutly no information in my program guide  everything appeared to be setup to get the guide from DVB-T, the answer was to simply disable any encypted channels in the channel list in the TV (<a href="http://www.team-mediaportal.com/manual/TV-Server/Configuration/TVChannels">wiki link</a>).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gotbadger.org.uk/2008/12/17/media-portal-rc4-soft-subs-and-epg-woes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gentoo linux and fluxbox</title>
		<link>http://www.gotbadger.org.uk/2007/10/19/gentoo-linux-and-fluxbox/</link>
		<comments>http://www.gotbadger.org.uk/2007/10/19/gentoo-linux-and-fluxbox/#comments</comments>
		<pubDate>Fri, 19 Oct 2007 21:31:36 +0000</pubDate>
		<dc:creator>Phil</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[fluxbox]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://gotbadger.co.uk/2007/10/19/gentoo-linux-and-fluxbox/</guid>
		<description><![CDATA[By nature i like to try stuff out and have a bit of a tinker so with an old dell inspiron 4150 we had in the house I decided to spend a day messing about with linux. Now as you may know laptops are usually what some people might call &#8220;a bit of a bastard&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>By nature i like to try stuff out and have a bit of a tinker so with an old dell inspiron 4150 we had in the house I decided to spend a day messing about with linux.</p>
<p>Now as you may know laptops are usually what some people might call &#8220;a bit of a bastard&#8221; when it comes to installing anything other than windows. Now I haven&#8217;t seriously used a Linux distro in about 3 years so I decided to check out one that I had heard a lot about recently; Ubuntu as it turned out this was a bit of a mistake the inital startup gladly informed me it was having trouble reading my floppy drive before dying horribly, not surprising really considering I don&#8217;t have one. Googling around for a bit revealed this was a known issue with my laptop the other being having the parallel port enabled in BIOS broke the sound card (WTF) with a lot of people not making much progress I decided to turn back to a distro I was familiar with <a href="http://www.gentoo.org" title="gentoo linux">Gentoo</a>.</p>
<p>Gentoo&#8217;s inital kernel fired up ok and then came the fun bit; the install. Now Gentoo basically likes to compile everything and give you a load of options about how you set your system up, this is great if you have an old system and you want to install the minimum of stuff so it runs as fast as possible. The downside is it takes <a href="http://www.gentoo.org/doc/en/handbook/handbook-x86.xml" title="handbook">forever</a>. Its not for the weak of heart but by the end you feel like you have achieved something and quite possibly learned something too. The main install guide ends with getting your system configured to your preference and fully bootable what it doesn&#8217;t do is tell you how to setup X, I really like this because as window managers go i love the little known <a href="http://fluxbox.sourceforge.net/" title="fluxbox rocks">fluxbox</a>. Fluxbox is quite simple, lightweight and looks good too, its a brilliant window manager I used extensively during my uni days for development. Luckily someone that uses it likes it as much as i do and created a <a href="http://www.gentoo.org/doc/en/fluxbox-config.xml" title="fluxbox guide">helpful guide</a> for Gentoo users. Flux is .</p>
<p>Now theres quite a difference between setting up for fun and actually using it full time. Yesterday my main  PC died the culprit; broken memory, result? one scrambled windows PC. With the postman a few days away I&#8217;m back on the laptop so I decide my desktop needs prittying up a bit this is where i hit a problem:</p>
<p><code><br />
fbsetbg -f mybackground.jpg</code></p>
<p>produced something along the lines of:</p>
<p><code><br />
Esetroot: unable to load image file</code></p>
<p>Helpful it wasn&#8217;t I found out that another program called feh could also be used to a background trying to find out if it was a general problem setting background feh firmly pointed the finger at imlib2. Emerging this imlib2 didn&#8217;t have any effect until I realised why apparently you need to do this:</p>
<p><code><br />
USE="jpeg gif" emerge imlib2 --newuse</code></p>
<p>Now for people that don&#8217;t know how emerge works what its basiclay saying is install imlib2 with support for jpeg and gif files, now why it doesn&#8217;t do this as a matter of course ill never know and generally such questions are best left unanswered when it comes to Linux as usually there long and boring. In the end things turned out fairly nice:</p>
<p align="center"><a class="thickbox" href="http://gotbadger.co.uk/wp-content/uploads/2007/10/myfluxdesktop.jpg" title="fluxbox desktop"><img src="http://gotbadger.co.uk/wp-content/uploads/2007/10/myfluxdesktop.thumbnail.jpg" alt="fluxbox desktop" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gotbadger.org.uk/2007/10/19/gentoo-linux-and-fluxbox/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
