<?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>everhack</title>
	<atom:link href="http://everhack.blog.atxhackerspace.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://everhack.blog.atxhackerspace.org</link>
	<description>Stuff I&#039;ve been messing with, or just thinking about.</description>
	<lastBuildDate>Fri, 03 May 2013 18:34:07 +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>LED as a light sensor</title>
		<link>http://everhack.blog.atxhackerspace.org/2013/05/03/led-as-a-light-sensor/</link>
		<comments>http://everhack.blog.atxhackerspace.org/2013/05/03/led-as-a-light-sensor/#comments</comments>
		<pubDate>Fri, 03 May 2013 18:01:10 +0000</pubDate>
		<dc:creator>everhack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[led]]></category>

		<guid isPermaLink="false">http://everhack.blog.atxhackerspace.org/?p=326</guid>
		<description><![CDATA[This is nothing new, but it's still pretty neat. Using a LED as a light sensor. I modded this demo code from the Blinkenlight blog to read just one LED as input and turn a second LED on and off based on a simple threshold. // // www.blinkenlight.net // // Copyright 2011 Udo Klein // [...]]]></description>
				<content:encoded><![CDATA[<p>This is nothing new, but it's still pretty neat. Using a LED as a light sensor.</p>
<p>I modded this demo code from the Blinkenlight blog to read just one LED as input and turn a second LED on and off based on a simple threshold.</p>
<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2013/05/led_sensor_circuit.jpg"><img src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2013/05/led_sensor_circuit-300x258.jpg" alt="led_sensor_circuit" width="300" height="258" class="alignnone size-medium wp-image-348" /></a></p>
<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2013/05/led_light_sensor.avi"><img src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2013/05/led_light_sensor.jpg" alt="led_light_sensor" width="176" height="144" class="alignnone size-full wp-image-336" /></a></p>
<blockquote><p>//<br />
//  www.blinkenlight.net<br />
//<br />
//  Copyright 2011 Udo Klein<br />
// modded 2013 by david mitchell - turn an LED on and off based on the light sensor value<br />
//<br />
//  This program is free software: you can redistribute it and/or modify<br />
//  it under the terms of the GNU General Public License as published by<br />
//  the Free Software Foundation, either version 3 of the License, or<br />
//  (at your option) any later version.<br />
//<br />
//  This program is distributed in the hope that it will be useful,<br />
//  but WITHOUT ANY WARRANTY; without even the implied warranty of<br />
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br />
//  GNU General Public License for more details.<br />
//<br />
//  You should have received a copy of the GNU General Public License<br />
//  along with this program. If not, see http://www.gnu.org/licenses/</p>
<p>// Usage<br />
//<br />
// This sketch uses the Blinkenlight Shield as a light<br />
// sensor. In order to make this work jumper the shield<br />
// such the common cathode of the LEDs it connected<br />
// to +5V.<br />
//<br />
// It will output hexadecimal digits that correspond<br />
// to the amount of light captured by the LEDs.<br />
// 0 = very bright light<br />
// higher numbers = less light<br />
//<br />
//<br />
// Theory of operation<br />
//<br />
// For each LED the following happens:</p>
<p>// 1) The PIN is pulled low thus reversing the LED.<br />
//    Thus the LED will act like a capacitor and gets<br />
//    charged.<br />
// 2) We store the current milli second count in<br />
//    start_millis for later use.<br />
// 3) The PIN is put to high Z input and starts to<br />
//    "float" with the voltage of the "LED cap".<br />
// 4) If the LED captures light the "LED cap" will<br />
//    discharge fast, otherwise it discharges slow.<br />
// 5) As the cap discharges the input PIN will<br />
//    float high.<br />
// 6) Once the pin is detected to be high we will<br />
//    compute elapsed_millis by subtracting<br />
//    start_millis from the current milli second<br />
//    count</p>
<p>// The loops are coded in such a way that this<br />
// happens "in parallel". They are also coded<br />
// in such a way that each pin gets some time<br />
// to settle.</p>
<p>// used to store the start milli second count per pin<br />
uint16_t start_millis[1];<br />
// used to store the last computed milli second count when pin floated to high<br />
uint16_t elapsed_millis[1];</p>
<p>uint8_t transform(uint16_t data) {<br />
    // output transformation, used to map uint16_t to 1 hex digit<br />
    // basically a logarithm to the base of 2<br />
    uint8_t i=0;<br />
    while (data) {<br />
        data >>= 1;<br />
        ++i;<br />
    }<br />
    return i;<br />
}</p>
<p>boolean pin_is_ok(uint8_t pin) {<br />
    // used to determine which pins are good for light detection<br />
    // pins 0,1 are spoiled by the serial port<br />
    // pin 13 is spoiled by the Arduino's LED<br />
    return (pin == 5);<br />
}<br />
#define MINPIN 5<br />
#define MAXPIN 5<br />
#define ANODE_POWER 6</p>
<p>#define LED_OUT 7</p>
<p>void setup() {<br />
    Serial.begin(115200);<br />
    Serial.println("go");</p>
<p>    pinMode(LED_OUT, OUTPUT);<br />
    digitalWrite(LED_OUT, HIGH);</p>
<p>    pinMode(ANODE_POWER, OUTPUT);<br />
    // turn on the LED charge power<br />
    digitalWrite(ANODE_POWER, HIGH);</p>
<p>    for (uint8_t pin = MINPIN; pin <= MAXPIN; ++pin) if (pin_is_ok(pin)) {<br />
        pinMode(pin, OUTPUT);<br />
        digitalWrite(pin, LOW);<br />
        start_millis[pin] = millis();<br />
        elapsed_millis[pin] = 0;<br />
    }<br />
    for (uint8_t pin = MINPIN; pin <= MAXPIN; ++pin) if (pin_is_ok(pin)) {<br />
        pinMode(pin, INPUT);<br />
    }<br />
}</p>
<p>void loop() {<br />
    for (uint8_t pin = MINPIN; pin <= MAXPIN; ++pin) if (pin_is_ok(pin)) {<br />
        if (digitalRead(pin)) {<br />
            pinMode(pin, OUTPUT);<br />
            elapsed_millis[pin] = millis()-start_millis[pin];<br />
            start_millis[pin] = millis();<br />
            pinMode(pin, INPUT);<br />
        }<br />
    }<br />
    for (uint8_t pin = MINPIN; pin <= MAXPIN; ++pin) if (pin_is_ok(pin)) {<br />
        int diff = transform(elapsed_millis[pin]);<br />
        if (diff > 6) {<br />
          digitalWrite(LED_OUT, HIGH);<br />
        }<br />
        else {<br />
          digitalWrite(LED_OUT, LOW);<br />
        }<br />
        Serial.print(diff, HEX);<br />
    }<br />
    Serial.println();<br />
}</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://everhack.blog.atxhackerspace.org/2013/05/03/led-as-a-light-sensor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2013/05/led_light_sensor.avi" length="609758" type="video/avi" />
		</item>
		<item>
		<title>How my Dulcimers turned out</title>
		<link>http://everhack.blog.atxhackerspace.org/2013/04/28/how-my-dulcimers-turned-out/</link>
		<comments>http://everhack.blog.atxhackerspace.org/2013/04/28/how-my-dulcimers-turned-out/#comments</comments>
		<pubDate>Sun, 28 Apr 2013 19:58:39 +0000</pubDate>
		<dc:creator>everhack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://everhack.blog.atxhackerspace.org/?p=319</guid>
		<description><![CDATA[Well, after a long delay, I'm finally back to post some updates. It took me about a month, but I finished building my dulcimer around May of last year, and it turned out really nice! I've been playing for almost a year now and really having a great time with it. Here's another photo of [...]]]></description>
				<content:encoded><![CDATA[<p>Well, after a long delay, I'm finally back to post some updates.</p>
<p>It took me about a month, but I finished building my dulcimer around May of last year, and it turned out really nice! I've been playing for almost a year now and really having a great time with it.</p>
<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2013/04/dulc_sm.jpg"><img class="alignnone size-medium wp-image-320" alt="dulc_sm" src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2013/04/dulc_sm-300x225.jpg" width="491" height="368" /></a></p>
<p>Here's another photo of it, hanging next to the one my dad made as a wedding gift for my mom in 1964.</p>
<p>Between them is an experimental one I made from HDF (hardboard). I wanted to know if I could make one completely from laser-cut pieces.</p>
<p>The answer is yes, but that HDF is a lousy tonewood. I ended up bandsawing it in half in a fit of frustration and discovered it makes a very nice wall hanger.</p>
<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2013/04/dulcimers3.jpg"><img class="alignnone size-medium wp-image-322" alt="dulcimers3" src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2013/04/dulcimers3-300x225.jpg" width="480" height="359" /></a></p>
<p>Here's another one of the HDF dulcimer.. I love the design of it, my next real dulcimer will look very similar, but I'll use a pegbox more like the one my dad made (like on the teardrop dulcimer above).</p>
<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2013/04/0804121128.jpg"><img class="alignnone size-large wp-image-324" alt="0804121128" src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2013/04/0804121128-1024x768.jpg" width="484" height="362" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://everhack.blog.atxhackerspace.org/2013/04/28/how-my-dulcimers-turned-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Mountain Dulcimer : how to make it and play it (after a fashion)</title>
		<link>http://everhack.blog.atxhackerspace.org/2012/04/17/the-mountain-dulcimer-how-to-make-it-and-play-it-after-a-fashion/</link>
		<comments>http://everhack.blog.atxhackerspace.org/2012/04/17/the-mountain-dulcimer-how-to-make-it-and-play-it-after-a-fashion/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 19:13:56 +0000</pubDate>
		<dc:creator>everhack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://everhack.blog.atxhackerspace.org/?p=295</guid>
		<description><![CDATA[Back in the late 50's and early 60's, my dad started building and playing Appalachian (mountain) dulcimers. Being the teacher and playful maker he is, he soon wrote a pamphlet on the subject that he shared with his students and anyone who wrote to ask about it. Here's a copy of his 1962 (second edition) [...]]]></description>
				<content:encoded><![CDATA[<p>Back in the late 50's and early 60's, my dad started building and playing Appalachian (mountain) dulcimers. Being the teacher and playful maker he is, he soon wrote a pamphlet on the subject that he shared with his students and anyone who wrote to ask about it. </p>
<p>Here's a copy of his 1962 (second edition) pamphlet, "The Mountain Dulcimer, how to make and play it (after a fashion)", which he has generously given me permission to post here for public consumption.</p>
<p>This pamphlet is the basis for the 1965 Folk Legacy book &amp; album of the same title, but there are many differences between the two.</p>
<p><strong><a href='http://dl.dropbox.com/u/16333218/TheMountainDulcimer_1962_pamphlet.pdf'>The Mountain Dulcimer, 2nd ed.</a></strong></p>
<p>I had a nice long chat with Caroline Paton (of Folk Legacy Records) and she has generously given permission for me to publicly share a PDF of the Folk Legacy book, "The Mountain Dulcimer - How to Make it and Play it (after a fashion).". This is a significantly revised and lengthened version of the pamphlet, with a wonderful companion recording.</p>
<p><img alt="" src="http://dl.dropbox.com/u/16333218/FolkLegacy-MountainDulcimer-Book/cover.jpg" class="alignnone" width="542" height="741" /></p>
<p><strong><a href="http://dl.dropbox.com/u/16333218/FolkLegacy-MountainDulcimer-Book/TheMountainDulcimer-HowieMitchell-part1.pdf" title="The Mountain Dulcimer - Part 1">The Mountain Dulcimer - Part 1</a></p>
<p><a href="http://dl.dropbox.com/u/16333218/FolkLegacy-MountainDulcimer-Book/TheMountainDulcimer-HowieMitchell-part2.pdf" title="The Mountain Dulcimer - Part 2">The Mountain Dulcimer - Part 2</a></strong></p>
<p>The CD is still available from Folk Legacy's website at:<br />
<a href="http://www.folk-legacy.com/store/scripts/prodView.asp?idproduct=58">http://www.folk-legacy.com/store/scripts/prodView.asp?idproduct=58</a></p>
<p>The books, CDs, and original LPs are also pretty easy to find on eBay and Amazon.</p>
<p>The pamphlet focuses on the 3-string dulcimer and has quite a few more specific measurements than the book. The book mostly covers the 4-string dulcimer, but discusses a number of variations. </p>
<p>Enjoy and share with the blessings of Howie, Ann, Caroline and myself. I just love the way he encourages experimentation and presents the topics in such a clear and light-hearted fashion, it should appeal to most anyone with a creative streak, even if you never plan to actually make, or play, your own dulcimer.</p>
<p>I recommend both!</p>
<p>And yes, I finally decided to try building one for myself. Here's what mine looks like so far <img src='http://everhack.blog.atxhackerspace.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/04/dulcparts.jpg"><img src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/04/dulcparts-261x300.jpg" alt="" width="261" height="300" class="alignnone size-medium wp-image-308" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://everhack.blog.atxhackerspace.org/2012/04/17/the-mountain-dulcimer-how-to-make-it-and-play-it-after-a-fashion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RFID Reader wrapup</title>
		<link>http://everhack.blog.atxhackerspace.org/2012/03/09/rfid-reader-wrapup/</link>
		<comments>http://everhack.blog.atxhackerspace.org/2012/03/09/rfid-reader-wrapup/#comments</comments>
		<pubDate>Fri, 09 Mar 2012 18:13:52 +0000</pubDate>
		<dc:creator>everhack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://everhack.blog.atxhackerspace.org/?p=285</guid>
		<description><![CDATA[I realized I never posted any images of my RFID reader in action, so here's a few of how it looks today in action. This first view is of my workbench with scope, logic analyzer, reader &#38; tag, and a few of my homemade tags. Here's a closeup of the reader itself. The USB cable [...]]]></description>
				<content:encoded><![CDATA[<p>I realized I never posted any images of my RFID reader in action, so here's a few of how it looks today in action.</p>
<p>This first view is of my workbench with scope, logic analyzer, reader &amp; tag, and a few of my homemade tags.</p>
<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/03/benchview.jpg"><img src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/03/benchview-300x225.jpg" alt="" width="300" height="225" class="alignnone size-medium wp-image-286" /></a></p>
<p>Here's a closeup of the reader itself. The USB cable and antenna are the only connections required. The LED flashes every time the code recognizes the "triple-0" tag header sequence.</p>
<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/03/reader_working.jpg"><img src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/03/reader_working-300x237.jpg" alt="" width="300" height="237" class="alignnone size-medium wp-image-287" /></a></p>
<p>I have my 4 scope probes hooked up to the following signals from bottom to top.</p>
<p>First is a closeup view of just a couple of bits from the signal, showing the bits modulated with the 125khz carrier.</p>
<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/03/scope_in.jpg"><img src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/03/scope_in-300x225.jpg" alt="" width="300" height="225" class="alignnone size-medium wp-image-288" /></a></p>
<p>4) This is the antenna input signal after passing through the detector diode, low-pass filter, and decoupling capacitor.</p>
<p>3) The noisy line near the top of the antenna signal is the threshold voltage, which is adjusted manually to a couple hundred mV via a simple potentiometer / voltage divider. These two signals are fed into the AVR's built-in analog comparator to produce interrupts whenever the antenna signal rises above the threshold.</p>
<p>1) This the raw manchester-encoded signal from the tag as output by the detector code. It's composed of sequences of 5 possible signals, "short low", "double low", "triple low (this is the start-flag)", "short high", and "double high". You can see the how the trace echoes the signal in the antenna, delayed by 1/2 the length of a "short", which is how long the timer takes to detect the end of a high or low.</p>
<p>2) The topmost trace is what I use for triggering the scope, it's always low except when the tag header (000) is detected.</p>
<p>The next view is zoomed out a bit, showing the trigger pulse on channel 2, and the first 8 or 9 bits of the signal on channel 1.</p>
<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/03/scope_out.jpg"><img src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/03/scope_out-300x225.jpg" alt="" width="300" height="225" class="alignnone size-medium wp-image-289" /></a></p>
<p>Here's the two logic signals as seen via the Saleae Logic, and underneath are the (slightly obscured) decoded tag values output to the serial port.</p>
<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/03/rfid_logicanalyzer_serialoutput1.png"><img src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/03/rfid_logicanalyzer_serialoutput1-300x168.png" alt="" width="300" height="168" class="alignnone size-medium wp-image-291" /></a></p>
<p>Here's the schematic:</p>
<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/03/reader_sch.jpg"><img src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/03/reader_sch-300x297.jpg" alt="" width="300" height="297" class="alignnone size-medium wp-image-292" /></a></p>
<p>And, last but not least, <a href="http://atxhackerspace.org/wiki/HID_reader.pde" title="the code itself">the code itself</a> (This is Arduino code for Teensy 2.0)</p>
]]></content:encoded>
			<wfw:commentRss>http://everhack.blog.atxhackerspace.org/2012/03/09/rfid-reader-wrapup/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>smd pcb rfid on the Cricut (semi-fail)</title>
		<link>http://everhack.blog.atxhackerspace.org/2012/02/26/smd-pcb-rfid-fail/</link>
		<comments>http://everhack.blog.atxhackerspace.org/2012/02/26/smd-pcb-rfid-fail/#comments</comments>
		<pubDate>Sun, 26 Feb 2012 06:25:07 +0000</pubDate>
		<dc:creator>everhack</dc:creator>
				<category><![CDATA[Cricut]]></category>
		<category><![CDATA[Eagle]]></category>
		<category><![CDATA[Inkscape]]></category>
		<category><![CDATA[MTC]]></category>

		<guid isPermaLink="false">http://everhack.blog.atxhackerspace.org/?p=275</guid>
		<description><![CDATA[Using the "industrial" sharpies, fine and ultrafine point, I made two attempts at an AVR RFID card with integrated PCB antenna, with mixed results. I designed all but the antenna in Eagle and exported to EPS, then imported into Make-the-Cut. The spiral antenna I created using Inkscape spiral tool, then cut-and-paste into Make-the-cut, and just [...]]]></description>
				<content:encoded><![CDATA[<p>Using the "industrial" sharpies, fine and ultrafine point, I made two attempts at an AVR RFID card with integrated PCB antenna, with mixed results. </p>
<p>I designed all but the antenna in Eagle and exported to EPS, then imported into Make-the-Cut. The spiral antenna I created using Inkscape spiral tool, then cut-and-paste into Make-the-cut, and just rotate and move so the traces connect.</p>
<p>I draw a rectangular bounding box around the circuit and put into a separate layer, which I print first onto a piece of paper taped on the cutting mat. This shows me exactly where to place the blank circuit board.</p>
<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/02/mtc-rfid-antenna.jpg"><img src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/02/mtc-rfid-antenna.jpg" alt="" width="644" height="721" class="alignnone size-full wp-image-277" /></a></p>
<p>Next I tape the circuit board to the paper using masking tape at the very edges only. I snipped off one of the grey friction rollers so it doesn't roll back and forth over the design and ruin it while the ink is still wet.</p>
<p>I remove the Expression keyboard to make room for the pen, and wrap a long thin strip of duct tape around the pen close to the tip to make it big enough for the tool holder to grip. I "cut" (draw) from Make-the-Cut at Extreme speed, low pressure, and etch in the usual way.</p>
<p>The experiment was very successful in that I was able to get pretty reliable traces in two sizes, roughly 0.5 and 0.8 mm, plenty for a sporting shot at surface mount stuff. </p>
<p>Unfortunately, while a magnet-wire coil produces upwards of 10v peak-to-peak, I can't seem to get better than 850mV or so across the pcb coil leads, regardless of my choice of tuning capacitor, so for now running the Tiny85 is still out of the question. </p>
<p>The two antennas have about 25 and 45 turns respectively, but so far I've been totally unable to get them tuned to produce enough voltage to run the AVR. </p>
<p>I've been probing the tag coil across the capacitor leads while the tag is being stimulated at 125khz with my homemade reader.</p>
<p>The second antenna is pushing the resolution limits in the spiral because the "jaggies" from the machine reduce clearance between lines. I had to do a little cleanup work with a razor blade, separating adjacent lines that had shorted in a very few places. </p>
<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/02/spiralcoils.jpg"><img src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/02/spiralcoils-300x202.jpg" alt="" width="300" height="202" class="alignnone size-medium wp-image-276" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://everhack.blog.atxhackerspace.org/2012/02/26/smd-pcb-rfid-fail/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Cricut Repair Info</title>
		<link>http://everhack.blog.atxhackerspace.org/2012/02/08/cricut-repair-info/</link>
		<comments>http://everhack.blog.atxhackerspace.org/2012/02/08/cricut-repair-info/#comments</comments>
		<pubDate>Wed, 08 Feb 2012 21:09:06 +0000</pubDate>
		<dc:creator>everhack</dc:creator>
				<category><![CDATA[Cricut]]></category>

		<guid isPermaLink="false">http://everhack.blog.atxhackerspace.org/?p=252</guid>
		<description><![CDATA[Cricut Repair Info One way to get yourself a cheap Cricut machine is to buy a busted one off eBay. Try searching for both "broken cricut" and "defective cricut". Often you can win one for as low as $0.99 plus shipping for a Personal or Create model, or somewhat more for an Expression. Where to [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/02/0323012355.jpg"><img class="alignnone size-full wp-image-263" alt="" src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/02/0323012355.jpg" width="640" height="480" /></a></p>
<p><strong>Cricut Repair Info</strong></p>
<p>One way to get yourself a cheap Cricut machine is to buy a busted one off eBay. Try searching for both "broken cricut" and "defective cricut". Often you can win one for as low as $0.99 plus shipping for a Personal or Create model, or somewhat more for an Expression.</p>
<p><strong>Where to get one</strong></p>
<p>The main dealer of these machines, "<a href="http://stores.ebay.com/websbestdeals">websbestdeals</a>," must have some exclusive arrangement with PC, because they seem to have a pretty inexhaustible supply of broken machines to sell.</p>
<p>Have patience and don't get carried away with your bid, it seems there will always be more listed within a few days.</p>
<p>Read the seller's description carefully to see what is included. Usually (but not always), they only include the power supply, but sometimes it comes with everything, cutting mat, blade holder, power adapter, cartridge, overlay and even the manual and warranty card. Once in a while they'll sell two for one, but missing one or both power adapters.</p>
<p>Sometimes the seller's description will tell you exactly the issue, as in the case with a dragging blade. I'm not quite sure yet what it means when "the blade makes a lot of noise", but the broken limit-switch wires definitely cause a horrible noise on startup. Many times they simply say "it has no power," which so far often (but not always) indicates a power supply or broken trace problem.</p>
<p><strong>Mine didn't come with a cartridge!</strong></p>
<p>If you don't have a real cartridge, you can make yourself a "Fake George" to at least get a machine with the stock firmware to start up fully. <a href="http://kansasa.blogspot.com/2010/01/make-your-own-cricut-george-cartridge.html">More details here</a>. Basically, you just need to (carefully!) make something that will short together pins 4, 6, and 10 (or 11, 15, and 17) on the cartridge port, to fool the machine into using its own built-in "George and Basic Shapes" cartridge.</p>
<p><a href="http://www.built-to-spec.com/cricutwiki/index.php?title=Cricut_Carts">Here are some close-up photos</a> of what a real "George" looks like inside.</p>
<p><strong>Removing the Side Covers</strong></p>
<p>Don't rush to take the sides off the machine. Many times this won't be necessary, and it's hard to get the trim pieces off without doing at least cosmetic damage.</p>
<p>The way I do it is to use a thin bladed putty knife to get in between the trim and side cover (from the outside edge inwards), while pulling outwards with your other hand, to depress the little fingers that clip the trim piece on, one at a time. I've broken off quite a few of them with poor technique, but don't usually bother putting them back on anyways.</p>
<p>Once the trim piece is off you can get access to the 5 or 6 phillips-head screws holding the actual side cover on.</p>
<p><b>Accessing the Motherboard</b></p>
<p>Usually all the action happens in the bottom of the machine where the motherboard is located.</p>
<p>To access it, all you need is a long #1 phillips-head screwdriver. Roll the machine onto its back on a towel or something else soft, and remove the 8-or-so most obvious screws around the outside of the bottom cover. Then, tip the cover down and towards yourself like opening a panel. If you carefully tug a little on the wires leading up into the side covers you can get just enough slack to be able to rest it flat on the table while the machine is still on its back.</p>
<p><strong>Problems and Solutions</strong></p>
<p>Here are some of the things I have discovered so far while fixing a bunch of these machines:</p>
<p><em><strong>Schematic</strong></em></p>
<p>I don't have a schematic drawn up for these, but one of my Creates is an older model with only a 2-layer board. This makes the circuit far easier to figure out than the 3-layer boards that came later. The Expression board is nearly identical, so this should be of assistance for figuring out those issues as well.</p>
<p>Here are close-up photos of the full front and back side of the 2-layer Create board.<br />
<a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/02/create_front_full.jpg"><img src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/02/create_front_full-150x150.jpg" alt="create_front_full" width="150" height="150" class="alignnone size-thumbnail wp-image-327" /></a></p>
<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/02/create_back_full.jpg"><img src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/02/create_back_full-150x150.jpg" alt="create_back_full" width="150" height="150" class="alignnone size-thumbnail wp-image-328" /></a></p>
<p><b><em>Broken Dials</em></b></p>
<p>It seems the dials are pretty easy to break if the machine falls onto its front side. The size dial is expendable if you use Make-the-Cut or other cutting software on your PC, but if you cut with cartridges or the pressure dial is broken you may not have much choice but to try and find a replacement dial.</p>
<p><b><em>Bad Power Supply</em></b></p>
<p>An Expression I got with a bad power supply would constantly turn on and off, like a turn signal on a car. On, off, on, off. Replacing the power brick with a known-good one from another machine solved the problem.</p>
<p><b><em>Broken Inner-layer PCB traces</em></b></p>
<p>So far, two Create machines have been suffering from broken traces in the middle layer of the circuit board. Fixing these can be challenging since you can't see the inner layer to know where it was supposed to connect to.</p>
<p>Fortunately, I have a working older revision of both Personal and Create motherboards that are only 2-layers, and there were virtually no changes to the parts connections or positions when PC switched to the 3-layer boards. This means you can visually trace the connections on the older board, and verify those connections on the newer (broken 3-layer) one.</p>
<p>I will be adding specifics here to help with this process for anyone who doesn't have the benefit of a 2-layer board for reference.</p>
<p>1) One machine's power button would light up when you turned it on, but nothing else would happen. This was isolated to two broken inner-layer traces leading from the 5V regulator to two nearby parts.</p>
<p>Edit 4/28/2013:</p>
<p>At long last, I took a photo of the repairs for the "broken inner-layer traces" issue.</p>
<p>First photo shows the front of the board. The broken traces connect one of the inductor leads (circled) to the 5v voltage regulator and to the large capacitor below it.</p>
<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/02/create_mainboard_front.jpg"><img class="alignnone size-large wp-image-316" alt="Minolta DSC" src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/02/create_mainboard_front-1024x331.jpg" width="513" height="165" /></a></p>
<p>This next photo shows where the jumpers were placed. Your mileage may vary, but this got mine working.</p>
<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/02/create_repair_back.jpg"><img class="alignnone size-medium wp-image-317" alt="Minolta DSC" src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/02/create_repair_back-300x159.jpg" width="507" height="268" /></a></p>
<p>2) Another Create model would power up and boot fully, but the display would be either blank or show only a single line of pixels. Swapping out the display for another known-good one did not have any effect. This turned out to be a broken +5V power supply line to the OLED display connector. (pin 2, counting from the end with the red stripe). I repaired this one by adding a jumper over to the +5V power supply line on the keyboard connector an inch away.</p>
<p><b><em>Disconnected Cables</em></b></p>
<p>One expression, when you pushed the power button, would light up, but instead of booting would just beep three times and halt. This turned out to be simply a disconnected keyboard cable. The fix was simply to plug the cable back in to the motherboard.</p>
<p><b><em>Broken Limit Switch wires</em></b></p>
<p>Two different machines had this problem - they would start up okay, but when the carriage would slide all the way to right, it would crash at the end and make a horrible grinding noise. This indicates a problem with the button located in the right-side hidey-hole or the wires leading to it.</p>
<p>Upon removing the right-side cover, I discovered in one case that the pair of wires from the limit switch had been severed by the sharp edge of the metal motor bracket inside. Repairing the wires solved the problem. In another case, one of the wires had simply fallen off the switch, and I was able to just plug it back in.</p>
<p><b><em>Broken Solenoid wire</em></b></p>
<p>One Create would operate normally, except the cutting blade would not go up and down at all. Removing the carriage cover revealed the problem to be a broken solder joint at the top of the cutter solenoid. Space is pretty tight, but I was able to solder a short length of wire between the broken lead and the stub on the solenoid to fix this problem.</p>
<p><b><em>Blade Dragging</em></b></p>
<p>This problem seems to be one of the most common, and the easiest to fix as well. The machine seems to operate normally, except that the blade drags in some places, cutting where it shouldn't, and hangs up in some places, not cutting where it should. Normally, the blade holder should move smoothly up and down. You should be able to push it down with no friction detected, and when released, it should move smoothly and freely back upwards.</p>
<p>In some cases, the lower of the two leaf springs in the cutter solenoid mechanism can get bent, causing a slight misalignment, which creates friction that causes the observed "dragging" behavior.</p>
<p>The fix for this is about the simplest of all: remove 3 screws covering the cutter carriage, and simply pinch with your fingers the upper and lower leaf springs together at the right hinge point. (Where the red circles are in the photo below). This should straighten the bent lower leaf spring and free up the movement.</p>
<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/02/carriage.jpg"><img class="alignnone size-full wp-image-269" alt="" src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2012/02/carriage.jpg" width="640" height="480" /></a></p>
<p><b><em>Replacement Parts</em></b></p>
<p>The power brick is an 18v 2.5A switching power supply with a pretty standard cord end, so you could probably find something compatible, but you can get the real thing <a>from PC itself</a> for $9.99.</p>
<p>If you're looking for used parts, <a href="http://domoroboto.us">Here's one place</a> you could try, or <a href="http://www.diecutrepairs.com/">Here's another</a></p>
<p>I'm not 100% certain, but the <a href="http://www.uscutter.com/Refine-EcoCut-Carriage-ECOCARRIAGE">US Cutter Refine</a> carriage looks identical from the photo.</p>
<p><b><em>Unsolved Machines</em></b></p>
<p>I have several machines that I have not yet repaired.</p>
<p>One is a Personal model that will often fail to boot, and show only dark squares on the LCD screen. It was described this way to me before I got it, worked fine upon receipt, but then stopped working again soon after.</p>
<p>Another is an Expression that, when powered on, the power light comes on, but nothing else, and the 5V regulator starts to get very hot. Although replacing the regulator may be the solution, I want to be sure the problem wasn't caused by something else.</p>
<p>(two other Personals have not been checked out yet).</p>
]]></content:encoded>
			<wfw:commentRss>http://everhack.blog.atxhackerspace.org/2012/02/08/cricut-repair-info/feed/</wfw:commentRss>
		<slash:comments>161</slash:comments>
		</item>
		<item>
		<title>Fixed my Oscilloscope</title>
		<link>http://everhack.blog.atxhackerspace.org/2011/12/16/fixed-my-oscilloscope/</link>
		<comments>http://everhack.blog.atxhackerspace.org/2011/12/16/fixed-my-oscilloscope/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 17:16:52 +0000</pubDate>
		<dc:creator>everhack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://everhack.blog.atxhackerspace.org/?p=247</guid>
		<description><![CDATA[Several months ago I picked up a Tektronix TDS 640, 4-channel 500mhz oscilloscope at a hamfest for $50. It was failing several of the power-on self tests with some mysterious errors like "FAIL ++ Acquisition" and "FAIL ++ Attn/Acq interface". After my successes repairing Cricuts and resurrecting my first $20 analog scope with a bunch [...]]]></description>
				<content:encoded><![CDATA[<p>Several months ago I picked up a Tektronix TDS 640, 4-channel 500mhz oscilloscope at a hamfest for $50. </p>
<p>It was failing several of the power-on self tests with some mysterious errors like "FAIL ++ Acquisition" and "FAIL ++ Attn/Acq interface". After my successes repairing Cricuts and resurrecting my first $20 analog scope with a bunch of Deoxit spray I figured I'd get my money's worth of entertainment out of it.</p>
<p>Googling the subject quickly revealed this as the inevitable consequence of "Capacitor Plague." It seems the original SMD electrolytic capacitors all end up leaking corrosive gases and goo onto the circuit boards, which, if not cleaned up in time, eventually results in assorted broken vias and board traces. The visible result of all this is these failed self-tests.</p>
<p>The Tektronix Community <a href="http://www.tek.com/forum/viewforum.php?f=5" title="Oscilloscope Technical Support Forum">Oscilloscope Technical Support Forum</a>, fortunately, has accumulated quite a few threads over time with information and various troubleshooting &amp; repair tips for this issue. </p>
<p>So after a couple of months of building up my courage, buying a ESD-safe temp-controlled iron, antistatic work mat, and desoldering "hot tweezers", I was ready!</p>
<p>I started out by practicing desoldering and resoldering a bunch of similar SMD caps on a handful of old busted PC graphics cards from the pile on the hack shelf. </p>
<p>Removing all the old caps turned out to be pretty easy. As it turns out, and it's hard to believe this until you try it out, the best way to remove the old parts is actually to press down and gently wiggle the part right off. The copper leads work-harden and snap off without stressing the underlying solder pad one bit. After I learned about this method I practiced it a dozen times to prove to myself that it was actually the LEAST damaging way to get them off there. (The corroded old solder doesn't take heat well).</p>
<p>Fast forward to last week, I'd ordered in and received all the new capacitors and was ready to dig in.</p>
<p>After removing all 100 or so old caps on 3 circuit boards, the next thing was to use a combination of solder sucker, iron, and desoldering braid to remove all the old solder and remnants of broken leads, leaving the solder pads as clean as possible.</p>
<p>Once this is done, you super clean the entire board with a toothbrush and full strength Simple Green, rinse in the sink under super hot water. Bake in the oven at 125 degrees for an hour or two, followed by an Isopropanol rinse, and another overnight drying period in a warm place.</p>
<p>The resoldering process follows by putting some flux on all the solder pads, and melting a little pillow of solder on each one. Since the caps are polarized, you need to take care to orient the new one properly, but on this scope the process is super easy because nearly every single one is oriented in the same direction, and all but one pad is marked with a +.</p>
<p>Soldering the cap goes like this: use the iron to melt the solder pillow on one pad, and, just using your fingers, hold the cap in place. Touch the iron to the lead and stay long enough to make sure it bonds properly (too quick and you'll get a cold-solder joint). The cap will be attached on one side now, and slightly cocked due to the unmelted pillow under the other lead. To finish soldering, just press down lightly with one finger while heating up the lead. When the solder melts, you'll feel the part move downwards until it's fully seated on the board.</p>
<p>Now, just repeat this process 100 times <img src='http://everhack.blog.atxhackerspace.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  <img src='http://everhack.blog.atxhackerspace.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  It sounds like a really big job, but after the first few dozen it goes very quickly. The whole process excluding drying time only took a few hours.</p>
<p>At this point, I was eager to fire up the scope and see if those darn errors went away. Annnnnnd... no change! Arrgh! </p>
<p>Going back to the Tek Forum, I learned that the reason for this was almost certainly due to some combination of corroded vias, broken traces, or fried components.</p>
<p>The way to start finding these is to use the voltmeter and, with the machine running, carefully check the voltage across all the capacitors and make sure they are all about 5 or 15 volts. Similarly, check the voltages across the power &amp; ground leads to all the dozen or so opamp chips on the board to make sure they are also similarly valued.</p>
<p>In my case, I found one opamp chip with a bad ground, and one capacitor with only 1 volt across it instead of 5. Both problems ended up being due to a broken via, and were fixable by carefully determining exactly where the broken lead went to and soldering on a tiny little 30-gauge jumper wire to bridge the gap. (tracing the connections can be a little tricky with a multilayer board like this)...</p>
<p>After a couple rounds of probing and probing and installing the two jumper wires, I fired the scope back up... and YES, the self test passes completely now, and the formerly failing Signal Path Compensation routine also passes. </p>
<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2011/12/1216110832.jpg"><img src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2011/12/1216110832-1024x768.jpg" alt="" width="550" height="412" class="alignnone size-large wp-image-250" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://everhack.blog.atxhackerspace.org/2011/12/16/fixed-my-oscilloscope/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sniffer Nano 2.0</title>
		<link>http://everhack.blog.atxhackerspace.org/2011/12/14/sniffer-nano-2-0/</link>
		<comments>http://everhack.blog.atxhackerspace.org/2011/12/14/sniffer-nano-2-0/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 05:52:29 +0000</pubDate>
		<dc:creator>everhack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://everhack.blog.atxhackerspace.org/?p=245</guid>
		<description><![CDATA[Now that I understand how it all works, here's a much nicer looking version of my reader. It's the $20 Sniffer Nano 2.0 - a nice SMD AVR168 design on a daughterboard, powered by arduino sketch.. Glad I didn't discover this one earlier, it might have ruined all the fun http://iteadstudio.com/store/index.php?main_page=product_info&#38;cPath=16&#38;products_id=220 here's the code: http://code.google.com/p/rfidsniffernano/]]></description>
				<content:encoded><![CDATA[<p>Now that I understand how it all works, here's a much nicer looking version of my reader. It's the $20 Sniffer Nano 2.0 - a nice SMD AVR168 design on a daughterboard, powered by arduino sketch.. Glad I didn't discover this one earlier, it might have ruined all the fun <img src='http://everhack.blog.atxhackerspace.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2011/12/sniffer3.jpg"><img src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2011/12/sniffer3.jpg" alt="" width="800" height="601" class="alignnone size-full wp-image-248" /></a></p>
<p><a href="http://iteadstudio.com/store/index.php?main_page=product_info&amp;cPath=16&amp;products_id=220" title="Sniffer Nano 2.0 from Ideadstudio">http://iteadstudio.com/store/index.php?main_page=product_info&amp;cPath=16&amp;products_id=220</a></p>
<p>here's the code:<br />
<a href="http://code.google.com/p/rfidsniffernano/" title="http://code.google.com/p/rfidsniffernano/">http://code.google.com/p/rfidsniffernano/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://everhack.blog.atxhackerspace.org/2011/12/14/sniffer-nano-2-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AVR RFID Reader, part 6 &#8211; Successful Reads!</title>
		<link>http://everhack.blog.atxhackerspace.org/2011/12/05/avr-rfid-reader-part-6-successful-reads/</link>
		<comments>http://everhack.blog.atxhackerspace.org/2011/12/05/avr-rfid-reader-part-6-successful-reads/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 20:28:49 +0000</pubDate>
		<dc:creator>everhack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://everhack.blog.atxhackerspace.org/?p=242</guid>
		<description><![CDATA[Finally! Even after reading up on Manchester encoding from a number of sources, and reading Beth Scott's reader code &#38; comments, I still just couldn't quite understand how to do the decoding. My biggest problem with the reader code from part 5 was that I was only detecting the lengths of the LOW periods, but [...]]]></description>
				<content:encoded><![CDATA[<p>Finally!</p>
<p>Even after reading up on Manchester encoding from a number of sources, and reading Beth Scott's reader code &amp; comments, I still just couldn't quite understand how to do the decoding.</p>
<p>My biggest problem with the reader code from part 5 was that I was only detecting the lengths of the LOW periods, but not the HIGH periods, so I was only getting half the bits.</p>
<p>Secondly, after a hint from a RFID reader IC datasheet (http://www.125khz-rfid-reader.com/how-the-driver-works/how-the-driver-functions), I realized I also didn't have to muck about with detecting both rising and falling edges as various other literature indicated. </p>
<p>"Using a clever detection method the driver only needs to detect each rising edge to determine the preceeding bit states, reducing the interrupt burden on the main application. Also only detecting each rising edge removes issues of dealing with non perfect high and low widths within each cycle – being radio they are often not perfectly 50/50, but the overall bit frequency will be relatively accurate."</p>
<p>At this point, I was logging the timer value for each rising edge to the serial port so I can get a look at what exactly was being received. Just as a picture tells a thousand words this text file pointed me towards what to do next.</p>
<p>Here's a piece of the log where I've manually annotated the lows and highs to indicate short or long lows and highs. (0 is a short low, 00 is a long low, 000 is a "triple low," which occurs only in the tag header. 1s indicate the length of the highs similarly). </p>
<p>Basically, the lows are easy, they're always around 900-1000 'ticks' for a short, and around 1500-1600 for a long. A triple long low is around 2500. </p>
<p>The highs are a little trickier. Since the carrier is pulsed, we get a rising edge every time the carriers rises above the threshold value. These show up in the log as multiple entries around 150 ticks in duration. A "short high" gives about 4, a "long high" is about 8, and a "triple long high" (seen right after the leading 000) gives about 14 of them.</p>
<p>180:2585		000<br />
181:152<br />
182:153<br />
183:152<br />
184:153<br />
185:152<br />
186:153<br />
187:152<br />
188:153<br />
189:151<br />
190:154<br />
191:152<br />
192:153<br />
193:152<br />
194:153		111<br />
195:919		0<br />
196:153<br />
197:153<br />
198:153<br />
199:152		1<br />
200:1065		0<br />
201:152<br />
202:153<br />
203:152<br />
204:154		1<br />
...<br />
235:1671		00</p>
<p>One additional tricky part was figuring how to detect the end of a "high" period, since the event trigger only gives rising edges, meaning I don't know the High is done before I reach the end of the Low period immediately after. To solve this, I added an Overflow interrupt handler to my input capture timer, set to a length of 200. This ensures that the overflow interrupt will always fire as soon as "no more rising edges" are detected in a sequence. </p>
<p>A problem I'd been having all along at home had been viewing the received signal on my analog non-storage oscilloscope due to the inability to "pause" the display, or accurately trigger on the beginning of the tag signal. </p>
<p>However, this was solved once I was accurately able to detect the "3T low 3T high" tag header in my code. I enabled a second debug pin and toggle it on and off each time I detect that sequence. This now finally allows me to accurately view the received manchester bits on my scope.</p>
<p><a href="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2011/12/rfid_signal.jpg"><img src="http://everhack.blog.atxhackerspace.org/wp-content/uploads/2011/12/rfid_signal.jpg" alt="" width="948" height="423" class="alignnone size-full wp-image-243" /></a></p>
<p>I still didn't quite get the idea of reconstructing the data clock, but after finding this forum comment and having a long chat with Danny at the hackerspace, I finally had my decoding approach:</p>
<p>http://www.sonsivri.to/forum/index.php?topic=20972.0</p>
<p>Basically, two things you need to do are to:<br />
  A) accurately determine where the message begins. Looking at the data, I realized there was a repeating 3T low followed by a 3T high. Since Manchester encoding forbids any high or low longer than 2T, this was clearly our header signal. Thus, the first rising edge after our 3T high marks the beginning of the actual data stream.<br />
  B) decode the 0s and 1s into the original data bits. In my case, the expanded representation of the "shorts" as 1 digit, and "longs" as two digits effectively reconstructs our clock signal, and lets us decode the stream by simply interpreting every received "01" as a data "0", and every "10" as a data "1".</p>
<p>Finally once you have the actual data bits, you have to convert them back to the card values, which for HID means the first 20 bits contain the "Manufacturer Code" (always constant), then 8 bits of "site code", and finally 16 bits of 'card code' and a trailing parity bit.</p>
<p>This is where the code stands right now. I can read both my badges pretty reliably, but the threshold voltage is still manually adjusted which limits the read distance to a very narrow range.</p>
<p>Next steps, I want to:<br />
 - implement a dynamic threshold voltage via PWM,<br />
 - display the decoded digits via LCD, or at least flash a LED on successful read.<br />
 - start spoofing the digits<br />
 - design a PCB and begin to package this thing</p>
]]></content:encoded>
			<wfw:commentRss>http://everhack.blog.atxhackerspace.org/2011/12/05/avr-rfid-reader-part-6-successful-reads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RFID reader, part 5 &#8211; 1&#8242;s and 0&#8242;s, but what do they mean?</title>
		<link>http://everhack.blog.atxhackerspace.org/2011/10/21/rfid-reader-part-5-1s-and-0s-but-what-do-they-mean/</link>
		<comments>http://everhack.blog.atxhackerspace.org/2011/10/21/rfid-reader-part-5-1s-and-0s-but-what-do-they-mean/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 16:11:45 +0000</pubDate>
		<dc:creator>everhack</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://everhack.blog.atxhackerspace.org/?p=229</guid>
		<description><![CDATA[100000001000000001000110001100111011 &#160; 0000000000000000 &#160; 100011 001100111011000000 1000000000100 11000110011101100000001000000000100011000110011101100000001000000000 100011000110011101100000001000000000100011000110011101100000001000000000100011000110011101100000001000000000 10001100 01100111 01100000 00100000 00001000 11000110 01110110 00000010 00000000 10001100 01100111 01100000 00100000 0000 100011000110011101100000001000000000100011000110011101100000001000000000100011000110011101100000001000000000 100011000110011101100000001000000000100011000110011101100000001000000000100011000110011101100000001000000000 100011000110011101100000001000000000100011000110011101100000001000000000100011000110011101100000001000000000 100011000110011101100000001000000000100011000110011101100000001000000000100011000110011101100000001000000000 100011000110011101100000001000000000100011000110011101100000001000000000100011000110011101100000001000000000 100011000110011 0110000000100000000 1000110001 00111011000000 1000000000100011000110011101100000001000000001 00011000110011 0110000000100000000 1000110011 00111011000000 10000000001 0011000110011 0110000000100000000 100011000100111 011000000010000000001000110011 0011101100000001000000000100011000110011101100000001000000000 100011000100111 01100000001000000000100011000110011101100000001000000000100011000110011101100000001000000000 &#160; &#160; 1000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000100011001110110000000100000000010001100011001110110000000100000000100110001100111011000000100000000010001100011001111100000001000000001000110001101110110000001000000000100010001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001 This is what my reader is writing [...]]]></description>
				<content:encoded><![CDATA[<p>100000001000000001000110001100111011</p>
<p>&nbsp;</p>
<p>0000000000000000</p>
<p>&nbsp;</p>
<p>100011 001100111011000000 1000000000100 11000110011101100000001000000000100011000110011101100000001000000000</p>
<p>100011000110011101100000001000000000100011000110011101100000001000000000100011000110011101100000001000000000</p>
<p>10001100 01100111 01100000 00100000 00001000 11000110 01110110 00000010 00000000 10001100 01100111 01100000 00100000 0000</p>
<p>100011000110011101100000001000000000100011000110011101100000001000000000100011000110011101100000001000000000</p>
<p>100011000110011101100000001000000000100011000110011101100000001000000000100011000110011101100000001000000000</p>
<p>100011000110011101100000001000000000100011000110011101100000001000000000100011000110011101100000001000000000</p>
<p>100011000110011101100000001000000000100011000110011101100000001000000000100011000110011101100000001000000000</p>
<p>100011000110011101100000001000000000100011000110011101100000001000000000100011000110011101100000001000000000</p>
<p>100011000110011 0110000000100000000 1000110001 00111011000000 1000000000100011000110011101100000001000000001</p>
<p>00011000110011 0110000000100000000 1000110011 00111011000000 10000000001 0011000110011 0110000000100000000</p>
<p>100011000100111 011000000010000000001000110011 0011101100000001000000000100011000110011101100000001000000000</p>
<p>100011000100111 01100000001000000000100011000110011101100000001000000000100011000110011101100000001000000000</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>1000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000100011001110110000000100000000010001100011001110110000000100000000100110001100111011000000100000000010001100011001111100000001000000001000110001101110110000001000000000100010001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001000110001100111011000000010000000001</p>
<p>This is what my reader is writing to the serial port now.</p>
<p>As before, the analog comparator is connected between the analog threshold voltage and the antenna signal.</p>
<p>The input capture interrupt function now toggles the LED and debug pins, and writes a 0 or 1 to the serial port, if the time between the last falling and rising edge from the analog comparator output occurred in one of two ranges of time. i.e, 250-1100 ticks right now for a "short", and 1101-3499 ticks for a "long". </p>
<p>Based on my previous reading I think I have to actually be timing how long since the last rising edge* - the catch is that the "high part" of the signal is actually constantly toggling at 250khz (every rising and falling analog comparator edge), so I have to be able to ignore the very short-duration low periods to properly time the "high part". Maybe if I just check the low period duration and don't reset the timer if it's too short, effectively filtering out the higher frequency component of the signal. </p>
<p>I've had a great time trying to view the signal on my analog scope. I connected one probe to the raw, rectified, a/c coupled antenna signal,  and the other probe to the debug pin on the Teensy.</p>
<p>Using the coarse and fine timebase controls on the scope, triggering on the debug pin, I can zoom out far enough to see the entire signal from the card. Since the signal is constantly repeating, I can get a static and unique "image" of each card's bitstream.</p>
<p>Playing with the potentiometer on the threshold voltage, I discovered that the ideal threshold voltage is directly related to how far away the card is. The further the card, the lower the threshold voltage.</p>
<p>The "depth of field" of the "best" threshold value is surprisingly low as well. Holding the card at a constant distance from the reader, I turn the knob back and forth, watching as the bits in the "bit picture" on the scope eerily flicker in and out of view, locked horizontally, but flickering more and less depending on the error rate.</p>
<p>Sorry, I thought I took a cellphone picture of it but I must have not   hit "save" before closing the phone. I hate when I do that.</p>
<p>The best, most rock-solid signal is obtained (not surprisingly) when the card is laying right on the wood of the reader coil. At the best threshold setting, it reads the card only up to about a half inch from the wood.</p>
<p>However, by re-tuning the threshold voltage for various card-to-reader distances, I can manage to successfully lock onto the signal from up to maybe 4 inches away.</p>
<p>Clearly, a dynamic threshold voltage tuner seems like a worthwhile upgrade for maximum read-range flexibility.</p>
<p>Something else interesting that I noticed, the cards are nearly "one-sided." That is, when I flip the card over, I can only barely see the signal, probably not well enough to actually read it. My work badge is a different type of HID card and doesn't seem to have that behavior. I'll have to see if the reader on the hackerspace door does the same thing.</p>
<p>Back to the bits. I was really eager to see what my serial bitstream looked like, if it was repeating, the length, and so on.</p>
<p>Opening the log file in my text editor, I played with trying to line up sections of the text to find a repeating pattern, and its length.</p>
<p>Sure enough, I discovered one on each of my two hackerspace cards! But, oddly enough, the number of bits doesn't seem to match up with the expected number.</p>
<p>I've realized that I don't really know what encoding is being used.</p>
<p>From <a href="http://scanlime.org/2010/06/avrfid-1-1-firmware/">Scanlime's blog</a>, I read that "... Cesar Fernandez described the HID card format ... The 45-bit code"... ; but in my text file, the two visually identical cards appear to give slightly different-length repeating bitstreams. (36 &amp; 38 bits) </p>
<p><code>00000000 10001100011010000100100000001<br />
00000000010001100011010000100100000001<br />
00000000 10001100011010000100100000001<br />
00000000010001100011010000100100000001<br />
00000000 1000110001101000 100100000001<br />
00000000 10001100011010000100100000001<br />
0000000001000110001101000 100100000001<br />
00000000 10001100011010000100100000001<br />
0000000001000110001101000 100100000001<br />
0000000001000110001101000 100100000001<br />
00000000010001100011010000100100000001<br />
00000000 1000110001101000 100100000001<br />
00000000010001100011010000100100000001</code></p>
<p>Lining up the repeating rows, and adding spaces where there were missing bits, I realized that the errors nearly all occur in the same places in the signal, and so I must have a slight misalignment in my time window lengths between 0's and 1's. I'll probably have to increase the timer1 prescaler from /8 to /1 to increase the resolution my cycle counter, and create a bigger difference in values between "short" vs "long". </p>
<p>If the card is using around 4 "low antenna cycles" to mean short, and around 8 to mean long, I had expected that a /8 timer would give me plenty of resolution (1 timer tick per 8 16mhz clock cycles, 16 per 125khz antenna cycle, 64 timer ticks per "4 low antenna cycle" 0, and 128 ticks per 1.</p>
<p>However, in practice, my window sizes are currently set at 4 and 10 times larger than this, based on just experimentation and observation of the output. I think what this means is that the encoding is not quite what I'm picking up, and I'm actually reliably missing 9 or 10 bits of the true signal.</p>
<p>Here's my latest code.</p>
<p><code><br />
#include &#060;avr/interrupt.h&#062;<br />
#include &#060;avr/io.h&#062;</p>
<p>#define CARRIERPOS_PIN 10<br />
#define CARRIERPOS_REG PORTC6<br />
#define CARRIERNEG_PIN 9<br />
#define CARRIERPOS_REG PORTC7</p>
<p>#define LED_PIN 11<br />
#define LED_PORT PORTD<br />
#define LED_REG PORTD6</p>
<p>// AIN0 = PB6 = detect<br />
// ADC0 = PF0 = threshold</p>
<p>#define DEBUG_PORT PORTB<br />
#define DEBUG_REG PORTB3</p>
<p>#define LED_ON() (LED_PORT |= _BV(LED_REG))<br />
#define LED_OFF() (LED_PORT &amp;= ~_BV(LED_REG))<br />
#define TOGGLE_LED() (LED_PORT ^= _BV(LED_REG))</p>
<p>#define DEBUG_ON() (DEBUG_PORT |= _BV(DEBUG_REG))<br />
#define DEBUG_OFF() (DEBUG_PORT &amp;= ~_BV(DEBUG_REG))<br />
#define TOGGLE_DEBUG() (PORTB ^= _BV(DEBUG_REG))</p>
<p>void initTimer4()<br />
{<br />
  // pwm with dead time generator<br />
  TCCR4A = _BV(PWM4A) | _BV(COM4A0);<br />
  // no prescaler (CK/1)<br />
  TCCR4B =  _BV(CS40);<br />
  // phase &amp; frequency correct pwm<br />
  TCCR4D = _BV(WGM40);<br />
  TCCR4E = _BV(ENHC4);</p>
<p>  //duty cycle for oscillator toggle<br />
  OCR4A = 64;<br />
  // 125k would be no prescaler, period = 128<br />
  OCR4C = 64;<br />
}</p>
<p>void initTimer1()<br />
{</p>
<p>  TCCR1A = 0; // ctc mode 4<br />
  TCCR1B |= _BV(WGM12);  // CTC mode 4<br />
  //TCCR1B &amp;= ~_BV(ICNC1) | ~_BV(ICES1);  // edge detect falling, disable noise canceler<br />
  TCCR1B &amp;= ~_BV(ICES1);<br />
  TCCR1B |= _BV(ICNC1);</p>
<p>  OCR1A = 255;                         // TOP // 64 is about 8 cycles<br />
  TCNT1 = 0;</p>
<p>  TCCR1B  = _BV(CS11);                // PS = 1<br />
}</p>
<p>void initAnalogComparator()<br />
{</p>
<p>// AIN0 = PE6 = detect<br />
// ADC0 = PF0 = threshold</p>
<p>// input capture timer1<br />
  //ACSR = _BV(ACIC);</p>
<p>  // disable adc<br />
  ADCSRA &amp;= ~_BV(ADEN);<br />
  // enable analog comparator mux<br />
  ADCSRB |= _BV(ACME);<br />
    // clear analog comparator interrupt flag<br />
  ACSR |= _BV(ACI); </p>
<p>  ACSR &amp;= ~_BV(ACIS1) &amp; ~_BV(ACIS0) &amp; ~_BV(ACBG);<br />
  // enable analog comparator input capture on output toggle, AIN0 connected to AC+<br />
  ACSR |= _BV(ACIC);</p>
<p>  TIMSK1 |= _BV(ICIE1);</p>
<p>  // ADC0 connected to AC- input<br />
  ADMUX &amp;= ~_BV(MUX2) &amp; ~_BV(MUX1) &amp; ~_BV(MUX0);</p>
<p>  // disable digital input buffer<br />
  DIDR1 |= _BV(AIN0D);</p>
<p>  // input ddr regs, enable pull-up resistors<br />
  DDRE &amp;= ~_BV(DDE6);<br />
  PINE &amp;= ~_BV(PORTE6);<br />
  DDRF &amp;= ~_BV(DDF0);<br />
  PINF &amp;= ~_BV(PORTF0);<br />
}</p>
<p>ISR(TIMER1_CAPT_vect)<br />
{<br />
  uint16_t timer1val = ICR1;</p>
<p>  if (bit_is_set(ACSR, ACO))<br />
  {<br />
    // change edge to descending<br />
    TCCR1B &amp;= ~_BV(ICES1);<br />
  }<br />
  else<br />
  {<br />
    // long for 1, short for 0<br />
    if (timer1val &gt; 1100 &amp;&amp; timer1val  250)<br />
    {<br />
      LED_ON();<br />
      DEBUG_ON();<br />
      LED_OFF();<br />
      DEBUG_OFF();<br />
      Serial.print("0");<br />
    }<br />
    else<br />
    {<br />
      LED_OFF();<br />
      DEBUG_OFF();<br />
    }<br />
    // if the signal was below threshold for longer than 8 125khz cycles, it's a 1<br />
    // change edge to rising<br />
    TCCR1B |= _BV(ICES1);<br />
  }</p>
<p>  // the pulse timer<br />
  TCNT1 = 0;<br />
  // clear the interrupt flag after changing edge<br />
  TIFR1 |= _BV(ICF1);</p>
<p>}</p>
<p>void setup()<br />
{<br />
  cli();</p>
<p>  initTimer4();<br />
  initTimer1();<br />
  initAnalogComparator();  </p>
<p>  // debug pin out / toggle on analog comparator isr &amp; timer0<br />
  DDRB |= _BV(PORTB3) | _BV(PORTB7);<br />
  PINB |= _BV(PINB7) | _BV(PINB7);</p>
<p>    // 125khz carrier oscillator pins 8&amp;9, OC4A/~OC4A<br />
  pinMode(CARRIERPOS_PIN, OUTPUT);<br />
  pinMode(CARRIERNEG_PIN, OUTPUT);<br />
  // led<br />
  pinMode(LED_PIN, OUTPUT);<br />
  sei();</p>
<p>  Serial.begin(57600);<br />
}</p>
<p>void loop()<br />
{<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://everhack.blog.atxhackerspace.org/2011/10/21/rfid-reader-part-5-1s-and-0s-but-what-do-they-mean/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
