<?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>K&#039;s Lair</title>
	<atom:link href="http://andreas.goelzer.de/feed" rel="self" type="application/rss+xml" />
	<link>http://andreas.goelzer.de</link>
	<description>Electronics and small programs and other stuff</description>
	<lastBuildDate>Thu, 02 Sep 2010 12:30:24 +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>USB Controller for 12 RC Servos</title>
		<link>http://andreas.goelzer.de/usbservo</link>
		<comments>http://andreas.goelzer.de/usbservo#comments</comments>
		<pubDate>Thu, 12 Aug 2010 22:59:36 +0000</pubDate>
		<dc:creator>Andreas Goelzer</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[avr]]></category>
		<category><![CDATA[servo]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://andreas.goelzer.de/?p=153</guid>
		<description><![CDATA[This article describes building a small (3.3 cm times 3.3 cm) RC servo controller using an avr microprocessor and an FT232RL USB-uart chip.  All RC servo signals can be set to pulsewidths from 0 to 8.1 ms using the usb-serial interface. 
 <a href="http://andreas.goelzer.de/usbservo">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This article describes building a small (3.3 cm times 3.3 cm) RC servo controller using an avr microprocessor and an FT232RL USB-uart chip.  All RC servo signals can be set to pulsewidths from 0 to 8.1 ms using the usb-serial interface. </p>
<p>RC Servos are popular among modelling and robotics enthusiasts because of their simplicity.  They take a pulsewidth-encoded input, and turn accordingly with relatively high torque.  They have their disadvantages, for example one cannot tell if the servo was able to get where it was sent, but their low price and the fact that driver and gear box are integrated make up for that.  Also, <a href="http://www.conrad.de">Conrad</a> sells them for 3 € a piece, so I bought some.</p>
<p>My first idea was to control them with <a href="http://www.obdev.at/products/vusb/index.html">firmware-usb</a>, however, the high load imposed on the controller by usb makes software-pwm erratic, and also, implementing the usb communicating device class is not possible for low-speed devices. </p>
<div class="image" style="font-size: 80%; text-align:center; font-face:bold;">
<a href="articlephotos/withservos.jpg"><img src="articlephotos/withservos_s.jpg" width="400" height="279" alt="[picture of assembled bord and two rc servos]" title="rather small, or is it?"></a>
<div>The servo controller prototype together with one regular sized RC servo, and one miniservo</div>
</div>
<p>The path I followed that resulted in the servo controller pictured above was, to use an <a href="http://www.ftdichip.com/Products/ICs/FT232R.htm">FT232R</a> usb-to-uart converter and an <a href="http://www.atmel.com/dyn/resources/prod_documents/8246S.pdf">Attiny 2313a</a> microcontroller to provide the software pwm.  There are some other possibilities, like taking an at90usb or another microcontroller with usb, but FTDI has nice chips, good support, and one can get usb pids from them, and remans flexible.  If 12 servos are not enough, the software should easily be portable to a bigger avr, the chips are widely avalable and low in cost: I got the attiny for about 1 € and the FT232RL for about 2.5 € at <a href="http://www.csd-electronics.de/">CSD</a>.</p>
<p>The <a href="download/usbservo_schematic.pdf">full schematic</a> is available as pdf and in the kicad format, and so is the <a href="download/usbservo_pcb.pdf">pcb layout</a>.  Feel free to rebuild it.</p>
<p>This was my first project using kicad and my first project using surface mounted technology, and surprisingly both made few problems.  Even soldering the tqfp-sized FT232RL without solder resist worked well, though i needed lots of light and a good magnifying glass. </p>
<div class="image" style="font-size: 80%; text-align:center; font-face:bold;">
<a href="articlephotos/smd_seite.jpg"><img src="articlephotos/smd_seite_s.jpg" width="400" height="279" alt="(picture of assembled pcb]" title="well, it was small"></a>
<div>The copper side of the assembled pcb, showing the results of my subpar soldering skills</div>
</div>
<h3>Hardware</h3>
<p>You will need:</p>
<ul>
<li>One <a href="http://www.ftdichip.com/Products/ICs/FT232R.htm">FT232RL</a> USB-to-UART convertor</li>
<li>One <a href="http://www.atmel.com/dyn/resources/prod_documents/8246S.pdf">Attiny 2313a</a> (or the older, nrfnd, attiny2313) avr microprocessor.</li>
<li>An USB B-type connector</li>
<li>A 6-pin connector for your AVR-ISP programmer.</li>
<li>Connectors for the servos. I used simple multi-pin connectors and some colored insulating tape to mark plus, minus and signal.</li>
<li>A connector for your power supply.</li>
<li>An optional jumper to power the servos from usb. Since the device does not ask the usb host for more power, this is outside the usb specifications. however, with small miniservos it is convenient, as you do not need an extra power supply.</li>
<li>One 4.7 µF electrolyte capacitor</li>
<li>Three SMD 100 nF ceramic capacitors and two 10 kOhm resistors. The plan calls for size 0603, but the resistors I used were actually 0805, and fitted also well.</li>
<li>A printed circuit board.  With the right equipment, you can make this yourself.  Or you can have one made for you at various companies</li>
</ul>
<p>All the parts together cost about 5 € (with a self-made pcb).</p>
<h3>Software</h3>
<p>The software provides a rather minimalistic interface.  To send commands, open the serial port at 9600 baud, using your favorite terminal program, I used gtkterm.</p>
<p>The available commands are:</p>
<ul>
<li>Typing <b>v</b> shows the device name, a link here, and the software version.</li>
<li>Typing <b>l</b> lists the servo numbers and the corresponding pwm settings. The pwm settings are the number of cpu cycles the servo should get a high signal level.</li>
<li>Typing <b>d</b> shows the softpwm table, a list of when which signals should go from high to low. This list is calculated from the pwm settings, it&#8217;s mainly there for debugging purposes.</li>
<li>Typing <b>s (servonumber) (new value)</b> sets the pwm value for the selected servo. Be sure to send a newline character or other whitespace to execute the command.</li>
</ul>
<p>Since RC servos typically want a 1 ms pulse (at 8 MHz this are 8000 cpu cycles) for one end, and a 2 ms pulse (similarly, at 8 MHz this are 16000 cpu cycles) for the other end, you would in linux do something like</p>
<pre>stty -F /dev/ttyUSB0 9600
echo "s 11 8000 " > /dev/ttyUSB0
echo "s 10 16000 " > /dev/ttyUSB0</pre>
<p>to send servo 11 to one end and servo 10 to the other.  If you have other serial devices, the device might not be /dev/ttyUSB0, but /dev/ttyUSB1 or so.  Should this be a problem, you can create a udev rule to create a symlink.  Note that the actual pulse lengths required to go to the mechanical end of the servo differ widely between servo types, I do not know if there is some standard, if you do, please tell me.</p>
<div class="image" style="font-size: 80%; text-align:center; font-face:bold;">
<a href="articlephotos/usbservo1.jpg"><img src="articlephotos/usbservo1_s.jpg" width="400" height="269" alt="[screenshot of qt host software]" title="rather small, or is it?"></a>
<div>A QT frontend to turn servos by turning dials</div>
</div>
<p>For some cases, like finding the end positions of the rc servos, it is convenient to have a graphical user interface, which is also available.</p>
<h3>Usage with embedded linux devices</h3>
<p>In most households, many devices run linux and have an usbport. however, without a modified firmware most cannot connect to serial usb devices. I tested a fritzbox 7270 (possible with alternative firmware <a href="http://trac.freetz.org/">freetz</a>, not with the original firmware), a dreambox dm 7000(no success, and alternative firmwares are lost in the mists of time), and an Asus oplay hdp-r1(also no success, and alternative firmwares seem to be not yet available).  So, unless you have a device that runs <a href="http://openwrt.org/">openwrt</a> by default, chances are this won&#8217;t work without some work.</p>
<h3>List of things still to do</h3>
<ul>
<li>As seen on the pictures, the avr isp connector is slightly too large, so either a smaller one has to be used, or only 8 servo connectors have place. For testing purposes, this was enough, but a new hardware revsion is necessary.</li>
</ul>
<hr /><a href='http://andreas.goelzer.de/download/usbservo_hardware.tar.gz'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-compressed.png" width="16" height="16" alt="filetype" class="icon16" /> usbservo_hardware.tar.gz</a> (60.86 kiB, 2010-08-12)<br/><a href='http://andreas.goelzer.de/download/usbservo_software.tar.bz2'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-compressed.png" width="16" height="16" alt="filetype" class="icon16" /> usbservo_software.tar.bz2</a> (48.24 kiB, 2010-08-14)<br/><a href='http://andreas.goelzer.de/download/qusbservoc.tar.gz'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-compressed.png" width="16" height="16" alt="filetype" class="icon16" /> qusbservoc.tar.gz</a> (20.49 kiB, 2010-08-14)<br/><a href='http://andreas.goelzer.de/download/usbservo_schematic.pdf'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-pdf.png" width="16" height="16" alt="filetype" class="icon16" /> usbservo_schematic.pdf</a> (26.66 kiB, 2010-08-12)<br/><a href='http://andreas.goelzer.de/download/usbservo_pcb.pdf'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-pdf.png" width="16" height="16" alt="filetype" class="icon16" /> usbservo_pcb.pdf</a> (23.32 kiB, 2010-08-02)<br/><hr />
]]></content:encoded>
			<wfw:commentRss>http://andreas.goelzer.de/usbservo/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ytplay &#8211; wrapper for youtube-dl.py</title>
		<link>http://andreas.goelzer.de/ytplay-wrapper-for-youtube-dl-py</link>
		<comments>http://andreas.goelzer.de/ytplay-wrapper-for-youtube-dl-py#comments</comments>
		<pubDate>Wed, 17 Feb 2010 22:55:59 +0000</pubDate>
		<dc:creator>Andreas Goelzer</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Internet]]></category>

		<guid isPermaLink="false">http://andreas.goelzer.de/?p=148</guid>
		<description><![CDATA[Due to my slightly outdated computer flash is a huge problem. So, for viewing youtube videos, youtube-dl.py is a great solution. However, I wanted something more comfortable. ytplay wraps around youtube-dl.py, it searches for a video, orders youtube-dl to get &#8230; <a href="http://andreas.goelzer.de/ytplay-wrapper-for-youtube-dl-py">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Due to my slightly outdated computer flash is a huge problem. So, for viewing youtube videos, <a href="http://bitbucket.org/rg3/youtube-dl/wiki/Home">youtube-dl.py</a> is a great solution. However, I wanted something more comfortable.</p>
<p>ytplay wraps around youtube-dl.py, it searches for a video, orders youtube-dl to get it, and starts playing it in vlc.</p>
<p>Usage is simple:<br />
> ytplay foobar<br />
will search youtube for videos about foobar and play the first one found.</p>
<p>The code is still quite dirty, especially the subprocess part. However, it should work, have fun!</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
<span style="color: #808080; font-style: italic;"># -*- coding: utf-8 -*-</span>
<span style="color: #808080; font-style: italic;">#		parser.add_option('-P', '--play', action='store_true',</span>
<span style="color: #808080; font-style: italic;">#				dest='play', help='play in vlc', default=False)</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">optparse</span> <span style="color: #ff7700;font-weight:bold;">import</span> OptionParser
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">subprocess</span> <span style="color: #ff7700;font-weight:bold;">import</span> Popen, PIPE
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">urllib2</span> <span style="color: #ff7700;font-weight:bold;">import</span> urlopen 
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">urllib</span> <span style="color: #ff7700;font-weight:bold;">import</span> quote_plus
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">re</span> <span style="color: #ff7700;font-weight:bold;">import</span> search, match
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">os</span> <span style="color: #ff7700;font-weight:bold;">import</span> system
&nbsp;
<span style="color: #dc143c;">parser</span> = OptionParser<span style="color: black;">&#40;</span>version=<span style="color: #483d8b;">'2010.02.13'</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'-p'</span>, <span style="color: #483d8b;">'--player'</span>,
dest=<span style="color: #483d8b;">'player'</span>, metavar=<span style="color: #483d8b;">'PROGRAM'</span>, <span style="color: #008000;">help</span>=<span style="color: #483d8b;">'media player to use'</span>, default=<span style="color: #483d8b;">'vlc'</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: black;">&#40;</span>opts, args<span style="color: black;">&#41;</span> = <span style="color: #dc143c;">parser</span>.<span style="color: black;">parse_args</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> match<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;http://&quot;</span>,args<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>:
	videopageurl = args<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>
<span style="color: #ff7700;font-weight:bold;">else</span>:
	searchargs = <span style="color: #483d8b;">'+'</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>args<span style="color: black;">&#41;</span>
	searchurl = <span style="color: #483d8b;">&quot;http://www.youtube.com/results?search_type=&amp;aq=f&amp;oq=&amp;search_query=&quot;</span> + quote_plus<span style="color: black;">&#40;</span>searchargs<span style="color: black;">&#41;</span>
	searchresult = urlopen<span style="color: black;">&#40;</span>searchurl<span style="color: black;">&#41;</span>.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	p=search<span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'(watch<span style="color: #000099; font-weight: bold;">\?</span>[^&quot;]*)'</span>,searchresult<span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">if</span> p==<span style="color: #008000;">None</span>:
		<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;No Videos found&quot;</span>
		exit<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	videopageurl=<span style="color: #483d8b;">&quot;http://www.youtube.com/&quot;</span> + p.<span style="color: black;">group</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
&nbsp;
&nbsp;
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Starting youtube-dl for &quot;</span> + videopageurl
ytdl = Popen<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;youtube-dl.py -t -b &quot;</span> + videopageurl,shell=<span style="color: #008000;">True</span>,stdout=PIPE<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #ff7700;font-weight:bold;">not</span> ytdl.<span style="color: black;">stdout</span>.<span style="color: black;">closed</span>:
	line = ytdl.<span style="color: black;">stdout</span>.<span style="color: #dc143c;">readline</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">print</span> line,
	<span style="color: #ff7700;font-weight:bold;">if</span> line == <span style="color: #483d8b;">''</span>: exit<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	p = search<span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\[</span>download<span style="color: #000099; font-weight: bold;">\]</span> Destination: (<span style="color: #000099; font-weight: bold;">\S</span>*)'</span>,line<span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">if</span> p <span style="color: #66cc66;">!</span>= <span style="color: #008000;">None</span>:
		<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Starting player: &quot;</span> + opts.<span style="color: black;">player</span> + <span style="color: #483d8b;">&quot; &quot;</span> + p.<span style="color: black;">group</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
		system<span style="color: black;">&#40;</span>opts.<span style="color: black;">player</span> + <span style="color: #483d8b;">&quot; &quot;</span> + p.<span style="color: black;">group</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span> + <span style="color: #483d8b;">&quot; &amp;&quot;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<hr /><a href='http://andreas.goelzer.de/download/ytplay'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-generic.png" width="16" height="16" alt="filetype" class="icon16" /> ytplay</a> (1.28 kiB, 2010-02-14)<br/><br />
<hr />
]]></content:encoded>
			<wfw:commentRss>http://andreas.goelzer.de/ytplay-wrapper-for-youtube-dl-py/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GPS plasmoid</title>
		<link>http://andreas.goelzer.de/gps-plasmoid</link>
		<comments>http://andreas.goelzer.de/gps-plasmoid#comments</comments>
		<pubDate>Thu, 09 Apr 2009 16:16:20 +0000</pubDate>
		<dc:creator>Andreas Goelzer</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[plasmoid]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://andreas.goelzer.de/?p=133</guid>
		<description><![CDATA[Having recently acquired a bluetooth GPS receiver for as little as 20 €, and just having switched to KDE 4, i tried to combine those two, and write a little plasmoid to show the current position on the desktop. And &#8230; <a href="http://andreas.goelzer.de/gps-plasmoid">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Having recently acquired a bluetooth <a href="http://en.wikipedia.org/wiki/Gps">GPS</a> receiver for as little as 20 €, and just having switched to <a href="http://www.kde.org/announcements/4.2/desktop.php">KDE 4</a>, i tried to combine those two, and write a little plasmoid to show the current position on the desktop.</p>
<p>And that is basically everything to say, enjoy the little applet.</p>
<h3>Installation</h3>
<p>Make sure <a href="http://gpsd.berlios.de/">gpsd</a> is installed and set up properly. Also make sure the python bindings are installed.<br />
In Ubuntu you would need to:</p>
<pre>sudo apt-get install gpsd python-gps
sudo dpkg-reconfigure gpsd
sudo apt-get install python-plasma python-dev</pre>
<p>After those are installed,  you can proceed to install the plasmoid with plasmapkg -i.</p>
<h3>Problems and TODOs</h3>
<p>This is all rather dirty and bloated. The correct way to do it would probably be to write a data engine for plasma, which would provide the positional data. Maybe someone will do it, especially if <a href="http://edu.kde.org/marble/">Marble</a> will one day <strike>be able to support overlays</strike> integrate <a href="http://geoclue.freedesktop.org/">GeoClue</a> or something similar.</p>
<p>Right now the data travels from the GPS device to the PC in the form of <a href="http://www.gpsinformation.org/dale/nmea.htm">NMEA sentences</a>, gets then converted into gpsd&#8217;s own format, python-gps connects to gpsd over TCP port 2947, interprets the gpsd output, hands it over to the applet, which reformats the data yet again. For something so useless that just wastes too many CPU cycles. <a href="http://andreas.goelzer.de/gps-mouse-in-python">Interpreting GPS data</a> entirely in python is not hard, but still a bit harder than with gpsd, especially if one wants to cover a lot of GPS devices. Don&#8217;t get me wrong, gpsd does its job quite well, it is just a bit overkill for this task.</p>
<p>Another improvement would be readable coordinates. Something like &#8220;10 km northwest of Zürich&#8221; or even &#8220;200 meters south of Sternen Oerlikon, Zürich&#8221; would really be much more useful.</p>
<p>Update February 2010: Version 0.16 now uses KDE&#8217;s geolocation data engine. This drops the (direct) dependency on gpsd, and allows for ip-based location &#8211; unfortnately i now can no longer get my gps to work with it, hoping for kubuntu lucid.<br /><hr /><a href='http://andreas.goelzer.de/download/gps-plasmoid_0.16.plasmoid'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-generic.png" width="16" height="16" alt="filetype" class="icon16" /> gps-plasmoid_0.16.plasmoid</a> (5.85 kiB, 2010-02-13)<br/><a href='http://andreas.goelzer.de/download/gps-plasmoid_0.15.plasmoid'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-generic.png" width="16" height="16" alt="filetype" class="icon16" /> gps-plasmoid_0.15.plasmoid</a> (2.59 kiB, 2009-04-11)<br/><a href='http://andreas.goelzer.de/download/gps-plasmoid012.png'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-image.png" width="16" height="16" alt="filetype" class="icon16" /> gps-plasmoid012.png</a> (911.48 kiB, 2009-04-09)<br/><hr />
]]></content:encoded>
			<wfw:commentRss>http://andreas.goelzer.de/gps-plasmoid/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>lcdshift</title>
		<link>http://andreas.goelzer.de/lcdshift</link>
		<comments>http://andreas.goelzer.de/lcdshift#comments</comments>
		<pubDate>Tue, 31 Mar 2009 14:45:40 +0000</pubDate>
		<dc:creator>Andreas Goelzer</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[avr]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[lcd]]></category>

		<guid isPermaLink="false">http://andreas.goelzer.de/?p=122</guid>
		<description><![CDATA[LCD Controllers using an HD44780 Display Controller are commonly used for small batch electronic devices, and are popular with electronics fans worldwide. One problem with those controllers is their demand for IO-lines, due too the parallel interface they require at &#8230; <a href="http://andreas.goelzer.de/lcdshift">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>LCD Controllers using an <a href="http://www.alldatasheet.com/datasheet-pdf/pdf/63673/HITACHI/HD44780.html">HD44780</a> Display Controller are commonly used for small batch electronic devices, and are popular with electronics fans worldwide. One problem with those controllers is their demand for IO-lines, due too the parallel interface they require at least 7 IO lines.</p>
<p>One solution, if you don&#8217;t have enough IO ports to spare, is to use another Display, like serial <a href="http://superkranz.de/christian/S65_Display/DisplayIndex.html">cellphone displays</a>, which are cheap and color is a great thing to show off. Or you can expand the number of IO lines by using a shift register or TWI device. This is one such implementation using a <a href="http://www.datasheetcatalog.org/datasheet/motorola/74HC164.pdf">74hc164</a> shift register. It is based on an <a href="http://www.mikrocontroller.net/topic/6496">implementation</a> by Peter Dannegger. If you prefer to use a 4094 cmos shift register, there are also <a href="http://bansky.net/blog/2008/10/interfacing-lcd-with-3-wires-from-net-micro-framework/">schematics</a>  floating around the net.<br />
<div class="ngg-galleryoverview" id="ngg-gallery--122">


	
	<!-- Thumbnails -->
		
	<div id="ngg-image-11958" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://andreas.goelzer.de/photos/elektronik/lcdshift/lcdshift_schematic.png" title="lcdshift_schematic.png" class="thickbox" rel="lcdshift" >
				<img title=" " alt=" " src="http://andreas.goelzer.de/photos/elektronik/lcdshift/thumbs/thumbs_lcdshift_schematic.png" width="130" height="83" />
			</a>
		</div>
	</div>
	 		
	<div id="ngg-image-11959" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://andreas.goelzer.de/photos/elektronik/lcdshift/lcdshift_assembly.png" title="lcdshift_assembly.png" class="thickbox" rel="lcdshift" >
				<img title=" " alt=" " src="http://andreas.goelzer.de/photos/elektronik/lcdshift/thumbs/thumbs_lcdshift_assembly.png" width="130" height="83" />
			</a>
		</div>
	</div>
	 	 	
	<!-- Pagination -->
 	<div class="ngg-clear">&nbsp;</div> 	
</div>

<br />
The idea behind this implementation is to fill the shift register from the microcontroller using hard- or softspi, then toggle the hd44780&#8242;s enable pin. While toggling, the data pin determines the R/S state of the display.</p>
<p>The demo software will print a hello world message onto the display, it is written for AVR microcontrollers, it should work &#8211; after modifying the ports and pin numbers &#8211; on almost any AVR. Peter Daneggers <a href="http://www.mikrocontroller.net/attachment/highlight/1929">original software</a> is written for 8051 µCs, I don&#8217;t know of any code for PICs.</p>
<hr /><a href='http://andreas.goelzer.de/download/lcd.tar.bz2'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-compressed.png" width="16" height="16" alt="filetype" class="icon16" /> lcd.tar.bz2</a> (2.30 kiB, 2009-03-31)<br/><a href='http://andreas.goelzer.de/download/lcdshift.pdf'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-pdf.png" width="16" height="16" alt="filetype" class="icon16" /> lcdshift.pdf</a> (13.73 kiB, 2009-03-31)<br/><a href='http://andreas.goelzer.de/download/lcdshift.sch'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-generic.png" width="16" height="16" alt="filetype" class="icon16" /> lcdshift.sch</a> (94.29 kiB, 2009-03-31)<br/><a href='http://andreas.goelzer.de/download/lcdshift.brd'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-generic.png" width="16" height="16" alt="filetype" class="icon16" /> lcdshift.brd</a> (12.28 kiB, 2009-03-31)<br/><hr />
]]></content:encoded>
			<wfw:commentRss>http://andreas.goelzer.de/lcdshift/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>readESM &#8211; Reading Digital Tachograph files</title>
		<link>http://andreas.goelzer.de/readesm-reading-digital-tachograph-files</link>
		<comments>http://andreas.goelzer.de/readesm-reading-digital-tachograph-files#comments</comments>
		<pubDate>Tue, 10 Feb 2009 02:33:51 +0000</pubDate>
		<dc:creator>Andreas Goelzer</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Vehicles]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[tachograph]]></category>

		<guid isPermaLink="false">http://andreas.goelzer.de/?p=111</guid>
		<description><![CDATA[For several years now, new trucks sold in the European union are equipped with digital tachographs, that record the driving times and replace the older chart-based mechanical tachographs. For companies in road transport that means, although in theory they get &#8230; <a href="http://andreas.goelzer.de/readesm-reading-digital-tachograph-files">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For several years now, new trucks sold in the European union are equipped with digital tachographs, that record the driving times and replace the older chart-based mechanical tachographs.</p>
<p>For companies in road transport that means, although in theory they get nice data about their drivers and vehicles, in practice they have to pay a lot of money for the digital tachograph and the associated equipment, which is then used against them &#8211; the old fraud schemes no longer work, the machine cruelly gives every police officer the driving times of the last 28 days (and could give much more).</p>
<p>The usability of the devices I&#8217;m familiar with is also abysmal. It just takes forever to read out the data (9600 baud per default, 115000 baud maximal, but i guess the company&#8217;s software does just the former), and the drivers have to keep track of their times manually &#8211; just not up to par with 2009 technology.</p>
<p>The company also had just a very bad software for analyzing the data recorded by the card and the digital tachograph, so I was asked to write a simple visualization program.</p>
<h3>Compiling</h3>
<p>You can get the program files from this page, or from the <a href="http://sourceforge.net/projects/readesm/">development page</a> at Sourceforge.<br />
Since so far there is no binary distribution for the program, you will have to compile it yourself.<br />
To do that, you need a c++ compiler, parts of the <a href="http://www.boost.org/">boost library</a> (specifically program_options and shared_ptr) and the <a href="http://gmplib.org/">Gnu MP library</a>, wich is used to check the various <a href="http://en.wikipedia.org/wiki/RSA">RSA</a> signatures. Once all those are installed, typing make/make install should work fine. On <a href="http://www.ubuntu.com/">Ubuntu</a> systems, you will need to do something like:</p>
<pre>svn co https://readesm.svn.sourceforge.net/svnroot/readesm readesm
sudo apt-get install libboost-program-options-dev libgmpxx4ldbl  libgmp3-dev
make
sudo make install
</pre>
<p>You can of course also use checkinstall instead of make install, or type make package, which invokes checkinstall.</p>
<h3>Running the program</h3>
<p>In most circumstances, you will run the program from the commandline like this:</p>
<pre>readesm --infile foo.esm --outfile bar.html --format=html</pre>
<p>Alternatively, if no output file is specified, stdout is used. For <a href="http://www.kde.org/">KDE</a> users, i wrote a little wrapper script named readesm-wrap-kde.sh. It will get installed my typing make install</p>
<h3>Security</h3>
<p>It is a really pleasant surprise to see a nice security model in the digital tachographs, considering the rules for the security implementations were made by politicians. Both cards and vehicle units work with 1024-bit RSA keys, and each vehicle unit has its own key, with an certificate signed by the member state, which in turn is signed by an European master key. Data is hashed with SHA-1, subsequently padded and signed by the vehicle unit, and that signature appended to the readouts. The law even states that the companies have to store the data in this signed form, so there is little chance to tamper with the data, once recorded.</p>
<p>Since the most likely attacker &#8211; the evil manager who wants to exploit the drivers &#8211; has physical access to the card and vehicle unit, which contain the private keys, even 1024-bit RSA provides no absolute security. The manager could try a timing attack, or take a really close look at the storage, both times avoiding having to solve the RSA problem.</p>
<p>The connection from tachograph to sensor is also secured, using Triple-DES. The week point here is the sensor &#8211; a successful attack against the sensors some DAF trucks are equipped with is to disturb it using strong permanent magnets, thereby preventing it from recognizing the changing magnetic fields.</p>
<p>All possible attacks against the security system however face the problem of being unveiled by police checkpoints or a cross-correlation of the faked data with data from other sources, for example the toll systems recording every few highway kilometers in Germany.</p>
<p>So, although I could sell manipulation programs for quite some money, all I can offer is a program that can detect such attacks <img src='http://andreas.goelzer.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<div class="ngg-galleryoverview" id="ngg-gallery--111">


	
	<!-- Thumbnails -->
		
	<div id="ngg-image-11673" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://andreas.goelzer.de/photos/Grafik/screenshots/readesm/alpha_html_output.png" title="alpha_html_output.png" class="thickbox" rel="readESM &#8211; Reading Digital Tachograph files" >
				<img title=" " alt=" " src="http://andreas.goelzer.de/photos/Grafik/screenshots/readesm/thumbs/thumbs_alpha_html_output.png" width="130" height="83" />
			</a>
		</div>
	</div>
	 		
	<div id="ngg-image-11674" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://andreas.goelzer.de/photos/Grafik/screenshots/readesm/card_error.png" title="card_error.png" class="thickbox" rel="readESM &#8211; Reading Digital Tachograph files" >
				<img title=" " alt=" " src="http://andreas.goelzer.de/photos/Grafik/screenshots/readesm/thumbs/thumbs_card_error.png" width="130" height="83" />
			</a>
		</div>
	</div>
	 		
	<div id="ngg-image-11675" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://andreas.goelzer.de/photos/Grafik/screenshots/readesm/alpha_html_control.png" title="alpha_html_control.png" class="thickbox" rel="readESM &#8211; Reading Digital Tachograph files" >
				<img title=" " alt=" " src="http://andreas.goelzer.de/photos/Grafik/screenshots/readesm/thumbs/thumbs_alpha_html_control.png" width="130" height="83" />
			</a>
		</div>
	</div>
	 		
	<div id="ngg-image-12798" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://andreas.goelzer.de/photos/Grafik/screenshots/readesm/readesm_0.3.2_german_locale.png" title="readesm_0.3.2_german_locale.png" class="thickbox" rel="readESM &#8211; Reading Digital Tachograph files" >
				<img title=" " alt=" " src="http://andreas.goelzer.de/photos/Grafik/screenshots/readesm/thumbs/thumbs_readesm_0.3.2_german_locale.png" width="130" height="83" />
			</a>
		</div>
	</div>
	 		
	<div id="ngg-image-12801" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://andreas.goelzer.de/photos/Grafik/screenshots/readesm/readesm_0.3.2_windows_xml_2.PNG" title="readesm_0.3.2_windows_xml_2.PNG" class="thickbox" rel="readESM &#8211; Reading Digital Tachograph files" >
				<img title=" " alt=" " src="http://andreas.goelzer.de/photos/Grafik/screenshots/readesm/thumbs/thumbs_readesm_0.3.2_windows_xml_2.PNG" width="130" height="83" />
			</a>
		</div>
	</div>
	 	 	
	<!-- Pagination -->
 	<div class="ngg-clear">&nbsp;</div> 	
</div>

<br /><hr /><a href='http://andreas.goelzer.de/download/readesm.tar.bz2'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-compressed.png" width="16" height="16" alt="filetype" class="icon16" /> readesm.tar.bz2</a> (60.86 kiB, 2009-05-19)<br/><hr />
]]></content:encoded>
			<wfw:commentRss>http://andreas.goelzer.de/readesm-reading-digital-tachograph-files/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Blinking Eva</title>
		<link>http://andreas.goelzer.de/blinking-eva</link>
		<comments>http://andreas.goelzer.de/blinking-eva#comments</comments>
		<pubDate>Sat, 06 Dec 2008 20:47:17 +0000</pubDate>
		<dc:creator>Andreas Goelzer</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[avr]]></category>
		<category><![CDATA[blinky]]></category>

		<guid isPermaLink="false">http://andreas.goelzer.de/?p=83</guid>
		<description><![CDATA[Since it&#8217;s suddenly, out of nowhere, christmas time again, and since christmas is traditionally the time to build blinking somethings, i decided to publish this. Long ago &#8211; well, actually last year &#8211; this as a christmas present for my &#8230; <a href="http://andreas.goelzer.de/blinking-eva">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Since it&#8217;s suddenly, out of nowhere, christmas time again, and since christmas is traditionally the time to build blinking somethings, i decided to publish this. Long ago &#8211; well, actually last year &#8211; this as a christmas present for my girlfriend Eva.</p>
<p>What does it do? Nothing useful. You plug it in, and the various LEDs blink wildly, one letter at a time, two letters at a time, all on, all off.</p>
<p>I&#8217;m not particularly proud of this board. The matrix design is just painful to route on an one-sided PCB, so please don&#8217;t do it, especially if you plan on doing something similar with more than three letters. I&#8217;d like to use something like the <a href=""http://www.austriamicrosystems.com/eng/Products/Lighting-Management/LED-Drivers/AS1110/(oi)/1>AS 1110</a> for something similar, but there are just no distributors for those chips.</p>
<p>Nevertheless, if you know someone named Eva who likes to solder a bit or who just likes blinking things, this might be a nice present.</p>
<p>Things to take care of:</p>
<ul>
<li>Energy source: I used some old wall wart for this. The used 7805 is quite robust, but not very efficient. Use something between around 8 V to 15 V, and check the polarity, which is unfortunately not standardized.</li>
<li>Since the LEDs are driven only 1/4th of the time, you can in theory use higher currents than if driven all the time.</li>
</ul>

<div class="ngg-galleryoverview" id="ngg-gallery--83">


	
	<!-- Thumbnails -->
		
	<div id="ngg-image-11044" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://andreas.goelzer.de/photos/elektronik/blinking-eva/assembly-diagram.png" title="assembly-diagram.png" class="thickbox" rel="Blinking Eva" >
				<img title=" " alt=" " src="http://andreas.goelzer.de/photos/elektronik/blinking-eva/thumbs/thumbs_assembly-diagram.png" width="130" height="83" />
			</a>
		</div>
	</div>
	 		
	<div id="ngg-image-11045" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://andreas.goelzer.de/photos/elektronik/blinking-eva/rendering.png" title="rendering.png" class="thickbox" rel="Blinking Eva" >
				<img title=" " alt=" " src="http://andreas.goelzer.de/photos/elektronik/blinking-eva/thumbs/thumbs_rendering.png" width="130" height="83" />
			</a>
		</div>
	</div>
	 		
	<div id="ngg-image-11046" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://andreas.goelzer.de/photos/elektronik/blinking-eva/schematic.png" title="schematic.png" class="thickbox" rel="Blinking Eva" >
				<img title=" " alt=" " src="http://andreas.goelzer.de/photos/elektronik/blinking-eva/thumbs/thumbs_schematic.png" width="130" height="83" />
			</a>
		</div>
	</div>
	 	 	
	<!-- Pagination -->
 	<div class="ngg-clear">&nbsp;</div> 	
</div>

<br /><hr /><a href='http://andreas.goelzer.de/download/blinking-eva/eagle-files.tar.bz2'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-compressed.png" width="16" height="16" alt="filetype" class="icon16" /> blinking-eva/eagle-files.tar.bz2</a> (54.42 kiB, 2008-12-06)<br/><a href='http://andreas.goelzer.de/download/blinking-eva/firmware.tar.bz2'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-compressed.png" width="16" height="16" alt="filetype" class="icon16" /> blinking-eva/firmware.tar.bz2</a> (3.75 kiB, 2008-12-06)<br/><a href='http://andreas.goelzer.de/download/blinking-eva/blinking-eva-board.pdf'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-pdf.png" width="16" height="16" alt="filetype" class="icon16" /> blinking-eva/blinking-eva-board.pdf</a> (249.03 kiB, 2008-12-06)<br/><a href='http://andreas.goelzer.de/download/blinking-eva/manual-german.pdf'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-pdf.png" width="16" height="16" alt="filetype" class="icon16" /> blinking-eva/manual-german.pdf</a> (1.28 MiB, 2008-12-06)<br/><hr />
]]></content:encoded>
			<wfw:commentRss>http://andreas.goelzer.de/blinking-eva/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GPS Mouse in Python</title>
		<link>http://andreas.goelzer.de/gps-mouse-in-python</link>
		<comments>http://andreas.goelzer.de/gps-mouse-in-python#comments</comments>
		<pubDate>Sat, 08 Nov 2008 00:15:49 +0000</pubDate>
		<dc:creator>Andreas Goelzer</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://andreas.goelzer.de/?p=74</guid>
		<description><![CDATA[Some months ago I aquired a cheap gps mouse (Royaltek RGM-2000, really cheap, 2 € + shipping) at ebay. My plans to use it in combination with an microcontroller and a display haven&#8217;t worked out, it is a lot of &#8230; <a href="http://andreas.goelzer.de/gps-mouse-in-python">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Some months ago I aquired a cheap gps mouse (Royaltek RGM-2000, really cheap, 2 € + shipping) at ebay. My plans to use it in combination with an microcontroller and a display haven&#8217;t worked out, it is a lot of work and the garmin units do that job fine.<br />
However, playing around with it in python lead to better results. Getting the data to <a href="http://earth.google.com/">google earth</a> works nicely, and at least <a href="http://qlandkarte.sourceforge.net/">qlandkarte</a> can read the generated gpx tracks.</p>
<h4>Usage</h4>
<ul>
<li>Start the Program, add a parameter for the port your nmea device is attached to (/dev/ttyUSB0 is the default</li>
<li>Start google earth or something, load the generated kml file (/tmp/posdate by default)</li>
<li>Exit the program by pressing ctrl-c, track data will be written to /tmp/track-some time.gpx</li>
</ul>
<p>Guess I should code something with <a href="http://xkcd.com/407/">extra geek value</a> now.<br />
It might be comfortable to have google earth automatically reload the file, so instead open sth. like</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;kml</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://earth.google.com/kml/2.1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;NetworkLink<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>GPS<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;flyToView<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/flyToView<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;href<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/tmp/posdata.kml<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/href<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;refreshMode<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>onInterval<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/refreshMode<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;refreshInterval<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>10<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/refreshInterval<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Url<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/NetworkLink<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/kml<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
<span style="color: #483d8b;">&quot;&quot;&quot;
Script to read nmea data from a GPS mouse
Copyright (C) 2008  Andreas Goelzer
&nbsp;
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
&nbsp;
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
&nbsp;
You should have received a copy of the GNU General Public License
along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
&nbsp;
This program reads data from a nmea device (uses the GGA sentence),
and creates a google kml file with the current position and the path
leading there. Additionally, a gpx file is generated containing the
track data with time information.
&quot;&quot;&quot;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">from</span> serial <span style="color: #ff7700;font-weight:bold;">import</span> Serial<span style="color: #66cc66;">;</span>
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">time</span> <span style="color: #ff7700;font-weight:bold;">import</span> strftime, gmtime<span style="color: #66cc66;">;</span>
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">optparse</span> <span style="color: #ff7700;font-weight:bold;">import</span> OptionParser<span style="color: #66cc66;">;</span>
&nbsp;
&nbsp;
hist = <span style="color: #483d8b;">&quot;&quot;</span><span style="color: #66cc66;">;</span>
gpx = <span style="color: #483d8b;">&quot;&quot;</span><span style="color: #66cc66;">;</span>
&nbsp;
kmlmask=<span style="color: #483d8b;">&quot;&quot;&quot;&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;kml xmlns=&quot;http://earth.google.com/kml/2.0&quot;&gt;
&lt;Document&gt;
	&lt;Placemark&gt;
		&lt;name&gt;Your Position&lt;/name&gt;
		&lt;Point&gt;
			&lt;coordinates&gt;%s&lt;/coordinates&gt;
		&lt;/Point&gt;
	&lt;/Placemark&gt;
	&lt;Placemark&gt;
		&lt;name&gt;Previous positions&lt;/name&gt;
		&lt;description&gt;Path that lead you here&lt;/description&gt;
		&lt;LineString&gt;
			&lt;coordinates&gt;%s&lt;/coordinates&gt;
		&lt;/LineString&gt;
	&lt;/Placemark&gt;
&lt;/Document&gt;
&lt;/kml&gt;&quot;&quot;&quot;</span>
<span style="color: #808080; font-style: italic;">#			&lt;altitudeMode&gt;absolute&lt;/altitudeMode&gt;</span>
&nbsp;
gpxmask = <span style="color: #483d8b;">&quot;&quot;&quot;&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot; ?&gt;&lt;gpx xmlns=&quot;http://www.topografix.com/GPX/1/1&quot; xmlns:gpxx=&quot;http://www.garmin.com/xmlschemas/GpxExtensions/v3&quot; xmlns:gpxtpx=&quot;http://www.garmin.com/xmlschemas/TrackPointExtension/v1&quot; creator=&quot;Colorado 300&quot; version=&quot;1.1&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation=&quot;http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensions/v3/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtension/v1/TrackPointExtensionv1.xsd&quot;&gt;
&lt;trk&gt;&lt;name&gt;%s&lt;/name&gt;&lt;trkseg&gt;%s&lt;/trkseg&gt;&lt;/trk&gt;&lt;/gpx&gt;&quot;&quot;&quot;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> gpstime<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">return</span> strftime<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;%Y-%m-%dT%H:%M:%SZ&quot;</span>,gmtime<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> readlatlon<span style="color: black;">&#40;</span>value,inverse<span style="color: black;">&#41;</span>:
	lat = <span style="color: #008000;">float</span><span style="color: black;">&#40;</span>value<span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
	lat2 = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>lat<span style="color: black;">&#41;</span> / <span style="color: #ff4500;">100</span><span style="color: #66cc66;">;</span>
	lat = lat2 + <span style="color: black;">&#40;</span>lat - <span style="color: #ff4500;">100</span> <span style="color: #66cc66;">*</span> lat2<span style="color: black;">&#41;</span>/ <span style="color: #ff4500;">60</span><span style="color: #66cc66;">;</span> 
	<span style="color: #ff7700;font-weight:bold;">if</span> inverse:
		lat = -lat<span style="color: #66cc66;">;</span>
	<span style="color: #ff7700;font-weight:bold;">return</span> lat<span style="color: #66cc66;">;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> calcchecksum<span style="color: black;">&#40;</span>checkstr<span style="color: black;">&#41;</span>:
	cs = <span style="color: #008000;">ord</span><span style="color: black;">&#40;</span>checkstr<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
	<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>,<span style="color: #008000;">len</span><span style="color: black;">&#40;</span>checkstr<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>:
		cs ^= <span style="color: #008000;">ord</span><span style="color: black;">&#40;</span>checkstr<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">return</span> cs<span style="color: #66cc66;">;</span>
&nbsp;
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> sentencevalidator:
	<span style="color: #483d8b;">&quot;Check checksum and other stuff and split to fields&quot;</span>
	<span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>,line<span style="color: black;">&#41;</span>:
		<span style="color: #ff7700;font-weight:bold;">if</span><span style="color: black;">&#40;</span>line<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> == <span style="color: #483d8b;">'$'</span> <span style="color: #ff7700;font-weight:bold;">and</span> line<span style="color: black;">&#91;</span>-<span style="color: #ff4500;">5</span><span style="color: black;">&#93;</span> == <span style="color: #483d8b;">'*'</span> <span style="color: #ff7700;font-weight:bold;">and</span> calcchecksum<span style="color: black;">&#40;</span>line<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>:-<span style="color: #ff4500;">5</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> ==  <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>line<span style="color: black;">&#91;</span>-<span style="color: #ff4500;">4</span>:-<span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span>,<span style="color: #ff4500;">16</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>:
			<span style="color: #008000;">self</span>.<span style="color: black;">valid</span> = <span style="color: #008000;">True</span><span style="color: #66cc66;">;</span>
			<span style="color: #008000;">self</span>.<span style="color: black;">sentence</span> = line<span style="color: black;">&#91;</span><span style="color: #ff4500;">3</span>:<span style="color: #ff4500;">6</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">;</span>
			<span style="color: #008000;">self</span>.<span style="color: black;">data</span> = line<span style="color: black;">&#91;</span><span style="color: #ff4500;">7</span>:-<span style="color: #ff4500;">5</span><span style="color: black;">&#93;</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">','</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
		<span style="color: #ff7700;font-weight:bold;">else</span> :
			<span style="color: #008000;">self</span>.<span style="color: black;">valid</span> = <span style="color: #008000;">False</span><span style="color: #66cc66;">;</span>
&nbsp;
<span style="color: #dc143c;">parser</span> = OptionParser<span style="color: black;">&#40;</span>version=<span style="color: #483d8b;">&quot;%prog 0.1&quot;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;-s&quot;</span>, <span style="color: #483d8b;">&quot;--serial&quot;</span>, dest=<span style="color: #483d8b;">&quot;serial&quot;</span>,
                  <span style="color: #008000;">help</span>=<span style="color: #483d8b;">&quot;serial terminal of the gps unit&quot;</span>, default=<span style="color: #483d8b;">'/dev/ttyUSB0'</span>, metavar=<span style="color: #483d8b;">&quot;FILE&quot;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;-g&quot;</span>, <span style="color: #483d8b;">&quot;--gpxfile&quot;</span>, dest=<span style="color: #483d8b;">&quot;gpxfile&quot;</span>,
                  <span style="color: #008000;">help</span>=<span style="color: #483d8b;">&quot;GPX output file&quot;</span>, default=<span style="color: #483d8b;">&quot;/tmp/track&quot;</span> + gpstime<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> + <span style="color: #483d8b;">&quot;.gpx&quot;</span>, metavar=<span style="color: #483d8b;">&quot;FILE&quot;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;-k&quot;</span>, <span style="color: #483d8b;">&quot;--kmlfile&quot;</span>, dest=<span style="color: #483d8b;">&quot;kmlfile&quot;</span>,
                  <span style="color: #008000;">help</span>=<span style="color: #483d8b;">&quot;KML output file&quot;</span>, default=<span style="color: #483d8b;">&quot;/tmp/posdata.kml&quot;</span>, metavar=<span style="color: #483d8b;">&quot;FILE&quot;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;-v&quot;</span>, <span style="color: #483d8b;">&quot;--verbose&quot;</span>,
                  action=<span style="color: #483d8b;">&quot;store_true&quot;</span>, dest=<span style="color: #483d8b;">&quot;verbose&quot;</span>, default=<span style="color: #008000;">False</span>,
                  <span style="color: #008000;">help</span>=<span style="color: #483d8b;">&quot;print debug messages&quot;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
<span style="color: black;">&#40;</span>options, args<span style="color: black;">&#41;</span> = <span style="color: #dc143c;">parser</span>.<span style="color: black;">parse_args</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
gps = Serial<span style="color: black;">&#40;</span>options.<span style="color: black;">serial</span>, <span style="color: #ff4500;">4800</span>, timeout=<span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">#on sirf chips, activate all sentences</span>
<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>,<span style="color: #ff4500;">5</span><span style="color: black;">&#41;</span>:
	<span style="color: #dc143c;">cmd</span> = <span style="color: #483d8b;">&quot;PSRF103,0%d,00,05,01&quot;</span> <span style="color: #66cc66;">%</span> i<span style="color: #66cc66;">;</span>
	realcmd=<span style="color: #483d8b;">&quot;$%s*%x<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span><span style="color: #dc143c;">cmd</span>,calcchecksum<span style="color: black;">&#40;</span><span style="color: #dc143c;">cmd</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
	<span style="color: #ff7700;font-weight:bold;">print</span> realcmd<span style="color: #66cc66;">;</span>
	gps.<span style="color: black;">write</span><span style="color: black;">&#40;</span>realcmd<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">try</span>:
	<span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #ff4500;">1</span>:
		line = gps.<span style="color: #dc143c;">readline</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">if</span><span style="color: black;">&#40;</span>options.<span style="color: black;">verbose</span><span style="color: black;">&#41;</span>: <span style="color: #ff7700;font-weight:bold;">print</span> line,
		s = sentencevalidator<span style="color: black;">&#40;</span>line<span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
		<span style="color: #ff7700;font-weight:bold;">if</span><span style="color: black;">&#40;</span>s.<span style="color: black;">valid</span> <span style="color: #ff7700;font-weight:bold;">and</span> s.<span style="color: black;">sentence</span> == <span style="color: #483d8b;">&quot;GGA&quot;</span> <span style="color: #ff7700;font-weight:bold;">and</span> <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>s.<span style="color: black;">data</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">5</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">!</span>= <span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span>:
			lat = readlatlon<span style="color: black;">&#40;</span>s.<span style="color: black;">data</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>,s.<span style="color: black;">data</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span>==<span style="color: #483d8b;">'S'</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
			lon = readlatlon<span style="color: black;">&#40;</span>s.<span style="color: black;">data</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">3</span><span style="color: black;">&#93;</span>,s.<span style="color: black;">data</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">4</span><span style="color: black;">&#93;</span>==<span style="color: #483d8b;">'W'</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
			alt = <span style="color: #008000;">float</span><span style="color: black;">&#40;</span>s.<span style="color: black;">data</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">8</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
			gpx += <span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> + <span style="color: #483d8b;">'&lt;trkpt lat=&quot;%f&quot; lon=&quot;%f&quot;&gt;&lt;ele&gt;%f&lt;/ele&gt;&lt;time&gt;%s&lt;/time&gt;&lt;/trkpt&gt;'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>lon,lat,alt,gpstime<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
			position =  <span style="color: #483d8b;">&quot;%f, %f, %f&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>lon,lat,alt<span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
			<span style="color: #ff7700;font-weight:bold;">print</span> position
			hist += <span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> + position<span style="color: #66cc66;">;</span>
			f=<span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;/tmp/posdata.kml&quot;</span>,<span style="color: #483d8b;">'w'</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
			f.<span style="color: black;">write</span><span style="color: black;">&#40;</span>kmlmask <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>position,hist<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
			f.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">except</span>:
	<span style="color: #ff4500;">0</span>
&nbsp;
f=<span style="color: #008000;">open</span><span style="color: black;">&#40;</span>options.<span style="color: black;">gpxfile</span>,<span style="color: #483d8b;">'w'</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
f.<span style="color: black;">write</span><span style="color: black;">&#40;</span>gpxmask <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>gpstime<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>,gpx<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
f.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
gps.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<hr /><a href='http://andreas.goelzer.de/download/readgps.py'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-source-alt.png" width="16" height="16" alt="filetype" class="icon16" /> readgps.py</a> (4.46 kiB, 2008-11-08)<br/><br />
<hr />
]]></content:encoded>
			<wfw:commentRss>http://andreas.goelzer.de/gps-mouse-in-python/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>usbmot</title>
		<link>http://andreas.goelzer.de/usbmot</link>
		<comments>http://andreas.goelzer.de/usbmot#comments</comments>
		<pubDate>Mon, 03 Nov 2008 20:01:06 +0000</pubDate>
		<dc:creator>Andreas Goelzer</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[avr]]></category>
		<category><![CDATA[motor]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://andreas.goelzer.de/?p=41</guid>
		<description><![CDATA[This device connects to a computer&#8217;s usb port and controls two small electric motors using the L293D. The atmega microcontroller uses the firmware-only USB driver from objective development. Device description The usbmot device controls up to two small motors, 600 &#8230; <a href="http://andreas.goelzer.de/usbmot">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img src="http://andreas.goelzer.de/photos/elektronik/usbmot/coll.png" title="collage"/><br />
This device connects to a computer&#8217;s usb port and controls two small electric motors using the <a href="http://www.st.com/stonline/products/literature/ds/1330.pdf">L293D</a>. The atmega microcontroller uses the firmware-only <a href="http://www.obdev.at/products/avrusb/">USB driver</a> from objective development.</p>
<h4>Device description</h4>
<p>The usbmot device controls up to two small motors, 600 mA current each, 1.2 A peak each, with an atmel atmega microcontroller connected to some host device via USB. The speed of the motors can be controlled with PWM.</p>
<h4>Compiling</h4>
<p>Both firmware and host software are in the software package at the end of this page. In order to recompile the firmware, you will need an avr build chain (for example avr-gcc and avrdude), which you probably have if you found this page. To compile the host software, you will need a c++-compiler and the qt development package.</p>
<p>To compile the firmware, change into the firmware folder. Then edit the makefile and adjust device type and programmer. In order to remake the hex file, type &#8220;make hex&#8221;, and to transfer it to the device, type &#8220;make flash&#8221; (jumper 1-1 needs to be set).</p>
<p>To compile the host software, change into the qusbmot folder. You will need <a href="http://trolltech.com/products">qt</a> and <a href="http://libusb.sourceforge.net/">libusb</a> with their respective tools and header files to successfully compile. If both are properly installed, typing &#8220;qmake &#038;&#038; make&#8221; should compile the program, which can then be executed by typing &#8220;./qusbmot&#8221;.</p>
<h4>Usable AVR Microcontrollers</h4>
<p>So far I&#8217;ve used this board only with an atmega 168. Due to pin compatibility, it should work with at least an atmega 8, 48, 88, 168. Since 12 MHz speed are needed, the low-voltage versions will not work. The firmware size is about 2 kiB, so all are a bit oversized, but in low quantities this is no problem.</p>
<h4>USBAsp roots</h4>
<p>The PCB is based on the <a href="http://www.fischl.de/usbasp/">USBAsp</a> Layout. It can still be used as a programmer, however the USBAsp Firmware has to be modified since I changed the USB port and pins to use the output compare pins for PWM.</p>
<h4>Jumper description</h4>
<ul>
<li><b>JP 1-1: Self programming: </b>Needs to be set in order to program the device, and must not be set if the device is operating. Sorry, this is a bit inconvenient, a residue of the usbasp roots.</li>
<li><b>JP 1-2: Programmer Power: </b>Powers the device logic from the Programmers power source.</li>
<li><b>JP 5: coupled power: </b> Connects the motor and logic voltages. Might work for really small motors(take care that the current of the motor is much higher when under heavy load) or strong USB power sources.</li>
</ul>
<h4>Two red LEDs hack</h4>
<p>When all that separated my board from completion were the two 3V6 Z-diodes, I asked for help in the <a href="http://www.mikrocontroller.net/">mikrocontroller.net</a> &#8211; chat, and Loetmichel told me the 3.6 V Zener diodes can be replaced by 2 red LEDs each. If incorporated into the PCB, this might even look really nice, and add some information.</p>
<h4>Free pins</h4>
<p>in the pcb, some of the atmega&#8217;s pins are connected to pinheads, so the board can be extended. I&#8217;ve tested a rather crude servo control for PC2&#8230;PC5, but unfortunately, if there is activity on the usb bus, the timing will get disturbed and the servos will move without being told so. I guess one could use the two 8-bit timers with their pwm pins to avoid being disturbed by the high-level usb interrupt, maybe in the next version. If however you can live with a bad servo control, try the &#8220;trunk&#8221; package.</p>
<h4>Board problems</h4>
<ul>
<li>JP 5 is too close to the power connector.</li>
<li>The L293D is a bit old and can only power rather small motors. There are some nice <a href="http://www.roboternetz.de/wissen/index.php/Getriebemotoren_Ansteuerung#Noch_mehr_Power_gew.C3.BCnscht.3F">automotive ICs</a>, but unfortunately, those chips aren&#8217;t that easily available. Another Problem of the L293D is the low allowed pwm frequency &#8211; with 5 kHz in a region that is acoustically displeasing.</li>
<li>The holes for screws are placed randomly.</li>
<li>Setting the jumpers for programming is not that comfortable. I guess I will use a USB bootloader for the next version, saves some wires, too</li>
<li>Probably a lot more.</li>
</ul>
<h4>License and warnings</h4>
<p>The software for both the microcontroller and the host is available under the terms of the <a href="http://www.gnu.org/copyleft/gpl.html">GPL</a>, in the hope that it might be useful for someone out there. In Addition to the terms of the GPL, obdev, who provide the firmware-only usb driver, kindly ask and require <a href="http://www.obdev.at/products/avrusb/license.html">additional terms</a> that especially apply as long as the shared obdev vid/pid pair is used.</p>
<p>The atmega, especially if powered by 5 Volts as in this device, cannot comply to the electrical part of the USB standard. Nevertheless, it works well with a large range of computers. However, there is no guarantee that it will not destroy your USB controller or your entire computer, so keep in mind the last sentence of the GPL: This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.</p>

<div class="ngg-galleryoverview" id="ngg-gallery--41">


	
	<!-- Thumbnails -->
		
	<div id="ngg-image-10604" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://andreas.goelzer.de/photos/elektronik/usbmot/usbmot.png" title="usbmot.png" class="thickbox" rel="usbmot" >
				<img title=" " alt=" " src="http://andreas.goelzer.de/photos/elektronik/usbmot/thumbs/thumbs_usbmot.png" width="130" height="83" />
			</a>
		</div>
	</div>
	 		
	<div id="ngg-image-10611" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://andreas.goelzer.de/photos/elektronik/usbmot/usbmot_in_action.jpg" title="usbmot_in_action.jpg" class="thickbox" rel="usbmot" >
				<img title=" " alt=" " src="http://andreas.goelzer.de/photos/elektronik/usbmot/thumbs/thumbs_usbmot_in_action.jpg" width="130" height="83" />
			</a>
		</div>
	</div>
	 		
	<div id="ngg-image-10616" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://andreas.goelzer.de/photos/elektronik/usbmot/usbmot_assembly_diagram.png" title="usbmot_assembly_diagram.png" class="thickbox" rel="usbmot" >
				<img title=" " alt=" " src="http://andreas.goelzer.de/photos/elektronik/usbmot/thumbs/thumbs_usbmot_assembly_diagram.png" width="130" height="83" />
			</a>
		</div>
	</div>
	 		
	<div id="ngg-image-10617" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://andreas.goelzer.de/photos/elektronik/usbmot/usbmot_screenshot.png" title="usbmot_screenshot.png" class="thickbox" rel="usbmot" >
				<img title=" " alt=" " src="http://andreas.goelzer.de/photos/elektronik/usbmot/thumbs/thumbs_usbmot_screenshot.png" width="130" height="83" />
			</a>
		</div>
	</div>
	 	 	
	<!-- Pagination -->
 	<div class="ngg-clear">&nbsp;</div> 	
</div>


<hr /><a href='http://andreas.goelzer.de/download/usbmot_software.tar.bz2'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-compressed.png" width="16" height="16" alt="filetype" class="icon16" /> usbmot_software.tar.bz2</a> (723.15 kiB, 2008-11-03)<br/><a href='http://andreas.goelzer.de/download/usbmot_trunk.tar.bz2'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-compressed.png" width="16" height="16" alt="filetype" class="icon16" /> usbmot_trunk.tar.bz2</a> (759.19 kiB, 2008-11-21)<br/><a href='http://andreas.goelzer.de/download/usbmot_schematic.pdf'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-pdf.png" width="16" height="16" alt="filetype" class="icon16" /> usbmot_schematic.pdf</a> (93.99 kiB, 2008-10-29)<br/><a href='http://andreas.goelzer.de/download/usbmot_pcb.pdf'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-pdf.png" width="16" height="16" alt="filetype" class="icon16" /> usbmot_pcb.pdf</a> (194.58 kiB, 2008-10-29)<br/><a href='http://andreas.goelzer.de/download/usbmot_eagle_pcb.tar.bz2'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-compressed.png" width="16" height="16" alt="filetype" class="icon16" /> usbmot_eagle_pcb.tar.bz2</a> (73.22 kiB, 2008-11-21)<br/><hr />
]]></content:encoded>
			<wfw:commentRss>http://andreas.goelzer.de/usbmot/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>kernel config based on lsmod output</title>
		<link>http://andreas.goelzer.de/kernel-config-based-on-lsmod-output</link>
		<comments>http://andreas.goelzer.de/kernel-config-based-on-lsmod-output#comments</comments>
		<pubDate>Mon, 06 Oct 2008 11:35:20 +0000</pubDate>
		<dc:creator>Andreas Goelzer</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://andreas.goelzer.de/?p=23</guid>
		<description><![CDATA[After reading about the amazing 5-seconds bootup I decided to once again compile a kernel myself. Compiling a kernel is almost trivial these days, but customizing the configuration can still be quite confusing. For example, the names of the modules &#8230; <a href="http://andreas.goelzer.de/kernel-config-based-on-lsmod-output">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>After reading about the amazing <a href="http://lwn.net/Articles/299483/">5-seconds bootup</a> I decided to once again compile a kernel myself. Compiling a kernel is almost trivial these days, but customizing the configuration can still be quite confusing. For example, the names of the modules in lsmod aren&#8217;t the ones you select as config options. To map them, I found some scripts in the <a href="http://wiki.linuxquestions.org/wiki/Configuring_linux_kernel">LQWiki</a>, but they weren&#8217;t that easily to use, and also programming in bash is just painful.</p>
<p>So i wrote a python variant, that takes an input config(for example your distributions config) and changes the reply to &#8220;y&#8221; for all config options if the respective module is loaded(ie. if ext3 is loaded, CONFIG_EXT3_FS=y will be set).</p>
<p>In almost all cases you still want to tweak the resulting config file with make menuconfig. Also keep in mind that some things don&#8217;t work that easily if compiled in, for example if firmware has to be loaded from a file, the disk should be accessible.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
<span style="color: #808080; font-style: italic;"># -*- coding: utf-8 -*-</span>
<span style="color: #483d8b;">&quot;&quot;&quot;
Script to modify kernel config based on lsmod output
Copyright (C) 2008  Andreas Goelzer
&nbsp;
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
&nbsp;
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
&nbsp;
You should have received a copy of the GNU General Public License
along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
&nbsp;
&nbsp;
Based on a previous config and the output of lsmod, this script determines
which modules could be compiled in and generates a new config.
See http://andreas.goelzer.de/kernel-config-based-on-lsmod-output for updates
&quot;&quot;&quot;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span><span style="color: #66cc66;">;</span>
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">optparse</span> <span style="color: #ff7700;font-weight:bold;">import</span> OptionParser<span style="color: #66cc66;">;</span>
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">os</span> <span style="color: #ff7700;font-weight:bold;">import</span> popen<span style="color: #66cc66;">;</span>
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">sys</span> <span style="color: #ff7700;font-weight:bold;">import</span> stderr, stdout, stdin<span style="color: #66cc66;">;</span>
&nbsp;
<span style="color: #dc143c;">parser</span> = OptionParser<span style="color: black;">&#40;</span>version=<span style="color: #483d8b;">&quot;%prog 0.31&quot;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;-i&quot;</span>, <span style="color: #483d8b;">&quot;--infile&quot;</span>, dest=<span style="color: #483d8b;">&quot;cfgfile&quot;</span>,
                  <span style="color: #008000;">help</span>=<span style="color: #483d8b;">&quot;input config file&quot;</span>, default=<span style="color: #483d8b;">&quot;.config&quot;</span>, metavar=<span style="color: #483d8b;">&quot;FILE&quot;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;-o&quot;</span>, <span style="color: #483d8b;">&quot;--outfile&quot;</span>, dest=<span style="color: #483d8b;">&quot;outfile&quot;</span>,
                  <span style="color: #008000;">help</span>=<span style="color: #483d8b;">&quot;output config file&quot;</span>, default=<span style="color: #483d8b;">&quot;-&quot;</span>, metavar=<span style="color: #483d8b;">&quot;FILE&quot;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;-l&quot;</span>, <span style="color: #483d8b;">&quot;--logfile&quot;</span>, dest=<span style="color: #483d8b;">&quot;logfile&quot;</span>,
                  <span style="color: #008000;">help</span>=<span style="color: #483d8b;">&quot;file to log errors to&quot;</span>, default=<span style="color: #483d8b;">&quot;-&quot;</span>, metavar=<span style="color: #483d8b;">&quot;FILE&quot;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;-s&quot;</span>, <span style="color: #483d8b;">&quot;--sourcedir&quot;</span>, dest=<span style="color: #483d8b;">&quot;sourcedir&quot;</span>,
                  <span style="color: #008000;">help</span>=<span style="color: #483d8b;">&quot;kernel source tree&quot;</span>, default=<span style="color: #483d8b;">&quot;.&quot;</span>, metavar=<span style="color: #483d8b;">&quot;DIR&quot;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #808080; font-style: italic;">#parser.add_option(&quot;-v&quot;, &quot;--verbose&quot;,</span>
                  <span style="color: #808080; font-style: italic;">#action=&quot;store_true&quot;, dest=&quot;verbose&quot;, default=False,</span>
                  <span style="color: #808080; font-style: italic;">#help=&quot;print debug messages&quot;);</span>
&nbsp;
<span style="color: black;">&#40;</span>options, args<span style="color: black;">&#41;</span> = <span style="color: #dc143c;">parser</span>.<span style="color: black;">parse_args</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #ff7700;font-weight:bold;">if</span><span style="color: black;">&#40;</span>options.<span style="color: black;">outfile</span> == <span style="color: #483d8b;">'-'</span><span style="color: black;">&#41;</span>: of = stdout<span style="color: #66cc66;">;</span>
<span style="color: #ff7700;font-weight:bold;">else</span>: of = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>options.<span style="color: black;">outfile</span>, <span style="color: #483d8b;">'w'</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #ff7700;font-weight:bold;">if</span><span style="color: black;">&#40;</span>options.<span style="color: black;">logfile</span> <span style="color: #66cc66;">!</span>= <span style="color: #483d8b;">'-'</span><span style="color: black;">&#41;</span>: stderr = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>options.<span style="color: black;">logfile</span>, <span style="color: #483d8b;">'w'</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
&nbsp;
loadedmods=popen<span style="color: black;">&#40;</span><span style="color: #483d8b;">'lsmod | tail -n+2'</span><span style="color: black;">&#41;</span>.<span style="color: black;">readlines</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
getmodname=<span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">&quot;^(?P&lt;modname&gt;<span style="color: #000099; font-weight: bold;">\w</span>*)&quot;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#prob. need to replace kernel with sth. like (kernel|ubuntu) for an ubuntu kernel source</span>
parsepath=<span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">&quot;/kernel(?P&lt;path&gt;/.*/)(?P&lt;file&gt;.*).ko&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
wantin=<span style="color: black;">&#91;</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">;</span>
<span style="color: #ff7700;font-weight:bold;">for</span> module <span style="color: #ff7700;font-weight:bold;">in</span> loadedmods:
	modname = <span style="color: #dc143c;">re</span>.<span style="color: black;">search</span><span style="color: black;">&#40;</span>getmodname,module<span style="color: black;">&#41;</span>.<span style="color: black;">group</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'modname'</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
	moduleprops=<span style="color: #dc143c;">re</span>.<span style="color: black;">search</span><span style="color: black;">&#40;</span>parsepath,popen<span style="color: black;">&#40;</span><span style="color: #483d8b;">'modinfo -n '</span> + modname<span style="color: black;">&#41;</span>.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
	<span style="color: #ff7700;font-weight:bold;">if</span><span style="color: black;">&#40;</span>moduleprops<span style="color: black;">&#41;</span>:
		<span style="color: #808080; font-style: italic;">#search the makefile for the module name</span>
		<span style="color: #ff7700;font-weight:bold;">try</span>:
			f=<span style="color: #008000;">open</span><span style="color: black;">&#40;</span>options.<span style="color: black;">sourcedir</span> + moduleprops.<span style="color: black;">group</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'path'</span><span style="color: black;">&#41;</span> + <span style="color: #483d8b;">'Makefile'</span> , <span style="color: #483d8b;">'r'</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
		<span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">IOError</span>:
			stderr.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Could not find Makefile for '</span> + modname + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
			<span style="color: #ff7700;font-weight:bold;">continue</span>
		cont=f.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
		f.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
		m=<span style="color: #dc143c;">re</span>.<span style="color: black;">search</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">&quot;obj-<span style="color: #000099; font-weight: bold;">\$</span><span style="color: #000099; font-weight: bold;">\(</span>(?P&lt;cfgname&gt;[A-Z0-9_]*)<span style="color: #000099; font-weight: bold;">\)</span><span style="color: #000099; font-weight: bold;">\W</span>*<span style="color: #000099; font-weight: bold;">\+</span>=<span style="color: #000099; font-weight: bold;">\W</span>*&quot;</span>+moduleprops.<span style="color: black;">group</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'file'</span><span style="color: black;">&#41;</span>+r<span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\.</span>o&quot;</span>,cont<span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
		<span style="color: #ff7700;font-weight:bold;">if</span><span style="color: black;">&#40;</span>m<span style="color: black;">&#41;</span>:wantin.<span style="color: black;">append</span><span style="color: black;">&#40;</span>m.<span style="color: black;">group</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'cfgname'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
		<span style="color: #ff7700;font-weight:bold;">else</span>:stderr.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Could not determine config name for '</span> + modname + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
	<span style="color: #ff7700;font-weight:bold;">else</span>:
		stderr.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Could not parse modinfo for '</span> + modname + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span><span style="color: black;">&#40;</span>options.<span style="color: black;">cfgfile</span> <span style="color: #66cc66;">!</span>= <span style="color: #483d8b;">'-'</span><span style="color: black;">&#41;</span>: 
	f=<span style="color: #008000;">open</span><span style="color: black;">&#40;</span>options.<span style="color: black;">cfgfile</span>, <span style="color: #483d8b;">'r'</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
	lines=f.<span style="color: black;">readlines</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
	f.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #ff7700;font-weight:bold;">else</span>:
	lines=stdin.<span style="color: black;">readlines</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
confparse = <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\W</span>*(?P&lt;iscomment&gt;#?)<span style="color: #000099; font-weight: bold;">\W</span>*(?P&lt;cfgname&gt;CONFIG_[A-Z0-9_]*)<span style="color: #000099; font-weight: bold;">\W</span>*=?<span style="color: #000099; font-weight: bold;">\W</span>*(?P&lt;answer&gt;[nmy]?)&quot;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">for</span> line <span style="color: #ff7700;font-weight:bold;">in</span> lines:
	matches = <span style="color: #dc143c;">re</span>.<span style="color: black;">search</span><span style="color: black;">&#40;</span>confparse,line<span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
	<span style="color: #ff7700;font-weight:bold;">if</span><span style="color: black;">&#40;</span>matches <span style="color: #ff7700;font-weight:bold;">and</span> matches.<span style="color: black;">group</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'cfgname'</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">in</span> wantin<span style="color: black;">&#41;</span>: 
		of.<span style="color: black;">write</span><span style="color: black;">&#40;</span>matches.<span style="color: black;">group</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'cfgname'</span><span style="color: black;">&#41;</span>+<span style="color: #483d8b;">'=y<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
	<span style="color: #ff7700;font-weight:bold;">else</span>: 
		<span style="color: #808080; font-style: italic;">#if(matches and matches.group('answer') == 'm'):of.write(matches.group('cfgname')+'=n\n');</span>
		of.<span style="color: black;">write</span><span style="color: black;">&#40;</span>line<span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span></pre></td></tr></table></div>

<hr /><a href='http://andreas.goelzer.de/download/customconfig.py'><img src="http://andreas.goelzer.de/wp-content/plugins/kfile/fileicons/file-source-alt.png" width="16" height="16" alt="filetype" class="icon16" /> customconfig.py</a> (3.41 kiB, 2009-05-19)<br/><br />
<hr />To use the script, call it for example like <code>./customconfig.py -i /boot/config-2.6.24-21-generic -o .config</code> if it is located in a linux kernel directory. Then modify the resulting config to suit your needs with <code>make menuconfig</code>, and then you can proceed to compile your kernel.</p>
]]></content:encoded>
			<wfw:commentRss>http://andreas.goelzer.de/kernel-config-based-on-lsmod-output/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>World of Overkill</title>
		<link>http://andreas.goelzer.de/world-of-overkill</link>
		<comments>http://andreas.goelzer.de/world-of-overkill#comments</comments>
		<pubDate>Thu, 18 Sep 2008 17:33:33 +0000</pubDate>
		<dc:creator>Andreas Goelzer</dc:creator>
				<category><![CDATA[Musings]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://andreas.goelzer.de/?p=13</guid>
		<description><![CDATA[Think about an ordinary man on an ordinary day. He drives to work using 1.5 tons of steel, with an engine strong enough to carry two cows to the slaughterhouse, does some work in some office, using some 3 GHz &#8230; <a href="http://andreas.goelzer.de/world-of-overkill">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Think about an ordinary man on an ordinary day. He drives to work using 1.5 tons of steel, with an engine strong enough to carry two cows to the slaughterhouse, does some work in some office, using some 3 GHz machine to answer some emails and print some forms. Later that day he goes home, where roughly 400 cubic meters of air and some more of wood and concrete are heated to comfortable 23 degrees Celsius, to provide a comfortable evening for 0.1 cubic meters of person.</p>
<p>That is one hell of a potential for saving goods and energy. The question is just, how would one realize it? Treehuggers would like you to not use a car, and instead use a train or a bike. But it&#8217;s cold out there, waiting for the bus. Some German politician wants people to heat to only 16 degrees Celsius, to save some money. But, even with a warm coat, that&#8217;s still chilly. Does it have to get cold out there?</p>
<p>Surely not. We have all those technology at hand, fulfilling our basic needs should still be possible without sacrificing too much comfort, perhaps even with gaining a little. Lets just start from the cold, and solve things from there.<br />
Think of an, for lack of a better word, <a href="http://babylon5.wikia.com/wiki/Encounter_suit">encountersuit</a> &#8211; close that create a nice environment directly above your skin. Since several thousand years clothing hasn&#8217;t improved much. Today&#8217;s clothes might be lighter, and better tailored than the pelts the first humans wore, but, and that is something I find truly amazing, they don&#8217;t fulfill their function better if we limit our discussion to everyday clothes and exclude things like neoprene suit, body armor and arctic expedition clothing. Although temperature sensors are a couple of cents, small motors and microcontrollers are available for around 2 euro, and batteries are a bit more expensive, but still far cheaper than a designer suit &#8211; we do not use them in our clothing. At material costs less than 100 euro it should be possible to build a simple temperature-controlled suit, that would actively warm you in those cold places out there. It could also cool you down just the right amount to prevent you from sweating. On hot summer days it&#8217;ll get a bit more difficult, but perhaps with a lighter suit with some more built-in fans could solve that. And washing the suit would also be a problem.</p>
<p>So suppose we could build such a suit. Now we could ride a bike, the fans would prevent us from sweating, and the heater wires would keep our fingers warm. Maybe it could even heat up the air we breathe. But still, biking is not to everybodys liking. How about an electric skateboard instead? Controls could be easily integrated into the encountersuit, and it fits much better into a go to community center, take train from there scenario; it neatly fits into a backpack.</p>
<p>At home, we also wouldn&#8217;t have to worry that much about the temperature. we&#8217;d just have to heat enough to prevent mold, and heat the bathroom and the bedroom on those occasions where we&#8217;d slip out of the suit.</p>
<p>The technical component is but one part of the solution. At some occasions, you need more than an electrical skateboard. But that doesn&#8217;t mean everybody has to have 1.5 tons of steel in some garage, several people could share a car. You wouldn&#8217;t neccessarily lose comfort, you could even gain some &#8211; on some occasions you&#8217;d need a caravan, on some an offroader. Car pools and car renting services can solve that quite well, especially if people wouldn&#8217;t need a car every day at seven.</p>
<p>In Germany there are 55 million vehicles. for 80 million people. Suppose every car is driven on average one hour per day. That means, in theory 23 of 24 cars are not needed. Even if the sharing would be quite horribly inefficient and most people would still not go for a bus/skateboard combination, if every second car could be saved, and we evaluate every car at 10 k€, we could save 275 G€, more than the german government manages to <strike>waste</strike> spend for the greater good every year. That would be roughly 3.5 k€ per citizen, more than enough for some high-tech warm clothes.</p>
<p>The problem with both using devices that just can do the necessary, like the skateboard, and sharing stuff seems to be the human mind. We do not evaluate our wealth by the things we actually use, or could rent and use, but archaically by the things we do own.</p>
<p>And that is the world of overkill.</p>
]]></content:encoded>
			<wfw:commentRss>http://andreas.goelzer.de/world-of-overkill/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)

Served from: andreas.goelzer.de @ 2010-09-04 00:19:44 -->