<?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>t-square &#187; Tim Teatro</title>
	<atom:link href="http://www.timteatro.net/author/admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.timteatro.net</link>
	<description>Pursuit of Inspiration, Imagination and Science.</description>
	<lastBuildDate>Mon, 01 Oct 2012 20:52:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>TeXLive 2012 on Ubuntu 12.04</title>
		<link>http://www.timteatro.net/2012/10/01/tex-live-2012-on-ubuntu-12-04/</link>
		<comments>http://www.timteatro.net/2012/10/01/tex-live-2012-on-ubuntu-12-04/#comments</comments>
		<pubDate>Mon, 01 Oct 2012 06:32:26 +0000</pubDate>
		<dc:creator>Tim Teatro</dc:creator>
				<category><![CDATA[Software & FOSS]]></category>
		<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.timteatro.net/?p=1109</guid>
		<description><![CDATA[After years of wrestling with the out-of-date TeXLive packages with Ubuntu and Fedora, I started simply using the official TeXLive packages. It is easy and highly pleasurable to have completely up to date packages and a full set of package maintenance tools.]]></description>
				<content:encoded><![CDATA[<p>
After years of wrestling with the out-of-date TeXLive packages with Ubuntu and Fedora, I started simply using the official TeXLive packages. It is easy and highly pleasurable to have completely up to date packages and a full set of package maintenance tools.
</p>
<p>
Manually installing TeX Live is pretty simple. The hardest part is tricking Ubuntu&#8217;s package manager into knowing that TeX Live is installed without it having to have the copy from the repos.
</p>
<p>
To start, just download the small gzip <a href="http://www.tug.org/texlive/acquire-netinstall.html">from here</a>. Unpack it and change directory into it in a terminal.<br />
<code>sudo apt-get install perl-tk</code><br />
which you&#8217;ll need for the installer GUI. Now, run the installer:<br />
<code>sudo ./install-tl --gui</code>
</p>
<p>
Once you&#8217;re in the installer, go through the list of options. If you don&#8217;t know what they do, you probably don&#8217;t need to bother with it. The main one to look out for are A4 vs. Letter paper. I do generate the simlinks, but if you don&#8217;t can manually edit your PATH variable later. Hit the <i>install</i> button and go make yourself a sandwich. You&#8217;ll be a while.
</p>
<p>
At the end of the install, you&#8217;ll get the following message</p>
<blockquote><p>
    Add /usr/local/texlive/2012/texmf/doc/man to MANPATH.<br />
    Add /usr/local/texlive/2012/texmf/doc/info to INFOPATH.<br />
    Most importantly, add /usr/local/texlive/2012/bin/x86-linux<br />
    to your PATH for current and future sessions.
</p></blockquote>
<p>Note, you&#8217;ll get a message which reflects your architecture. (x86_64, for example.)
</p>
<p>
So, if you didn&#8217;t opt in to have the symlinks generated for you, you&#8217;ll have to add those directories to the path variable. Edit your bashrc:<br />
<code> gedit ~/.bashrc</code><br />
and added the following lines:</p>
<pre class="brush: plain; title: ; notranslate">
export PATH=$PATH:/usr/local/texlive/2012/bin/i386-linux
export MANPATH=$MANPATH:/usr/local/texlive/2012/texmf/doc/man
export INFOPATH=$INFOPATH:/usr/local/texlive/2012/texmf/doc/info
</pre>
</p>
<p>
Now, install a few more packages:<br />
<code>sudo apt-get install tex-common texinfo lmodern perl-tk</code><br />
Be sure to restart the terminal (or <code>source ~/.bashrc</code>) before you try using anything.
</p>
<p>
Now, if you try to bring anything from the repositories that depends on TeX Live, apt is going to pull over Ubuntu&#8217;s crappy copy. To avoid this, I created a meta package which checks off all of the TeX Live packages but doesn&#8217;t install anything.
</p>
<p>
I got the following from <a href="http://blogs.ethz.ch/ubuntu/2011/03/14/tex-live-2010-installation/">schlasim&#8217;s ubuntu blog</a>. First, paste and execute the following lines one at a time:</p>
<pre class="brush: plain; title: ; notranslate">
sudo apt-get install equivs
mkdir /tmp/tl-equivs &amp;&amp; cd /tmp/tl-equivs
equivs-control texlive-local
</pre>
<p>Now, edit the file texlive-local (<code>gedit texlive-local</code>), which was just created by the equivs-control program. Paste in the following lines:</p>
<pre class="brush: plain; title: ; notranslate">
Section: misc
Priority: optional
Standards-Version: 3.6.2
 
Package: texlive-local
Version: 2012-1~1
Maintainer: you 
Provides: biblatex, biblatex-dw, cm-super, cm-super-minimal, context, dvipng,
 feynmf, fragmaster, lacheck, latex-beamer, latex-cjk-all, latex-cjk-chinese,
 latex-cjk-chinese-arphic-bkai00mp, latex-cjk-chinese-arphic-bsmi00lp,
 latex-cjk-chinese-arphic-gbsn00lp, latex-cjk-chinese-arphic-gkai00mp,
 latex-cjk-common, latex-cjk-japanese, latex-cjk-japanese-wadalab,
 latex-cjk-korean, latex-cjk-thai, latex-cjk-xcjk, latexmk, latex-sanskrit,
 latex-xcolor, lcdf-typetools, lmodern, luatex, musixlyr, musixtex, pgf,
 preview-latex-style, prosper, ps2eps, psutils, purifyeps, t1utils, tex4ht,
 tex4ht-common, tex-gyre, texlive, texlive-base, texlive-base-bin,
 texlive-base-bin-doc, texlive-bibtex-extra, texlive-binaries, texlive-common,
 texlive-doc-base, texlive-doc-bg, texlive-doc-cs+sk, texlive-doc-de,
 texlive-doc-el, texlive-doc-en, texlive-doc-es, texlive-doc-fi,
 texlive-doc-fr, texlive-doc-it, texlive-doc-ja, texlive-doc-ko,
 texlive-doc-mn, texlive-doc-nl, texlive-doc-pl, texlive-doc-pt,
 texlive-doc-ru, texlive-doc-si, texlive-doc-th, texlive-doc-tr,
 texlive-doc-uk, texlive-doc-vi, texlive-doc-zh, texlive-extra-utils,
 texlive-fonts-extra, texlive-fonts-extra-doc, texlive-fonts-recommended,
 texlive-fonts-recommended-doc, texlive-font-utils, texlive-formats-extra,
 texlive-games, texlive-generic-extra, texlive-generic-recommended,
 texlive-humanities, texlive-humanities-doc, texlive-lang-african,
 texlive-lang-all, texlive-lang-arab, texlive-lang-arabic,
 texlive-lang-armenian, texlive-lang-croatian, texlive-lang-cyrillic,
 texlive-lang-czechslovak, texlive-lang-danish, texlive-lang-dutch,
 texlive-lang-finnish, texlive-lang-french, texlive-lang-german,
 texlive-lang-greek, texlive-lang-hebrew, texlive-lang-hungarian,
 texlive-lang-indic, texlive-lang-italian, texlive-lang-latin,
 texlive-lang-latvian, texlive-lang-lithuanian, texlive-lang-manju,
 texlive-lang-mongolian, texlive-lang-norwegian, texlive-lang-other,
 texlive-lang-polish, texlive-lang-portuguese, texlive-lang-spanish,
 texlive-lang-swedish, texlive-lang-tibetan, texlive-lang-ukenglish,
 texlive-lang-vietnamese, texlive-latex3, texlive-latex-base,
 texlive-latex-base-doc, texlive-latex-extra, texlive-latex-extra-doc,
 texlive-latex-recommended, texlive-latex-recommended-doc, texlive-luatex,
 texlive-math-extra, texlive-metapost, texlive-metapost-doc, texlive-music,
 texlive-omega, texlive-pictures, texlive-pictures-doc, texlive-plain-extra,
 texlive-pstricks, texlive-pstricks-doc, texlive-publishers,
 texlive-publishers-doc, texlive-science, texlive-science-doc, texlive-xetex,
 texpower, texpower-manual, thailatex, tipa, ttf-freefont, ttf-gfs-artemisia,
 ttf-gfs-baskerville, ttf-gfs-bodoni-classic, ttf-gfs-didot,
 ttf-gfs-didot-classic, ttf-gfs-gazis, ttf-gfs-neohellenic, ttf-gfs-olga,
 ttf-gfs-porson, ttf-gfs-solomos, ttf-gfs-theokritos, ttf-sil-gentium, xindy,
 xindy-rules
Architecture: all
Description: My local installation of TeX Live 2011.
 A full &quot;vanilla&quot; TeX Live 2011

http://tug.org/texlive/debian#vanilla

</pre>
<p>Now, finish off by executing the last two lines:</p>
<pre class="brush: plain; title: ; notranslate">
equivs-build texlive-local
sudo dpkg -i texlive-local_2011-1~1_all.deb
</pre>
</p>
<p>
You should now be able to maintain your own TeX Live installation. You can update or install packages as you see fit, and you don&#8217;t have to deal with out of date packages causing you frustration.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.timteatro.net/2012/10/01/tex-live-2012-on-ubuntu-12-04/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Beginning Atmel AVR Development in Linux using AVR-Eclipse, AVR-GCC and AVRDUDE</title>
		<link>http://www.timteatro.net/2012/03/22/beginning-atmel-avr-development-in-linux-using-avr-eclipse-avr-gcc-and-avrdude/</link>
		<comments>http://www.timteatro.net/2012/03/22/beginning-atmel-avr-development-in-linux-using-avr-eclipse-avr-gcc-and-avrdude/#comments</comments>
		<pubDate>Thu, 22 Mar 2012 15:45:51 +0000</pubDate>
		<dc:creator>Tim Teatro</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Software & FOSS]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Atmel AVR]]></category>
		<category><![CDATA[AVR-GCC]]></category>
		<category><![CDATA[AVRDUDE]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Microcontrollers]]></category>
		<category><![CDATA[Physical computing]]></category>

		<guid isPermaLink="false">http://www.timteatro.net/?p=1262</guid>
		<description><![CDATA[For a beginning AVR developer with more typical platform programming experience, introductory information can seem scattered and sparse. There are a lot of programming tutorials, but since many people develop on Windows using AVR Studio, getting started using Linux can have a steeper learning curve. This article aims to be a complete introduction to setting up the hardware and software IDE for developing for the AVR platform.]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.timteatro.net/wp-content/uploads/2012/03/beginning_AVR_Linux.png"><img src="http://www.timteatro.net/wp-content/uploads/2012/03/beginning_AVR_Linux-250x300.png" alt="" title="beginning_AVR_Linux" width="250" height="300" class="alignright size-medium wp-image-1345" /></a>For a beginning AVR developer with more typical platform programming experience, introductory information can seem scattered and sparse. There are a lot of programming tutorials, but since many people develop on Windows using AVR Studio, getting started using Linux can have a steeper learning curve. This article aims to be a complete introduction to setting up the hardware and software IDE under Linux for developing for the AVR platform.</p>
<p>I strive to use open-source and widely available software and hardware, to make everything as accessible as possible to the beginner.</p>
<h2>The Development Environment</h2>
<p>On the software side of things, I assume the reader is using either <a href="http://www.ubuntu.com/" title="Canonical's Ubuntu homepage" target="_blank">Ubuntu</a> or <a href="http://fedoraproject.org/" title="The Fedora Core site" target="_blank">Fedora Core</a>. We will be using the <a href="http://www.avrfreaks.net/wiki/index.php/Documentation:AVR_GCC" title="AVR Freaks Wiki for AVR-GCC" target="_blank">AVR-GCC compiler</a> to emit machine code and <a href="http://www.nongnu.org/avrdude/" title="AVRDUDE site" target="_blank">AVRDUDE</a> to upload the code to the Atmel microcontroller. To integrate and streamline the development process, we will use <a href="http://www.eclipse.org/" title="Eclipse website" target="_blank">Eclipse</a>.</p>
<p>To upload the software to the microcontroller, buy or build <a href="http://www.ladyada.net/make/usbtinyisp/" title="Ladyada USBtinyISP site" target="_blank">Adafruit&#8217;s USBtinyISP</a> or equivalent [<a href="http://search.digikey.com/ca/en/products/ATAVRISP2/ATAVRISP2-ND/898891" title="Atmel ISP programmer" target="_blank">Digikey</a>]. The USBtinyISP is directly supported by AVRDUDE and can be built from your own parts using <a href="http://www.ladyada.net/make/usbtinyisp/download.html" title="Schematics of USBtinyISP" target="_blank">freely available schematics</a>, or purchased as a kit. You will also need to build a target board, which is covered in a later section.</p>
<h2>Installing the Software Environment</h2>
<p>The base environment is AVR-GCC and AVRDUDE. You can download and install individually, but the easiest solution is to grab them from your distribution&#8217;s repos:<br />
In Ubuntu</p>
<pre class="brush: plain; title: ; notranslate">
apt-get install avrdude binutils-avr gcc-avr avr-libc gdb-avr
</pre>
<p>In Fedora Core</p>
<pre class="brush: plain; title: ; notranslate">
yum install uisp avr-libc avr-gcc-c++ rxtx avrdude
</pre>
<p>Alternatively, you can just yum or apt-get install the Arduino development environment. If you have not yet, Arduino may be something you want to play with later anyway for rapid prototyping.</p>
<p>The Eclipse version in the Ubuntu repos did not take AVR-Eclipse, so I work with a copy right from the <a href="http://www.eclipse.org/downloads/" title="Eclipse download site" target="_blank">Eclipse download site</a>.</p>
<h2>Add udev rule for programmer</h2>
<p>When executing AVRDUDE, it may give an error such as</p>
<pre class="brush: plain; title: ; notranslate">
avrdude: error: usbtiny_transmit: error sending control message: Operation not permitted.
</pre>
<p>As a quick fix, run AVRDUDE as root (or sudo). To permanently fix it, create the text file <code>/etc/udev/rules.d/10-usbtinyisp.rules</code>. In it, place the code</p>
<pre class="brush: plain; title: ; notranslate">
SUBSYSTEM==&quot;usb&quot;, SYSFS{idVendor}==&quot;1781&quot;, SYSFS{idProduct}==&quot;0c9f&quot;, GROUP=&quot;adm&quot;, MODE=&quot;0666&quot;
</pre>
<p>Now restart udev by executing <code>sudo restart udev</code>.</p>
<h2>Setting up AVR-Eclipse</h2>
<p>It is not uncommon to see physical computing nerds hunched over a Vim window and shuffling Makefiles. If you are not already familiar with those tools (especially make), it is not the best system to learn with.</p>
<p>AVR-Eclipse provides an integrated interface for editing code, compiling and uploading to the device. And, not to be undervalued, also has a GUI to set fuses and lock bits. It generates Makefiles, so if and when you are ready to graduate from an IDE back to bare bones then you will have something familiar to work from.</p>
<p>Open Eclipse and click <i>Help > Install New Software</i>. This will open a dialogue, at the top of which is a text box labelled <i>Work with</i>. In that text box, paste the address of the AVR-Eclipse update server <i>(http://avr-eclipse.sourceforge.net/updatesite/)</i>.<br />
<a href="http://www.timteatro.net/wp-content/uploads/2012/03/avr-eclipse_install1.png"><img src="http://www.timteatro.net/wp-content/uploads/2012/03/avr-eclipse_install1-300x241.png" alt="" title="avr-eclipse_install" width="300" height="241" class="aligncenter size-medium wp-image-1321" /></a><br />
Select the AVR-Eclipse plugin and click next. The installer will ask you a series of installation related questions that you can just rapid-click your way through. Once done, restart and now you should see an extra option, <i>AVR</i> on the top of the Eclipse window.<br />
<a href="http://www.timteatro.net/wp-content/uploads/2012/03/avr-eclipse_window.png"><img src="http://www.timteatro.net/wp-content/uploads/2012/03/avr-eclipse_window-300x168.png" alt="" title="avr-eclipse_window" width="300" height="168" class="aligncenter size-medium wp-image-1324" /></a></p>
<p>Now, click <i>Window > Preferences</i> and expand the <i>AVR</i> entry on the right.<br />
<a href="http://www.timteatro.net/wp-content/uploads/2012/03/avr-eclipse_config_avr.png"><img src="http://www.timteatro.net/wp-content/uploads/2012/03/avr-eclipse_config_avr-300x254.png" alt="" title="avr-eclipse_config_avr" width="300" height="254" class="aligncenter size-medium wp-image-1325" /></a><br />
Beside <i>Programmer Configurations</i> click <i>Add</i>. In the new window that appears, scroll to find USBtiny near the bottom of the lot.<br />
<a href="http://www.timteatro.net/wp-content/uploads/2012/03/avr-eclipse_config_usbtiny.png"><img src="http://www.timteatro.net/wp-content/uploads/2012/03/avr-eclipse_config_usbtiny-300x233.png" alt="" title="avr-eclipse_config_usbtiny" width="300" height="233" class="aligncenter size-medium wp-image-1326" /></a><br />
Click <i>Ok</i> and return to the main preferences window. You can click on the <i>Paths</i> entry under <i>AVR</i>, but it hangs the window. However, the default paths seem fine.</p>
<p>AVR-Eclipse should now be installed and configured. Not done yet however, you will need to set more configuration options for each  project. If you are ready for that, look ahead to <i><b>Creating a New AVR-Eclipse Project</b></i>. Otherwise, continue to finish the hardware setup.</p>
<h2>Building a target board</h2>
<p><div id="attachment_1280" class="wp-caption alignright" style="width: 310px"><a href="http://www.timteatro.net/wp-content/uploads/2012/03/avr_target_board.jpg"><img src="http://www.timteatro.net/wp-content/uploads/2012/03/avr_target_board-300x168.jpg" width="300" height="168" class="size-medium wp-image-1280" /></a><p class="wp-caption-text">Example target board.</p></div> In order to program your AVR chip, you will need to build a target board, or set one up on a solderless breadboard. This is a simple circuit which routes the ISP interface from your programmer to the proper pins of your AVR chip. The picture to the right shows a rough target board made from a small piece of pad-per-hole board [cheap Chinese junk], a six-pin header [<a href="http://search.digikey.com/scripts/DkSearch/dksus.dll?WT.z_header=search_go&#038;lang=en&#038;site=ca&#038;keywords=3M9459-ND&#038;x=0&#038;y=0" target="_blank">Digikey</a>], and a Zero Insertion Force (ZIF) socket [<a href="http://search.digikey.com/ca/en/cat/connectors-interconnects/sockets-for-ics-transistors/1442972?k=A302-ND" target="_blank">Digikey</a>, Ebay is great for these].</p>
<p><div id="attachment_1299" class="wp-caption alignright" style="width: 310px"><a href="http://www.timteatro.net/wp-content/uploads/2012/03/ISP_6pin_pinout1.png"><img src="http://www.timteatro.net/wp-content/uploads/2012/03/ISP_6pin_pinout1-300x136.png" alt="" title="ISP_6pin_pinout" width="300" height="136" class="size-medium wp-image-1299" /></a><p class="wp-caption-text">6-pin AVR ISP Pinout.</p></div> Most commonly, you will be using the 6-pin ISP interface: Vcc, Gnd, SCK, MISO, MOSI and Reset are the pins (See FIG, right). You will need to trace each one of these to the corresponding pins on your AVR chip. To find out which pins, you will need to consult the datasheet for your desired chip. As an example, below is the pin configuration clipped from the ATtiny25/45/85.</p>
<div id="attachment_1290" class="wp-caption aligncenter" style="width: 460px"><a href="http://www.timteatro.net/wp-content/uploads/2012/03/ATtiny_pin_config1.png"><img src="http://www.timteatro.net/wp-content/uploads/2012/03/ATtiny_pin_config1.png" alt="" title="ATtiny_pin_config" width="450" height="116" class="size-full wp-image-1290" /></a><p class="wp-caption-text">AVR pin configuration for ATtiny25/45/85 taken from the Atmel datasheet.</p></div>
<p>Once finished, plug your programmer into the target board. Now your target chip can be placed into the ZIF socket<br />
<div id="attachment_1294" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.timteatro.net/wp-content/uploads/2012/03/usbtinyisp_targetboard.jpg"><img src="http://www.timteatro.net/wp-content/uploads/2012/03/usbtinyisp_targetboard-300x168.jpg" alt="" title="USBtinyISP and Target Board" width="300" height="168" class="size-medium wp-image-1294" /></a><p class="wp-caption-text">USBtinyISP plugged into a target board.</p></div></p>
<p>With the USB cable connecting your computer to the programmer, and the programmer attached to the target board with target chip, you are ready to write some code, and program your chip.</p>
<h2>Creating a New AVR-Eclipse Project</h2>
<p>Click <i>File > New > C Project</i><br />
<a href="http://www.timteatro.net/wp-content/uploads/2012/03/avr-eclipse_new_C.png"><img src="http://www.timteatro.net/wp-content/uploads/2012/03/avr-eclipse_new_C-283x300.png" alt="" title="avr-eclipse_new_C" width="283" height="300" class="aligncenter size-medium wp-image-1333" /></a><br />
Give your project a name and use the above settings. If you have a more advanced knowledge of Eclipse projects, feel free to set them as you like.</p>
<p>Now in the new project, click <i>Project > Properties</i> and expand the <i>AVR</i> entry. You will need to set your programmer.<br />
<a href="http://www.timteatro.net/wp-content/uploads/2012/03/AVR-Eclipse_conf_proj_avrdude.png"><img src="http://www.timteatro.net/wp-content/uploads/2012/03/AVR-Eclipse_conf_proj_avrdude-300x253.png" alt="" title="AVR-Eclipse_conf_proj_avrdude" width="300" height="253" class="aligncenter size-medium wp-image-1334" /></a><br />
Go through those tabs and set the specifics as you like, assuming you are familiar with the AVR concepts relating to those settings (such as fuses and lock bits).</p>
<p>Now, set the target hardware. With the programmer, target board and target chip attached, click <i>Load from MCU</i>.<br />
<a href="http://www.timteatro.net/wp-content/uploads/2012/03/avr-eclipse_conf_target-hardware.png"><img src="http://www.timteatro.net/wp-content/uploads/2012/03/avr-eclipse_conf_target-hardware-300x248.png" alt="" title="avr-eclipse_conf_target-hardware" width="300" height="248" class="aligncenter size-medium wp-image-1336" /></a><br />
If this fails, it generally indicates a configuration problem with AVRDUDE. Be sure that you have followed the steps in <i><b>Add udev rule for programmer</b></i>.</p>
<p>If you have successfully completed all steps, you should now be in a position to test out a simple light blinking program or alike. As such introductory programming tutorials are readily Googleable, I will leave that to the reader.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.timteatro.net/2012/03/22/beginning-atmel-avr-development-in-linux-using-avr-eclipse-avr-gcc-and-avrdude/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A Library for Using the Wii Nunchuk In Arduino Sketches</title>
		<link>http://www.timteatro.net/2012/02/10/a-library-for-using-the-wii-nunchuk-in-arduino-sketches/</link>
		<comments>http://www.timteatro.net/2012/02/10/a-library-for-using-the-wii-nunchuk-in-arduino-sketches/#comments</comments>
		<pubDate>Fri, 10 Feb 2012 01:34:39 +0000</pubDate>
		<dc:creator>Tim Teatro</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Software & FOSS]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Nintendo Wii]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Wii Nunchuk]]></category>

		<guid isPermaLink="false">http://www.timteatro.net/?p=1185</guid>
		<description><![CDATA[There are <a href="http://arduino.cc/playground/Main/InterfacingWithHardware" target="_blank">several available libraries</a> for communicating with the Wii nunchuk. I somehow found something lacking in all of them, so I wrote <a href="http://www.timteatro.net/download/wiinunchuk.h" target="_blank">wiinunchuk.h</a> for my projects. It is inspired by <a href="https://raw.github.com/todbot/wiichuck_adapter/master/firmware/WiichuckDemo/nunchuck_funcs.h" target="_blank">Tod E. Kurt.</a> but my <a href="http://www.timteatro.net/download/wiinunchuk.h" target="_blank">wiinunchuk.h</a> boasts more powerful features and a more flexible API.]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.timteatro.net/wp-content/uploads/2012/02/P1271229.jpg"><img src="http://www.timteatro.net/wp-content/uploads/2012/02/P1271229-168x300.jpg" alt="" title="Arduino Wii Nuncuk Project" width="168" height="300" class="alignright size-medium wp-image-1249" /></a>
<p>There are <a href="http://arduino.cc/playground/Main/InterfacingWithHardware" target="_blank">several available libraries</a> for communicating with the Wii nunchuk. I somehow found something lacking in all of them, so I wrote <a href="http://www.timteatro.net/download/wiinunchuk.h" target="_blank">wiinunchuk.h</a> for my projects. It is inspired by <a href="https://raw.github.com/todbot/wiichuck_adapter/master/firmware/WiichuckDemo/nunchuck_funcs.h" target="_blank">Tod E. Kurt.</a> but my <a href="http://www.timteatro.net/download/wiinunchuk.h" target="_blank">wiinunchuk.h</a> boasts more powerful features and a more flexible API.</p>
<p>This library is free software and is licensed under the GPL v3.</p>
<p><b>Update!</b> Due to relative popularity, I have created a Git repository for wiinunchuck.h. For the latest version, get it <a href="https://github.com/timtro/wiinunchuck-h" target="_blank">here</a>.</p>
<p>The code is relatively well commented on its own. The header provides the functions</p>
<ul>
<li>void nunchuk_setpowerpins()</li>
<li>void nunchuk_init()</li>
<li>int nunchuk_get_data()</li>
<li>void nunchuk_calibrate_joy()</li>
<li>inline unsigned int nunchuk_zbutton()</li>
<li>inline unsigned int nunchuk_cbutton()</li>
<li>inline int nunchuk_joy_x()</li>
<li>inline int nunchuk_cjoy_x()</li>
<li>inline int nunchuk_cjoy_y()</li>
<li>inline uint16_t nunchuk_accelx()</li>
<li>inline uint16_t nunchuk_accely()</li>
<li>inline uint16_t nunchuk_accelz()</li>
<li>inline int nunchuk_caccelx()</li>
<li>inline int nunchuk_caccely()</li>
<li>inline int nunchuk_caccelz()</li>
<li>inline int nunchuk_joyangle()</li>
<li>inline int nunchuk_rollangle()</li>
<li>inline int nunchuk_pitchangle()</li>
<li>void nunchuk_calibrate_accelxy()</li>
<li>void nunchuk_calibrate_accelz().</li>
</ul>
<h2>Calibration</h2>
<p>Although the header provides functions to pull raw data right from the nunchuck, in most typical applications it is useful to have the data from the nunchuck normalised so that certain reference points are defined to be zero. For example, the reading from the joystick potentiometer will range from about 24 to about 230 on both x and y axes. The normal reading when the joystick is centred is about 130 (it will be slightly different in for each axis). If you subtract the centre value from the instantaneous joystick readings, then it is zeroed at the centre and readings will be relative to the centre.</p>
<p>Reasonable default centre values are #defined near the top of the document:</p>
<pre class="brush: cpp; title: ; notranslate">
#define DEFAULT_CENTRE_JOY_X 124
#define DEFAULT_CENTRE_JOY_Y 132
#define ACCEL_ZEROX 490
#define ACCEL_ZEROY 500
#define ACCEL_ZEROZ 525
</pre>
<p>These are loaded into program memory in <code>void nunchuk_init()</code>. If you need accuracy and plan to use the same nunchuk in all applications, it is worth your time to measure these for your nunchuk by spitting the rad nunchuk data to a serial terminal. For other cases, wiinunchuk.h provides functions</p>
<ul>
<li>void nunchuk_calibrate_joy()</li>
<li>void nunchuk_calibrate_accelxy()</li>
<li>void nunchuk_calibrate_accelz().</li>
</ul>
<p>The function <code>nunchuk_calibrate_joy()</code> will take the instantaneous reading of the joystick values and record them as the zero value. The end user should be warned not to manipulate the joystick during the moment it is called. Usually, this is at the beginning of the sketch before the action starts.</p>
<pre class="brush: cpp; title: ; notranslate">
void nunchuk_calibrate_joy()
	{
	joy_zerox = joy_x;
	joy_zeroy = joy_y;
	}
</pre>
<p><code>nunchuk_calibrate_accelxy()</code> and <code>nunchuk_calibrate_accelz()</code> will record zero values for the accelerometer axes. This has to be done in two steps since the force of gravity will always affect at least one of the accelerometer axes. If the nunchuk is held upright, the <i>xy</i> calibration will be clean since gravity is pulling towards negative <i>z</i>. Then, with the nunchuk on its side or face so that gravity affects only <i>x</i> or <i>y</i>, the <i>z</i> accelerometer can be read to take the zero value using <code>nunchuk_calibrate_accelz()</code>.</p>
<pre class="brush: cpp; title: ; notranslate">
void nunchuk_calibrate_accelxy()
	{
	accel_zerox = nunchuk_accelx();
	accel_zeroy = nunchuk_accely();
	}

void nunchuk_calibrate_accelz()
	{
	accel_zeroz = nunchuk_accelz();
	}
</pre>
<h2>Initialisation</h2>
<p><code>nunchuk_setpowerpins()</code> sets up the pins.</p>
<pre class="brush: cpp; title: ; notranslate">
void nunchuk_setpowerpins()
	{
	#define pwrpin PORTC3
	#define gndpin PORTC2
	DDRC |= _BV(pwrpin) | _BV(gndpin);
	PORTC &amp;= ~_BV(gndpin);
	PORTC |=  _BV(pwrpin);
	delay(100); // wait for things to stabilize
	}
</pre>
<p>The function assumes that the nuncuk is connected using a <a href="http://todbot.com/blog/2008/02/18/wiichuck-wii-nunchuck-adapter-available/" target="_blank">WiiChuk</a>, or at least that you are using the same pin configuration. That is to say A2, A3, A4 and A5 are power (-), power (+), data and clock, respectively. Even though these are analog pins, this function treats A2 and A3 as digital pins and sets them high and ground to power the nunchuk with 5V. As I write that, I recall that the nunchuk spec calls for less than 5V, but WiiChuk users don&#8217;t have much choice. If you cut the connector on your nunchuck and are plugging in directly, I would try using the Arduino&#8217;s 3.3V power instead.</p>
<p>The <code>nunchuk_init()</code> function sets up communication with the nunchuk by establishing the i2c bus and handshaking. The way this is done should work for OEM Nintendo nunchuks and for the el-cheapo knock-offs.</p>
<pre class="brush: cpp; title: ; notranslate">
void nunchuk_init()
	{
	Wire.begin();
	delay(1);
	Wire.beginTransmission(0x52);  // device address
	#if (ARDUINO &gt;= 100)
		Wire.write((uint8_t)0xF0);  // 1st initialisation register
		Wire.write((uint8_t)0x55);  // 1st initialisation value
		Wire.endTransmission();
		delay(1);
		Wire.beginTransmission(0x52);
		Wire.write((uint8_t)0xFB);  // 2nd initialisation register
		Wire.write((uint8_t)0x00);  // 2nd initialisation value
	#else
		Wire.send((uint8_t)0xF0);   // 1st initialisation register
		Wire.send((uint8_t)0x55);   // 1st initialisation value
		Wire.endTransmission();
		delay(1);
		Wire.beginTransmission(0x52);
		Wire.send((uint8_t)0xFB);   // 2nd initialisation register
		Wire.send((uint8_t)0x00);   // 2nd initialisation value
	#endif
	Wire.endTransmission();
	delay(1);
	//
	// Set default calibration centres:
	//
	joy_zerox = DEFAULT_CENTRE_JOY_X;
	joy_zeroy = DEFAULT_CENTRE_JOY_Y;
	accel_zerox = ACCEL_ZEROX;
	accel_zeroy = ACCEL_ZEROY;
	accel_zeroz = ACCEL_ZEROZ;
	}
</pre>
<p>Some other libraries do a more canonical sort of initialization that causes the data to be encrypted and is not compatible with 3rd party nunchucks. The function finishes off by loading the default zero values for the sensors into memory. They can hereon be changed directly or using the calibration functions discussed earlier.</p>
<h2>Communication</h2>
<p>We expect to get back six bytes of information:</p>
<table align="center" width=100%>
<tr>
<td><b>Byte</b></td>
<td><b>Contains</b></td>
</tr>
<tr>
<td>1</td>
<td>Joystick x</td>
</tr>
<tr>
<td>2</td>
<td>Joystick y</td>
</tr>
<tr>
<td>3</td>
<td>First 8 of 10-bit accelerometer <i>x</i> value</td>
</tr>
<tr>
<td>4</td>
<td>First 8 of 10-bit accelerometer <i>y</i> value</td>
</tr>
<tr>
<td>5</td>
<td>First 8 of 10-bit accelerometer <i>z</i> value</td>
</tr>
<tr>
<td>6</td>
<td>
<ul>
<li>Last two bits from acc <i>z</i></li>
<li>last two bits from acc <i>y</i></li>
<li>last two bits from acc <i>x</i></li>
<li>1-bit for Cbutton state</li>
<li>1-bit for Z-button state</li>
</ul>
</td>
</tr>
</table>
<p>The function <code>nunchuk_get_data()</code> requests and receives the six bytes data, reads it into a six element array <code>nunchuk_buf</code>. </p>
<pre class="brush: cpp; title: ; notranslate">
int nunchuk_get_data()
	{
	int cnt=0;
	  // Request six bytes from the chuck.
	Wire.requestFrom (0x52, 6);
	while (Wire.available ())
		{
	  // receive byte as an integer
		#if (ARDUINO &gt;= 100)
			nunchuk_buf[cnt] = Wire.read();
		#else
			nunchuk_buf[cnt] = Wire.receive();
		#endif
		cnt++;
		}
	//
	//Send read address, zero-byte.
	#if (ARDUINO &gt;= 100)
		Wire.write((uint8_t)0x00);
	#else
		Wire.send((uint8_t)0x00);
	#endif

	if (cnt &gt;= 5)
		{
		return 1;   // success
		}
	return 0; // failure
	}
</pre>
<h2>Processing and output</h2>
<p>The remaining functions deal with unpacking our six-byte data package, <code>nunchuk_buf[]</code> and presenting it in various useful forms. Since these functions are small and likely to be in a program loop, I cast them all as static inline functions to avoid emission of object code and have the code injected directly into the points of use in the Arduino sketches.</p>
<p>To start, we capture the C and Z buttons with <code>nunchuk_cbutton()</code> and <code>nunchuk_zbutton()</code>. The one-bit on/off values are stored in the last two bits of the sixth byte. We just bit shift an appropriate value and check the state of the last bit of that byte. The checking of the byte value is done using C&#8217;s inline ternary conditional operator <code>(condition)? true : false;</code>.</p>
<pre class="brush: cpp; title: ; notranslate">
static inline unsigned int nunchuk_zbutton()
	{
	return ((nunchuk_buf[5] &gt;&gt; 0) &amp; 1) ? 0 : 1;
	}

static inline unsigned int nunchuk_cbutton()
	{
	return ((nunchuk_buf[5] &gt;&gt; 1) &amp; 1) ? 0 : 1;
	}
</pre>
<p>There isn&#8217;t much to be done about the raw <i>x</i> and <i>y</i> values, so we just return them with <code>nunchuk_joy_x()</code> and <code>nunchuk_joy_x()</code>.</p>
<pre class="brush: cpp; title: ; notranslate">
static inline int nunchuk_joy_x()
	{
	return (int) nunchuk_buf[0];
	}

static inline int nunchuk_joy_y()
	{
	return (int) nunchuk_buf[1];
	}
</pre>
<p>We also want the option of having the calibrated (zeroed and centre) joystick values which are returned with functions <code>nunchuk_cjoy_x()</code> and <code>nunchuk_cjoy_x()</code></p>
<pre class="brush: cpp; title: ; notranslate">
static inline int nunchuk_cjoy_x()
	{
	return (int)nunchuk_buf[0] - joy_zerox;
	}

static inline int nunchuk_cjoy_y()
	{
	return (int)nunchuk_buf[1] - joy_zeroy;
	}
</pre>
<p>The accelerometer readings are a more difficult matter because of the 10-bit values, the least significant two bits are stored in byte six, which is a mish-mash of data. So, take for example the function <code>nunchuk_accelx()</code>.</p>
<pre class="brush: cpp; title: ; notranslate">
static inline uint16_t nunchuk_accelx()
	{
	return (  0x0000 | ( nunchuk_buf[2] &lt;&lt; 2 ) +
		( ( nunchuk_buf[5] &amp; B00001100 ) &gt;&gt; 2 )  );
	}
</pre>
<p>First, <code>0x0000 | ( nunchuk_buf[2] << 2 )</code> takes a blank 16-bits (0x0000) and does a bitwise OR (|) with the 8-bit nunchuk_buf[2] which has been bit-shifted by 2 (<<2). The bitwise OR simply takes nunchuk_buff[2] and imprints it onto 0x0000 creating a 16-bit version of nunchuk_buf[2]. The bit-shift ensures that the last two bits are blank so we can add in the last two bits which are stored in nunchuk_buf[5]. So, to this we add <code>( nunchuk_buf[5] &#038; B00001100 ) >> 2 )</code> which takes the pair of bits starting second from the left of nunchuk_buf[5] and zeros everything else. Then those two bits are shifted to the end to be added to the 16-bit copy of nunchuk_buf[2] which has the right-most two bits empty and waiting.</p>
<p>Rinse and repeat for the <i>y</i> and <i>z</i> accelerometer values.</p>
<pre class="brush: cpp; title: ; notranslate">
static inline uint16_t nunchuk_accely()
	{
	return (  0x0000 ^ ( nunchuk_buf[3] &lt;&lt; 2 ) +
		( ( nunchuk_buf[5] &amp; B00110000 ) &gt;&gt; 4 )  );
	}

static inline uint16_t nunchuk_accelz()
	{
	return (  0x0000 ^ ( nunchuk_buf[4] &lt;&lt; 2 ) +
		( ( nunchuk_buf[5] &amp; B11000000 ) &gt;&gt; 6 )  );
	}
</pre>
<p>The sketch may optionally want the calibrated accelerometer values which are offered by the following three functions.</p>
<pre class="brush: cpp; title: ; notranslate">
static inline int nunchuk_caccelx()
	{
		return (int)(nunchuk_accelx() - accel_zerox);
	}

static inline int nunchuk_caccely()
	{
		return (int)(nunchuk_accely() - accel_zeroy);
	}

static inline int nunchuk_caccelz()
	{
		return (int)(nunchuk_accelz() - accel_zeroz);
	}
</pre>
<p>The final three functions are concerned with angle. I include them because some people have a rather serious trigonometry allergy. The vector magnitudes which compliment these angles, I&#8217;ll leave to the Pythagorean wizardry of whom ever may need them.</p>
<p>You&#8217;ll note the use of the <a href="http://en.wikipedia.org/wiki/Atan2" target="_blank"><code>atan2()</code></a> function. This is exactly like vanilla <code>atan()</code>, except that it keeps track of which quadrant we are in by the signs of the opposite and adjacent lengths, and also handles vectors one the axes gracefully.</p>
<pre class="brush: cpp; title: ; notranslate">
static inline int nunchuk_joyangle()
	{
	double theta;
	theta = atan2( nunchuk_cjoy_y(), nunchuk_cjoy_x() );
	while (theta &lt; 0) theta += 2*M_PI;
	return (int)(theta * 180/M_PI);
	}
</pre>
<p>The little while-loop in here makes sure that we get a positive angle by rotating angles into their positive equivalent.</p>
<p>A little trick to get the orientation of the nunchuk from the accelerometers is to sniff out the gravity vector. If the accelerometer is properly zeroed, and all other external forces are negligible (i.e., gravity is the only significant fore on the numchuk), then the ratios of the accelerometer readings will give the roll and pitch of the nunchuk.</p>
<p>Roll (<code>nunchuk_rollangle()</code>) is the angle created by tipping an upright nunchuk to the left or right as viewed from behind. More precisely, with the z-axis pointing up from the joystick, the y-axis point out of the c-button and the x-axis pointing from the right side, roll is the angle created between the z-axis and the nunchuk when it is rotated about the y-axis.</p>
<pre class="brush: cpp; title: ; notranslate">
static inline int nunchuk_rollangle()
	{
	return (int) (  atan2( (double) nunchuk_caccelx(),
		(double) nunchuk_caccelz() ) * 180 / M_PI  );
	}
</pre>
<p>Then by the same definitions, pitch is the angle created between the nunchuk and the z-axis when the nunchuk is rotated about the x-axis and &#8216;tipped&#8217; forward or backward.</p>
<pre class="brush: cpp; title: ; notranslate">
static inline int nunchuk_pitchangle()
	{
	return (int) (  atan2( (double) nunchuk_caccely(),
		(double)nunchuk_caccelz() ) * 180 / M_PI  );
	}
</pre>
<p>If you haven&#8217;t already, <b>click here to <a href="http://www.timteatro.net/download/wiinunchuk.h" target="_blank">Download wiinunchuk.h</a>.</b></p>
<p>I hope you find this useful. Please feel free to post links to your projects or ask questions. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.timteatro.net/2012/02/10/a-library-for-using-the-wii-nunchuk-in-arduino-sketches/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Canadians take a stand against online spying</title>
		<link>http://www.timteatro.net/2011/09/15/canadians-take-a-stand-against-online-spying/</link>
		<comments>http://www.timteatro.net/2011/09/15/canadians-take-a-stand-against-online-spying/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 19:23:57 +0000</pubDate>
		<dc:creator>Tim Teatro</dc:creator>
				<category><![CDATA[Headline]]></category>
		<category><![CDATA[Government]]></category>
		<category><![CDATA[Privacy]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.timteatro.net/?p=1164</guid>
		<description><![CDATA[The government is trying to ram through an anti-Internet set of electronic surveillance laws that will invade your privacy and cost you money. The plan is to...]]></description>
				<content:encoded><![CDATA[<p>I won&#8217;t stand for it. Will you?</p>
<p><iframe width="460" height="264" src="http://www.youtube.com/embed/QwqIYHwRcxY" frameborder="0" allowfullscreen></iframe></p>
<p>Do something about it: <a href="http://www.stopspying.ca" target="_blank">www.stopspying.ca</a> or <a href="http://www.openmedia.ca" target="_blank">www.openmedia.ca<br />
</a></p>
<p><iframe src="http://action.cwa-union.org/c/779/p/dia/action/public/?action_KEY=2276" width="460" height="580" frameborder="0" marginheight="0" marginwidth="0">Loading&#8230;</iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.timteatro.net/2011/09/15/canadians-take-a-stand-against-online-spying/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Review: Solomon SL-30 Soldering Station</title>
		<link>http://www.timteatro.net/2011/07/26/review-solomon-sl-30-soldering-station/</link>
		<comments>http://www.timteatro.net/2011/07/26/review-solomon-sl-30-soldering-station/#comments</comments>
		<pubDate>Tue, 26 Jul 2011 23:54:02 +0000</pubDate>
		<dc:creator>Tim Teatro</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Headline]]></category>
		<category><![CDATA[Review]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[soldering]]></category>

		<guid isPermaLink="false">http://www.timteatro.net/?p=1143</guid>
		<description><![CDATA[<p>About two months ago I bought a <a href="http://www.a1parts.com/solomon/index.html" target="_blank">Solomon SL-30 from a1parts.com</a>, the online store for A1 Electronics here in Toronto. I chose that station after a lot of research, despite not being familiar with the name. This review is not based on a series of cleverly designed test, but just my day-to-day use of the station for soldering connectors, wires and even a little PCB work.</p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.timteatro.net/wp-content/uploads/2011/07/solomon_sl-30_box.jpg"><img src="http://www.timteatro.net/wp-content/uploads/2011/07/solomon_sl-30_box-300x275.jpg" alt="" title="solomon_sl-30_box" width="300" height="275" class="alignright size-medium wp-image-1146" /></a>
<p>About two months ago I bought a <a href="http://www.a1parts.com/solomon/index.html" target="_blank">Solomon SL-30 from a1parts.com</a>, the online store for A1 Electronics here in Toronto. I chose that station after a lot of research, despite not being familiar with the name. This review is not based on a series of cleverly designed test, but just my day-to-day use of the station for soldering connectors, wires and even a little PCB work.</p>
<p>I had been shopping around for a while when I decided to try the Solomon SL-30. I knew I wanted temperature control, a comfortable pen, easily to find tips and a good build quality. I had considered the <a href="http://www.amazon.com/WELLER-WESD51-DIGITAL-SOLDERING-STATION/dp/B005C2W4NC">Weller WESD51D</a>, the <a href="http://www.amazon.com/Hakko-Soldering-Station-FX-888/dp/B004M3U0VU/ref=sr_1_14?s=power-hand-tools&#038;ie=UTF8&#038;qid=1311709505&#038;sr=1-14">Hakko FX-888</a> and the <a href="http://www.amazon.com/Edsyn-Soldering-951SX-Temperature-Controlled/dp/B00012YSG4/ref=sr_1_28?s=power-hand-tools&#038;ie=UTF8&#038;qid=1311709544&#038;sr=1-28">Edsyn 951SX</a> <a href="http://www.escience.ca/hobby/RENDER/0001/84/3063/12153.html">SX-500D</a>.</p>
<h2>Summary</h2>
<p>I&#8217;m really very happy with the station overall. I feel like I got good value for my money, and I got just about everything I wanted in a soldering station.</p>
<h3>Pros</h3>
<ul>
<li>Temperature setting and readout, very nice, especially for the price.</li>
<li>Solid quality &mdash; a heavy unit with solid feeling construction. The temperature knob feels smooth and strong. I feel like this may be something that will be in my workshop for a lot of years.</li>
<li>Tip and iron replacement seem readily available, even if the iron is swapped to Elenco brand. However, apparently Solomon has been around for a lot of years and is one of the biggest manufacturers in the world (according to Glen from A1).</li>
<li>Really nice holder for the iron. I&#8217;m not a big fan of the wire coil ones, and because space is an issue for me, I also don&#8217;t want one of the huge ones that hold the iron and sponge (or brass) separate from the unit.</li>
<li>Silicone coated wire on the iron, not that I can imagine ever burning my iron with itself.</li>
</ul>
<h3>Cons</h3>
<p>I can really only think of one con:</p>
<ul>
<li>I really wanted a thin pencil-like iron with a super flexible (spaghetti-like) cord, but this one feels like most any cheap plug-in iron. In fact, it feels just fine in my hand, I just like the look of the smaller ones. The cord is a little stiff at first too. The silicone grip does occasionally slide down on my pen, but I just push it back up. I&#8217;m nitpicking really.</li>
</ul>
<h2>Deciding on the Solomon</h2>
<p>The price of most other offerings, relative to the feature set really made the decision for me. Less than $100.00 got me a temperature controlled soldering station with a digital readout of both current temperature and set temperature.</p>
<p>I read a lot of reviews saying that the Weller had a cheap knob that broke, and basically that people who had owned Wellers from 40+ years back aren&#8217;t happy with the quality of the modern Weller products. Solomon seems to come out with new products, but the quality (from what I hear) is consistent. I was really tempted to get a Hakko, and I probably will some day, but there was just nothing for this price that could compete with the SL-30.</p>
<p>A serious consideration was the <a href="http://www.elenco.com/soldering.htm">Elenco line of soldering stations</a>, some of which seem identical to the Solomon offerings. The price of Elenco stations is a little less online, but shipping costs make it preferable for me to just buy it locally from A1 Electronics.</p>
<h2>Impressions out of the box</h2>
<div id="attachment_1148" class="wp-caption alignright" style="width: 310px"><a href="http://www.timteatro.net/wp-content/uploads/2011/07/solomon_sl-30_instructions.png"><img src="http://www.timteatro.net/wp-content/uploads/2011/07/solomon_sl-30_instructions-300x218.png" alt="Instruction Manual" title="solomon_sl-30_instructions" width="300" height="218" class="size-medium wp-image-1148" /></a><p class="wp-caption-text">A scanned image of the instruction booklet that came in the box with the SL-30. The reverse side seems to contain the same instructions in several languages.</p></div>
<p>
Aside form the fact that the box looks like marketing material for a discount Chinese dish detergent, my first impressions were very good. Out of the box, the weight and build quality felt good, and everything was straight forward to set up.
</p>
<h2>Afterthoughts</h2>
<p>It really just does what you expect. There&#8217;s not much more to say. The tips are very nice for the price, but the handle feels somewhat cheap. I&#8217;m going to be very picky on this point, however, because I really did want a station with a thin pencil-like handle and a very flexible cord. The Solomon is a little disappointing in that light, but there is really nothing to complain out. It is comfortable to use, even for hours at a time.</p>
<p>If anything ever happened and I had trouble getting Solomon parts, I believe that I can buy an Elenco replacement iron and tips (~$20.00 total) and it should be a drop-in replacement for the Solomon iron.<br />
<h2>Overall&#8230;</h2>
<p>I&#8217;m very happy with the unit, and I feel like I&#8217;m going to use it for a long time. I&#8217;m eventually going to replace it with a very expensive one, but that will be years down the road. And based on the build quality, I definitely feel that years down the road when I do replace it, I will be replacing a fully functioning Solomon.</p>
<div class="clearfloat"></div>
]]></content:encoded>
			<wfw:commentRss>http://www.timteatro.net/2011/07/26/review-solomon-sl-30-soldering-station/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Convert CPMD TRAJECTORY for tfreq Autocorrelation and Vibrational Density of States</title>
		<link>http://www.timteatro.net/2011/05/26/convert-cpmd-trajectory-for-tfreq-autocorrelation-and-vibrational-density-of-states/</link>
		<comments>http://www.timteatro.net/2011/05/26/convert-cpmd-trajectory-for-tfreq-autocorrelation-and-vibrational-density-of-states/#comments</comments>
		<pubDate>Thu, 26 May 2011 20:05:58 +0000</pubDate>
		<dc:creator>Tim Teatro</dc:creator>
				<category><![CDATA[Scientific Computing]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[Physics]]></category>
		<category><![CDATA[Science]]></category>
		<category><![CDATA[solid state]]></category>

		<guid isPermaLink="false">http://www.timteatro.net/?p=1130</guid>
		<description><![CDATA[Recently, I&#8217;ve been getting a few of people wanting to use tfreq, autocorrelation and vibrational density of states to analyse data from CPMD. tfreq is written to process output from Quantum-ESPRESSO&#8216;s cp.x output. The two options are to modify the source file tfreq.c to read the new input, which could be difficult for someone inexperienced [...]]]></description>
				<content:encoded><![CDATA[<p>Recently, I&#8217;ve been getting a few of people wanting to use <a href="http://www.timteatro.net/2010/09/29/velocity-autocorrelation-and-vibrational-spectrum-calculation/" target="_blank">tfreq</a>,  autocorrelation and vibrational density of states to analyse data from <a href="http://www.cpmd.org/">CPMD</a>. tfreq is written to process output from <a href="http://www.quantum-espresso.org/">Quantum-ESPRESSO</a>&#8216;s cp.x output.</p>
<p>The two options are to modify the source file tfreq.c to read the new input, which could be difficult for someone inexperienced with C. As a quick solution, I wrote a quick awk script to make a .vel file from a CPMD TRAJECTORY file.</p>
<p>The following script should would with cubic geometry (just a guess). It doesn&#8217;t read anything from the GEOMETRY file and I leave it to the user to make any necessary conversions. I need someone to test it, and I&#8217;ll post the results here.</p>
<pre class="brush: plain; title: ; notranslate">
BEGIN {
	nat=###     # Number of Atoms.
	dt=###       # Duration (in fs) of teach time step.
	}

{
	# For each atom:
	for (i=0; i&lt;=nat; i++) {
		# Read the time step out of the first column:
		ts=$1
		# If this is the first row of a time step, print the time:
		if (i==0) printf &quot; %10d %16.10f\n&quot;, ts, ts*dt
		# Now print the volocity out of the TRAJECTORY file:
		printf &quot;%16.12f  %16.12f  %16.12f\n&quot;, $5, $6, $7
		# Get a new line:
		getline
	}
}
</pre>
<p>Save this code as <code>CPMD2vel.awk</code> and define nat (the number of atoms) and dt (the time step size)</p>
<p>Run this with code: <code>awk -f CPMD2vel.awk TRAJECTORY > output.vel</code></p>
<p>This will create a .vel file (output.vel, or the name you wish), which can be used with tfreq.</p>
<p>ESPRESSO&#8217;s .vel file format is very simple:<br />
<code><br />
timestep  time(in fs)<br />
vx1 vy1 vz1<br />
vx2 vy2 vz2<br />
vx3 vy3 vz3<br />
...<br />
</code><br />
With the format:<br />
<code><br />
integer   float<br />
float  float  float<br />
float  float  float<br />
...<br />
integer   float<br />
float  float  float<br />
float  float  float<br />
</code><br />
For example:<br />
<code><br />
      1       0.123456<br />
1.2345E01  1.2345E01  1.2345E01<br />
1.2345E01  1.2345E01  1.2345E01<br />
1.2345E01  1.2345E01  1.2345E01<br />
1.2345E01  1.2345E01  1.2345E01<br />
     2       0.123456<br />
1.2345E01  1.2345E01  1.2345E01<br />
1.2345E01  1.2345E01  1.2345E01<br />
1.2345E01  1.2345E01  1.2345E01<br />
1.2345E01  1.2345E01  1.2345E01<br />
     3       0.123456<br />
1.2345E01  1.2345E01  1.2345E01<br />
1.2345E01  1.2345E01  1.2345E01<br />
1.2345E01  1.2345E01  1.2345E01<br />
1.2345E01  1.2345E01  1.2345E01<br />
...<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.timteatro.net/2011/05/26/convert-cpmd-trajectory-for-tfreq-autocorrelation-and-vibrational-density-of-states/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I&#8217;m Voting Pro-Internet</title>
		<link>http://www.timteatro.net/2011/04/29/im-voting-pro-internet/</link>
		<comments>http://www.timteatro.net/2011/04/29/im-voting-pro-internet/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 21:25:57 +0000</pubDate>
		<dc:creator>Tim Teatro</dc:creator>
				<category><![CDATA[Site News]]></category>
		<category><![CDATA[Politics]]></category>
		<category><![CDATA[The Internet]]></category>

		<guid isPermaLink="false">http://www.timteatro.net/?p=1118</guid>
		<description><![CDATA[In case you don't already know, the big Internet Service Providers (ISPs) in Canada want to start billing Internet usage by the byte. Anyone with a smart phone is familiar with this system. For anyone who lives on the Internet, as most twenty-somethings and younger tend to do these days, this could easily become prohibitively expensive.]]></description>
				<content:encoded><![CDATA[<p><div id="attachment_1119" class="wp-caption alignright" style="width: 279px"><img src="http://www.timteatro.net/wp-content/uploads/2011/04/canada_pro_internet_support_2011.jpg" title="canada_pro_internet_support_2011" width="269" height="550" class="size-full wp-image-1119" /><p class="wp-caption-text">Candidates supporting open-Internet by party. Taken from <a href=http://openmedia.ca/candidates target=_blank>openmedia.ca</a></p></div>
<p>
In this day in age, I can&#8217;t believe that there is a politician stupid enough to support metered Internet billing.
</p>
<p>
In case you don&#8217;t already know, the big Internet Service Providers (ISPs) in Canada want to start billing Internet usage by the byte. Anyone with a smart phone is familiar with this system. For anyone who lives on the Internet, as most twenty-somethings and younger tend to do these days, this could easily become prohibitively expensive.
</p>
<p>
The good folks over at <a href=http://openmedia.ca/candidates target=_blank>openmedia.ca</a> have been fighting the good fight. I&#8217;ve been helping them as much as I can by signing petitions, sending emails to politicians, etc. I&#8217;d encourage the reader to do the same. I&#8217;m actually really surprised by how big of an impact openmedia.ca has had.
</p>
<p>
The telecommunications industry in this country is already behind much of the world in terms of the quality of service. I have many friends in Europe who absolutely pity our situation. (Although I&#8217;m quick to remind many of them about three-strikes.) Metered billing would be another major step backward from Canada&#8217;s already embarrassing position.
</p>
<p>
I simply can&#8217;t begin to comprehend the stupidity. It&#8217;s bad for private citizens, especially in the lower and middle class brackets, and it&#8217;s also bad for business.
</p>
<p>
We not only share our lives over the Internet, but also our talents and passions. Show me an independent band that doesn&#8217;t have some mp3s (or FLAC, better yet). Emerging authors are self publishing on the Internet. Visual artists (painters, photographers, etc) are selling their prints on the Internet. Limiting ones access to this content not only hurts the artists, but all of us whose lives are improved by it.
</p>
<p>
As for business, let&#8217;s rime off a few: Google, Netflix, iTunes, Amazon, YouTube, Ebay, Facebook, Steam, Indigo, iStockPhoto and maybe several thousand others I&#8217;m missing. Not only do companies like these make money by selling physical goods online, but also digital products such as mp3s, movies, digital images and software. All things that will be taxed by the cost of downloading the files. And let&#8217;s not forget that we like to look at plenty of high resolution images of products before we buy them.
</p>
<p>
Well, I guess none of the companies mentioned in the last paragraph are doing enough to fund the Conservatives, because they seem dead set on screwing us all over. I&#8217;d love to know how much money they&#8217;re selling us out for.
</p>
<p>
I&#8217;m so disappointed with my choices for this election. I&#8217;m actually thinking of voting Green party, just to shake things up. I can&#8217;t believe how badly our system is broken.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.timteatro.net/2011/04/29/im-voting-pro-internet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sleep timer (suspend) script for Linux</title>
		<link>http://www.timteatro.net/2011/01/16/sleep-timer-suspend-script-for-linux/</link>
		<comments>http://www.timteatro.net/2011/01/16/sleep-timer-suspend-script-for-linux/#comments</comments>
		<pubDate>Sun, 16 Jan 2011 20:23:30 +0000</pubDate>
		<dc:creator>Tim Teatro</dc:creator>
				<category><![CDATA[Software & FOSS]]></category>
		<category><![CDATA[Bash]]></category>

		<guid isPermaLink="false">http://www.timteatro.net/?p=1099</guid>
		<description><![CDATA[I usually go to sleep listening to <a href="http://gnaural.sourceforge.net/" target="_blank">gnaural</a> or watching old TV shows on the computer beside my bed (which my wife just loves). Rather than have it running all night, I'd rather have my computer sleep after a certain time.

Here's a simple (Bash) script to do just that.]]></description>
				<content:encoded><![CDATA[<p><img src="http://www.timteatro.net/wp-content/uploads/2011/01/charmaineswart_S6302417_sm.jpg" alt="" title="charmaineswart_S6302417_sm" width="200" height="240" class="alignright size-full wp-image-1104" />
<p>
I usually go to sleep listening to <a href="http://gnaural.sourceforge.net/" target="_blank">gnaural</a> or watching old TV shows on the computer beside my bed (which my wife just loves). Rather than have it running all night, I&#8217;d rather have my computer sleep after a certain time.
</p>
<p>
For some reason, the last time I tried to write a script to suspend my computer (a few years ago), it was a serious pain in the ass. Now, thanks to <a href="http://pm-utils.freedesktop.org/wiki/" target="_blank">pm-utils</a>, it&#8217;s pretty easy. The command <code>pm-suspend</code> must be run as root, but aside from that it pretty much does what it says on the tin.
</p>
<p>
To use the script, copy and paste it into a text file (preferably called <code>sleeptimer</code>). Then, change the permissions on the file to make it executable. From the command line, you can do this with <code>chmod u+x sleeptimer</code>. From the command line, <code>./sleeptimer N</code>  &#8211; will sleep the computer in N minutes, where N is some positive integer. The script will go through a count down for each fifteen minutes and gives a warning at 10, 5 and then 1 minute before it sleeps.
</p>
<p>
Please forgive the crudity. I didn&#8217;t really write it for general public usage, but I&#8217;m posting it in response to a request.
</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash
#
# sleeptimer.sh
#
# Author: Timothy A.V. Teatro &lt;tim@timteatro.net&gt;
# Date  : Jan 11, 2011
#
# Description: A rather unsophisticated little script that I wrote for
#    myself. Since I usually fall asleep listening to gnaural or watching
#    a movie on my computer beside my bed, I wanted something to suspend
#    my computer rather than using shutdown.
#
# Usage : sudo ./sleeptimer &lt;integer&gt;
#    where &lt;integer&gt; is the number of minutes before the computer is suspended
#
#    This script 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.
#
#####################################################

#
# Must be run as root, so check id at the door.
#
if [ &quot;$(id -u)&quot; != &quot;0&quot; ]; then
	echo Must be run as root.
	exit 1
fi

min=$1 # Keep the first argument on the command line here
elapsed=0 

#
# Check to be sure argument is a number...
#
if [ $min -eq $min 2&gt; /dev/null ]; then
	#
	# ... and if it is, then decide what to do with it
	#
	# If it's less than 15 minutes, we want to count down to 10, 5 and
	# then 1 minute for feedback to the user.
	#	
	if [ $min -lt 15 ]; then
		echo Sleeping in $min minutes [`date`]
		while [ $elapsed -le $min ]; do
			sleep 1m
			elapsed=$((elapsed+1))
			if [ $((min-elapsed)) -eq 10 ]; then
				echo Sleeping in 10 min.
			elif [ $((min-elapsed)) -eq 5 ]; then
				echo Sleeping in 5 min.
			elif [ $((min-elapsed)) -eq 1 ]; then
				echo Sleeping in less than 1 min.
			fi
		done
	else # If it's more, we'll count down in 15 minute intervals.
		#
		# Get the remainder of $min/15 and sleep that down.
		#
		remainder=`expr $min % 15`
		sleep ${remainder}m
		elapsed=$((elapsed+remainder))
		#
		# Now that the time remaining is a factor of 15, we'll sleep
		# in 15 minute incriments until the last 15 minutes of the
		# timer.
		#
		while [ $elapsed -lt $((min-15)) ]; do
			sleep 15m
			elapsed=$((elapsed+15))
			echo Sleeping in $((min-elapsed)) minutes. [`date`]
		done
		sleep 5m
		echo Sleeping in 10 minutes
		sleep 5m
		echo Sleeping in 5 minutes
		sleep 4m
		echo Sleeping in less than a minute.
		sleep 1m
	fi
	#
	# We've done our counting, now suspend.
	#
	echo &quot;!!! NOW SUSPENDING YOUR MACHINE !!!&quot;
	pm-suspend
	exit 0
else
	echo $min is not an integer. Please specify the number of minutes before sleep.
	exit 2
fi
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.timteatro.net/2011/01/16/sleep-timer-suspend-script-for-linux/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Quadratic approximation in Maple</title>
		<link>http://www.timteatro.net/2010/11/12/quadratic-approximation-in-maple/</link>
		<comments>http://www.timteatro.net/2010/11/12/quadratic-approximation-in-maple/#comments</comments>
		<pubDate>Fri, 12 Nov 2010 01:49:43 +0000</pubDate>
		<dc:creator>Tim Teatro</dc:creator>
				<category><![CDATA[Scientific Computing]]></category>
		<category><![CDATA[Maple]]></category>
		<category><![CDATA[Mathematics]]></category>

		<guid isPermaLink="false">http://www.timteatro.net/?p=1094</guid>
		<description><![CDATA[A few of my students are having trouble using Maple to pull off a quadratic approximation. I wanted to post a little code to help them along.]]></description>
				<content:encoded><![CDATA[<p>A few of my students are having trouble using Maple to pull off a quadratic approximation. I wanted to post a little code to help them along.</p>
<p>As usual, I strongly encourage my students to use Maple <i>Classic</i>. The java interface of normal Maple may be flashy an appealing to the ignorant or those unfortunate enough to get used to it, but most real world work in Maple is done with Maple classic.</p>
<p>For a function <img src="http://www.timteatro.net/wp-content/ql-cache/quicklatex.com-455852e0b3175cb9044ede0782b37488_l3.png" class="ql-img-inline-formula " alt="&#102;&#40;&#120;&#41;" title="Rendered by QuickLaTeX.com" height="16" width="31" style="vertical-align: -4px;"/>, the quadratic approximation about a point <img src="http://www.timteatro.net/wp-content/ql-cache/quicklatex.com-1f2b5ae068b799a6ce682b2c2948861a_l3.png" class="ql-img-inline-formula " alt="&#97;" title="Rendered by QuickLaTeX.com" height="8" width="9" style="vertical-align: 0px;"/> is given by
<p class="ql-center-displayed-equation" style="line-height: 38px;"><span class="ql-right-eqno"> &nbsp; </span><span class="ql-left-eqno"> &nbsp; </span><img src="http://www.timteatro.net/wp-content/ql-cache/quicklatex.com-ad3a7d1860006e105524cb6f15582623_l3.png" height="38" width="315" class="ql-img-displayed-equation " alt="&#92;&#91; &#32;&#32;&#81;&#40;&#120;&#41;&#32;&#61;&#32;&#102;&#40;&#97;&#41;&#32;&#43;&#32;&#102;&#39;&#40;&#97;&#41;&#32;&#40;&#120;&#45;&#97;&#41;&#32;&#43;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#102;&#39;&#39;&#40;&#97;&#41;&#125;&#123;&#50;&#125;&#92;&#44;&#40;&#120;&#45;&#97;&#41;&#94;&#50;&#46; &#92;&#93; " title="Rendered by QuickLaTeX.com"/></p>
</p>
<p>In Maple, this can be implemented as:<br />
<code><br />
> restart;<br />
> f:=ln(x)/sqrt(x);  # Define a function<br />
> a:=1; # The point about which we'll expand<br />
> Q:=subs(x=a, f) + subs(x=a, diff(f, x))*(x-a) + subs(x=a, diff(f, x, x))*(x-a)^2/2;<br />
> plot([f, Q], x=-5..5, y=-5..5);<br />
</code></p>
<p>Now try playing around with the above code. Change the values of a and f(x).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.timteatro.net/2010/11/12/quadratic-approximation-in-maple/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comic: Busted to the Future!</title>
		<link>http://www.timteatro.net/2010/11/04/comic-busted-to-the-future/</link>
		<comments>http://www.timteatro.net/2010/11/04/comic-busted-to-the-future/#comments</comments>
		<pubDate>Thu, 04 Nov 2010 03:31:20 +0000</pubDate>
		<dc:creator>Tim Teatro</dc:creator>
				<category><![CDATA[Comics]]></category>
		<category><![CDATA[Comic]]></category>

		<guid isPermaLink="false">http://www.timteatro.net/?p=1083</guid>
		<description><![CDATA[Proof positive that you just can't run from the cops... Even if you have a time machine.]]></description>
				<content:encoded><![CDATA[<div id="attachment_1084" class="wp-caption aligncenter" style="width: 490px"><a href="http://www.timteatro.net/wp-content/uploads/2010/11/BTF_comic_1.jpg"><img src="http://www.timteatro.net/wp-content/uploads/2010/11/BTF_comic_1.jpg" alt="Please contact me if you don&#039;t see the comic." title="BTF_comic_1" width="480" height="308" class="size-full wp-image-1084" /></a><p class="wp-caption-text">What'ca gonna do when they come for you?</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.timteatro.net/2010/11/04/comic-busted-to-the-future/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
