<?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>Solder In The Veins &#187; Python</title>
	<atom:link href="http://solderintheveins.co.uk/category/prog/progpython/feed/" rel="self" type="application/rss+xml" />
	<link>http://solderintheveins.co.uk</link>
	<description>Electronics and Programming for All</description>
	<lastBuildDate>Mon, 28 Jun 2010 21:40:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Simple Power Loss Detector with SMS Notification</title>
		<link>http://solderintheveins.co.uk/2010/06/simple-power-loss-detector-with-sms-notification/</link>
		<comments>http://solderintheveins.co.uk/2010/06/simple-power-loss-detector-with-sms-notification/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 21:40:26 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[gammu]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sms]]></category>

		<guid isPermaLink="false">http://solderintheveins.co.uk/?p=904</guid>
		<description><![CDATA[After having a few un-expected power outages this year, it got me thinking about how I could easily (and cheaply) be alerted (preferably via SMS) should one occur. With a laptop running Linux, a little bit of Python and some easily obtainable hardware and software, I come up with a simple method of doing just


Related posts:<ol><li><a href='http://solderintheveins.co.uk/2009/03/fun-with-pyrssi-an-arduino-and-twitter/' rel='bookmark' title='Permanent Link: Fun with PyRSSI, an Arduino and Twitter'>Fun with PyRSSI, an Arduino and Twitter</a></li>
<li><a href='http://solderintheveins.co.uk/2009/03/arduino-based-talking-remote-thermometer/' rel='bookmark' title='Permanent Link: Arduino-based Talking &#038; Remote Thermometer'>Arduino-based Talking &#038; Remote Thermometer</a></li>
<li><a href='http://solderintheveins.co.uk/2009/03/webthermo-web-based-temperature-monitor/' rel='bookmark' title='Permanent Link: Webthermo: Web-based Temperature Monitor'>Webthermo: Web-based Temperature Monitor</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsolderintheveins.co.uk%2F2010%2F06%2Fsimple-power-loss-detector-with-sms-notification%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsolderintheveins.co.uk%2F2010%2F06%2Fsimple-power-loss-detector-with-sms-notification%2F&amp;source=pmjlavelle&amp;style=normal&amp;service=cli.gs&amp;service_api=581d909a4143a80247443415d4bdc80c" height="61" width="50" /><br />
			</a>
		</div>
<p>After having a few un-expected power outages this year, it got me thinking about how I could easily (and cheaply) be alerted (preferably via SMS) should one occur. With a laptop running Linux, a little bit of Python and some easily obtainable hardware and software, I come up with a simple method of doing just that. Read on for the code and set-up instructions.<span id="more-904"></span></p>
<h1>What You&#8217;ll Need</h1>
<ul>
<li>A Laptop or netbook running Linux (This won&#8217;t work with a Desktop PC)</li>
<li><a title="Wammu and Gammu" href="http://wammu.eu/" target="_blank">Gammu</a> (a management application for cellular devices)</li>
<li>The <strong>acpi</strong> system utility.</li>
<li>The Python Interpreter (Version 2.6.)</li>
<li>The <strong>commands, time</strong> and <strong>datetime</strong> Python modules</li>
<li>The <a title="Python Bindings for Gammu" href="http://wammu.eu/python-gammu/" target="_blank">Python bindings for Gammu.</a></li>
<li>A GSM  modem or Phone that is compatible with Gammu (in my case, I&#8217;m using a <a title="Huawei E160" href="http://www.mobilebroadbandrocks.com/device/huawei-e160" target="_blank">Huawei E160 HSDPA USB modem</a> with a Prepaid SIM card on the O2 network in the UK.)</li>
</ul>
<h1>Installing and Configuring the Software</h1>
<p>Ubuntu/Debian users can install Gammu, the Gammu Python bindings and the acpi utility using the following command:</p>
<p style="padding-left: 30px;"><strong>apt-get install gammu python-gammu acpi</strong></p>
<p>The only configuration we&#8217;ll have to do here is to Gammu. First, determine what serial port device your GSM modem is connected to by running the <strong>dmesg</strong> command. If your using a USB dongle like me, the serial port device will be prefixed with <strong>/dev/ttyUSB</strong></p>
<p>Once you&#8217;ve found the serial port device, enter the command <strong>gammu-config</strong> into the terminal to configure Gammu for use with your modem. You should be presented with something similar to the screenshot below:</p>
<div id="attachment_916" class="wp-caption alignnone" style="width: 310px"><a href="http://solderintheveins.co.uk/wordpress/wp-content/uploads/2010/06/gammu-config-screen1.png"><img class="size-medium wp-image-916  " title="Gammu Configuration Utility" src="http://solderintheveins.co.uk/wordpress/wp-content/uploads/2010/06/gammu-config-screen1-300x201.png" alt="Gammu Configuration Utility Screenshot" width="300" height="201" /></a><p class="wp-caption-text">gammu-config Configuration Menu Screen (Click on the image for a full-sized version.)</p></div>
<p>The only thing you need to worry about here is the <strong>Port </strong>option. Just replace the value in this option with the serial port device that corresponds to your GSM modem, then select the Save option to save the new configuration.</p>
<h1>The Code</h1>
<p>The Python script (<a href="http://solderintheveins.co.uk/wordpress/wp-content/uploads/2010/06/pwralarm.zip">pwralarm.py</a>) which handles the job of detecting mains power outages and sending notifications can be found on the <a title="Software Page" href="http://solderintheveins.co.uk/software" target="_blank">Software</a> page. You will need to extract the script from the zip archive and configure it for your own use before it can be used. To configure the script for your own use, just set the variable <strong>mobileno</strong> at the top of the script<strong> </strong>to the Mobile/Cellular number you would like SMS notifications to be sent to by entering the number between the quotes.</p>
<p>Everything should now be good to go. To use the script,, make sure you have your GSM modem connected and your laptop/netbook plugged into the mains first,  then type the command .<strong>/pwralarm.py</strong> to execute the script.</p>
<p>The script will run in an infinite loop and If the mains power source is disconnected (which is determined by the script running the <strong>acpi -a</strong> command and looking at the output) this will be detected by the script and an SMS notification message sent using the <strong>SendSMS()</strong> method of the<strong> Gammu module</strong>. To stop the script, just hold down the <strong>CTRL </strong>and<strong> C </strong>keys in the terminal you&#8217;re running the script in.</p>
<h1>In Conclusion&#8230;</h1>
<p>Ok, so this is a <strong>very, very, very </strong>ugly hack, but if you&#8217;re like me and you use a laptop as your main PC, which spends most of it&#8217;s time anchored to a desk and connected to the mains, you should find this useful as a way to alert you to possible power cuts or if your laptop is disconnected from the mains for any reason, for that matter (theft detection device, anyone?)</p>
<p>Hope it&#8217;s useful to someone. Feel free to leave any feedback in the comments or you can always get in touch with me via the <a title="Contact Me" href="http://solderintheveins.co.uk/contact-me/" target="_blank">Contact</a> page on this site.</p>


<p>Related posts:<ol><li><a href='http://solderintheveins.co.uk/2009/03/fun-with-pyrssi-an-arduino-and-twitter/' rel='bookmark' title='Permanent Link: Fun with PyRSSI, an Arduino and Twitter'>Fun with PyRSSI, an Arduino and Twitter</a></li>
<li><a href='http://solderintheveins.co.uk/2009/03/arduino-based-talking-remote-thermometer/' rel='bookmark' title='Permanent Link: Arduino-based Talking &#038; Remote Thermometer'>Arduino-based Talking &#038; Remote Thermometer</a></li>
<li><a href='http://solderintheveins.co.uk/2009/03/webthermo-web-based-temperature-monitor/' rel='bookmark' title='Permanent Link: Webthermo: Web-based Temperature Monitor'>Webthermo: Web-based Temperature Monitor</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://solderintheveins.co.uk/2010/06/simple-power-loss-detector-with-sms-notification/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>From HPR: Python Roundtable Discussion</title>
		<link>http://solderintheveins.co.uk/2010/02/from-hpr-python-roundtable-discussion/</link>
		<comments>http://solderintheveins.co.uk/2010/02/from-hpr-python-roundtable-discussion/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 06:55:20 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[hpr]]></category>
		<category><![CDATA[podcast]]></category>

		<guid isPermaLink="false">http://solderintheveins.co.uk/?p=863</guid>
		<description><![CDATA[This may be old news to some of you but I thought it was interesting enough to warrant a blog post. The Podcast site Hacker Public Radio has a rather interesting episode about the current and future plans for the development of Python.  Hope it&#8217;s useful to someone. Related posts:Handy Link: &#8220;Invent with Python&#8221; Taken


Related posts:<ol><li><a href='http://solderintheveins.co.uk/2009/12/invent-with-python/' rel='bookmark' title='Permanent Link: Handy Link: &#8220;Invent with Python&#8221;'>Handy Link: &#8220;Invent with Python&#8221;</a></li>
<li><a href='http://solderintheveins.co.uk/2009/10/python-challenge/' rel='bookmark' title='Permanent Link: Taken the Python Challenge?'>Taken the Python Challenge?</a></li>
<li><a href='http://solderintheveins.co.uk/2009/12/techradar-history-of-modems/' rel='bookmark' title='Permanent Link: From techradar: History of Modems'>From techradar: History of Modems</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsolderintheveins.co.uk%2F2010%2F02%2Ffrom-hpr-python-roundtable-discussion%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsolderintheveins.co.uk%2F2010%2F02%2Ffrom-hpr-python-roundtable-discussion%2F&amp;source=pmjlavelle&amp;style=normal&amp;service=cli.gs&amp;service_api=581d909a4143a80247443415d4bdc80c" height="61" width="50" /><br />
			</a>
		</div>
<p>This may be old news to some of you but I thought it was interesting enough to warrant a blog post.</p>
<p>The Podcast site <a title="Hacker Public Radio" href="http://hackerpublicradio.org/" target="_blank">Hacker Public Radio</a> has a <a href="http://hackerpublicradio.org/eps/hpr0510.mp3" target="_blank">rather interesting episode</a> about the current and future plans for the development of Python.  Hope it&#8217;s useful to someone.</p>


<p>Related posts:<ol><li><a href='http://solderintheveins.co.uk/2009/12/invent-with-python/' rel='bookmark' title='Permanent Link: Handy Link: &#8220;Invent with Python&#8221;'>Handy Link: &#8220;Invent with Python&#8221;</a></li>
<li><a href='http://solderintheveins.co.uk/2009/10/python-challenge/' rel='bookmark' title='Permanent Link: Taken the Python Challenge?'>Taken the Python Challenge?</a></li>
<li><a href='http://solderintheveins.co.uk/2009/12/techradar-history-of-modems/' rel='bookmark' title='Permanent Link: From techradar: History of Modems'>From techradar: History of Modems</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://solderintheveins.co.uk/2010/02/from-hpr-python-roundtable-discussion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://hackerpublicradio.org/eps/hpr0510.mp3" length="22955434" type="audio/mpeg" />
		</item>
		<item>
		<title>Handy Link: bpython</title>
		<link>http://solderintheveins.co.uk/2009/12/handy-link-bpython-2/</link>
		<comments>http://solderintheveins.co.uk/2009/12/handy-link-bpython-2/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 18:56:32 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Handy Link]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[bython]]></category>

		<guid isPermaLink="false">http://solderintheveins.co.uk/?p=795</guid>
		<description><![CDATA[bpython is a Python interpreter interface on steroids! It&#8217;s main features are: Syntax Highlighting A save function (to save code you&#8217;ve entered to a file) Auto-intending (we all know how important correct indenting is when you&#8217;re writing python scripts!) Auto-Completion which displays suggestions for any built-in functions, helping you to get the syntax for a


Related posts:<ol><li><a href='http://solderintheveins.co.uk/2009/12/invent-with-python/' rel='bookmark' title='Permanent Link: Handy Link: &#8220;Invent with Python&#8221;'>Handy Link: &#8220;Invent with Python&#8221;</a></li>
<li><a href='http://solderintheveins.co.uk/2009/03/fun-with-pyrssi-an-arduino-and-twitter/' rel='bookmark' title='Permanent Link: Fun with PyRSSI, an Arduino and Twitter'>Fun with PyRSSI, an Arduino and Twitter</a></li>
<li><a href='http://solderintheveins.co.uk/2010/06/simple-power-loss-detector-with-sms-notification/' rel='bookmark' title='Permanent Link: Simple Power Loss Detector with SMS Notification'>Simple Power Loss Detector with SMS Notification</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsolderintheveins.co.uk%2F2009%2F12%2Fhandy-link-bpython-2%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsolderintheveins.co.uk%2F2009%2F12%2Fhandy-link-bpython-2%2F&amp;source=pmjlavelle&amp;style=normal&amp;service=cli.gs&amp;service_api=581d909a4143a80247443415d4bdc80c" height="61" width="50" /><br />
			</a>
		</div>
<p><strong>bpython</strong> is a Python interpreter interface on steroids! It&#8217;s main features are:</p>
<ul>
<li><strong>Syntax Highlighting </strong></li>
<li><strong>A s</strong><strong>ave function </strong>(to save code you&#8217;ve entered to a file)</li>
<li><strong> Auto-intending </strong> (we all know how important correct indenting is when you&#8217;re writing python scripts!)</li>
<li><strong>Auto-Completion </strong>which displays suggestions for any built-in functions, helping you to get the syntax for a statement spot-on without having to dig through reference manuals. The auto-completion feature also helps with <strong><em>import</em></strong> declarations, showing you a list of available modules as you type.</li>
</ul>
<p>Installation in Ubuntu is as painless as typing <strong>sudo apt-get install bpython</strong> Other packages are available for Debian, Fedora and OpenSUSE as well. You can also obtain the source code from <a title="bython Source Tarball Download" href="http://www.bpython-interpreter.org/releases/bpython-0.9.5.2.tar.gz" target="_blank">here</a> and compile it yourself if need be.</p>
<p>If you need any help with using bpython, then check out the<a title="bython Project Page" href="http://www.bpython-interpreter.org/home/" target="_blank"> project&#8217;s webpage.</a> Hope this is useful to someone.</p>
<h2>Happy new year!</h2>


<p>Related posts:<ol><li><a href='http://solderintheveins.co.uk/2009/12/invent-with-python/' rel='bookmark' title='Permanent Link: Handy Link: &#8220;Invent with Python&#8221;'>Handy Link: &#8220;Invent with Python&#8221;</a></li>
<li><a href='http://solderintheveins.co.uk/2009/03/fun-with-pyrssi-an-arduino-and-twitter/' rel='bookmark' title='Permanent Link: Fun with PyRSSI, an Arduino and Twitter'>Fun with PyRSSI, an Arduino and Twitter</a></li>
<li><a href='http://solderintheveins.co.uk/2010/06/simple-power-loss-detector-with-sms-notification/' rel='bookmark' title='Permanent Link: Simple Power Loss Detector with SMS Notification'>Simple Power Loss Detector with SMS Notification</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://solderintheveins.co.uk/2009/12/handy-link-bpython-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handy Link: &#8220;Invent with Python&#8221;</title>
		<link>http://solderintheveins.co.uk/2009/12/invent-with-python/</link>
		<comments>http://solderintheveins.co.uk/2009/12/invent-with-python/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 23:33:57 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Handy Link]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[guide]]></category>

		<guid isPermaLink="false">http://solderintheveins.co.uk/?p=759</guid>
		<description><![CDATA[Need an accessible guide to learning Python that won&#8217;t send you to sleep? &#8220;Invent with Python&#8221; is just what you need! Invent Your Own Computer Games with Python, 2nd Edition (to give it its full title) is a book written by Al Sweigart.  It is available for free on-line in both HTML and PDF format.


Related posts:<ol><li><a href='http://solderintheveins.co.uk/2009/12/handy-link-bpython-2/' rel='bookmark' title='Permanent Link: Handy Link: bpython'>Handy Link: bpython</a></li>
<li><a href='http://solderintheveins.co.uk/2010/02/from-hpr-python-roundtable-discussion/' rel='bookmark' title='Permanent Link: From HPR: Python Roundtable Discussion'>From HPR: Python Roundtable Discussion</a></li>
<li><a href='http://solderintheveins.co.uk/2009/10/python-challenge/' rel='bookmark' title='Permanent Link: Taken the Python Challenge?'>Taken the Python Challenge?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsolderintheveins.co.uk%2F2009%2F12%2Finvent-with-python%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsolderintheveins.co.uk%2F2009%2F12%2Finvent-with-python%2F&amp;source=pmjlavelle&amp;style=normal&amp;service=cli.gs&amp;service_api=581d909a4143a80247443415d4bdc80c" height="61" width="50" /><br />
			</a>
		</div>
<p>Need an accessible guide to learning Python that <strong>won&#8217;t </strong>send you to sleep? <a title="Invent with Python: Home Page" href="http://inventwithpython.com/" target="_blank">&#8220;Invent with Python&#8221;</a> is just what you need!</p>
<p><strong>Invent Your Own Computer Games with Python, 2nd Edition</strong> (to give it its full title) is a book written by Al Sweigart.  It is available for free on-line in both HTML and PDF format. You can download the PDF format from <a title="Invent With Python: PDF Download Link" href="http://inventwithpython.com/IYOCGwP_book1.pdf" target="_blank">here.</a></p>
<p>The book is released under a <a href="http://en.wikipedia.org/wiki/Creative_Commons_licenses" target="_blank">Creative Commons licence</a> and is aimed at people who are completely new to programming.</p>
<p>Comprised of 19 Chapters (at the time this post was written), it guides the reader through the basic concepts (Installation of Python, use of the Python interactive shell, Variables, functions, etc) and some of the more advanced stuff as well.</p>
<p>The coding examples in the book are all games (so you can actually have some fun with what you create as you go through the book!), which increase in complexity as the chapters progress.</p>
<p>There is also a <a title="Invent With Python: Blog" href="http://inventwithpython.com/blog/" target="_blank">Blog</a> related to the book, so you can keep up with any future additions that are made to it.</p>


<p>Related posts:<ol><li><a href='http://solderintheveins.co.uk/2009/12/handy-link-bpython-2/' rel='bookmark' title='Permanent Link: Handy Link: bpython'>Handy Link: bpython</a></li>
<li><a href='http://solderintheveins.co.uk/2010/02/from-hpr-python-roundtable-discussion/' rel='bookmark' title='Permanent Link: From HPR: Python Roundtable Discussion'>From HPR: Python Roundtable Discussion</a></li>
<li><a href='http://solderintheveins.co.uk/2009/10/python-challenge/' rel='bookmark' title='Permanent Link: Taken the Python Challenge?'>Taken the Python Challenge?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://solderintheveins.co.uk/2009/12/invent-with-python/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Taken the Python Challenge?</title>
		<link>http://solderintheveins.co.uk/2009/10/python-challenge/</link>
		<comments>http://solderintheveins.co.uk/2009/10/python-challenge/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 22:59:27 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[python-challenge]]></category>

		<guid isPermaLink="false">http://solderintheveins.co.uk/?p=530</guid>
		<description><![CDATA[Want a great way to learn a programming language and have some fun? Why not take the Python Challenge. Just found out about this little gem on hackaday  and thought I&#8217;d post it here to help spread the word. The Python Challenge site consists of a series of levels ( 33 levels at present) in


Related posts:<ol><li><a href='http://solderintheveins.co.uk/2009/12/invent-with-python/' rel='bookmark' title='Permanent Link: Handy Link: &#8220;Invent with Python&#8221;'>Handy Link: &#8220;Invent with Python&#8221;</a></li>
<li><a href='http://solderintheveins.co.uk/2010/02/from-hpr-python-roundtable-discussion/' rel='bookmark' title='Permanent Link: From HPR: Python Roundtable Discussion'>From HPR: Python Roundtable Discussion</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsolderintheveins.co.uk%2F2009%2F10%2Fpython-challenge%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsolderintheveins.co.uk%2F2009%2F10%2Fpython-challenge%2F&amp;source=pmjlavelle&amp;style=normal&amp;service=cli.gs&amp;service_api=581d909a4143a80247443415d4bdc80c" height="61" width="50" /><br />
			</a>
		</div>
<p>Want a great way to learn a programming language <strong>and</strong> have some fun? Why not take the <a title="The Python Challenge" href="http://www.pythonchallenge.com/" target="_blank">Python Challenge</a>. Just found out about this little gem on hackaday  and thought I&#8217;d post it here to help spread the word.</p>
<p>The Python Challenge site consists of a series of levels ( 33 levels at present) in which you have to solve puzzles of increasing complexity using code you write yourself. Each puzzle solution then gives you access to the next level.</p>
<p>The site also has a great community behind it, with <a title="Python Challenge Forums" href="http://www.pythonchallenge.com/forums/" target="_blank">forums</a> if you get really stuck and need a hint.</p>


<p>Related posts:<ol><li><a href='http://solderintheveins.co.uk/2009/12/invent-with-python/' rel='bookmark' title='Permanent Link: Handy Link: &#8220;Invent with Python&#8221;'>Handy Link: &#8220;Invent with Python&#8221;</a></li>
<li><a href='http://solderintheveins.co.uk/2010/02/from-hpr-python-roundtable-discussion/' rel='bookmark' title='Permanent Link: From HPR: Python Roundtable Discussion'>From HPR: Python Roundtable Discussion</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://solderintheveins.co.uk/2009/10/python-challenge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>From Hackaday: Arduino Snow Clock</title>
		<link>http://solderintheveins.co.uk/2009/07/from-hackaday-arduino-snow-clock/</link>
		<comments>http://solderintheveins.co.uk/2009/07/from-hackaday-arduino-snow-clock/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 18:13:23 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Microcontrolers]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://solderintheveins.co.uk/?p=415</guid>
		<description><![CDATA[This Alarm Clock Arduino hack , featured on hackaday,  has to be one of the most innovative uses of an Arduino and Python I have seen! The maker, insingertech, has published full instructions on his hack here. He goes into great detail on his build process and the diagrams (for the Relay Driver part of


Related posts:<ol><li><a href='http://solderintheveins.co.uk/2009/12/simple-audio-switch/' rel='bookmark' title='Permanent Link: Simple LAN Controlled Stereo Audio Switch'>Simple LAN Controlled Stereo Audio Switch</a></li>
<li><a href='http://solderintheveins.co.uk/2009/03/arduino-based-talking-remote-thermometer/' rel='bookmark' title='Permanent Link: Arduino-based Talking &#038; Remote Thermometer'>Arduino-based Talking &#038; Remote Thermometer</a></li>
<li><a href='http://solderintheveins.co.uk/2009/03/fun-with-pyrssi-an-arduino-and-twitter/' rel='bookmark' title='Permanent Link: Fun with PyRSSI, an Arduino and Twitter'>Fun with PyRSSI, an Arduino and Twitter</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsolderintheveins.co.uk%2F2009%2F07%2Ffrom-hackaday-arduino-snow-clock%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsolderintheveins.co.uk%2F2009%2F07%2Ffrom-hackaday-arduino-snow-clock%2F&amp;source=pmjlavelle&amp;style=normal&amp;service=cli.gs&amp;service_api=581d909a4143a80247443415d4bdc80c" height="61" width="50" /><br />
			</a>
		</div>
<p><a title="Hackaday: Arduino Snow Clock" href="http://hackaday.com/2009/07/01/the-snow-clock/">This Alarm Clock Arduino hack </a>, featured on <a title="Hack a Day" href="http://www.hackaday.com">hackaday</a>,  has to be one of the most innovative uses of an Arduino and Python I have seen! The maker, insingertech, has published full instructions on his hack <a title="Snow Clock Instructable" href="http://www.instructables.com/id/Snow-Clock-Arduino-Based/" target="_blank">here</a>.</p>
<p>He goes into great detail on his build process and the diagrams (for the Relay Driver part of his circuit, especially) really help to explain things.</p>
<p>The only critisism I can think of here is that perhaps he should have used an <a title="Ethernet Shield Description" href="http://arduino.cc/en/Main/ArduinoEthernetShield" target="_blank">Ethernet Shield</a> for the network connectivity element of his project instead of a PC/Laptop.</p>


<p>Related posts:<ol><li><a href='http://solderintheveins.co.uk/2009/12/simple-audio-switch/' rel='bookmark' title='Permanent Link: Simple LAN Controlled Stereo Audio Switch'>Simple LAN Controlled Stereo Audio Switch</a></li>
<li><a href='http://solderintheveins.co.uk/2009/03/arduino-based-talking-remote-thermometer/' rel='bookmark' title='Permanent Link: Arduino-based Talking &#038; Remote Thermometer'>Arduino-based Talking &#038; Remote Thermometer</a></li>
<li><a href='http://solderintheveins.co.uk/2009/03/fun-with-pyrssi-an-arduino-and-twitter/' rel='bookmark' title='Permanent Link: Fun with PyRSSI, an Arduino and Twitter'>Fun with PyRSSI, an Arduino and Twitter</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://solderintheveins.co.uk/2009/07/from-hackaday-arduino-snow-clock/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Webthermo: Web-based Temperature Monitor</title>
		<link>http://solderintheveins.co.uk/2009/03/webthermo-web-based-temperature-monitor/</link>
		<comments>http://solderintheveins.co.uk/2009/03/webthermo-web-based-temperature-monitor/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 15:58:23 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Microcontrolers]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Sensor]]></category>
		<category><![CDATA[temperature]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://solderintheveins.co.uk/?p=341</guid>
		<description><![CDATA[Ok, so someone has already beaten me to it (and done a excellent job of it as well) with the whole web-based temperature monitoring thing, but anyway&#8230; Here&#8217;s Webthermo! Webthermo,  my follow-up to Ardthermo, is a small, web-enabled Python script which uses the CherryPy HTTP Python framework.  It allows you to monitor temperature (in both


Related posts:<ol><li><a href='http://solderintheveins.co.uk/2009/03/arduino-based-talking-remote-thermometer/' rel='bookmark' title='Permanent Link: Arduino-based Talking &#038; Remote Thermometer'>Arduino-based Talking &#038; Remote Thermometer</a></li>
<li><a href='http://solderintheveins.co.uk/2009/03/fun-with-pyrssi-an-arduino-and-twitter/' rel='bookmark' title='Permanent Link: Fun with PyRSSI, an Arduino and Twitter'>Fun with PyRSSI, an Arduino and Twitter</a></li>
<li><a href='http://solderintheveins.co.uk/2009/07/from-hackaday-arduino-snow-clock/' rel='bookmark' title='Permanent Link: From Hackaday: Arduino Snow Clock'>From Hackaday: Arduino Snow Clock</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsolderintheveins.co.uk%2F2009%2F03%2Fwebthermo-web-based-temperature-monitor%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsolderintheveins.co.uk%2F2009%2F03%2Fwebthermo-web-based-temperature-monitor%2F&amp;source=pmjlavelle&amp;style=normal&amp;service=cli.gs&amp;service_api=581d909a4143a80247443415d4bdc80c" height="61" width="50" /><br />
			</a>
		</div>
<p>Ok, so someone<a title="Arduino Web Thermostat" href="http://hackaday.com/2009/03/12/thermosmart-arduino-thermostat/" target="_blank"> has already beaten me to it</a> (and done a excellent job of it as well) with the whole web-based temperature monitoring thing, but anyway&#8230; Here&#8217;s Webthermo! <img src='http://solderintheveins.co.uk/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Webthermo,  my follow-up to <a title="Ardthermo" href="http://solderintheveins.co.uk/?p=64" target="_blank">Ardthermo</a>, is a small, web-enabled Python script which uses the <a title="CherryPy Homepage" href="http://www.cherrypy.org/" target="_blank">CherryPy</a> HTTP Python framework.  It allows you to monitor temperature (in both Celsius and Fahrenheit units) over the Internet (using the port-fowarding facility of your Router),  or on your own LAN via a web browser, your favorite RSS reader or a <a title="Wireless Application Protocol" href="http://en.wikipedia.org/wiki/Wireless_Application_Protocol" target="_blank">WAP</a>-capable Mobile phone, using the same Arduino sketch and hardware setup as was used for Ardthermo.</p>
<p>It&#8217;s still in the early stages of development at the moment, so its still a bit rough around the edges but it works well enough. You can get a copy of the Python script, which also includes the Arduino sketch needed for the hardware side of things, from the Software page.</p>
<p>System Requirements and instructions on how to use Webthermo can be found below. Enjoy everyone!</p>
<p><span id="more-341"></span></p>
<h2>System Requirements</h2>
<h3>Software</h3>
<ul>
<li>Python 2.5.2 or above with the <a title="CherryPy Homepage" href="http://www.cherrypy.org/" target="_blank">CherryPy</a> (version 3.1.1) and <a title="Threading Module Docs" href="http://docs.python.org/dev/library/threading.html#module-threading" target="_blank">Threading</a> modules installed.</li>
<li>Linux recommended. Use of Ubuntu is assumed in this guide, but this should work under Windows, Mac OS X, etc as well  <strong><em>(Could any MAC or Windows users out there post their experiences with using this script? )</em></strong></li>
</ul>
<p><strong>You don&#8217;t need to use a seperate Webserver, such as Apache, as the server component is provided by the CherryPy module.</strong><strong><em><br />
</em></strong></p>
<h3>Hardware</h3>
<p>The hardware requirements and instructions for setting up the Measurement circuit are  the same as in the<a title="Arduino Remote Thermometer" href="http://solderintheveins.co.uk/?p=64" target="_blank"> Arduino Remote Thermometer</a> article, so I won&#8217;t repeat them here. Have a look at the instructions there and make sure you have everything setup and the thermometer sketch uploaded to the Arduino before continuing.</p>
<h2>Installing Software Dependencies</h2>
<p>The Threading module should already be included with your Python installation. The CherryPy module can be installed by issuing the following command at the terminal:</p>
<p style="padding-left: 60px;"><strong>sudo apt-get install python-cherrypy3</strong></p>
<p style="padding-left: 60px;">
<h2><strong>Configuring Webthermo</strong></h2>
<p>Before you use Webthermo, you&#8217;ll need to configure it. Open up the <strong>webthermo.py</strong> file (this is the main program, the <strong>obtaindata.py</strong> file is just a companion module)  in your favorate text editor and scroll down to the <strong>Configuration Options</strong> section. A description of the Configuration options can be found below:</p>
<ul>
<li><strong>ArduinoPort:</strong> The serial port device your Arduino is connected to.</li>
</ul>
<ul>
<li><strong>MonitorLocation: </strong>A short description of the location Webthermo is monitoring. This will show on all web pages as well as in the RSS feeds descriptions.</li>
</ul>
<ul>
<li><strong>ServerPort:</strong> The port webthermo will listen on for connections.</li>
</ul>
<ul>
<li><strong>Refresh_Interval:</strong> Sets the delay between page auto-refreshes. (This is only applicable to the home page.)</li>
</ul>
<ul>
<li><strong>Users:</strong> The maximum number of Concurent Users you want Webthermo to be able to serve. The Default setting is 5.</li>
</ul>
<h2>Using Webthermo</h2>
<p>To use Webthermo,  open a terminal, go<strong> </strong>to the directory where you unpacked Webthermo,  change to the <strong>bin </strong>subdirectory and issue the following command:</p>
<p style="padding-left: 60px;"><strong>./webthermo.py</strong></p>
<p>The script will then execute. You can stop the script by pressing <strong>Ctrl-C</strong>.</p>
<p>To check that everything&#8217;s working, load up a web browser and point it to the address and port number Webthermo is running on. You should then get the homepage in your browser. (See screenshot below for an example.)</p>
<div id="attachment_310" class="wp-caption aligncenter" style="width: 310px"><a href="http://solderintheveins.co.uk/wordpress/wp-content/uploads/2009/03/screenshot-webthermo.png"><img class="size-medium wp-image-310" title="Webthermo In Action" src="http://solderintheveins.co.uk/wordpress/wp-content/uploads/2009/03/screenshot-webthermo-300x253.png" alt="Webthermo In Action" width="300" height="253" /></a><p class="wp-caption-text">Webthermo homepage. Click for full-sized image.</p></div>
<p>You can access the RSS feeds by appending <strong>/rss</strong> to the end of the URL. The WAP readings page  can be accessed by appending <strong>/wap</strong> and the lite (plain-text version, suitable for PDA&#8217;s and older web browsers) can be accessed by appending <strong>/lite</strong> to the end of the URL.</p>
<p>Hope you find this little script useful. Until next time, good bye and Happy Hacking.</p>


<p>Related posts:<ol><li><a href='http://solderintheveins.co.uk/2009/03/arduino-based-talking-remote-thermometer/' rel='bookmark' title='Permanent Link: Arduino-based Talking &#038; Remote Thermometer'>Arduino-based Talking &#038; Remote Thermometer</a></li>
<li><a href='http://solderintheveins.co.uk/2009/03/fun-with-pyrssi-an-arduino-and-twitter/' rel='bookmark' title='Permanent Link: Fun with PyRSSI, an Arduino and Twitter'>Fun with PyRSSI, an Arduino and Twitter</a></li>
<li><a href='http://solderintheveins.co.uk/2009/07/from-hackaday-arduino-snow-clock/' rel='bookmark' title='Permanent Link: From Hackaday: Arduino Snow Clock'>From Hackaday: Arduino Snow Clock</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://solderintheveins.co.uk/2009/03/webthermo-web-based-temperature-monitor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fun with PyRSSI, an Arduino and Twitter</title>
		<link>http://solderintheveins.co.uk/2009/03/fun-with-pyrssi-an-arduino-and-twitter/</link>
		<comments>http://solderintheveins.co.uk/2009/03/fun-with-pyrssi-an-arduino-and-twitter/#comments</comments>
		<pubDate>Sat, 07 Mar 2009 16:40:33 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[bluetooth]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://solderintheveins.co.uk/?p=229</guid>
		<description><![CDATA[In this little project,  the RSSI value (detected by a small python script)  is used to control 3 LED&#8217;s on an Arduino. The LED&#8217;s are used to indicate the proximity (in terms of Far Away, Slightly Closer and Very Close) of a paired device relative to the PC running the script. The python script can


Related posts:<ol><li><a href='http://solderintheveins.co.uk/2009/03/arduino-based-talking-remote-thermometer/' rel='bookmark' title='Permanent Link: Arduino-based Talking &#038; Remote Thermometer'>Arduino-based Talking &#038; Remote Thermometer</a></li>
<li><a href='http://solderintheveins.co.uk/2009/03/webthermo-web-based-temperature-monitor/' rel='bookmark' title='Permanent Link: Webthermo: Web-based Temperature Monitor'>Webthermo: Web-based Temperature Monitor</a></li>
<li><a href='http://solderintheveins.co.uk/2009/07/from-hackaday-arduino-snow-clock/' rel='bookmark' title='Permanent Link: From Hackaday: Arduino Snow Clock'>From Hackaday: Arduino Snow Clock</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsolderintheveins.co.uk%2F2009%2F03%2Ffun-with-pyrssi-an-arduino-and-twitter%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsolderintheveins.co.uk%2F2009%2F03%2Ffun-with-pyrssi-an-arduino-and-twitter%2F&amp;source=pmjlavelle&amp;style=normal&amp;service=cli.gs&amp;service_api=581d909a4143a80247443415d4bdc80c" height="61" width="50" /><br />
			</a>
		</div>
<p>In this little project,  the RSSI value (detected by a small python script)  is used to control 3 LED&#8217;s on an Arduino. The LED&#8217;s are used to indicate the proximity (in terms of Far Away, Slightly Closer and Very Close) of a paired device relative to the PC running the script. The python script can also send a message to Twitter when the paired Bluetooth device is in close proximity to the PC.</p>
<p>The Arduino Sketch and companion Python script are both in the zip file rssitracker.zip which can be downloaded from the Software page.</p>
<p><span id="more-229"></span></p>
<h2>What you need</h2>
<h3>Hardware:</h3>
<ul>
<li>1x Arduino</li>
<li>1x Solderless Breadboard</li>
<li> 3x LED&#8217;s (Different Colours if possible. I&#8217;ve used Red, Blue and Green to indicate Far Away, Slightly Closer and Very Close proximity.)</li>
<li>1x Bluetooth Dongle (If you don&#8217;t have built-in Bluetooth on your machine.)</li>
<li>A Bluetooth device to pair with the PC.</li>
</ul>
<h3>Software:</h3>
<ul>
<li>Linux</li>
<li>Python with the <a title="PyRSSI Source" href="http://pysportslive.googlecode.com/svn/trunk/pyrssi/" target="_blank">PyRSSI</a>,  <a title="PyBluez Module Site" href="http://org.csail.mit.edu/pybluez/" target="_blank">pyBluez</a> and <a title="Twitter Python Module Site" href="http://code.google.com/p/python-twitter/" target="_blank">Twitter</a> modules installed.</li>
<li><a title="Swig" href="http://www.swig.org/" target="_blank">Swig</a></li>
<li>The Python and Bluetooth development libraries.</li>
</ul>
<p>You will also need to register a Twitter account to use the Twitter Announce features. You can sign up for free <a title="Twitter" href="http://www.twitter.com" target="_blank">here</a>.</p>
<h2>Installing the Software Components</h2>
<p>Start off by installing<strong> pyBlueZ</strong>,  <strong>swig</strong>, <strong>python-twitter</strong> and the development libraries for Python and Bluetooth. For Ubuntu users, installing these components is as easy as issuing the following command:</p>
<p style="padding-left: 60px;"><strong>sudo apt-get install python-twitter python-bluez swig libbluetooth-dev python-all-dev<br />
</strong></p>
<p>The installation of PyRSSI, on the other hand, requires a couple more steps. Here are the steps I taken:</p>
<ul>
<li> Download the archive (tar.gz or tar.bz2) from <a title="pyRSSI Source" href="http://pysportslive.googlecode.com/svn/trunk/pyrssi/" target="_blank">here</a> and uncompress to a directory of your choice.</li>
<li>Change to the directory where you uncompressed PyRSSI and issue the following command to complete the installation:</li>
</ul>
<p style="padding-left: 60px;"><strong> sudo python setup.py install</strong></p>
<p>This should install the PyRSSI module and its dependencies to the correct directory.</p>
<h2>Hardware Setup</h2>
<p>The hardware side of this project is simple and consists of 3 LED&#8217;s connected to the Digital pins <strong>2</strong>, <strong>4</strong> and <strong>7</strong> of the Arduino. If anyone wants an pic or Circuit diagram putting up,  I&#8217;ll be more than happy to do so.</p>
<h2><strong>Pairing a Bluetooth device </strong></h2>
<p>Now that everything is connected up and all software components are installed, we need a Bluetooth device paired to the PC so we can use it. First, make sure the Bluetooth device is in Discoverable mode.</p>
<p>In Ubuntu, you can just load the<strong> Bluetooth Setup Wizard</strong> by right-clicking on the<strong> Bluetooth icon</strong> on the top bar of the desktop and selecting the  <strong>Setup New Device</strong> option then just follow the steps.</p>
<h2>Getting the Device&#8217;s MAC address</h2>
<p>Now that the device is paired to the PC we need to get it&#8217;s MAC address.  You can use the following command in Ubuntu to get the Name and MAC address of any discoverable device:</p>
<p style="padding-left: 60px;"><strong>hcitool scan</strong></p>
<p>When hcitool has finished scanning for devices, you should get output similar to that in the screenshot below:</p>
<div id="attachment_279" class="wp-caption alignnone" style="width: 310px"><a href="http://solderintheveins.co.uk/wordpress/wp-content/uploads/2009/03/hcitool-example.png"><img class="size-medium wp-image-279" title="hcitool Command: Example Output" src="http://solderintheveins.co.uk/wordpress/wp-content/uploads/2009/03/hcitool-example-300x208.png" alt="hcitool Command: Example Output. Click here to view the full-sized version" width="300" height="208" /></a><p class="wp-caption-text">hcitool Command: Example Output. Click here to view the full-sized version</p></div>
<p>Have a look at the top entry that I&#8217;ve highlighted. You can see the Devices name &#8216;<strong><em>V630i</em></strong>&#8216; on the right-hand side, and it&#8217;s corresponding MAC address &#8216;<em><strong>00:1A:75:A0:32:DC</strong></em>&#8221; on the left-hand side.</p>
<h2><strong>Using the Software</strong></h2>
<p>First of all, upload the Arduino sketch (<strong>bthoming_dev.pde</strong>) to the Arduino.  When the sketch has been uploaded successfully<strong>, </strong>open up the python script (<strong>rssitracker.py</strong>)  and configure it to your needs<strong>. </strong>A list of the configuration options and what they do can be found below:</p>
<ul>
<li><strong>ArduinoPort</strong>:</li>
</ul>
<p style="padding-left: 60px;">Set to the serial port device your Arduino is connected to.</p>
<p style="padding-left: 60px;">
<ul>
<li><strong>DEV_MAC: </strong></li>
</ul>
<p style="padding-left: 60px;">Sets the MAC address of your paired Bluetooth device.</p>
<p style="padding-left: 60px;">
<ul>
<li><strong>UseTwitter:</strong></li>
</ul>
<p style="padding-left: 60px;"><strong> </strong>Determines whether the Twitter feature is used.  Set to <strong>True</strong> to use it and <strong> False</strong> to not use it.</p>
<p style="padding-left: 60px;">
<ul>
<li><strong>TwitterUser:</strong></li>
</ul>
<p style="padding-left: 60px;">The <strong>Username</strong> of Your Twitter Account.</p>
<p style="padding-left: 60px;">
<ul>
<li><strong>TwitterPass:</strong></li>
</ul>
<p style="padding-left: 60px;">The <strong>Password</strong> of your Twitter account.</p>
<p style="padding-left: 60px;">
<ul>
<li><strong>TwitterThis:</strong></li>
</ul>
<p style="padding-left: 60px;">The message you want to &#8216;Twitter&#8217; when the Bluetooth device is in close proximity</p>
<p style="padding-left: 60px;">
<p>The three options below configure the RSSI threshold values. What I&#8217;ve found from using pyRSSI is that any RSSI value of 0 and above indicates <strong>Very Close </strong>Proximity, while a RSSI value of -1 or below indicates <strong>Very Far</strong> or<strong> Out Of Range</strong>. So bear that in mind when setting the options below:</p>
<ul>
<li><strong>VeryClose:</strong></li>
</ul>
<p style="padding-left: 60px;">You can set the trigger value for when the bluetooth device is very close to the PC.</p>
<p style="padding-left: 60px;">
<ul>
<li><strong>AwayFromPC:</strong></li>
</ul>
<p style="padding-left: 60px;">You can set the trigger value for when the bluetooth device is away from the PC, but not too far away from it.</p>
<p style="padding-left: 60px;">
<ul>
<li><strong>VeryFarAway:</strong></li>
</ul>
<p style="padding-left: 60px;">You can set the trigger value for when the bluetooth device is very far away from the PC.</p>
<p>When you&#8217;ve set all the configuration values to your preferences then connect up the Arduino and execute the Python script. There&#8217;s no command line arguments to enter here so just type: <strong>&#8216;./rssitracker.py&#8217;</strong> to run it.<strong><br />
</strong></p>
<h2><strong>Limitations</strong></h2>
<p>This was just a 5-minute hack and is bound to have problems, so don&#8217;t rely on it for anything just yet;  I just wanted get it up on here to  show you all what you could do with the PyRSSI module. I should hopefully be able to get an improved version of this up in the next few days or so.  Until then, Enjoy.</p>
<p><script type="text/javascript">// <![CDATA[
amazon_ad_tag = "sointhve-21"; amazon_ad_width = "180"; amazon_ad_height = "150"; amazon_ad_link_target = "new"; amazon_color_border = "FFFFFF";
// ]]&gt;</script><br />
<script src="http://www.assoc-amazon.co.uk/s/ads.js" type="text/javascript"></script></p>


<p>Related posts:<ol><li><a href='http://solderintheveins.co.uk/2009/03/arduino-based-talking-remote-thermometer/' rel='bookmark' title='Permanent Link: Arduino-based Talking &#038; Remote Thermometer'>Arduino-based Talking &#038; Remote Thermometer</a></li>
<li><a href='http://solderintheveins.co.uk/2009/03/webthermo-web-based-temperature-monitor/' rel='bookmark' title='Permanent Link: Webthermo: Web-based Temperature Monitor'>Webthermo: Web-based Temperature Monitor</a></li>
<li><a href='http://solderintheveins.co.uk/2009/07/from-hackaday-arduino-snow-clock/' rel='bookmark' title='Permanent Link: From Hackaday: Arduino Snow Clock'>From Hackaday: Arduino Snow Clock</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://solderintheveins.co.uk/2009/03/fun-with-pyrssi-an-arduino-and-twitter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arduino-based Talking &amp; Remote Thermometer</title>
		<link>http://solderintheveins.co.uk/2009/03/arduino-based-talking-remote-thermometer/</link>
		<comments>http://solderintheveins.co.uk/2009/03/arduino-based-talking-remote-thermometer/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 03:34:38 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Microcontrolers]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Sensor]]></category>

		<guid isPermaLink="false">http://solderintheveins.co.uk/?p=64</guid>
		<description><![CDATA[After recently acquiring an Arduino Duemilanove I was racking my brains with what I could do with this marvel of modern electronics until I came across this example Sketch at the Arduino Playground Website that allowed an Arduino to function as a temperature measuring device with the addition of a few cheap and easily obtainable components.


Related posts:<ol><li><a href='http://solderintheveins.co.uk/2009/03/webthermo-web-based-temperature-monitor/' rel='bookmark' title='Permanent Link: Webthermo: Web-based Temperature Monitor'>Webthermo: Web-based Temperature Monitor</a></li>
<li><a href='http://solderintheveins.co.uk/2009/03/thermometer-project-update/' rel='bookmark' title='Permanent Link: Thermometer Project: Update'>Thermometer Project: Update</a></li>
<li><a href='http://solderintheveins.co.uk/2009/03/fun-with-pyrssi-an-arduino-and-twitter/' rel='bookmark' title='Permanent Link: Fun with PyRSSI, an Arduino and Twitter'>Fun with PyRSSI, an Arduino and Twitter</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsolderintheveins.co.uk%2F2009%2F03%2Farduino-based-talking-remote-thermometer%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsolderintheveins.co.uk%2F2009%2F03%2Farduino-based-talking-remote-thermometer%2F&amp;source=pmjlavelle&amp;style=normal&amp;service=cli.gs&amp;service_api=581d909a4143a80247443415d4bdc80c" height="61" width="50" /><br />
			</a>
		</div>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="data" value="http://www.youtube.com/v/QpLrxeNcR4M&amp;hl=en&amp;fs=1" /><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/QpLrxeNcR4M&amp;hl=en&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/QpLrxeNcR4M&amp;hl=en&amp;fs=1" allowscriptaccess="always" allowfullscreen="true" data="http://www.youtube.com/v/QpLrxeNcR4M&amp;hl=en&amp;fs=1"></embed></object></p>
<p>After recently getting my hands on an Arduino Duemilanove, I came across <a title="Arduino Thermometer Sketch" href="http://www.arduino.cc/playground/ComponentLib/Thermistor" target="_blank">this</a> Sketch on <a title="Arduino Playground Homepage" href="http://www.arduino.cc/playground/" target="_blank">Arduino Playground</a> that allowed an Arduino to function as a temperature measuring device with the addition of a few cheap and easily obtainable components.</p>
<p>Deciding to take things a step further, I  wrote a Python script to create a DIY temperature measuring device that could be used both locally, via the command line, as well as remotely, using a googlemail account to check the temperature of a room. You can grab a copy of this script, called &#8220;Ardthermo&#8221;,  from the Software page.</p>
<p>This article should give all the info you need to know to build this little project for yourself and make use of the Ardthermo script.  Enjoy.</p>
<p><span id="more-64"></span></p>
<h2>What you&#8217;ll need</h2>
<h3>Hardware:</h3>
<ul>
<li>1x <a title="What's an Arduino?" href="http://en.wikipedia.org/wiki/Arduino" target="_blank">Arduino</a> with at least 1 free Analog input port.</li>
</ul>
<ul>
<li> 1x Solderless Breadboard (to try the circuit out on.)</li>
</ul>
<ul>
<li> 1x 10k resistor</li>
</ul>
<ul>
<li> 1x 10k NTC (Negative Temperature Coefficient) <a title="What's a Thermistor?" href="http://en.wikipedia.org/wiki/Thermistor" target="_blank">Thermistor</a>.</li>
</ul>
<h3>Software:</h3>
<ul>
<li>Linux (Ubuntu Recommended. All instructions in this article assume that Ubuntu is installed on your PC.)</li>
</ul>
<ul>
<li>The <a title="Festival Software Website" href="http://www.cstr.ed.ac.uk/projects/festival/" target="_blank">Festival</a> Text To Speech software program. (Optional, but needed if you want the temperature reading &#8216;Spoke&#8217; to you as well well as printed on the screen.)</li>
</ul>
<ul>
<li>A Googlemail account (You can sign up for free <a title="Google Mail" href="http://mail.google.com" target="_blank">here</a>)</li>
</ul>
<ul>
<li>Python version 2.5.2 or above with <em><strong>termios</strong></em> support compiled in and the <a title="libgmail Module Site" href="http://libgmail.sourceforge.net/" target="_blank">libgmail</a>,  <a title="Python pSerial Module Site" href="http://pyserial.wiki.sourceforge.net/pySerial" target="_blank">pySerial</a> and <a title="getpass module documentation" href="http://docs.python.org/library/getpass.html" target="_blank">getpass</a> Python modules installed.</li>
</ul>
<ul>
<li>The Arduino IDE software package (Get it  from <a title="Arduino IDE software page" href="http://www.arduino.cc/en/Main/Software" target="_blank">here</a>.)</li>
</ul>
<ul>
<li>My Python script, Ardthermo, for the PC (get it from the Software page.)</li>
</ul>
<ul>
<li>My slightly modified version of the Temperature Measurement Sketch for the Arduino which is bundled in with the Ardthermo script.<strong> (I take NO credit for this Sketch at all</strong>, as all I&#8217;ve done to it is modify it a little bit to suit my needs.)</li>
</ul>
<h2>Construction</h2>
<p>Ok, lets get the Arduino-side of the project up and running by putting the Temperature Measuring circuit together. In the rest of this guide, I make the assumption that you&#8217;re using a Solderless Breadboard but soldering the circuit together onto a bit of Vero or Matrix Board should be a trivial task for a beginner.</p>
<p>You&#8217;ll need to use the <strong>Power</strong> (+5v),<strong> Gnd</strong> (Ground)  and one of the<strong> Analog-in</strong> connectors (Pin 0) on the Arduino. On mine, the Analog-In connectors are located near the bottom right-hand corner of the board and the Power connectors are just to the left of them. The image below should explain this better:</p>
<div id="attachment_89" class="wp-caption alignnone" style="width: 310px"><a href="http://solderintheveins.co.uk/wordpress/wp-content/uploads/2009/02/ardports.jpg" target="_blank"><img class="size-medium wp-image-89" title="Arduino Board Connectors" src="http://solderintheveins.co.uk/wordpress/wp-content/uploads/2009/02/ardports-300x207.jpg" alt="Arduino Board Connectors" width="300" height="207" /></a><p class="wp-caption-text">Click for Full-Sized version</p></div>
<p>You will need to set up the 10K  NTC thermistor and 10K resistor on your breadboard (if you have one.) You might be able to see how everything is hooked up from the video near the top of the article (sorry about the rubbish quality), but the schematic diagram below shows how everything should fit together better than the vid.</p>
<div id="attachment_96" class="wp-caption alignnone" style="width: 235px"><img class="size-full wp-image-96" title="Temperature Measurement Circuit" src="http://solderintheveins.co.uk/wordpress/wp-content/uploads/2009/02/schematictmpmeasure.png" alt="Schematic Diagram" width="225" height="258" /><p class="wp-caption-text">Schematic Diagram for Temperature Measuring circuit</p></div>
<p>On the diagram above, <strong>VR1</strong> represents the 10K NTC thermistor and <strong>R2</strong> represents the 10K resistor. Be sure to check all connections between the Arduino and the Measuring circuit, as well as the USB or Serial connection between the PC and Arduino before continuing.</p>
<h2>Installing Software components</h2>
<p>So, now we have everything connected up it&#8217;s time to configure all the software components you&#8217;ll need. This section will concentrate on installing the Python modules, uploading the Thermometer Sketch to the Arduino and using the Ardthermo script. Installation of the Arduino IDE is outside the scope of this article but information on getting it setup under Ubuntu can be found at the <a title="Installing Arduino IDE in Ubuntu" href="http://www.arduino.cc/playground/Linux/Ubuntu" target="_blank">Arduino Playground</a> site.</p>
<h3>Installing the Python modules</h3>
<p>In Ubuntu, the getpass module should already be installed on you system and termios support compiled in (at least, it is on mine. I&#8217;m using Ubuntu 8.10.)</p>
<p>You can install the libgmail and serial Python modules in one go by opening up a Terminal window and issuing the following command:</p>
<p style="padding-left: 60px;"><strong>sudo apt-get install python-serial python-libgmail </strong></p>
<p style="padding-left: 60px;"><strong><br />
</strong></p>
<h3>Installing Festival</h3>
<p>In Ubuntu, just load up a Terminal and issue the following command to install the Festival Text To Speech package:</p>
<p style="padding-left: 60px;"><strong>sudo apt-get install festival</strong></p>
<p style="padding-left: 60px;"><strong><br />
</strong></p>
<h3><strong>Uploading the Sketch to the Arduino</strong></h3>
<p>First of all, connect the Arduino to your PC if you haven&#8217;t already done so<strong>, </strong>then execute the Arduino IDE<strong>. </strong></p>
<p>When the Arduino IDE has loaded, check that the Board and Serial Port settings are correct for the setup you have. To check the Board setting<em><strong>, </strong></em>select <em><strong>Tools</strong></em> from the top menu then select the <em><strong>Board</strong></em> menu option and check that the name that&#8217;s currently selected matches the board you have. For example, my Arduino board is a Duemilanove, so I have the <strong>&#8220;Arduino Diecimila or Duemilanove&#8221; </strong>option selected here for my setup.</p>
<p>To check the serial port settings, select <em><strong>Tools</strong></em> from the top menu then select the <em><strong>Serial Port</strong></em> option. If your Arduino uses a USB port and you have no other USB-serial devices plugged in then <strong>/dev/ttyUSB0</strong> should be OK here. Otherwise, use<strong> /dev/ttyUSB1</strong> instead.</p>
<p>When you&#8217;ve configured your Board and serial options and everything checks out OK, it&#8217;s time to upload the Sketch to the Arduino. In the Arduino IDE, either use the <em><strong>Ctrl-O</strong></em> keyboard shortcut or select <em><strong>File</strong></em> from the top menu, then <strong><em>Sketchbook</em></strong> and then <em><strong>Open</strong></em> which should bring up the <strong>Open Processing Sketch</strong> window like the one in the screenshot below:</p>
<div id="attachment_167" class="wp-caption alignnone" style="width: 310px"><a href="http://solderintheveins.co.uk/wordpress/wp-content/uploads/2009/03/opensketchwin.png" target="_blank"><img class="size-medium wp-image-167" title="opensketchwin" src="http://solderintheveins.co.uk/wordpress/wp-content/uploads/2009/03/opensketchwin-300x232.png" alt="Open Processing Sketch Window" width="300" height="232" /></a><p class="wp-caption-text">Open Processing Sketch Window. Click on image to open a full-sized version in a new browser window.</p></div>
<p>When this window is displayed, navigate to the directory where you unpacked the ardthermo source archive. From there, navigate to the <strong>sketch</strong> sub-directory, then to the <strong>thermometer</strong>.  sub-directory. In the <em><strong>Files</strong></em> pane you should see <strong>thermometer.pde </strong>displayed. Click on this file to load the sketch into the IDE.</p>
<p>When the sketch has loaded, use the <em><strong>Ctrl-U</strong></em> keyboard shortcut or go to <strong><em>File</em></strong>, then select <em><strong>Upload to Board</strong></em>. If all went well you should see an LED on the Arduino blinking on and off once a second. This indicated that the sketch has been uploaded and has executed successfully.</p>
<h2><strong>About The Ardthermo Script</strong></h2>
<p>The Ardthermo script is a command line application and can operate in one of three basic modes:</p>
<ol>
<li> <strong>Standard mode:</strong> Prints out a temperature reading (In degrees Celsius) and speak the temperature reading using Festival if its installed on the host system.</li>
<li> <strong>Email Listening Mode:</strong> Polls a configured email account for a valid command and send a temperature reading to the address the command originated from. A valid request email contains the text <strong>CMD:rtemp</strong> in the subject line. Any unread message with a valid subject line is treated as a new request and any text in the message body is ignored.</li>
<li><strong>Email Alerts Mode:</strong> Monitor the temperature once every minute and send an email to a configured address if the temperature exceeds a threshold specified by the user.</li>
</ol>
<p>When you first unpack the script, you will need to configure it. To do this, load the file <strong>ardthermo.py</strong> (this is the main program, all the other files you will see are modules and cannot be run directly!) into your preferred text editor and scroll down until you come across the configuration options.</p>
<p>There are 5 configuration options you will need to set, which are described below:</p>
<ul>
<li><strong>AlertsAddress:</strong> Used by the Email Alerts mode function: Specifies the recipient of alert messages.</li>
</ul>
<ul>
<li><strong>FestivalPath:</strong> The path to the Festival program on your system.</li>
</ul>
<ul>
<li><strong>GmailUser and GmailPass:</strong> The username and password of the gmail account that will be used by the Email Listening mode function for incoming requests and responses, as well as by the Email Alerts Mode function in order to send alert messages.</li>
</ul>
<ul>
<li><strong>MailCheckDelay: </strong>Used by the Email Listening mode function<strong>: </strong>Specifies how often the configured gmail account should be checked for new incoming requests.</li>
</ul>
<p>After setting the configuration options, you should also check that the ardthermo.py script has executable permissions. If it does not then issue the following command to enable them:</p>
<p style="padding-left: 60px;"><strong>chmod +x ardthermo.py </strong></p>
<h2>Using Ardthermo</h2>
<p>In order to run the script, you must supply the serial port the Arduino is connected to as the first argument, then the mode you wish to run it in as the second argument. For example, if you wanted to run ardthermo in Standard Mode and your Arduino was connected to the serial port device /dev/ttyUSB0,  you would issue the following command:</p>
<p style="padding-left: 60px;"><strong>ardthermo.py /dev/ttyUSB0 -t</strong></p>
<p>To use Email Listening Mode, you would supply<strong> -e</strong> as the second command line argument. For Email Alerts Mode, you would supply <strong>-ea</strong> as a second argument and the trigger-point (or threshold) for the alert email message as a third argument. So, for example, if you wanted to be emailed when the temperature of a room reached or exceeded 20 Degrees Celsius, you would issue the following command:</p>
<p style="padding-left: 60px;"><strong>ardthermo.py /dev/ttyUSB0 -ea 20.0</strong></p>
<p>More details on the command line arguments needed to use the different modes of the script can be obtained by either running ardthermo.py with no additional arguments or by supplying  the<strong> -h</strong> (help) argument on its own, which will print the help message to the terminal. You can also check the comments of the Ardthermo script and its companion modules for more guidance.</p>
<h2>Limitations</h2>
<p>This script does have a few limitations. For one, its not mult-threaded so you can only use one mode function at a time. Another big limitation is that it only reports the temperature readings in Celsius, with no option for readings to be given in Fahrenheit as well.</p>
<p>If there&#8217;s demand for it, I plan to write a multi-threaded version of Ardthermo with an option for Fahrenheit readings as well;  If I can get my head around writing mult-threaded apps, that is!  Oh, the &#8220;joys&#8221; of being a Python newbie <img src='http://solderintheveins.co.uk/wordpress/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<p>Until next time, have fun and happy coding/hacking/whatever floats your boat!</p>


<p>Related posts:<ol><li><a href='http://solderintheveins.co.uk/2009/03/webthermo-web-based-temperature-monitor/' rel='bookmark' title='Permanent Link: Webthermo: Web-based Temperature Monitor'>Webthermo: Web-based Temperature Monitor</a></li>
<li><a href='http://solderintheveins.co.uk/2009/03/thermometer-project-update/' rel='bookmark' title='Permanent Link: Thermometer Project: Update'>Thermometer Project: Update</a></li>
<li><a href='http://solderintheveins.co.uk/2009/03/fun-with-pyrssi-an-arduino-and-twitter/' rel='bookmark' title='Permanent Link: Fun with PyRSSI, an Arduino and Twitter'>Fun with PyRSSI, an Arduino and Twitter</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://solderintheveins.co.uk/2009/03/arduino-based-talking-remote-thermometer/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>
