<?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>MitchTech</title>
	<atom:link href="http://mitchtech.net/feed" rel="self" type="application/rss+xml" />
	<link>http://mitchtech.net</link>
	<description>Android, Linux, and embedded development</description>
	<lastBuildDate>Fri, 15 Mar 2013 07:07:35 +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>Raspberry Pi OpenCV Pan &amp; Tilt Face Tracker</title>
		<link>http://mitchtech.net/raspberry-pi-servo-face-tracker/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=raspberry-pi-servo-face-tracker</link>
		<comments>http://mitchtech.net/raspberry-pi-servo-face-tracker/#comments</comments>
		<pubDate>Fri, 15 Mar 2013 07:07:30 +0000</pubDate>
		<dc:creator>michael</dc:creator>
				<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[Computer Vision]]></category>
		<category><![CDATA[Device Driver]]></category>
		<category><![CDATA[Digital Input]]></category>
		<category><![CDATA[Digital Output]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Kernel]]></category>
		<category><![CDATA[LED]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Microcontroller]]></category>
		<category><![CDATA[OpenCV]]></category>
		<category><![CDATA[Pan & Tilt]]></category>
		<category><![CDATA[PWM]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Sensor]]></category>

		<guid isPermaLink="false">http://mitchtech.net/?p=1238</guid>
		<description><![CDATA[Create your own face tracking, pan and tilt camera on the Raspberry Pi! This tutorial will demonstrate use of the OpenCV (computer vision) library to identify and track faces on the raspberry pi using two servos and a USB webcam. For the interested, I previously covered a more thorough overview of the installation of OpenCV [...]]]></description>
				<content:encoded><![CDATA[<p><span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='580' height='357' src='http://www.youtube.com/embed/WlfecyC1J6A?version=3&#038;rel=1&#038;fs=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' frameborder='0'></iframe></span></p>
<p><span style="font-size: 13px; line-height: 19px;">Create your own face tracking, pan and tilt camera on the Raspberry Pi! </span></p>
<p><span style="font-size: 13px; line-height: 19px;">This tutorial will demonstrate use of the OpenCV (computer vision) library to identify and track faces on the raspberry pi using two servos and a USB webcam. For the interested, I previously covered a more thorough overview of the installation of OpenCV from source </span><a style="font-size: 13px; line-height: 19px;" href="http://mitchtech.net/raspberry-pi-opencv/">here</a><span style="font-size: small;"><span style="line-height: 19px;">, however, I have found that the apt package is </span></span>sufficient<span style="font-size: small;"><span style="line-height: 19px;"> for all but the most bleeding edge of projects.</span></span></p>
<p><span style="font-size: small;"><span style="line-height: 19px;"> This project </span><span style="line-height: 19px;">is based on the OpenCV face tracking example that comes along with the source-based distribution. In short, it performs face detection using haar-like features to analyze the video frame, and locates any faces present within it. In the live video window, identified faces are surrounded with a red rectangle. For additional information about how face detection works as well as the specifics of face detection with OpenCV, I recommend </span></span><a style="font-size: 13px; line-height: 19px;" href="http://www.cognotics.com/opencv/servo_2007_series/part_2/sidebar.html">this article by Robin Hewitt</a><span style="font-size: 13px; line-height: 19px;">. </span></p>
<p><span style="font-size: 13px; line-height: 19px;">Using the coordinates of the rectangle vertices, my script calculates the (X,Y) position of the center of the face. If the face is sufficiently on the left side of the screen, the pan servo will progressively rotate leftward, on the right side, rightward. This is likewise performed for the tilt servo as well, if the face is in the upper portion of the screen, it will pan upward, in the lower portion, pan downward. If the face is detected reasonably within the center of the image, no action is performed by the servos. This prevents unnecessary jitter once the camera has locked itself on the face.</span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h2>Hardware</h2>
<h4>Parts needed:</h4>
<ul>
<li>512 MB raspberry pi</li>
<li>2x Hobby servos (Turnigy 9g fom <a href="http://www.hobbyking.com/hobbyking/store/__9549__Turnigy_TG9e_9g_1_5kg_0_10sec_Eco_Micro_Servo.html">Hobby King</a>)</li>
<li>Pan &amp; tilt bracket (from <a href="http://www.foxtechfpv.com/plastic-pantilt-for-9g-servos-p-227.html">Foxtech FPV</a>)</li>
<li>USB webcam (Microsoft LifeCam Show from <a href="http://www.amazon.com/Microsoft-LifeCam-Show-Webcam-Black/dp/B001DWI1F0">Amazon</a>)</li>
<li>Power supply</li>
<li>Hook-up wire</li>
<li>Raspberry Pi enclosure (from <a href="http://builttospecstore.storenvy.com/products/745661-clear-raspberry-pi-enclosure-kit">Built to Spec</a>)</li>
</ul>
<h4>Assembly</h4>
<p>Connect the red, power lines of the servos to +5v, the black ground lines to GND, and the yellow signal lines to the desired output pins, GPIO pins 22 and 23 in the example. Here is a diagram of the completed circuit  (created with <a href="http://fritzing.org/">Fritzing</a>):</p>
<p><a href="http://mitchtech.net/raspberry-pi-servo-face-tracker/raspi_servo_facetracker/" rel="attachment wp-att-1239"><img class="size-medium wp-image-1239 aligncenter" alt="raspi_servo_facetracker" src="http://mitchtech.net/wp-content/uploads/2013/01/raspi_servo_facetracker-270x300.png" width="270" height="300" /></a></p>
<p>And here is how it looks all put together:</p>
<p>&nbsp;</p>
<p><a href="http://mitchtech.net/raspberry-pi-servo-face-tracker/raspi-facetracker-side/" rel="attachment wp-att-1265"><img class="size-medium wp-image-1265 aligncenter" alt="raspi-facetracker-side" src="http://mitchtech.net/wp-content/uploads/2013/03/raspi-facetracker-side-300x225.jpg" width="300" height="225" /></a></p>
<p><a href="http://mitchtech.net/raspberry-pi-servo-face-tracker/raspi-facetracker-front/" rel="attachment wp-att-1264"><img class="aligncenter" alt="raspi-facetracker-front" src="http://mitchtech.net/wp-content/uploads/2013/03/raspi-facetracker-front-225x300.jpg" width="225" height="300" /></a></p>
<h2>Software</h2>
<h4>Get the source.</h4>
<p>The first step of this procedure is to install the required libraries and packages using the Raspberry Pi package manager. Open up terminal shell and run:</p>
<blockquote><p>sudo apt-get update &amp;&amp; sudo apt-get install git python-opencv python-all-dev libopencv-dev</p></blockquote>
<p>This command will pull down all of the required packages (about 215 MB worth) including the git version control system, as well as the OpenCV development headers and Python bindings. The next step is to configure the Raspberry Pi for use with multiple pulse width modulation (PWM) outputs. Normally, the Raspberry Pi has only one channel of PWM output. However, thanks to the efforts of Richard Hirst, eight channels of PWM can be used through the use of this servoblaster kernel driver.The driver creates a device file, /dev/servoblaster to which commands can be sent to control the servos. The commands take the form &#8220;=&#8221; with servo number representing the desired servo (0-7 in this case) and servo position representing the pulse width in units of 10 µs. For example, to send servo 3 a pulse width of 120 µs: echo 3=120 &gt; /dev/servoblaster To configure the servoblaster on the Raspberry Pi, first pull down the sources from Richard’s Github repo:</p>
<blockquote><p>git clone https://github.com/richardghirst/PiBits.git</p></blockquote>
<p>Then change into the servo blaster directory, and install the module:</p>
<blockquote><p>cd PiBits/ServoBlaster</p>
<p>make install_autostart</p></blockquote>
<p>This command also sets up the necessary udev rules for accessing the /dev/servoblaster device. Note: using the ’install_autostart ’ command will set up a Raspberry Pi to load the servoblaster kernel module on every boot. If you don&#8217;t want this behavior, execute ‘make install’ instead. In either case, the module will not yet be loaded so go ahead and load it into the kernel using modprobe:</p>
<blockquote><p>sudo modprobe servoblaster</p></blockquote>
<p>Now that all the prerequisites have been installed and the servo blaster device configured, it&#8217;s time to get the actual face tracking and servo moving code. Clone my repo from Github here:</p>
<blockquote><p>git clone https://github.com/mitchtech/py_servo_facetracker</p></blockquote>
<p>Now change directory into the created folder, and run the script like this:</p>
<blockquote><p>cd py_servo_facetracker</p>
<p>python ./facetracker_servo_gpio.py 0</p></blockquote>
<p>&nbsp;</p>
<p>If you have a different servo bracket configuration, the pan and tilt axis may need to be inverted. To do so, invert the sign on the values of panStepSize and tiltStepSize.  Similarly, increasing or decreasing these values will change the sensitivity of the movement, larger numbers corresponding to more degrees moved per face detection frame.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://mitchtech.net/raspberry-pi-servo-face-tracker/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Raspberry Pi Google Talk Robot</title>
		<link>http://mitchtech.net/raspberry-pi-google-talk-robot/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=raspberry-pi-google-talk-robot</link>
		<comments>http://mitchtech.net/raspberry-pi-google-talk-robot/#comments</comments>
		<pubDate>Thu, 17 Jan 2013 02:06:48 +0000</pubDate>
		<dc:creator>michael</dc:creator>
				<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[Digital Input]]></category>
		<category><![CDATA[Digital Output]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Google Talk]]></category>
		<category><![CDATA[GPIO]]></category>
		<category><![CDATA[Home Automation]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Microcontroller]]></category>
		<category><![CDATA[XMPP]]></category>

		<guid isPermaLink="false">http://mitchtech.net/?p=1231</guid>
		<description><![CDATA[Google Talk/Chat/Messenger is normally used by humans to interact with other humans. However, its underlying technology can also be used as a mechanism to implement software robots.  Internet bots, also known as web robots, WWW robots or simply &#8216;bots&#8217; can also utilize the technology to perform automated functions over the web.  There are many such [...]]]></description>
				<content:encoded><![CDATA[<p><span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='580' height='357' src='http://www.youtube.com/embed/vd6RlkAXWRs?version=3&#038;rel=1&#038;fs=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' frameborder='0'></iframe></span></p>
<p><span style="font-size: 13px;">Google Talk/Chat/Messenger is normally used by humans to interact with other humans. However, its underlying technology can also be used as a mechanism to implement software robots.  Internet bots, also known as web robots, WWW robots or simply &#8216;bots&#8217; can also utilize the technology to perform automated functions over the web.  There are many such bots in existence, offering a diverse spectrum of services from jokes (jokes@askme.im) to URL Shortening using bit.ly (url@askme.im), even mathematical calculation (math@bot.im).  Using such bots is quick and easy to configure, all that must be done is to add the bot as a contact to your messaging account.  Then, whenever you desire data from the service, simply text the command to the bot and it will respond with the respective message.</span></p>
<p>The Raspi Bot is essentially the same as any other automated Internet robot.  To configure it, it must first have its own e-mail address associated with a Google talk account.  This e-mail address must also be added as a contact with the account that wishes to communicate to the bot.  Then, whenever the script is running on the remote machine, it will log into Google chat and appear as a friend in your contact list.</p>
<p>The software itself is essentially just a Python daemon script that is a wrapper around the XMPP protocol.  When executed, the script will sign in to Google talk using its own username and password.  The Python script is derived from the open source project pygtalkrobot: An open source python gtalk(google talk) bot framework using XMPPPY and PyDNS libraries, that also references the source code of python-jabberbot.</p>
<h3>Software</h3>
<p>The Raspi Bot requires several additional Python modules for use.  The easiest way to install these is with the python pip package manager. If you don&#8217;t have it installed, you can install them using apt-get:</p>
<blockquote><p>sudo apt-get install python-pip git-core python2.7-dev</p></blockquote>
<p>Then update the easy_install index:</p>
<blockquote><p>sudo easy_install -U distribute</p></blockquote>
<p>And install the GPIO, xmpppy, and pydns modules:</p>
<blockquote><p>sudo pip install RPi.GPIO xmpppy pydns</p></blockquote>
<p>Then clone my repo for the Raspi Gtalk robot:</p>
<blockquote><p>git clone https://github.com/mitchtech/raspi_gtalk_robot.git</p></blockquote>
<p>Now change into the newly created directory:</p>
<blockquote><p>cd raspi_gtalk_robot</p></blockquote>
<p>Finally, you will need  to configure the Raspi Bot’s Gtalk username and password.  This is done by editing the fields BOT_GTALK_USER, BOT_GTALK_PASS, and BOT_ADMIN, on lines 31-33 in the raspiBot.py file.  It is recommended, though not required, to give the Raspi Bot its own Gmail account. Since access to the Raspberry Pi GPIO pins is restricted, the script needs to be run with sudo:</p>
<blockquote><p>sudo python ./raspiBot.py</p></blockquote>
<p>This basic sample script supports the following commands:</p>
<ul>
<li>[pinon|pon|on|high] [pin] : turns on the specified GPIO pin</li>
<li>[pinoff|poff|off|low] [pin] : turns off the specified GPIO pin</li>
<li>[write|w] [pin] [state] : writes specified state to the specified GPIO pin</li>
<li>[read|r] [pin]: reads the value of the specified GPIO pin</li>
<li>[available|online|busy|dnd|away|idle|out|xa] [arg1] : set gtalk state and status message to specified argument</li>
<li>[shell|bash] [arg1] : executes the specified shell command argument after &#8216;shell&#8217; or &#8216;bash&#8217;</li>
</ul>
<p>For example, sending the message &#8220;pinon 10&#8243; will turn on GPIO pin #10, &#8220;read 8&#8243; will read the current state of GPIO pin 8, or &#8220;bash ps&#8221; to execute the shell command &#8216;ps&#8217;.</p>
<p>&nbsp;</p>
<h3>Hardware</h3>
<p>The video demonstration uses a slide switch connected to GPIO pin 8 and an LED connected to GPIO pin 10.  Here is a diagram of how this is wired   (created with <a href="http://fritzing.org/">Fritzing</a>):</p>
<p><a href="http://mitchtech.net/raspberry-pi-google-talk-robot/raspi_gtalk_robot/" rel="attachment wp-att-1245"><img class="alignnone size-medium wp-image-1245" alt="raspi_gtalk_robot" src="http://mitchtech.net/wp-content/uploads/2013/01/raspi_gtalk_robot-300x277.png" width="300" height="277" /></a></p>
<p>&nbsp;</p>
<h4>Use case #1: Home automation</h4>
<p>One of the most obvious usages of this technology is for home automation purposes. The Raspi Bot can be accessed anywhere with Google talk, which to my understanding, is nearly every system in existence.  Send the Raspi Bot messages to turn on and off lights and other electrical appliances.</p>
<p>This is also useful to provide immediate notification in the event of intrusion detection. The Raspi Bot can be supplemented with additional security sensors, including infrared motion, and ultrasonic distance sensors. If any pre-programmed sensor violates any predefined condition, you can be immediately notified via message from the Raspi Bot.</p>
<p>&nbsp;</p>
<h4>Use case #2: Remote shell</h4>
<p>The Raspi Bot can be used essentially as a remote shell.  In this configuration, every message sent to the Raspi Bot will be interpreted as a shell command with the output piped back to the user in the form of a response message.  Obviously, this could raise some security concerns. To protect against misuse, the Raspi Bot will only respond to Google chat messages from the Google user designated as the administrator of the bot.  By default, messages from any other user will simply be ignored.</p>
<p>The following is a small subset of the relatively benign commands possible to be run remotely via the Raspi Bot:</p>
<ul>
<li>vmstat &#8211; system activity, hardware and information</li>
<li>uptime &#8211; how long the system has been running</li>
<li>w &#8211; logged in users and their process activity</li>
<li>ps &#8211; reports a snapshot of the current processes</li>
<li>free &#8211; physical and swap memory usage</li>
<li>iostat &#8211; average CPU load, disk activity</li>
</ul>
<p>Arguably, disclosure of any amount of information about system can be considered a security issue such as that reported by some of the above tools.  For users more concerned about convenience over security exposure, much more elaborate commands can be run, such as executing additional scripts or accessing private data.</p>
<p>&nbsp;</p>
<h4>Use case #3: Remote Reboot</h4>
<p>Another problem that can be solved by the Raspi Bot is frozen remote machines. We&#8217;ve all been there before, attempting to access a remote machine only to find it to be completely non-responsive to any form of remote login.  These cases, we (or maybe a system administrator somewhere) would usually have to make a trip to the physical location of the server and push ‘the big red button’ to reboot the affected machine.  The situation can be eliminated completely by deputizing a Raspi Bot as a remote reboot agent. This can be done by adding bot controlled relay(s) to the power supplies of the machines.  In the event any of the machines controlled by the Raspi Bot becomes non-responsive, simply send the appropriate Google talk message to flip the respective relay, and reboot the affected machine.  Here&#8217;s a diagram of how this would look:</p>
<p><a href="http://mitchtech.net/raspberry-pi-google-talk-robot/raspi_remote_reboot/" rel="attachment wp-att-1232"><img class="alignnone size-medium wp-image-1232" alt="raspi_remote_reboot" src="http://mitchtech.net/wp-content/uploads/2013/01/raspi_remote_reboot-300x181.png" width="300" height="181" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://mitchtech.net/raspberry-pi-google-talk-robot/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Raspberry Pi + PWM RGB LED Strip</title>
		<link>http://mitchtech.net/raspberry-pi-pwm-rgb-led-strip/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=raspberry-pi-pwm-rgb-led-strip</link>
		<comments>http://mitchtech.net/raspberry-pi-pwm-rgb-led-strip/#comments</comments>
		<pubDate>Tue, 15 Jan 2013 23:29:15 +0000</pubDate>
		<dc:creator>michael</dc:creator>
				<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[Device Driver]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Home Automation]]></category>
		<category><![CDATA[Kernel]]></category>
		<category><![CDATA[LED]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Microcontroller]]></category>
		<category><![CDATA[PWM]]></category>
		<category><![CDATA[RGB LED Strip]]></category>

		<guid isPermaLink="false">http://mitchtech.net/?p=1221</guid>
		<description><![CDATA[This tutorial demonstrates how to easily use a Raspberry Pi to drive 12V RGB LED strips using Pulse Width Modulation (PWM).  Out of the box, the Raspberry Pi has only one GPIO pin that is capable of pulse width modulation (PWM).  However, thanks to the efforts of Richard Hirst and his servoblaster kernel module, standard [...]]]></description>
				<content:encoded><![CDATA[<p><span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='580' height='357' src='http://www.youtube.com/embed/--d8Sp2yoUU?version=3&#038;rel=1&#038;fs=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' frameborder='0'></iframe></span></p>
<p>This tutorial demonstrates how to easily use a Raspberry Pi to drive 12V RGB LED strips using Pulse Width Modulation (PWM).  Out of the box, the Raspberry Pi has only one GPIO pin that is capable of pulse width modulation (PWM).  However, thanks to the efforts of <a href="https://github.com/richardghirst/PiBits/tree/master/ServoBlaster">Richard Hirst and his servoblaster kernel module</a>, standard GPIO pins can be used to perform PWM.</p>
<p>Note: The flashing of the LED strip due to PWM is only noticeable in the uploaded video; in reality, the colors progress smoothly without any visible flashing.</p>
<h2>Hardware</h2>
<h4>Parts needed:</h4>
<ul>
<li>Raspberry Pi</li>
<li>3 x TIP120 power transistors</li>
<li>RGB LED strip</li>
<li>Perfboard/Breadboard</li>
<li>Hook-up wire</li>
</ul>
<p>&nbsp;</p>
<h4>Assembly</h4>
<p>&nbsp;</p>
<p>Connect a 12V power supply to the 12V pad on the RGB LED strip, connect the base of each TIP120 power transistor to its respective GPIO pin (pins 18, 23, and 24 in this example), connect the collector of each to its matching pad on the LED strip, and finally, connect the emitters to common ground for both the Raspberry Pi and the 12V power supply. Here is a diagram of the circuit  (created with <a href="http://fritzing.org/">Fritzing</a>):</p>
<p><a href="http://mitchtech.net/raspberry-pi-pwm-rgb-led-strip/raspi_rgb_led/" rel="attachment wp-att-1222"><img class="alignnone size-medium wp-image-1222" alt="raspi_rgb_led" src="http://mitchtech.net/wp-content/uploads/2013/01/raspi_rgb_led-300x194.png" width="300" height="194" /></a></p>
<p>&nbsp;</p>
<h2>Software</h2>
<h4>Configure servoblaster.</h4>
<p>The next step is to configure the servoblaster kernel driver. The driver creates a device file, /dev/servoblaster to which commands can be sent to control the servos. The commands take the form &#8220;=&#8221; with servo number representing the desired servo (0-7 in this case) and servo position representing the pulse width in units of 10 µs. For example, to send servo 3 a pulse width of 120 µs:</p>
<blockquote><p>echo 3=120 &gt; /dev/servoblaster</p></blockquote>
<p>To setup the servo blaster on the Raspberry Pi, we will need to have git installed to pull down the sources. If you don&#8217;t have it installed already, open a terminal and run:</p>
<blockquote><p>sudo apt-get install git-core</p></blockquote>
<p>Then pull down the sources from Richard’s Github repo:</p>
<blockquote><p>git clone https://github.com/richardghirst/PiBits.git</p></blockquote>
<p>Now change into the servo blaster directory:</p>
<blockquote><p>cd PiBits/ServoBlaster</p></blockquote>
<p>And compile and install the module:</p>
<blockquote><p>make install_autostart</p></blockquote>
<p>This command also sets up the necessary udev rules for accessing the /dev/servoblaster device. Note: using the ’install_autostart ’ command will set up a raspberry pi to load the servo blaster kernel module on every boot. If you don&#8217;t want this behavior, execute ‘make install’ instead. In either case, the module will not yet be loaded so go ahead and install it using modprobe:</p>
<blockquote><p>sudo modprobe servoblaster</p></blockquote>
<p>&nbsp;</p>
<h4>Sample code usage.</h4>
<p>Now that all the prerequisites have been installed and the servo blaster device configured, on to the actual sample code. The python sample script uses PWM to fade from blue to violet, to red, to yellow, to green, to teal, back to blue.</p>
<script src="https://gist.github.com/4543601.js"></script><noscript><pre><code class="language-python python">#!/usr/bin/env python

import time
import os

STEP = 100
DELAY = 0.5

def pwm(pin, angle):
    print &quot;servo[&quot; + str(pin) + &quot;][&quot; + str(angle) + &quot;]&quot;
    cmd = &quot;echo &quot; + str(pin) + &quot;=&quot; + str(angle) + &quot; &gt; /dev/servoblaster&quot;
    os.system(cmd)
    time.sleep(DELAY)

while True:
    for i in range(0, 8):
        for j in range(1, 249, STEP):
            pwm(i,j)   
    for i in range(0, 8):
        for j in range(249, 1, (STEP*-1)):
            pwm(i,j)</code></pre></noscript>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://mitchtech.net/raspberry-pi-pwm-rgb-led-strip/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Easily connect Raspberry Pi to Gmail, Facebook, Twitter &amp; more!</title>
		<link>http://mitchtech.net/connect-raspberry-pi-to-gmail-facebook-twitter-more/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=connect-raspberry-pi-to-gmail-facebook-twitter-more</link>
		<comments>http://mitchtech.net/connect-raspberry-pi-to-gmail-facebook-twitter-more/#comments</comments>
		<pubDate>Fri, 24 Aug 2012 00:20:05 +0000</pubDate>
		<dc:creator>michael</dc:creator>
				<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Gmail]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Home Automation]]></category>
		<category><![CDATA[Ifttt]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Web Server]]></category>

		<guid isPermaLink="false">http://mitchtech.net/?p=1152</guid>
		<description><![CDATA[Easily connect your Raspberry Pi to web services and social networks! This tutorial demonstrates how to painlessly send and receive Gmail on the Raspberry Pi from Python, which in turn, allows you to easily connect it to web services and social networks like Facebook, Twitter, and more! This would normally be well beyond the abilities [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://mitchtech.net/easilyconnect-raspberry-pi-to-gmail-facebook-twitter-more/ifttt/" rel="attachment wp-att-1173"><img class="alignnone size-medium wp-image-1173" title="ifttt" src="http://mitchtech.net/wp-content/uploads/2012/08/ifttt-300x225.png" alt="" width="300" height="225" /></a></p>
<p>Easily connect your Raspberry Pi to web services and social networks! This tutorial demonstrates how to painlessly send and receive Gmail on the Raspberry Pi from Python, which in turn, allows you to easily connect it to web services and social networks like Facebook, Twitter, and more! This would normally be well beyond the abilities of most users due to the inherent complexities of programming through social media APis, client/server authentication, etc. However, with the easy-to-use web service Swiss Army knife <a href="http://ifttt.com">ifttt (if this then that)</a> anyone with even the most basic programming skills can dramatically expand the capabilities of their Raspberry Pi.</p>
<h4>How does this work?</h4>
<p>If you are not yet aware, <a href="http://ifttt.com">ifttt</a> is a great tool to simplify interaction with many social networks and other web services. It operates with the premise that when some specific action occurs it should perform some other predefined action. The interface is intuitive and very easy to quicky understand. The bridge then is connecting the Raspberry Pi to any of these supported services, which in turn, enables the use of all other services that can respond to that respective trigger. In an earlier  tutorial, I  previously demonstrated how to <a href="http://mitchtech.net/dropbox-on-raspberry-pi-via-sshfs/">connect your Raspberry Pi to your Dropbox account using SSHFS</a>. This is another perfectly viable option to establish two way communication with ifttt. However, instead of using email as the primary communication medium, it relies on Dropbox and the filesystem itself. Depending on your application, this may or may not be a better option.</p>
<h4>Getting Started</h4>
<p>The tutorial uses the most recent Raspbian wheezy image, <a href="http://www.raspberrypi.org/downloads">(2012-08-16-wheezy-raspbian)</a>but should largely generalize for not only other Raspberry Pi distributions, but most other linux distributions as well (especially those derived from Debian, such as Ubuntu and Mint). The majority of the complexity and functionality comes from the feedparser Python module, which should be available essentially anywhere with Python support, even including Windows and OSX distributions too. In any case, begin by setting up the necessary accounts.</p>
<h4>Account Setup</h4>
<p>As you would undoubtedly expect, the ability to send and receive Gmail is predicated upon having a <a href="http://gmail.com">Gmail</a> account. You are welcome to use your personal Gmail account if you wish, however, I recommend creating a separate account for the Raspberry Pi as it provides the most flexibility. If you would like to expand beyond the capabilities of Gmail on the Raspberry Pi, you will also need an account on <a href="http://ifttt.com">ifttt</a>. As with Gmail, you can either share your accounts with the Raspberry Pi, or create a separate account specifically for this purpose. Your decision here might be dependent on which services will be necessary for your own specific application.</p>
<h4>Install Packages</h4>
<p>Independent of whether you are using one or multiple Gmail or ifttt accounts, you will first need to install some required packages. Open up a terminal on the Raspberry Pi and install the Python development headers and the pip package manager:</p>
<blockquote>
<pre>sudo apt-get install python-pip python2.7-dev</pre>
</blockquote>
<p>Next, for pip to work correctly you will need to update to a newer version of distribute using the easy_install utility:</p>
<blockquote>
<pre>sudo easy_install -U distribute</pre>
</blockquote>
<p>Once that completes, install the feedparser module with the pip package manager:</p>
<blockquote>
<pre>sudo pip install feedparser</pre>
</blockquote>
<p>Now that all of the prerequisites are installed, we can move on to the actual code!</p>
<h4>Checking Gmail by the Raspberry Pi</h4>
<p>This is an example script that will check the Gmail of the specified user, and display the subject line of all unread e-mails.</p>
<script src="https://gist.github.com/3481728.js"></script><noscript><pre><code class="language-python python">#!/usr/bin/env python
import feedparser

USERNAME = &quot;username@gmail.com&quot;
PASSWORD = &quot;password&quot;

response = feedparser.parse(&quot;https://&quot; + USERNAME + &quot;:&quot; + PASSWORD + &quot;@mail.google.com/gmail/feed/atom&quot;)
unread_count = int(response[&quot;feed&quot;][&quot;fullcount&quot;])

for i in range(0,unread_count):
	print &quot;(&quot; + str((i+1)) + &quot;/&quot; + str(unread_count) + &quot;) &quot; + response['items'][i].title</code></pre></noscript>
<p>&nbsp;</p>
<h4>Sending Gmail from the Raspberry Pi</h4>
<p>This is an example script that can be used to send plain text e-mails with Gmail to the specified mail to e-mail address.</p>
<script src="https://gist.github.com/3481745.js"></script><noscript><pre><code class="language-python python">#!/usr/bin/env python
import smtplib
from email.mime.text import MIMEText

USERNAME = &quot;username@gmail.com&quot;
PASSWORD = &quot;password&quot;
MAILTO  = &quot;mailto@gmail.com&quot;

msg = MIMEText('This is the body of the email')
msg['Subject'] = 'The email subject'
msg['From'] = USERNAME
msg['To'] = MAILTO

server = smtplib.SMTP('smtp.gmail.com:587')
server.ehlo_or_helo_if_needed()
server.starttls()
server.ehlo_or_helo_if_needed()
server.login(USERNAME,PASSWORD)
server.sendmail(USERNAME, MAILTO, msg.as_string())
server.quit()</code></pre></noscript>
<p>&nbsp;</p>
<h4>Sending Attachments through Gmail from the Raspberry Pi</h4>
<p>This is a more complex example script that can be used to attach files to emails sent from Gmail. It sends an array of attached files to an array of recipients.</p>
<script src="https://gist.github.com/3481781.js"></script><noscript><pre><code class="language-python python">#!/usr/bin/env python
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.Utils import COMMASPACE, formatdate
from email import Encoders
import os

USERNAME = &quot;username@gmail.com&quot;
PASSWORD = &quot;password&quot;

def sendMail(to, subject, text, files=[]):
    assert type(to)==list
    assert type(files)==list

    msg = MIMEMultipart()
    msg['From'] = USERNAME
    msg['To'] = COMMASPACE.join(to)
    msg['Date'] = formatdate(localtime=True)
    msg['Subject'] = subject
    
    msg.attach( MIMEText(text) )

    for file in files:
        part = MIMEBase('application', &quot;octet-stream&quot;)
        part.set_payload( open(file,&quot;rb&quot;).read() )
        Encoders.encode_base64(part)
        part.add_header('Content-Disposition', 'attachment; filename=&quot;%s&quot;'
                       % os.path.basename(file))
        msg.attach(part)

	server = smtplib.SMTP('smtp.gmail.com:587')
	server.ehlo_or_helo_if_needed()
	server.starttls()
	server.ehlo_or_helo_if_needed()
	server.login(USERNAME,PASSWORD)
	server.sendmail(USERNAME, to, msg.as_string())
	server.quit()


sendMail( [&quot;mailto@gmail.com&quot;],
        &quot;this is the subject&quot;,
        &quot;this is the body text of the email&quot;,
        [&quot;photo.jpg&quot;,&quot;text_file.txt&quot;] )</code></pre></noscript>
<p>&nbsp;</p>
<h4>Scheduling tasks with cron</h4>
<p>Often, we want to run tasks at periodic intervals, like to poll Gmail for example. Cron, the UNIX time-based job scheduler, is an easy way to run regular tasks on the Raspberry Pi (or other *nix). Cron is a daemon (like a Web server) that is used to execute commands or scripts automatically at a specified time and date interval. To use it, open the global crontab (cron table) for editing:</p>
<blockquote>
<pre>sudo crontab -e</pre>
</blockquote>
<p>In the text editor, you&#8217;ll see a commented out section of text describing how to configure tasks with cron. To add your own task, simply add a line to the end of the file. For example, to run the check_gmail.py script above every minute:</p>
<blockquote>
<pre>* * * * * python /home/pi/check_gmail.py</pre>
</blockquote>
<p>Here is a breakdown of what that line actually means, and how you can use to create your own periodic tasks at the desired frequency:</p>
<blockquote>
<pre>* * * * * command to be executed
- - - - -
| | | | |
| | | | |
| | | | +----- day of week (0 - 6) (0 is Sunday, or use names)
| | | +---------- month (1 - 12)
| | +--------------- day of month (1 - 31)
| +-------------------- hour (0 - 23)
+------------------------- min (0 - 59)</pre>
</blockquote>
<p>&nbsp;</p>
<h4>Expanding functionality with ifttt</h4>
<p>Now that the Raspberry Pi is capable of both sending and receiving e-mails and running scripts at regular intervals we can move on to fun things! The following are some quick examples of the types of things this interface enables. This list is FAR from inclusive, there are literally thousands of possible combinations!</p>
<h4>Facebook and Twitter</h4>
<p>Update your Facebook status, or post tweets based on raspberry pi events.</p>
<p><a href="http://ifttt.com/recipes/52802" rel="attachment wp-att-1153"><img class="alignnone size-medium wp-image-1153" title="ifttt-gmail-fb" src="http://mitchtech.net/wp-content/uploads/2012/08/ifttt-gmail-fb-300x87.png" alt="" width="300" height="87" /></a></p>
<p>Alternatively, create a Facebook or Twitter account specifically for the Raspberry Pi, and have it update its own status messages and post its own tweets.</p>
<p><a href="http://ifttt.com/recipes/52806" rel="attachment wp-att-1154"><img class="alignnone size-medium wp-image-1154" title="ifttt-gmail-twitter" src="http://mitchtech.net/wp-content/uploads/2012/08/ifttt-gmail-twitter-300x87.png" alt="" width="300" height="87" /></a></p>
<p>&nbsp;</p>
<h4>Google Calendar</h4>
<p>Automatically send alerts for events that match certain criteria within your Google calendar to the Raspberry Pi. Use this to make things like physical notifiers for holidays or other calendar events.</p>
<p><a href="http://ifttt.com/recipes/52803" rel="attachment wp-att-1155"><img class="alignnone size-medium wp-image-1155" title="ifttt-calendar-gmail" src="http://mitchtech.net/wp-content/uploads/2012/08/ifttt-calendar-gmail-300x87.png" alt="" width="300" height="87" /></a></p>
<p>&nbsp;</p>
<h4>SMS and Phone</h4>
<p>Receive SMS notifications or phone calls based on events from the Raspberry Pi. Notify based on certain sensor values, or create your own DIY security system, for example.</p>
<p><a href="http://ifttt.com/recipes/52807" rel="attachment wp-att-1156"><img class="alignnone size-medium wp-image-1156" title="ifttt-gmail-sms" src="http://mitchtech.net/wp-content/uploads/2012/08/ifttt-gmail-sms-300x87.png" alt="" width="300" height="87" /></a></p>
<p>&nbsp;</p>
<h4>Weather and Stocks</h4>
<p>It&#8217;s also easy to control the Raspberry Pi based on the weather forecast. For example, send notifications of impending severe weather or extreme temperatures.</p>
<p><a href="http://ifttt.com/recipes/52805" rel="attachment wp-att-1157"><img class="alignnone size-medium wp-image-1157" title="ifttt-weather-gmail" src="http://mitchtech.net/wp-content/uploads/2012/08/ifttt-weather-gmail-300x87.png" alt="" width="300" height="87" /></a></p>
<p>Or create physical notifiers that perform actions whenever a specified stock price exceeds or falls below a specified threshold.</p>
<p><a href="http://ifttt.com/recipes/52804" rel="attachment wp-att-1158"><img class="alignnone size-medium wp-image-1158" title="ifttt-stock-gmail" src="http://mitchtech.net/wp-content/uploads/2012/08/ifttt-stock-gmail-300x87.png" alt="" width="300" height="87" /></a></p>
<p>&nbsp;</p>
<h4>Limitations</h4>
<p>There are, of course, a few limitations from using Gmail and cron as the primary basis for communication to the cloud. Cron jobs can only be scheduled at minute granularity, that is, they can be scheduled to occur at maximum frequency of one minute intervals. This is acceptable for most tasks, though it does however leave a bit to be desired for the more &#8216;real time&#8217; applications like turning on and off lights, or remotely operated robotics.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://mitchtech.net/connect-raspberry-pi-to-gmail-facebook-twitter-more/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Raspberry Pi + MSP430 + SPI</title>
		<link>http://mitchtech.net/raspberry-pi-msp430-spi/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=raspberry-pi-msp430-spi</link>
		<comments>http://mitchtech.net/raspberry-pi-msp430-spi/#comments</comments>
		<pubDate>Mon, 13 Aug 2012 15:16:36 +0000</pubDate>
		<dc:creator>meyers</dc:creator>
				<category><![CDATA[MSP430 Launchpad]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[M430G2553]]></category>
		<category><![CDATA[msp430]]></category>
		<category><![CDATA[spi]]></category>

		<guid isPermaLink="false">http://mitchtech.net/?p=1118</guid>
		<description><![CDATA[This tutorial will explain how to communicate from the Raspberry Pi to an MSP430 Launchpad board (M430G2553 chip) using SPI.]]></description>
				<content:encoded><![CDATA[<p><a href="http://mitchtech.net/raspberry-pi-msp430-spi/raspi-msp-spi/" rel="attachment wp-att-1167"><img class="alignnone size-medium wp-image-1167" title="raspi-msp-spi" src="http://mitchtech.net/wp-content/uploads/2012/08/raspi-msp-spi-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>This tutorial will explain how to communicate from the Raspberry Pi to an MSP430 Launchpad board (M430G2553 chip) using SPI.</p>
<h2>Requirements</h2>
<ul>
<li>1 Raspberry pi (running <a href="http://www.raspbian.org/">Raspbian</a>)</li>
<li>1 MSP430 TI Launchpad</li>
<li>3 wires</li>
</ul>
<p>Your raspberry pi should be running the newest version of <a href="http://www.raspbian.org/">Raspbian</a>.  To ensure your system is up-to-date please download and run <a href="https://github.com/Hexxeh/rpi-update/">rpi-update</a>.</p>
<h2>Wiring</h2>
<p><a href="http://mitchtech.net/raspberry-pi-msp430-spi/raspi_msp_spi/" rel="attachment wp-att-1166"><img class="size-medium wp-image-1166 aligncenter" title="raspi_msp_spi" src="http://mitchtech.net/wp-content/uploads/2012/08/raspi_msp_spi-225x300.png" alt="" width="225" height="300" /></a></p>
<p>&nbsp;</p>
<h2>MSP430</h2>
<p>Flash the below code to your MSP430 chip. Please see <a href="http://mitchtech.net/cross-compiling-for-ti-msp430-launchpad/" target="_blank">this</a> tutorial for information on compiling and programming your MSP430.</p>
<h4>MSP430 Code</h4>
<script src="https://gist.github.com/3326502.js"></script><noscript><pre><code class="language-c c">//******************************************************************************
//   MSP430G2xx3 Demo - USCI_A0, SPI 3-Wire Slave Data Echo
//
//   Description: SPI slave talks to SPI master using 3-wire mode. Data received
//   from master is echoed back.  USCI RX ISR is used to handle communication,
//   CPU normally in LPM4.  Prior to initial data exchange, master pulses
//   slaves RST for complete reset.
//   ACLK = n/a, MCLK = SMCLK = DCO ~1.2MHz
//
//   Use with SPI Master Incremented Data code example.  If the slave is in
//   debug mode, the reset signal from the master will conflict with slave's
//   JTAG; to work around, use IAR's &quot;Release JTAG on Go&quot; on slave device.  If
//   breakpoints are set in slave RX ISR, master must stopped also to avoid
//   overrunning slave RXBUF.
//
//                MSP430G2xx3
//             -----------------
//         /|\|              XIN|-
//          | |                 |
//          | |             XOUT|-
// Master---+-|RST              |
//            |             P1.2|&lt;- Data Out (UCA0SOMI)
//            |                 |
//            |             P1.1|-&gt; Data In (UCA0SIMO)
//            |                 |
//            |             P1.4|&lt;- Serial Clock In (UCA0CLK)
//
//   D. Dang
//   Texas Instruments Inc.
//   February 2011
//   Built with CCS Version 4.2.0 and IAR Embedded Workbench Version: 5.10
//******************************************************************************
#include &quot;msp430g2553.h&quot;
#include &lt;string.h&gt;

char cmdbuf[20];
char cmd_index=0;

/** Delay function. **/
void delay(unsigned int d) {
  int i;
  for (i = 0; i&lt;d; i++) {
    nop();
  }
}

void flash_spi_detected(void) {
    int i=0;
    P1OUT = 0;
    for (i=0; i &lt; 6; ++i) {
        P1OUT = ~P1OUT;
        delay(0x4fff);
        delay(0x4fff);
    }
}

void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;                 // Stop watchdog timer
  /* led */
  //P1DIR |= BIT0 + BIT5;
  P1DIR |= BIT0;
  while (P1IN &amp; BIT4);                   // If clock sig from mstr stays low,
                                            // it is not yet in SPI mode

  flash_spi_detected();                 // Blink 3 times
  
  P1SEL = BIT1 + BIT2 + BIT4;
  P1SEL2 = BIT1 + BIT2 + BIT4;
  UCA0CTL1 = UCSWRST;                       // **Put state machine in reset**
  UCA0CTL0 |= UCMSB + UCSYNC;               // 3-pin, 8-bit SPI master
  UCA0CTL1 &amp;= ~UCSWRST;                     // **Initialize USCI state machine**
  IE2 |= UCA0RXIE;                          // Enable USCI0 RX interrupt

  __bis_SR_register(LPM4_bits + GIE);       // Enter LPM4, enable interrupts
}

__attribute__((interrupt(USCIAB0RX_VECTOR))) void USCI0RX_ISR (void)
{
    /*
  if (UCA0STAT &amp; UCOE) {
    P1OUT |= BIT0;
  }
  */
  char value = UCA0RXBUF;
  if (value == '\n') {
    if (strncmp(cmdbuf, &quot;HELLO WORLD&quot;, 11) == 0) {
      P1OUT |= BIT0;
    } else {
      P1OUT &amp;= ~BIT0;
    }
    cmd_index = 0;
  } else {
    cmdbuf[cmd_index] = value;
    cmd_index++;
  }

}</code></pre></noscript>
<h2>Raspberry Pi</h2>
<p>With your updated rasbian system you should have the drivers that you need. Now it&#8217;s time to load them.</p>
<blockquote><p>modprobe spi_bcm2708<br />
modprobe spidev</p></blockquote>
<p>Check to be sure the modules loaded:</p>
<blockquote><p>lsmod<br />
Module Size Used by<br />
spidev 5944 0<br />
spi_bcm2708 5350 0<br />
snd_bcm2835 21681 0<br />
snd_pcm 81170 1 snd_bcm2835<br />
snd_seq 59528 0<br />
snd_timer 21602 2 snd_seq,snd_pcm<br />
snd_seq_device 6924 1 snd_seq<br />
snd 57427 5 snd_seq_device,snd_timer,snd_seq,snd_pcm,snd_bcm2835<br />
snd_page_alloc 5343 1 snd_pcm<br />
i2c_bcm2708 3822 0</p></blockquote>
<h4>Raspberry Pi Code</h4>
<p>Save the below code as spidev_test.c on to your Raspberry Pi and compile it</p>
<blockquote><p>gcc spidev_test.c -o spidev_test</p></blockquote>
<script src="https://gist.github.com/3317805.js"></script><noscript><pre><code class="language-c c">/*
 * SPI testing utility (using spidev driver)
 *
 * Copyright (c) 2007  MontaVista Software, Inc.
 * Copyright (c) 2007  Anton Vorontsov &lt;avorontsov@ru.mvista.com&gt;
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License.
 *
 * Cross-compile with cross-gcc -I/path/to/cross-kernel/include
 */

#include &lt;stdint.h&gt;
#include &lt;unistd.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;getopt.h&gt;
#include &lt;fcntl.h&gt;
#include &lt;sys/ioctl.h&gt;
#include &lt;linux/types.h&gt;
#include &lt;linux/spi/spidev.h&gt;

#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))

static void pabort(const char *s)
{
	perror(s);
	abort();
}

static const char *device = &quot;/dev/spidev0.0&quot;;
static uint8_t mode;
static uint8_t bits = 8;
static uint32_t speed = 500000;
static uint16_t delay;

static void transfer(int fd)
{
	int ret;
	uint8_t tx[] = {
        0x48, 0x45, 0x4C, 0x4C, 0x4F,
        0x20, 
        0x57, 0x4F, 0x52, 0x4C, 0x44,
        0x0A 
	};
	uint8_t rx[ARRAY_SIZE(tx)] = {0, };
	struct spi_ioc_transfer tr = {
		.tx_buf = (unsigned long)tx,
		.rx_buf = (unsigned long)rx,
		.len = ARRAY_SIZE(tx),
		.delay_usecs = delay,
		.speed_hz = speed,
		.bits_per_word = bits,
	};

	ret = ioctl(fd, SPI_IOC_MESSAGE(1), &amp;tr);
	if (ret &lt; 1)
		pabort(&quot;can't send spi message&quot;);

    /*
	for (ret = 0; ret &lt; ARRAY_SIZE(tx); ret++) {
		if (!(ret % 6))
			puts(&quot;&quot;);
		printf(&quot;%.2X &quot;, rx[ret]);
	}
	puts(&quot;&quot;);
    */
}

static void print_usage(const char *prog)
{
	printf(&quot;Usage: %s [-DsbdlHOLC3]\n&quot;, prog);
	puts(&quot;  -D --device   device to use (default /dev/spidev1.1)\n&quot;
	     &quot;  -s --speed    max speed (Hz)\n&quot;
	     &quot;  -d --delay    delay (usec)\n&quot;
	     &quot;  -b --bpw      bits per word \n&quot;
	     &quot;  -l --loop     loopback\n&quot;
	     &quot;  -H --cpha     clock phase\n&quot;
	     &quot;  -O --cpol     clock polarity\n&quot;
	     &quot;  -L --lsb      least significant bit first\n&quot;
	     &quot;  -C --cs-high  chip select active high\n&quot;
	     &quot;  -3 --3wire    SI/SO signals shared\n&quot;);
	exit(1);
}

static void parse_opts(int argc, char *argv[])
{
	while (1) {
		static const struct option lopts[] = {
			{ &quot;device&quot;,  1, 0, 'D' },
			{ &quot;speed&quot;,   1, 0, 's' },
			{ &quot;delay&quot;,   1, 0, 'd' },
			{ &quot;bpw&quot;,     1, 0, 'b' },
			{ &quot;loop&quot;,    0, 0, 'l' },
			{ &quot;cpha&quot;,    0, 0, 'H' },
			{ &quot;cpol&quot;,    0, 0, 'O' },
			{ &quot;lsb&quot;,     0, 0, 'L' },
			{ &quot;cs-high&quot;, 0, 0, 'C' },
			{ &quot;3wire&quot;,   0, 0, '3' },
			{ &quot;no-cs&quot;,   0, 0, 'N' },
			{ &quot;ready&quot;,   0, 0, 'R' },
			{ NULL, 0, 0, 0 },
		};
		int c;

		c = getopt_long(argc, argv, &quot;D:s:d:b:lHOLC3NR&quot;, lopts, NULL);

		if (c == -1)
			break;

		switch (c) {
		case 'D':
			device = optarg;
			break;
		case 's':
			speed = atoi(optarg);
			break;
		case 'd':
			delay = atoi(optarg);
			break;
		case 'b':
			bits = atoi(optarg);
			break;
		case 'l':
			mode |= SPI_LOOP;
			break;
		case 'H':
			mode |= SPI_CPHA;
			break;
		case 'O':
			mode |= SPI_CPOL;
			break;
		case 'L':
			mode |= SPI_LSB_FIRST;
			break;
		case 'C':
			mode |= SPI_CS_HIGH;
			break;
		case '3':
			mode |= SPI_3WIRE;
			break;
		case 'N':
			mode |= SPI_NO_CS;
			break;
		case 'R':
			mode |= SPI_READY;
			break;
		default:
			print_usage(argv[0]);
			break;
		}
	}
}

int main(int argc, char *argv[])
{
	int ret = 0;
	int fd;

	parse_opts(argc, argv);

	fd = open(device, O_RDWR);
	if (fd &lt; 0)
		pabort(&quot;can't open device&quot;);

	/*
	 * spi mode
	 */
	ret = ioctl(fd, SPI_IOC_WR_MODE, &amp;mode);
	if (ret == -1)
		pabort(&quot;can't set spi mode&quot;);

	ret = ioctl(fd, SPI_IOC_RD_MODE, &amp;mode);
	if (ret == -1)
		pabort(&quot;can't get spi mode&quot;);

	/*
	 * bits per word
	 */
	ret = ioctl(fd, SPI_IOC_WR_BITS_PER_WORD, &amp;bits);
	if (ret == -1)
		pabort(&quot;can't set bits per word&quot;);

	ret = ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &amp;bits);
	if (ret == -1)
		pabort(&quot;can't get bits per word&quot;);

	/*
	 * max speed hz
	 */
	ret = ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, &amp;speed);
	if (ret == -1)
		pabort(&quot;can't set max speed hz&quot;);

	ret = ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &amp;speed);
	if (ret == -1)
		pabort(&quot;can't get max speed hz&quot;);

	printf(&quot;spi mode: %d\n&quot;, mode);
	printf(&quot;bits per word: %d\n&quot;, bits);
	printf(&quot;max speed: %d Hz (%d KHz)\n&quot;, speed, speed/1000);

	transfer(fd);

	close(fd);

	return ret;
}</code></pre></noscript>
<h3>Running</h3>
<p>The MSP430 board LED1 will blink 3 times upon recognition of the SPI clock. After this initial sequence, when you SPI data &#8220;HELLO WORLD\n&#8221; to the MSP430 it will turn on the LED1 light.<br />
On your Raspberry Pi run the previously compiled program. The -s options sets the frequency of the clock when performing the SPI communication.</p>
<blockquote><p>sudo ./spidev_test -s 120000</p></blockquote>
<p>Again, a successful sending of &#8220;HELLO WORLD\n&#8221; will be denoted by LED1 lighting up on the MSP430 board.</p>
]]></content:encoded>
			<wfw:commentRss>http://mitchtech.net/raspberry-pi-msp430-spi/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Raspberry Pi + Arduino + SPI</title>
		<link>http://mitchtech.net/raspberry-pi-arduino-spi/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=raspberry-pi-arduino-spi</link>
		<comments>http://mitchtech.net/raspberry-pi-arduino-spi/#comments</comments>
		<pubDate>Sat, 11 Aug 2012 11:35:53 +0000</pubDate>
		<dc:creator>meyers</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[3 wire spi]]></category>
		<category><![CDATA[spi]]></category>

		<guid isPermaLink="false">http://mitchtech.net/?p=1085</guid>
		<description><![CDATA[This tutorial will show you how to communicate from your raspberry pi to your arduino using 3-wire SPI.]]></description>
				<content:encoded><![CDATA[<p><a href="http://mitchtech.net/raspberry-pi-arduino-spi/raspi-arduino-spi/" rel="attachment wp-att-1162"><img class="size-medium wp-image-1162" title="raspi-arduino-spi" src="http://mitchtech.net/wp-content/uploads/2012/08/raspi-arduino-spi-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>This tutorial will show you how to communicate from your raspberry pi to your arduino using 3-wire SPI.</p>
<h2>Requirements</h2>
<ul>
<li>1 Raspberry pi (running <a href="http://www.raspbian.org/">Raspbian</a>)</li>
<li>1 Arduino</li>
<li>4 wires</li>
</ul>
<p>Your raspberry pi should be running the newest version of <a href="http://www.raspbian.org/">Raspbian</a>.  To ensure your system is up-to-date please download and run <a href="https://github.com/Hexxeh/rpi-update/">rpi-update</a>.</p>
<h2>Wiring</h2>
<p><a href="http://mitchtech.net/raspberry-pi-arduino-spi/raspi_arduino_spi/" rel="attachment wp-att-1163"><img class="size-medium wp-image-1163 aligncenter" title="raspi_arduino_spi" src="http://mitchtech.net/wp-content/uploads/2012/08/raspi_arduino_spi-225x300.png" alt="" width="225" height="300" /></a></p>
<p>&nbsp;</p>
<h2>Arduino</h2>
<p>Open your Arduino ide and flash the below code to your Arduino.</p>
<h4>Arduino code</h4>
<script src="https://gist.github.com/3317769.js"></script><noscript><pre><code class="language-processing processing">
// Written by Nick Gammon
// February 2011
/**
 * Send arbitrary number of bits at whatever clock rate (tested at 500 KHZ and 500 HZ).
 * This script will capture the SPI bytes, when a '\n' is recieved it will then output
 * the captured byte stream via the serial.
 */

#include &lt;SPI.h&gt;

char buf [100];
volatile byte pos;
volatile boolean process_it;

void setup (void)
{
  Serial.begin (115200);   // debugging

  // have to send on master in, *slave out*
  pinMode(MISO, OUTPUT);
  
  // turn on SPI in slave mode
  SPCR |= _BV(SPE);
  
  // get ready for an interrupt 
  pos = 0;   // buffer empty
  process_it = false;

  // now turn on interrupts
  SPI.attachInterrupt();

}  // end of setup


// SPI interrupt routine
ISR (SPI_STC_vect)
{
byte c = SPDR;  // grab byte from SPI Data Register
  
  // add to buffer if room
  if (pos &lt; sizeof buf)
    {
    buf [pos++] = c;
    
    // example: newline means time to process buffer
    if (c == '\n')
      process_it = true;
      
    }  // end of room available
}  // end of interrupt routine SPI_STC_vect

// main loop - wait for flag set in interrupt routine
void loop (void)
{
  if (process_it)
    {
    buf [pos] = 0;  
    Serial.println (buf);
    pos = 0;
    process_it = false;
    }  // end of flag set
    
}  // end of loop</code></pre></noscript>
<h2>Raspberry Pi</h2>
<p>With your updated rasbian system you should have the drivers that you need. Now it&#8217;s time to load them.</p>
<blockquote><p>modprobe spi_bcm2708<br />
modprobe spidev</p></blockquote>
<p>Check to be sure the modules loaded:</p>
<blockquote><p>lsmod<br />
Module Size Used by<br />
spidev 5944 0<br />
spi_bcm2708 5350 0<br />
snd_bcm2835 21681 0<br />
snd_pcm 81170 1 snd_bcm2835<br />
snd_seq 59528 0<br />
snd_timer 21602 2 snd_seq,snd_pcm<br />
snd_seq_device 6924 1 snd_seq<br />
snd 57427 5 snd_seq_device,snd_timer,snd_seq,snd_pcm,snd_bcm2835<br />
snd_page_alloc 5343 1 snd_pcm<br />
i2c_bcm2708 3822 0</p></blockquote>
<h4>Raspberry Pi Code</h4>
<p>Save the below code as spidev_test.c on to your Raspberry Pi and compile it</p>
<blockquote><p>gcc spidev_test.c -o spidev_test</p></blockquote>
<script src="https://gist.github.com/3317805.js"></script><noscript><pre><code class="language-c c">/*
 * SPI testing utility (using spidev driver)
 *
 * Copyright (c) 2007  MontaVista Software, Inc.
 * Copyright (c) 2007  Anton Vorontsov &lt;avorontsov@ru.mvista.com&gt;
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License.
 *
 * Cross-compile with cross-gcc -I/path/to/cross-kernel/include
 */

#include &lt;stdint.h&gt;
#include &lt;unistd.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;getopt.h&gt;
#include &lt;fcntl.h&gt;
#include &lt;sys/ioctl.h&gt;
#include &lt;linux/types.h&gt;
#include &lt;linux/spi/spidev.h&gt;

#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))

static void pabort(const char *s)
{
	perror(s);
	abort();
}

static const char *device = &quot;/dev/spidev0.0&quot;;
static uint8_t mode;
static uint8_t bits = 8;
static uint32_t speed = 500000;
static uint16_t delay;

static void transfer(int fd)
{
	int ret;
	uint8_t tx[] = {
        0x48, 0x45, 0x4C, 0x4C, 0x4F,
        0x20, 
        0x57, 0x4F, 0x52, 0x4C, 0x44,
        0x0A 
	};
	uint8_t rx[ARRAY_SIZE(tx)] = {0, };
	struct spi_ioc_transfer tr = {
		.tx_buf = (unsigned long)tx,
		.rx_buf = (unsigned long)rx,
		.len = ARRAY_SIZE(tx),
		.delay_usecs = delay,
		.speed_hz = speed,
		.bits_per_word = bits,
	};

	ret = ioctl(fd, SPI_IOC_MESSAGE(1), &amp;tr);
	if (ret &lt; 1)
		pabort(&quot;can't send spi message&quot;);

    /*
	for (ret = 0; ret &lt; ARRAY_SIZE(tx); ret++) {
		if (!(ret % 6))
			puts(&quot;&quot;);
		printf(&quot;%.2X &quot;, rx[ret]);
	}
	puts(&quot;&quot;);
    */
}

static void print_usage(const char *prog)
{
	printf(&quot;Usage: %s [-DsbdlHOLC3]\n&quot;, prog);
	puts(&quot;  -D --device   device to use (default /dev/spidev1.1)\n&quot;
	     &quot;  -s --speed    max speed (Hz)\n&quot;
	     &quot;  -d --delay    delay (usec)\n&quot;
	     &quot;  -b --bpw      bits per word \n&quot;
	     &quot;  -l --loop     loopback\n&quot;
	     &quot;  -H --cpha     clock phase\n&quot;
	     &quot;  -O --cpol     clock polarity\n&quot;
	     &quot;  -L --lsb      least significant bit first\n&quot;
	     &quot;  -C --cs-high  chip select active high\n&quot;
	     &quot;  -3 --3wire    SI/SO signals shared\n&quot;);
	exit(1);
}

static void parse_opts(int argc, char *argv[])
{
	while (1) {
		static const struct option lopts[] = {
			{ &quot;device&quot;,  1, 0, 'D' },
			{ &quot;speed&quot;,   1, 0, 's' },
			{ &quot;delay&quot;,   1, 0, 'd' },
			{ &quot;bpw&quot;,     1, 0, 'b' },
			{ &quot;loop&quot;,    0, 0, 'l' },
			{ &quot;cpha&quot;,    0, 0, 'H' },
			{ &quot;cpol&quot;,    0, 0, 'O' },
			{ &quot;lsb&quot;,     0, 0, 'L' },
			{ &quot;cs-high&quot;, 0, 0, 'C' },
			{ &quot;3wire&quot;,   0, 0, '3' },
			{ &quot;no-cs&quot;,   0, 0, 'N' },
			{ &quot;ready&quot;,   0, 0, 'R' },
			{ NULL, 0, 0, 0 },
		};
		int c;

		c = getopt_long(argc, argv, &quot;D:s:d:b:lHOLC3NR&quot;, lopts, NULL);

		if (c == -1)
			break;

		switch (c) {
		case 'D':
			device = optarg;
			break;
		case 's':
			speed = atoi(optarg);
			break;
		case 'd':
			delay = atoi(optarg);
			break;
		case 'b':
			bits = atoi(optarg);
			break;
		case 'l':
			mode |= SPI_LOOP;
			break;
		case 'H':
			mode |= SPI_CPHA;
			break;
		case 'O':
			mode |= SPI_CPOL;
			break;
		case 'L':
			mode |= SPI_LSB_FIRST;
			break;
		case 'C':
			mode |= SPI_CS_HIGH;
			break;
		case '3':
			mode |= SPI_3WIRE;
			break;
		case 'N':
			mode |= SPI_NO_CS;
			break;
		case 'R':
			mode |= SPI_READY;
			break;
		default:
			print_usage(argv[0]);
			break;
		}
	}
}

int main(int argc, char *argv[])
{
	int ret = 0;
	int fd;

	parse_opts(argc, argv);

	fd = open(device, O_RDWR);
	if (fd &lt; 0)
		pabort(&quot;can't open device&quot;);

	/*
	 * spi mode
	 */
	ret = ioctl(fd, SPI_IOC_WR_MODE, &amp;mode);
	if (ret == -1)
		pabort(&quot;can't set spi mode&quot;);

	ret = ioctl(fd, SPI_IOC_RD_MODE, &amp;mode);
	if (ret == -1)
		pabort(&quot;can't get spi mode&quot;);

	/*
	 * bits per word
	 */
	ret = ioctl(fd, SPI_IOC_WR_BITS_PER_WORD, &amp;bits);
	if (ret == -1)
		pabort(&quot;can't set bits per word&quot;);

	ret = ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &amp;bits);
	if (ret == -1)
		pabort(&quot;can't get bits per word&quot;);

	/*
	 * max speed hz
	 */
	ret = ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, &amp;speed);
	if (ret == -1)
		pabort(&quot;can't set max speed hz&quot;);

	ret = ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &amp;speed);
	if (ret == -1)
		pabort(&quot;can't get max speed hz&quot;);

	printf(&quot;spi mode: %d\n&quot;, mode);
	printf(&quot;bits per word: %d\n&quot;, bits);
	printf(&quot;max speed: %d Hz (%d KHz)\n&quot;, speed, speed/1000);

	transfer(fd);

	close(fd);

	return ret;
}</code></pre></noscript>
<h3>Running</h3>
<p>Plug your Arduino to your desktop via the serial cable. Open the arduino Serial Monitor and set the bitrate to 115200. Now, on the Raspberry Pi, run the compiled code</p>
<blockquote><p>sudo ./spidev_test</p></blockquote>
<p>You should see HELLO WORLD print in the Arduino IDE Serial Monitor.<br />
<a href="http://mitchtech.net/raspberry-pi-arduino-spi/screenshot-from-2012-08-10-181653/" rel="attachment wp-att-1106"><img class="aligncenter size-medium wp-image-1106" title="Screenshot from 2012-08-10 18:16:53" src="http://mitchtech.net/wp-content/uploads/2012/08/Screenshot-from-2012-08-10-181653-300x167.png" alt="" width="300" height="167" /></a></p>
<h3>Debugging</h3>
<ul>
<ul>
<li>Make sure that your kernel has the required drivers (spi-bcm2708.ko and spidev.ko)</li>
</ul>
</ul>
<blockquote><p>pi@raspberrypi ~/spi $ ls -al /lib/modules/`uname -r`/kernel/drivers/spi/<br />
total 64<br />
drwxrwxr-x 2 pi pi 4096 Aug 10 10:53 .<br />
drwxrwxr-x 23 pi pi 4096 Aug 10 10:53 ..<br />
-rw-rw-r&#8211; 1 pi pi 14428 Aug 10 10:53 spi-bcm2708.ko<br />
-rw-rw-r&#8211; 1 pi pi 10852 Aug 10 10:53 spi-bitbang.ko<br />
-rw-rw-r&#8211; 1 pi pi 15803 Aug 10 10:53 spidev.ko<br />
-rw-rw-r&#8211; 1 pi pi 10693 Aug 10 10:53 spi-gpio.ko</p></blockquote>
<p>Thanks to <a title="Arduino SPI Slave code" href="http://www.gammon.com.au/forum/?id=10892" target="_blank">Nick Gammon</a> for the SPI slave code.</p>
<p>Thanks to Anton Vorontsov for the kernel Documentation spidev_test.c example code.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://mitchtech.net/raspberry-pi-arduino-spi/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
		<item>
		<title>Arduino Poor Man&#8217;s Oscilloscope</title>
		<link>http://mitchtech.net/arduino-oscilloscope/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=arduino-oscilloscope</link>
		<comments>http://mitchtech.net/arduino-oscilloscope/#comments</comments>
		<pubDate>Mon, 06 Aug 2012 04:33:51 +0000</pubDate>
		<dc:creator>meyers</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[arduinoscope]]></category>
		<category><![CDATA[lxardoscope]]></category>
		<category><![CDATA[oscilloscope]]></category>
		<category><![CDATA[poor mans]]></category>
		<category><![CDATA[poor mans oscilloscope]]></category>

		<guid isPermaLink="false">http://mitchtech.net/?p=1049</guid>
		<description><![CDATA[Turn your Arduino into an Oscilloscope using poor man's oscilloscope.]]></description>
				<content:encoded><![CDATA[<p><a href="http://mitchtech.net/arduino-oscilloscope/arduino-oscilloscope-2/" rel="attachment wp-att-1112"><img class="alignnone size-medium wp-image-1112" title="arduino-oscilloscope" src="http://mitchtech.net/wp-content/uploads/2012/08/arduino-oscilloscope-300x248.png" alt="" width="300" height="248" /></a></p>
<p>This tutorial will show you how to use your Arduino as an oscilloscope.  We end the tutorial with a verification portion that uses the Arduino to generate a square wave, requiring a single wire.</p>
<h2>lxardoscope</h2>
<p><a href="http://lxardoscope.sourceforge.net/" target="_blank">Lxardoscope</a> is another Arduino + real-time graphing project that has the potential to turn an Arduino into an oscilloscope.  Unfortunately, I was unable to get any readings (the visual graph remained static).</p>
<h2>Poor Man&#8217;s Oscilloscope</h2>
<p>First, download processing.</p>
<blockquote><p>http://processing.googlecode.com/files/processing-1.5.1-linux.tgz<br />
gzip -d processing-1.5.1-linux.tgz<br />
tar -xf processing-1.5.1-linux.tar</p></blockquote>
<h3>Desktop Application</h3>
<p>Arduino uses a modified RXTXcomm.jar library.  This causes a problem when the processing project runs <a href="http://accrochages.drone.ws/en/node/90" target="_blank">poor man&#8217;s oscilloscope</a> and loads the RXTXcomm.jar library bundles with the processing project.  Instead, we wish for process to load the modified Arduino RXTXcomm.jar library.  To remedy this problem we simply replace processing RXTXcomm.jar with the Android specific RXTXcomm.jar.</p>
<blockquote><p>rm processing-1.5.1/modes/java/libraries/serial/library/linux64/librxtxSerial.so<br />
rm processing-1.5.1/modes/java/libraries/serial/library/RXTXcomm.jar<br />
ln -s /usr/share/arduino/lib/RXTXcomm.jar processing-1.5.1/modes/java/libraries/serial/library/</p></blockquote>
<p>Run processing</p>
<blockquote><p>cd processing-1.5.1<br />
./processing</p></blockquote>
<p>Running the processing command should result in a GUI application launching that looks a lot like the Arduino idea.  Download and open the below code in processing and click play.<br />
<script src="https://gist.github.com/3270419.js"></script><noscript><pre><code class="language-c c">  /*
 * Oscilloscope
 * Gives a visual rendering of analog pin 0 in realtime.
 * 
 * This project is part of Accrochages
 * See http://accrochages.drone.ws
 * 
 * (c) 2008 Sofian Audry (info@sofianaudry.com)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
 */ 
import processing.serial.*;

Serial port;  // Create object from Serial class
int val;      // Data received from the serial port
int[] values;
float zoom;

void setup() 
{
  size(1280, 480);
  // Open the port that the board is connected to and use the same speed (9600 bps)
  port = new Serial(this, Serial.list()[0], 9600);
  values = new int[width];
  zoom = 1.0f;
  smooth();
}

int getY(int val) {
  return (int)(height - val / 1023.0f * (height - 1));
}

int getValue() {
  int value = -1;
  while (port.available() &gt;= 3) {
    if (port.read() == 0xff) {
      value = (port.read() &lt;&lt; 8) | (port.read());
    }
  }
  return value;
}

void pushValue(int value) {
  for (int i=0; i&lt;width-1; i++)
    values[i] = values[i+1];
  values[width-1] = value;
}

void drawLines() {
  stroke(255);
  
  int displayWidth = (int) (width / zoom);
  
  int k = values.length - displayWidth;
  
  int x0 = 0;
  int y0 = getY(values[k]);
  for (int i=1; i&lt;displayWidth; i++) {
    k++;
    int x1 = (int) (i * (width-1) / (displayWidth-1));
    int y1 = getY(values[k]);
    line(x0, y0, x1, y1);
    x0 = x1;
    y0 = y1;
  }
}

void drawGrid() {
  stroke(255, 0, 0);
  line(0, height/2, width, height/2);
}

void keyReleased() {
  switch (key) {
    case '+':
      zoom *= 2.0f;
      println(zoom);
      if ( (int) (width / zoom) &lt;= 1 )
        zoom /= 2.0f;
      break;
    case '-':
      zoom /= 2.0f;
      if (zoom &lt; 1.0f)
        zoom *= 2.0f;
      break;
  }
}

void draw()
{
  background(0);
  drawGrid();
  val = getValue();
  if (val != -1) {
    pushValue(val);
  }
  drawLines();
}</code></pre></noscript><br />
<a href="http://mitchtech.net/arduino-poor-mans-oscilloscope/screenshot_processing_oscilloscope_zoom/" rel="attachment wp-att-1053"><img class="aligncenter size-medium wp-image-1053" title="screenshot_processing_oscilloscope_zoom" src="http://mitchtech.net/wp-content/uploads/2012/08/screenshot_processing_oscilloscope_zoom-250x300.png" alt="" width="250" height="300" /></a></p>
<h3>Arduino Code</h3>
<p>Arduinoscope has a simple arduino component to poll and forward analog 0 to the desktop via the serial connection.  Save the below code and flash it to your Arduino.<br />
<script src="https://gist.github.com/3270358.js"></script><noscript><pre><code class="language-c c">#define ANALOG_IN 0

void setup() {
  Serial.begin(9600); 
  //Serial.begin(115200); 
}

void loop() {
  int val = analogRead(ANALOG_IN);                                              
  Serial.write( 0xff );                                                         
  Serial.write( (val &gt;&gt; 8) &amp; 0xff );                                            
  Serial.write( val &amp; 0xff );
}</code></pre></noscript></p>
<h3><a href="http://mitchtech.net/arduino-poor-mans-oscilloscope/arduino_ide_poormans/" rel="attachment wp-att-1054"><img class="aligncenter size-medium wp-image-1054" title="arduino_ide_poormans" src="http://mitchtech.net/wp-content/uploads/2012/08/arduino_ide_poormans-250x300.png" alt="" width="250" height="300" /></a></h3>
<p>&nbsp;</p>
<h3>Verifying the Oscilloscope</h3>
<p>To test the oscilloscope we will generate data using the Arduino and feed it in to the analog A0 port to be viewed on our Desktop.  Flash the code below to your Arduino.<br />
<script src="https://gist.github.com/3270418.js"></script><noscript><pre><code class="language-c c">// The Arduino code.                                                            
                                                                                
#define ANALOG_IN 0                                                             
int outPin=13;                                                                  
int outPinState = LOW;                                                          
int count = 1;                                                                  
int every = 10000;                                                              
                                                                                
void setup() {                                                                  
  //Serial.begin(9600);                                                         
  Serial.begin(115200);                                                         
}                                                                               
                                                                                
void loop() {                                                                   
  int val = analogRead(ANALOG_IN);                                              
  Serial.write( 0xff );                                                         
  Serial.write( (val &gt;&gt; 8) &amp; 0xff );                                            
  Serial.write( val &amp; 0xff );                                                   
                                                                                
  /* Generate signal to test oscilloscope */                                    
  if ((count % every) == 0) {                                                   
    if (outPinState == LOW) {                                                   
      outPinState = HIGH;                                                       
    } else {                                                                    
      outPinState = LOW;                                                        
    }                                                                           
    digitalWrite(outPin, outPinState);                                          
    count = 0;                                                                  
  }                                                                             
  count++;                                                                      
}</code></pre></noscript><br />
Connect pin digital pin 13 on the Arduino to analog pin A0.  The above code will turn on and off the digital pin to produce a square wave.</p>
<p><a href="http://mitchtech.net/arduino-poor-mans-oscilloscope/screenshot_poormans_oscilloscope_zoom/" rel="attachment wp-att-1051"><img class="aligncenter size-medium wp-image-1051" title="screenshot_poormans_oscilloscope_zoom" src="http://mitchtech.net/wp-content/uploads/2012/08/screenshot_poormans_oscilloscope_zoom-300x118.png" alt="" width="300" height="118" /></a></p>
<h3>Extras</h3>
<ul>
<li>You can alter the baud rate from 9600 to 115200 in the arduino code as well as the processing code.</li>
<li>Plus sign zooms in (shift and =) while &#8211; zooms out (just -, no shift)</li>
<li>PWM at a normal 50 HZ is easily observable</li>
<li>Raspberry Pi pin 18 can generate PWM and the arduino can be used to test it.</li>
<li>An idle capture looks like:<a href="http://mitchtech.net/arduino-poor-mans-oscilloscope/screenshot_poormans_oscilloscope_idle/" rel="attachment wp-att-1073"><img class="aligncenter size-medium wp-image-1073" title="screenshot_poormans_oscilloscope_idle" src="http://mitchtech.net/wp-content/uploads/2012/08/screenshot_poormans_oscilloscope_idle-300x118.png" alt="" width="300" height="118" /></a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mitchtech.net/arduino-oscilloscope/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Dropbox on Raspberry Pi via SSHFS</title>
		<link>http://mitchtech.net/dropbox-on-raspberry-pi-via-sshfs/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dropbox-on-raspberry-pi-via-sshfs</link>
		<comments>http://mitchtech.net/dropbox-on-raspberry-pi-via-sshfs/#comments</comments>
		<pubDate>Tue, 10 Jul 2012 22:54:46 +0000</pubDate>
		<dc:creator>michael</dc:creator>
				<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[Boot]]></category>
		<category><![CDATA[Cron]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[Dropbox]]></category>
		<category><![CDATA[Filesystem]]></category>
		<category><![CDATA[FUSE]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mount]]></category>
		<category><![CDATA[OpenSSH]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Share]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[SSHFS]]></category>

		<guid isPermaLink="false">http://mitchtech.net/?p=829</guid>
		<description><![CDATA[This tutorial will demonstrate how to mount Dropbox (or any filesystem) over the network on the Raspberry Pi using SSHFS (Secure SHell FileSystem). ]]></description>
				<content:encoded><![CDATA[<p><a href="http://mitchtech.net/dropbox-on-raspberry-pi-via-sshfs/pi-dropbox/" rel="attachment wp-att-1034"><img class="alignnone size-medium wp-image-1034" title="pi-dropbox" src="http://mitchtech.net/wp-content/uploads/2012/07/pi-dropbox-300x225.png" alt="" width="300" height="225" /></a></p>
<p>This tutorial will demonstrate how to mount Dropbox (or any filesystem) over the network on the Raspberry Pi using SSHFS (Secure SHell FileSystem). For this procedure to work for your Dropbox share, you will need another machine somewhere that is running Dropbox, and is accessible to the Raspberry Pi via SSH.</p>
<p>Note: The following is not actually specific to the Raspberry Pi, nor to Dropbox. The tutorial generalizes for other systems and architectures that are not officially supported by Dropbox, as well as for mounting of other non Dropbox shares over the network.</p>
<h4>How it works</h4>
<p>SSH is a secure protocol for communicating between machines. SSHFS is a tool that uses SSH to enable mounting of a remote filesystem on a local machine; the network is (mostly) transparent to the user.</p>
<p>On the local computer where the SSHFS is mounted, the implementation makes use of the FUSE (Filesystem in Userspace) kernel module. The practical effect of this is that the end user can seamlessly interact with remote files being securely served over SSH just as if they were local files on his/her computer.</p>
<h4>Installation (remote host)</h4>
<p>The first step is to configure the remote host that the Raspberry Pi will connect to via SSH.  It will need to be running Dropbox, if you need to install it, <a href="https://www.dropbox.com/install">follow the instructions for your respective OS here</a>. If you are not yet a Dropbox user, and this has finally persuaded you to join, <a href="http://db.tt/WG4dR9shttp://db.tt/WG4dR9s">signup for Dropbox here</a>.</p>
<p>Next, the remote machine will need to be running OpenSSH server. For Windows and Mac instructions on how to set up OpenSSH server, I recommend this <a href="http://lifehacker.com/205090/geek-to-live--set-up-a-personal-home-ssh-servervvvvvvvvvvv">tutorial on Lifehacker</a>.  For Linux users, OpenSSH server is available in most every package manager. To install on Ubuntu, for example:</p>
<blockquote><p>sudo apt-get install openssh-server</p></blockquote>
<p>&nbsp;</p>
<h4>Installation (Raspberry Pi)</h4>
<p>Now that the remote host is configured, you can setup the mount on the Pi.  This first requires installation of the sshfs package.  Open a terminal on the Pi and install it like this:</p>
<blockquote><p>sudo apt-get install sshfs</p></blockquote>
<p>Then add the user pi to the FUSE users group:</p>
<blockquote><p>sudo gpasswd -a pi fuse</p></blockquote>
<p>Once added to the fuse group, log out and log back in again for the change to take effect. Next, create a directory to mount Dropbox (or other remote share)</p>
<blockquote><p>mkdir ~/Dropbox</p></blockquote>
<p>Now use sshfs to mount the remote share on the newly created mountpoint. Be sure to change the user@remote-host and path to Dropbox to match your own settings:</p>
<blockquote><p>sshfs -o idmap=user user@remote-host:/home/user/Dropbox ~/Dropbox</p></blockquote>
<p>For example, connecting to another machine on your local network will look something like this:</p>
<blockquote><p>sshfs -o idmap=user michael@192.168.1.100:/home/michael/Dropbox ~/Dropbox</p></blockquote>
<p>The idmap=user option ensures that files owned by the remote user are owned by the local user. If you don&#8217;t use idmap=user, files in the mounted directory might appear to be owned by someone else, because your computer and the remote computer have different ideas about the numeric user ID associated with each user name. idmap=user will not translate UIDs for other users.</p>
<p>That&#8217;s all there is to it! To unmount,</p>
<blockquote><p>fusermount -u ~/Dropbox</p></blockquote>
<h4><a href="http://mitchtech.net/dropbox-on-raspberry-pi-via-sshfs/raspberry-dropbox/" rel="attachment wp-att-1035"><img class="alignnone size-medium wp-image-1035" title="raspberry-dropbox" src="http://mitchtech.net/wp-content/uploads/2012/07/raspberry-dropbox-300x267.png" alt="" width="300" height="267" /></a></h4>
<h4>Automount Dropbox on boot</h4>
<p>To configure the Dropbox SSHFS to automatically mount at startup, we first need to enable SSH keyless remote login.  The first part of this task is to generate an RSA crypto key so we can securely login to the remote machine running Dropbox without entering a password.  In a terminal on the Pi, run:</p>
<blockquote><p>ssh-keygen -t rsa</p></blockquote>
<p>Hit enter three times when prompted, accepting the default settings for the RSA ssh keys. Now copy the public part of the key to the remote host using the ssh-copy-id command:</p>
<blockquote><p>ssh-copy-id -i ~/.ssh/id_rsa.pub user@remote-host</p></blockquote>
<p>You will be prompted for the password on the remote one last time. Once entered, terminal output will confim the key was added sucessfully.</p>
<p>Now that you can login remotely without password, the final task is to configure the share to automatically mount on startup. There are a few ways this could be accomplished, I decided to use cron for the task. Open the global crontab for editing:</p>
<blockquote><p>sudo crontab -e</p></blockquote>
<p>And add a line to the end like this:</p>
<blockquote><p>@reboot sshfs user@remote-host:/home/user/Dropbox /home/pi/Dropbox</p></blockquote>
<p>Then press CTRL and X to exit the editor, then Y to confirm the changes (if using nano, the default text editior).</p>
<p>That&#8217;s it! Reboot the Pi, and your Dropbox share will mount automatically on startup.</p>
<p>Another method to accomplish this task would be to add a line to /etc/fstab to automatically mount the Dropbox SSHFS share.</p>
<p>Reference: <a href="https://help.ubuntu.com/community/SSHFS">https://help.ubuntu.com/community/SSHFS</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://mitchtech.net/dropbox-on-raspberry-pi-via-sshfs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MSP430 Launchpad + PWM</title>
		<link>http://mitchtech.net/msp430-launchpad-pwm/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=msp430-launchpad-pwm</link>
		<comments>http://mitchtech.net/msp430-launchpad-pwm/#comments</comments>
		<pubDate>Mon, 09 Jul 2012 23:06:03 +0000</pubDate>
		<dc:creator>meyers</dc:creator>
				<category><![CDATA[MSP430 Launchpad]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[launchpad]]></category>
		<category><![CDATA[msp430]]></category>
		<category><![CDATA[pulse width modulation]]></category>
		<category><![CDATA[PWM]]></category>
		<category><![CDATA[Servo]]></category>

		<guid isPermaLink="false">http://mitchtech.net/?p=949</guid>
		<description><![CDATA[How to perform pulse width modulation using a MSP430g2553 TI Launchpad to control a sparkfun servo motor.]]></description>
				<content:encoded><![CDATA[<p><a href="http://mitchtech.net/msp430-launchpad-pwm/samsung/" rel="attachment wp-att-955"><img class="aligncenter size-medium wp-image-955" title="MSP430 pwm servo" src="http://mitchtech.net/wp-content/uploads/2012/06/msp430+servo-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>Inspired by <a href="http://gushh.net/blog/?cat=361">this</a> tutorial.</p>
<p>The following tutorial will describe how perform pulse width modulation using a MSP430g2553 TI Launchpad to control a sparkfun servo motor.</p>
<p>&nbsp;</p>
<h2>Prerequisites</h2>
<p>Please see <a href="http://mitchtech.net/cross-compiling-for-ti-msp430-launchpad/">Cross-Compiling for TI MSP430 Launchpad</a> to setup your development environment.</p>
<p>&nbsp;</p>
<h2>Hardware</h2>
<ul>
<li>Servo motor</li>
<li>MSP430</li>
<li>Power</li>
</ul>
<p>I&#8217;m using the Arduino to power the servo motors.  Alternatively you may use USB, a wall plug, or a battery.  The MSP430 is being used to generate the PWM for control.</p>
<p>Connect your servo control wire to MSP430 pin P1.2.</p>
<p>&nbsp;</p>
<h2>Software</h2>
<p>Save the below code as pwm.c<br />
<script src="https://gist.github.com/3024004.js"></script><noscript><pre><code class="language-c c">#include &quot;msp430g2553.h&quot; // make sure you change the header to suit your particular device.
 
// Connect the servo SIGNAL wire to P1.2 through a 1K resistor.
 
#define MCU_CLOCK           1100000
#define PWM_FREQUENCY       46      // In Hertz, ideally 50Hz.
 
#define SERVO_STEPS         180     // Maximum amount of steps in degrees (180 is common)
#define SERVO_MIN           700     // The minimum duty cycle for this servo
#define SERVO_MAX           3000    // The maximum duty cycle
 
unsigned int PWM_Period     = (MCU_CLOCK / PWM_FREQUENCY);  // PWM Period
unsigned int PWM_Duty       = 0;                            // %
 
void main (void){
 
    unsigned int servo_stepval, servo_stepnow;
    unsigned int servo_lut[ SERVO_STEPS+1 ];
    unsigned int i;
 
    // Calculate the step value and define the current step, defaults to minimum.
    servo_stepval   = ( (SERVO_MAX - SERVO_MIN) / SERVO_STEPS );
    servo_stepnow   = SERVO_MIN;
 
    // Fill up the LUT
    for (i = 0; i &lt; SERVO_STEPS; i++) {
        servo_stepnow += servo_stepval;
        servo_lut[i] = servo_stepnow;
    }
 
    // Setup the PWM, etc.
    WDTCTL  = WDTPW + WDTHOLD;     // Kill watchdog timer
    TACCTL1 = OUTMOD_7;            // TACCR1 reset/set
    TACTL   = TASSEL_2 + MC_1;     // SMCLK, upmode
    TACCR0  = PWM_Period-1;        // PWM Period
    TACCR1  = PWM_Duty;            // TACCR1 PWM Duty Cycle
    P1DIR   |= BIT2;               // P1.2 = output
    P1SEL   |= BIT2;               // P1.2 = TA1 output
 
    // Main loop
    while (1){
 
        // Go to 0&Acirc;&deg;
        TACCR1 = servo_lut[0];
        __delay_cycles(100000);

        // Go to 45&Acirc;&deg;
        TACCR1 = servo_lut[45];
        __delay_cycles(100000);
 
        // Go to 90&Acirc;&deg;
        TACCR1 = servo_lut[90];
        __delay_cycles(100000);
 
        // Go to 180&Acirc;&deg;
        TACCR1 = servo_lut[179];
        __delay_cycles(100000);
 
        // Move forward toward the maximum step value
        for (i = 0; i &lt; SERVO_STEPS; i++) {
            TACCR1 = servo_lut[i];
            __delay_cycles(20000);
        }               
        // Move backward toward the minimum step value
        for (i = SERVO_STEPS; i &gt; 0; i--) {
            TACCR1 = servo_lut[i];
            __delay_cycles(20000);
        }
   }
}</code></pre></noscript><br />
Compile install and run the code!</p>
<blockquote><p>
sudo mspdebug rf2500<br />
erase<br />
prog pwm.elf<br />
run</p></blockquote>
<p>If your lucky then your device will have moved a bit and you might notice that the device didn&#8217;t reach its full range of motion.  You will need to play with the SERVO_MIN and SERVO_MAX constants to achieve the devices full range of motion.</p>
<p><span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='580' height='357' src='http://www.youtube.com/embed/BPEImNC2fT0?version=3&#038;rel=1&#038;fs=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' frameborder='0'></iframe></span></p>
<p>&nbsp;</p>
<h2>Debugging</h2>
<p>This section contains hints and debug strategies if things didn&#8217;t just magically work for you.</p>
<p>&nbsp;</p>
<h4>Header File</h4>
<p>The biggest trouble I had was getting the correct header file. An incorrect header file did not produce any warnings.  The only feedback for a header file that didn&#8217;t match my board was the device moving less than 1 degree and behaving non-deterministic.  Look at the documentation that came with your board to find the exact device. A list of device headers can be found in the directory /usr/msp430/include/.</p>
<p>&nbsp;</p>
<h4>Erase</h4>
<p>The mspdebug program hosts a suite of commands.  A list of commands can be gotten by typing help.  The erase command is one that I found late into the night. Be sure to issue the erase command before you issue the load command.</p>
<p>&nbsp;</p>
<h4>Is it broke?</h4>
<p>Often times when things aren&#8217;t working you will wonder if you broke the board because you touched some pin, got pissed off and threw it across the room, or your kitty cat Mr. Bigglesworth played kitty frisbee with it.  Regardless of the reason you want some feedback that the board is still alive.  I like to reload a piece of code that blinks the development board built-in lights <a href="http://mitchtech.net/cross-compiling-for-ti-msp430-launchpad/">LED blinking tutorial</a>.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://mitchtech.net/msp430-launchpad-pwm/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Peer Guardian on Raspberry Pi</title>
		<link>http://mitchtech.net/peer-guardian-on-raspberry-pi/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=peer-guardian-on-raspberry-pi</link>
		<comments>http://mitchtech.net/peer-guardian-on-raspberry-pi/#comments</comments>
		<pubDate>Sun, 08 Jul 2012 22:52:09 +0000</pubDate>
		<dc:creator>michael</dc:creator>
				<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[Kernel]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Microcontroller]]></category>
		<category><![CDATA[Peer Guardian]]></category>

		<guid isPermaLink="false">http://mitchtech.net/?p=638</guid>
		<description><![CDATA[This tutorial will show how to compile and install Peer Guardian on a Raspberry Pi.]]></description>
				<content:encoded><![CDATA[<p><a href="http://mitchtech.net/peer-guardian-on-raspberry-pi/pi-peer-guardian/" rel="attachment wp-att-697"><img class="alignnone size-medium wp-image-697" title="pi-peer-guardian" src="http://mitchtech.net/wp-content/uploads/2012/06/pi-peer-guardian-300x183.png" alt="" width="300" height="183" /></a></p>
<p>This tutorial will show how to compile and install Peer Guardian on a Raspberry Pi.  The process requires the at least the 2012-06-18-wheezy-beta.zip or newer Debian image (or manual kernel re-compilation).  This will NOT work with debian6-19-04-2012.zip since the kernel does not have net filtering enabled. Also, you will need a decent sized SD card (4GB at least) &#8230; the dependencies alone require 382 MB.</p>
<p>First, install the required package dependencies. In a terminal on the Raspberry Pi:</p>
<blockquote><p>sudo apt-get install libnetfilter-queue-dev lsb-qt4 libdbus-1-dev qt4-dev-tools libdbus-1-dev libdbus-glib-1-dev firehol firestarter ufw zlib1g-dev</p></blockquote>
<p>Next, download and extract the Peer Guardian source archive, then change directory to the root of the tree:</p>
<blockquote><p>wget http://downloads.sourceforge.net/project/peerguardian/PeerGuardian%20Linux/2.1.3/pgl-2.1.3.tar.gz</p>
<p>tar -xvf pgl-2.1.3.tar.gz</p>
<p>cd pgl-2.1.3/</p></blockquote>
<p>Now we are finally ready to start the build! To compile, run make, then install Peer Guardian with make install:</p>
<blockquote><p>make</p>
<p>sudo make install</p></blockquote>
<p>Finally,</p>
<blockquote><p>sudo /usr/lib/lsb/install_initd /etc/init.d/pgl</p></blockquote>
<p>Now reboot the Pi:</p>
<blockquote><p>sudo reboot</p></blockquote>
<p>And on start-up you will see the confirmation that it starts:</p>
<blockquote><p>Starting PeerGuardian Linux: pgld.</p></blockquote>
<p>Note: this takes much longer than usual for the first boot, be patient!</p>
<p>To start the GUI from the LXDE menu, select Internet -&gt; pgl-gui</p>
<p><a href="http://mitchtech.net/peer-guardian-on-raspberry-pi/pi-pgl/" rel="attachment wp-att-700"><img class="alignnone size-medium wp-image-700" title="pi-pgl" src="http://mitchtech.net/wp-content/uploads/2012/06/pi-pgl-300x183.png" alt="" width="300" height="183" /></a></p>
<p>The default settings are very strict and you will likely want to change them.  It even blocks access to the apt sources, so until you changes the settings, even &#8216;apt-get update&#8217; will fail.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://mitchtech.net/peer-guardian-on-raspberry-pi/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
