<?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>AlferSoft Blog &#187; serial</title>
	<atom:link href="http://www.alfersoft.com.ar/blog/tag/serial/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alfersoft.com.ar/blog</link>
	<description>Explaining this blog in a few words since 1999</description>
	<lastBuildDate>Wed, 01 Feb 2012 22:36:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Make something useful out of your DPF (Digital Photo Frame)</title>
		<link>http://www.alfersoft.com.ar/blog/2011/04/04/make-something-useful-out-of-your-dpf-digital-photo-frame/</link>
		<comments>http://www.alfersoft.com.ar/blog/2011/04/04/make-something-useful-out-of-your-dpf-digital-photo-frame/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 16:52:05 +0000</pubDate>
		<dc:creator>fvicente</dc:creator>
				<category><![CDATA[Electronic Projects]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[circuit]]></category>
		<category><![CDATA[digital]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[dpf]]></category>
		<category><![CDATA[frame]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[parallel]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[serial]]></category>
		<category><![CDATA[switch]]></category>
		<category><![CDATA[USB]]></category>

		<guid isPermaLink="false">http://www.alfersoft.com.ar/blog/?p=221</guid>
		<description><![CDATA[We had this great idea of using an old digital photo frame from smartparts to display some useful reports at work. In this case, useful will mean that the reports (pictures in the frame) needs to be automatically updated, with no human intervention. Take a look to this post, you may find something useful for [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.alfersoft.com.ar/blog/wp-content/uploads/2011/04/IMG_20110401_171720.jpg"><img src="http://www.alfersoft.com.ar/blog/wp-content/uploads/2011/04/IMG_20110401_171720-150x150.jpg" alt="" title="IMG_20110401_171720" width="100" height="100" class="alignleft size-thumbnail wp-image-232" /></a>We had this great idea of using an old digital photo frame from <a href="http://smartpartsproducts.com/content/index.html">smartparts</a> to display some useful reports at work.<br />
In this case, useful will mean that the reports (pictures in the frame) needs to be automatically updated, with no human intervention.<br />
Take a look to this post, you may find something useful for your own DIY project!<br />
<span id="more-221"></span><br />
There are probably several ways to update the pictures dynamically, we have chosen the easiest one: connect it to an old Itona computer (we&#8217;ve plenty of these crappy machines 300Mhz processor, 512Mb of hard disk) running Ubuntu Linux and then make a script that will periodically (cron) gather the info we want to show from the Internet convert it to JPG images, and update the photo frame.</p>
<p><a href="http://www.alfersoft.com.ar/blog/wp-content/uploads/2011/04/IMG_20110404_105718.jpg"><img src="http://www.alfersoft.com.ar/blog/wp-content/uploads/2011/04/IMG_20110404_105718-225x300.jpg" alt="" title="IMG_20110404_105718" width="225" height="300" class="alignnone size-medium wp-image-225" /></a><br />
Too easy? Ok, a real ninja hacker solution would had been taking apart the photo frame, put a Linux on the nice ARC processor through the JTAG interface and then plug some Wi-Fi dongle and do Everything directly on the DPF itself. But that&#8217;s just dreaming, we don&#8217;t have experience nor time for that.</p>
<p>Now you may ask, why didn&#8217;t you plug a monitor on the machine and just display whatever you want directly on the monitor? and the first reason is, we don&#8217;t have spare LCD monitors for this purpose (in fact we have many CRT monitors that nobody uses, but that requires just too much space). The second reason is that we wanted to do something more exiting, like hacker things <img src='http://www.alfersoft.com.ar/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> .</p>
<p>So we setup everything: we made the scripts to generate the images, installed Ubuntu Linux 10.4 on the Itona and actually we borrowed another 512mb (flash) hard disk form another Itona and put it in the secondary IDE to get a RAID configuration with 1GB of space, just enough for Ubuntu and our script. Then realized of a small problem, as soon as you plug the DPF on the USB port, it enters in &#8220;transfer mode&#8221; and stops displaying the images. No matter if you eject, unmount, safe remove, shut down the computer, etc. the photo frame wont show the pictures until you physically unplug the USB cable (cut off the +5V). Here is were our ingenious circuit enters in action. A <strong>USB interrupter controlled by the parallel port</strong> (I guess serial RS-232 would work fine also using one of the signal pins).<br />
After googling, I&#8217;ve found <a href="http://forum.allaboutcircuits.com/showthread.php?t=38544&#038;page=2">a circuit</a> that seemed usable for this purpose. Just a couple transistors and a few resistors is everything we need.<br />
<a href="http://www.alfersoft.com.ar/blog/wp-content/uploads/2011/04/IMG_20110331_185113.jpg"><img src="http://www.alfersoft.com.ar/blog/wp-content/uploads/2011/04/IMG_20110331_185113-300x225.jpg" alt="" title="IMG_20110331_185113" width="300" height="225" class="alignnone size-medium wp-image-226" /></a><br />
Crop the board and put it in a case&#8230;<br />
<a href="http://www.alfersoft.com.ar/blog/wp-content/uploads/2011/04/IMG_20110331_191457.jpg"><img src="http://www.alfersoft.com.ar/blog/wp-content/uploads/2011/04/IMG_20110331_191457-300x225.jpg" alt="" title="IMG_20110331_191457" width="300" height="225" class="alignnone size-medium wp-image-227" /></a><br />
<a href="http://www.alfersoft.com.ar/blog/wp-content/uploads/2011/04/IMG_20110331_191507.jpg"><img src="http://www.alfersoft.com.ar/blog/wp-content/uploads/2011/04/IMG_20110331_191507-300x225.jpg" alt="" title="IMG_20110331_191507" width="300" height="225" class="alignnone size-medium wp-image-228" /></a><br />
<a href="http://www.alfersoft.com.ar/blog/wp-content/uploads/2011/04/IMG_20110331_192915.jpg"><img src="http://www.alfersoft.com.ar/blog/wp-content/uploads/2011/04/IMG_20110331_192915-300x225.jpg" alt="" title="IMG_20110331_192915" width="300" height="225" class="alignnone size-medium wp-image-229" /></a><br />
Finally, the whole thing mounted:<br />
The Itona hidden behind the desk&#8230;<br />
<a href="http://www.alfersoft.com.ar/blog/wp-content/uploads/2011/04/IMG_20110404_103336.jpg"><img src="http://www.alfersoft.com.ar/blog/wp-content/uploads/2011/04/IMG_20110404_103336-225x300.jpg" alt="" title="IMG_20110404_103336" width="225" height="300" class="alignnone size-medium wp-image-230" /></a><br />
And the DPF showing the reports!! <img src='http://www.alfersoft.com.ar/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
<a href="http://www.alfersoft.com.ar/blog/wp-content/uploads/2011/04/IMG_20110401_171707.jpg"><img src="http://www.alfersoft.com.ar/blog/wp-content/uploads/2011/04/IMG_20110401_171707-300x225.jpg" alt="" title="IMG_20110401_171707" width="300" height="225" class="alignnone size-medium wp-image-231" /></a><br />
<a href="http://www.alfersoft.com.ar/blog/wp-content/uploads/2011/04/IMG_20110401_171720.jpg"><img src="http://www.alfersoft.com.ar/blog/wp-content/uploads/2011/04/IMG_20110401_171720-300x225.jpg" alt="" title="IMG_20110401_171720" width="300" height="225" class="alignnone size-medium wp-image-232" /></a></p>
<p>For the circuit you will need:</p>
<ul>
<li>1k resistor (2)</li>
<li>10k resistor (2)</li>
<li>PNP transistor</li>
<li>NPN transistor</li>
<li>USB connectors, 1 to plug into the computer, the other whatever is better for your DPF</li>
<li>DB-25 male connector (if you decided to do it via parallel too)</li>
</ul>
<p><strong>IMPORTANT: following image was borrowed from http://forum.allaboutcircuits.com/showthread.php?t=38544&#038;page=2</strong><br />
<a href="http://www.alfersoft.com.ar/blog/wp-content/uploads/2011/04/5V-Switch.png"><img src="http://www.alfersoft.com.ar/blog/wp-content/uploads/2011/04/5V-Switch-300x216.png" alt="" title="5V-Switch" width="300" height="216" class="alignnone size-medium wp-image-238" /></a><br />
I&#8217;ve connected the control-in to the PIN #2 of the DB-25, and the PIN #20 to the ground.<br />
To turn the parallel port signal on/off I&#8217;ve made the following program in C (para.c):</p>
<pre>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include
<linux/ppdev.h>

static int pfd;

int main(int argc, char* argv[])
{
	unsigned char data=0;

	if (argc != 3) {
		printf("Usage:\n\tpara [port] [val]\n\nport: parallel port e.g. /dev/parport0\nval:  1 to activate all data bits in parallel port, or\n      0 to disable all data bits in parallel port\n\n");
		return 1;
	}
	if (argv[2][0] == '1') {
		data=0xff;
	}
	pfd = open(argv[1], O_RDWR);
	if (pfd < 0) {
		perror("Failed to open port");
		exit(0);
	}
	if ((ioctl(pfd, PPEXCL) < 0) || (ioctl(pfd, PPCLAIM) < 0)) {
		perror("Failed to lock port");
		close(pfd);
		exit(0);
	}
	printf("Setting %s data bits to: %.2X\n", argv[1], data);
	ioctl(pfd, PPWDATA, &#038;data);
	close(pfd);
	return 0;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.alfersoft.com.ar/blog/2011/04/04/make-something-useful-out-of-your-dpf-digital-photo-frame/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create two wired virtual serial ports on Linux?</title>
		<link>http://www.alfersoft.com.ar/blog/2010/02/19/how-to-create-two-wired-virtual-serial-ports-on-linux/</link>
		<comments>http://www.alfersoft.com.ar/blog/2010/02/19/how-to-create-two-wired-virtual-serial-ports-on-linux/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 18:18:32 +0000</pubDate>
		<dc:creator>fvicente</dc:creator>
				<category><![CDATA[Linux FAQ]]></category>
		<category><![CDATA[Programming FAQ]]></category>
		<category><![CDATA[bridged]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[null-modem]]></category>
		<category><![CDATA[port]]></category>
		<category><![CDATA[rs-232]]></category>
		<category><![CDATA[serial]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[virtual]]></category>
		<category><![CDATA[wired]]></category>

		<guid isPermaLink="false">http://www.alfersoft.com.ar/blog/?p=134</guid>
		<description><![CDATA[To create two bridged virtual serial ports use the following command: socat -d -d pty,raw,echo=0 pty,raw,echo=0 The output will show you which are the virtual ports (or pseudo terminals) created, e.g.: 2010/02/19 16:16:33 socat[9662] N PTY is /dev/pts/3 2010/02/19 16:16:33 socat[9662] N PTY is /dev/pts/4 2010/02/19 16:16:33 socat[9662] N starting data transfer loop with FDs [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone" title="FAQ" src="http://www.alfersoft.com.ar/files/question.png" alt="" width="48" height="48" /></p>
<p>To create two bridged virtual serial ports use the following command:<br />
<code><br />
socat -d -d pty,raw,echo=0 pty,raw,echo=0<br />
</code></p>
<p>The output will show you which are the virtual ports (or pseudo terminals) created, e.g.:<br />
<code><br />
2010/02/19 16:16:33 socat[9662] N PTY is /dev/pts/3<br />
2010/02/19 16:16:33 socat[9662] N PTY is /dev/pts/4<br />
2010/02/19 16:16:33 socat[9662] N starting data transfer loop with FDs [3,3] and [5,5]<br />
</code></p>
<p>Note: if you are using Ubuntu and you do not have this command, try:<br />
<code><br />
sudo apt-get install socat<br />
</code></p>
<h6><a title="Lock" href="http://commons.wikimedia.org/wiki/File:Gnome-dialog-question.svg" target="_blank">Image source</a></h6>
]]></content:encoded>
			<wfw:commentRss>http://www.alfersoft.com.ar/blog/2010/02/19/how-to-create-two-wired-virtual-serial-ports-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

