<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[AI Matt]]></title>
  <link href="/archive/atom.xml" rel="self"/>
  <link href="/archive/"/>
  <updated>2013-01-24T13:00:25-05:00</updated>
  <id>http://aimatt.com/</id>
  <author>
    <name><![CDATA[Matt Williamson]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[Über l33t coffee coaster]]></title>
    <link href="/archive/2013/01/14/uber-l33t-coffee-coaster/"/>
    <updated>2013-01-14T19:03:00-05:00</updated>
    <id>http://aimatt.com/2013/01/14/uber-l33t-coffee-coaster</id>
    <content type="html"><![CDATA[<p>Got borked PCBs that didn&#8217;t quite work out? Great! Instead of just taking up space, just turn them into useful coasters to protect that <a href="http://www.parnian.com/desk.shtml">Parnian</a> desk of yours.</p>

<p>Take your PCB (that will fit your favorite mug).</p>

<p><img src="https://github.com/mattwilliamson/aimatt.com/raw/gh-pages/images/posts/coaster/overview.jpg" alt="overview" /></p>

<p>Stick some self adhesive pads on the bottom</p>

<p><img src="https://github.com/mattwilliamson/aimatt.com/raw/gh-pages/images/posts/coaster/pads.jpg" alt="pads" /></p>

<p>Easy enough.</p>

<p><img src="https://github.com/mattwilliamson/aimatt.com/raw/gh-pages/images/posts/coaster/mug.jpg" alt="mug" /></p>

<p>Go forth and sell them on <a href="http://etsy.com">Etsy</a> or <a href="http://tindie.com">Tindie</a>!</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[DIY RC Receiver (Serial PPM)]]></title>
    <link href="/archive/2012/08/02/diy-rc-receiver-serial-ppm/"/>
    <updated>2012-08-02T17:43:00-04:00</updated>
    <id>http://aimatt.com/2012/08/02/diy-rc-receiver-serial-ppm</id>
    <content type="html"><![CDATA[<p>When I was first getting into multirotors, I didn&#8217;t have an RC transmitter and receiver pair to control a quadcopter with. But I <em>did</em> have a couple <a href="https://www.sparkfun.com/products/8664">XBees</a> and a <a href="http://www.amazon.com/gp/product/B0000AW9RE/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&amp;camp=1789&amp;creative=9325&amp;creativeASIN=B0000AW9RE&amp;linkCode=as2&amp;tag=appdelinc-20">Saitek PC USB Joystick</a>. So, I made my own RC setup and I&#8217;ll show you how.</p>

<iframe width="640" height="390" src="http://www.youtube.com/embed/wR0TUg2AFl8 " frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>


<h1>History</h1>

<h2>Mark I: Initial Prototype</h2>

<p>My first version was very rudimentary. It was an XBee Series 1 and an Arduino nano on the quadcopter side and on the computer side was the joystick, an <a href="https://www.sparkfun.com/products/9716">FTDI Basic</a> and another XBee. The Ardunio nano was running a simple sketch which took serial commands in the form of 6 bytes in the range of 0-250 and a terminator byte, 254. The sketch interprets each of the first 6 bytes as a value to output on one pin, using the Arduino Servo library. To test it out, I plugged 6 servos into their respective pins and moved the joystick around and pushed buttons.</p>

<h2>Mark II: Out of range kill switch</h2>

<p>The biggest thing I was worried about was stepping on the gas and my quadcopter flying out of range and then off forever, to be found by highway workers, or worse &#8211; seeing on the news that &#8220;some mysterious device fell out of the sky and hit an unsuspecting person in the face&#8221;. So, I added some code to check if the receiver has gotten an update in the last two seconds, and if not, kill the throttle and disarm. It was originally written to auto-land, but I felt that it was too dangerous for both bystanders and the quad itself to have the motors (with <em>blades</em>!) spinning for ~20 seconds after control has been lost.</p>

<h2>Mark III: Sum PPM</h2>

<p>While chatting with some fellas and gals in the freenode #multiwii channel and I heard about &#8220;Sum PPM&#8221;, also known as &#8220;Serial PPM&#8221;. It&#8217;s a version of <a href="http://en.wikipedia.org/wiki/Pulse-position_modulation">Pulse Position Modulation</a>, the PWM protocol used to control a servo. The length of a pulse (how long the line is high) determines the servo&#8217;s position. The range is 1000 microseconds to 2000 microseconds. Which degrees the servo points to for each value is determined by whether it&#8217;s a 180° servo, or a 360° model.</p>

<p>Sum PPM squeeze all of the channels onto one wire instead of one wire for each channel. The first pulse will be for the first channel, the second pulse for the second channel and so on. It knows which channel is which, by having an extra long pulse of 5000 or more microseconds after all the channels have pulsed. The pulse following the long &#8220;sync&#8221; pulse is channel 0. So a full datagram for 4 channels may look something like this:</p>

<pre><code>__-- 1000µs --___-- 1200µs --___-- 2000µs --___-- 1500µs --___-- 5100µs --__
</code></pre>

<p>The other big difference in this revision is I bought an <a href="https://www.sparkfun.com/products/11113">Arduino pro mini</a> and soldered it directly to an <a href="https://www.sparkfun.com/products/9132">XBee breakout board</a>. This reduced the size by about 4x.</p>

<h2>Mark IV: Deadbug</h2>

<p>I thought this would be the final version. I have a bunch of DIP ATmega328 chips, so I decided to solder one up <a href="http://en.wikipedia.org/wiki/Point-to-point_construction">deadbug</a>-style. It worked great and was much smaller than an Arduino Nano, but looked like&#8230; well, a dead bug! It just kinda hung there inline with the wires and there wasn&#8217;t really a nice way to keep it attached to the frame besides a rubber band. I also globbed it with hot glue to strengthen the connections and prevent shorts.</p>

<p><img src="https://github.com/mattwilliamson/aimatt.com/raw/gh-pages/images/posts/ppm-receiver/deadbug.jpg" alt="Deadbug" /></p>

<h2>Mark V: Yes, this many revisions!</h2>

<p>The major difference here is that I decided to switch to using a <a href="https://www.sparkfun.com/products/10822">Roving Networks RN-XV Wifly Module</a>. It fits in an XBee footprint which means I don&#8217;t have to change my receiver at all and I don&#8217;t need the XBee or the FTDI adapter on the laptop. Wifi has similar range to a Series 1 XBee anyway.</p>

<p>Here&#8217;s what the current model looks like:</p>

<p><img src="https://github.com/mattwilliamson/aimatt.com/raw/gh-pages/images/posts/ppm-receiver/top.jpg" alt="Receiver Top" /></p>

<p><img src="https://github.com/mattwilliamson/aimatt.com/raw/gh-pages/images/posts/ppm-receiver/bottom.jpg" alt="Receiver Bottom" /></p>

<h1>Usage</h1>

<h2>Compatibility</h2>

<p>I have tested it and it works on both <a href="http://www.multiwii.com/">MultiWii</a> and <a href="http://aeroquad.com/">Aeroquad</a> when the configuration is set for Futubu. It looks like this in MultiWii:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='c'><span class='line'><span class="cp">#define SERIAL_SUM_PPM   ROLL,PITCH,THROTTLE,YAW,AUX1,AUX2,AUX3,AUX4 </span><span class="c1">//For Robe/Hitec/Futaba</span>
</span></code></pre></td></tr></table></div></figure>


<h2>How to make your own</h2>

<p>I am currently considering designing a board which will fit an XBee pin-compatible radio and have a built in microcontroller if there is enough interest. But if you want to make one yourself, you&#8217;ll need:</p>

<ul>
<li><a href="http://www.amazon.com/gp/product/B0000AW9RE/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&amp;camp=1789&amp;creative=9325&amp;creativeASIN=B0000AW9RE&amp;linkCode=as2&amp;tag=appdelinc-20">Saitek USB Joystick</a></li>
<li>A <a href="https://www.sparkfun.com/products/10822">Wifly Module</a></li>
<li>An <a href="https://www.sparkfun.com/products/11113">Arduino pro mini</a></li>
<li>An <a href="https://www.sparkfun.com/products/9132">XBee explorer</a></li>
<li>4 pins worth of <a href="https://www.sparkfun.com/products/116">male header strip</a></li>
<li>The Arduino sketch at from <a href="https://github.com/mattwilliamson/Arduino-RC-Receiver/blob/master/serial_ppm_rx_ino/serial_ppm_rx_ino.ino">my github repo</a></li>
<li><a href="https://www.sparkfun.com/products/8738">Servo wire</a>, male-end (I think I cut mine off a dead servo)</li>
<li>Soldering Iron/Solder</li>
<li>Hot glue gun</li>
</ul>


<p>The pins of the XBee explorer and the Arduino Pro Mini line up perfectly. With the Arduino Mini facing down, put the headers into the serial port (pins GND, VCC, RXI, TXO) and solder them in. I would put the short end of headers into the Arduino side. The pins will be sticking out of the bottom of the Arduino when you are done. This is a good time to upload the serial PPM sketch using an <a href="https://www.sparkfun.com/products/9716">FTDI Basic</a>.</p>

<p>Now, strip the ends of the male side of the servo cable. Then, with the Arduino Mini facing down, solder BLACK into GND on the Arduino, RED to VCC and WHITE to Arduino PIN 9. Make sure the wires are coming out of the bottom of the Arduino. This is so when we hot glue the boards together, the hot glue will hold the cable in place and reduce stress on the solder joints.</p>

<p>Flip the Arduino over. Slide the explorer on the headers, facing up. Make sure GND matches up with GND on both boards. Put some hot glue between the boards to help them stick together. Solder the explorer onto the headers. They are now permanently joined! You should have something like this:</p>

<p><img src="https://github.com/mattwilliamson/aimatt.com/raw/gh-pages/images/posts/ppm-receiver/side.jpg" alt="Receiver Bottom" /></p>

<h2>Use it!</h2>

<p>Set up your XBee or WiFly chip and insert it into the receiver. Get the code from <a href="https://github.com/mattwilliamson/Arduino-RC-Receiver/blob/master/joystick.py">joystick.py</a> and make sure the <a href="http://www.pygame.org/install.html">pygame</a> python module is installed.</p>

<p><img src="https://github.com/mattwilliamson/aimatt.com/raw/gh-pages/images/posts/ppm-receiver/pluggedin.jpg" alt="Plugged In" /></p>

<p>If you are using a WiFly, make sure you set it up to do Ad-Hoc WiFi network and then connect to it from your computer once it is plugged in. Make sure the following line is uncommented when using a WifFly:</p>

<pre><code>SERIAL_PORT = 'socket://169.254.1.1:2000'
</code></pre>

<p><img src="https://github.com/mattwilliamson/aimatt.com/raw/gh-pages/images/posts/ppm-receiver/wifi.png" alt="Wifi" /></p>

<p>Plug the receiver into your quadcopter. If you are running MultiWii, the signal (white wire) should be connected to <code>DIGITAL 2</code> on an ATmega328 Arduino or <code>DIGITAL 19</code> on a Mega.</p>

<p>Plug in your joystick and run <code>joystick.py</code>. It may take a minute to establish an IP address after connecting and you may see &#8220;no route to host&#8221;. Keep trying until it works. Once it does, you&#8217;ll see the values being sent to the receiver printed out every couple seconds to make sure it&#8217;s still alive. And you should be getting PPM output on your quad.</p>

<p><img src="https://github.com/mattwilliamson/aimatt.com/raw/gh-pages/images/posts/ppm-receiver/console.png" alt="joystick.py" /></p>

<p>The receiver status LED will blink until it begins receiving commands and then will be solid.</p>

<hr />

<p>Hve Fun! Here&#8217;s a few &#8220;flights&#8221; using one of the early versions:</p>

<iframe width="640" height="390" src="http://www.youtube.com/embed/_Q5dbNigOiQ " frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>


<p>Let me know in the comments if designing a custom board for purchase is something you are interested in.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Custom Quadcopter Control Board]]></title>
    <link href="/archive/2012/07/25/custom-quadcopter-control-board/"/>
    <updated>2012-07-25T18:39:00-04:00</updated>
    <id>http://aimatt.com/2012/07/25/custom-quadcopter-control-board</id>
    <content type="html"><![CDATA[<p>After seeing hobbyist-oriented batch PCB services, such as Sparkfun&#8217;s BatchPCB and Laen&#8217;s OSHPark, I decided instead of squeezing an Arduino Mega and a DFRobotics shield into a plastic food container, I would make my own, compact PCB and send it out to be manufactured. To my dismay, it all worked on the first try!</p>

<p><img src="https://github.com/mattwilliamson/aimatt.com/raw/gh-pages/images/posts/quadcopter/quad_pcb_unpopulated.jpg" alt="PCB Unpopulated" /></p>

<h2>Step 1: Establish requirements</h2>

<p>There are some measures to cut cost and complexity (and thus board size) that were taken due to the nature of a multirotor. First, we can get rid of the voltage regulator circuit, since we will be powering the board with a 5v <a href="http://en.wikipedia.org/wiki/Battery_eliminator_circuit">BEC</a> such as <a href="http://www.hobbyking.com/hobbyking/store/__4319__TURNIGY_3A_UBEC_w_Noise_Reduction.html">this one</a> or powered by an <a href="http://www.hobbyking.com/hobbyking/store/__61__182__ESC_UBEC_VR-All_Speed_Controllers.html">ESC</a> motor controller with a BEC built in. This allows us to remove a voltage regulator and two electrolytic capacitors.</p>

<p>I also left out the FTDI USB serial converter. Thie probably cuts $10 off the board and we can just use a <a href="https://www.sparkfun.com/products/9716">standard USB-TTL converter</a> for all the boards to program them.</p>

<h2>Step 2: Get it working on the breadboard</h2>

<p>I&#8217;ve done breadboard Ardunio projects a bunch of times, so I&#8217;m pretty familiar with the process. I recommend trying it out, if you haven&#8217;t already. Here&#8217;s a good link for instruction: <a href="http://arduino.cc/en/Main/Standalone">http://arduino.cc/en/Main/Standalone</a>. I chose to use the <a href="http://www.multiwii.com/">MultiWii</a> firmware for the quadcopter, which just needs 2 lines for I2C sensors, 1 line for Serial PPM from an RC receiver and 1 line for each rotor to control the motors.</p>

<p>Next, I needed to map out the pins.</p>

<p>For an ATmega328 microcontroller, which I chose to use for this project, the pins are as follows based on the diagrams from <a href="http://www.multiwii.com/connecting-elements">MultiWii</a>:</p>

<ul>
<li>Arduino Pin 3 -> Motor 1</li>
<li>Arduino Pin 10 -> Motor 2</li>
<li>Arduino Pin 9 -> Motor 3</li>
<li>Arduino Pin 11 -> Motor 4</li>
<li>Arduino Pin 2 -> Serial PPM Receiver</li>
<li>Arduino Analog Pin 4 -> Sensor I2C Bus SDA (data)</li>
<li>Arduino Analog Pin 5 -> Sensor I2C Bus SCL (clock)</li>
</ul>


<p>Then I needed to map these pins to the ATmega328&#8217;s pins, since Arduino&#8217;s pins don&#8217;t match the microcontroller&#8217;s. So I used the following image, snagged from the <a href="http://arduino.cc">Arduino.cc</a> site.</p>

<p><img src="https://github.com/mattwilliamson/aimatt.com/raw/gh-pages/images/posts/Atmega168PinMap2.png" alt="Arduino Pins" /></p>

<h2>Step 3: Pick out the parts</h2>

<p>I bought all the crystals, capacitors, resistors, LEDs, headers and buttons on eBay, in quantities of between 20 and 100 each. For small quantities, I use Sparkfun. For the ATmega328P-AU, the <a href="http://en.wikipedia.org/wiki/Surface-mount_technology">SMT</a> version of the microcontroller of the Arduino Uno, I went to <a href="http://uk.mouser.com/ProductDetail/Atmel/ATMEGA328P-AU/?qs=K8BHR703ZXjB9uTYboq2G8iArio/9fOg">Mouser</a> which gives discounts with higher quantities. Each board needs:</p>

<ul>
<li>2x <a href="https://www.sparkfun.com/products/8377">330 Ohm resistors</a> for LEDs</li>
<li>2x 2.2 kOhm resistors for I2C bus</li>
<li>1x <a href="https://www.sparkfun.com/products/97">momentary push button</a></li>
<li>1x 0.1&#8221; 2x5 shrouded header for ICSP</li>
<li>1x <a href="https://www.sparkfun.com/products/536">16mhz crystal oscillator</a></li>
<li>1x <a href="https://www.sparkfun.com/products/533">3mm red LED</a></li>
<li>1x <a href="https://www.sparkfun.com/products/9650">3mm green LED</a></li>
<li><a href="https://www.sparkfun.com/products/116">0.1&#8221; male headers</a></li>
<li><a href="https://www.sparkfun.com/products/115">0.1&#8221; female headers</a></li>
<li>2x 22pF ceramic capacitors</li>
<li>1x <a href="http://www.goodluckbuy.com/10dof-l3g4200dadxl345hmc5883lbmp085-nine-axis-imu-module.html">10DOF IMU sensor board</a></li>
</ul>


<p>I hooked it all up to a breadboard to test out with a through-hole version of the ATmega328 to make sure it was all working before doing the design.</p>

<h2>Step 4: Design the board</h2>

<p>Now that I&#8217;d figured out to get all the parts working together, it was time to figure out how do design a PCB. I read <a href="http://www.sparkfun.com/tutorials/108">Sparkfun&#8217;s EAGLE tutorial</a> a couple times to let it sink in. Then, I went and downloaded the <a href="http://www.cadsoftusa.com/">free version of EAGLE</a> and got started.</p>

<p>First, I laid out the schematic, which was made <strong>so much easier</strong> thanks to <a href="https://github.com/sparkfun/SparkFun-Eagle-Library">Sparkfun&#8217;s parts library</a>.</p>

<p><img src="https://github.com/mattwilliamson/aimatt.com/raw/gh-pages/images/posts/quadcopter/quad_pcb_schematic.png" alt="Schematic" /></p>

<p>Then I roughly laid out the board, following the tutorial and just used EAGLE&#8217;s autorouter to route the traces.</p>

<p><img src="https://github.com/mattwilliamson/aimatt.com/raw/gh-pages/images/posts/quadcopter/quad_pcb_layput.png" alt="Layout" /></p>

<h2>Step 5: Fabrication</h2>

<p>I was looking into various hobbyist PCB fabrication services and I was liking the DorkbotPDX service the most when I realized it had been just re-done and had become <a href="http://oshpark.com/">OSHPark.com</a>. Since then, I&#8217;ve basically been using that site as a Gerber file viewer to see how my design will look on a final board. When I finally got to a point where I liked the board, I submitted my board and paid the $30 to have it fabricated and shipped to me. It took about 3 or 4 weeks to get them, but it was like Christmas when I did!</p>

<p><img src="https://github.com/mattwilliamson/aimatt.com/raw/gh-pages/images/posts/quadcopter/pcb_order.png" alt="OSHPark" /></p>

<h2>Step 6: Soldering</h2>

<p>I&#8217;d never soldered SMT before, but Sparkfun <a href="http://www.sparkfun.com/tutorials/107">has a tutorial for that</a>, too. I laid down the ATmega328 on it&#8217;s pads and soldered one corner to tack it down. Then I laid globs of solder down on each side and used solder wick to pick up the excess. Since I didn&#8217;t have flux, it was very frustrating to do at first, but I finally got the hang of it. Looking under a magnifying glass, it looked like there were no solder bridges, so I crossed my fingers and hoped all the pads were making contact with the pins and moved on.</p>

<p>Next, I put in all the through-hole components in and soldered them. Nothing interesting there. Then I soldered the headers in, one at a time. They are tricky since they wiggle and end up crooked. Sparkfun&#8217;s parts library has some &#8220;lock&#8221; headers which have the holes jagged, for a tighter fit, and I wish I had used them.</p>

<h2>Step 7: Programming</h2>

<p>Time for the fun part. I bought an <a href="http://www.fischl.de/usbasp/">USBasp</a> from ebay to program AVR microcontrollers which is why I used the 2x5 shrouded headers for ICSP. I plugged it into the computer and the board and once again crossed my fingers. The power LED didn&#8217;t light up. Dang! I decided to try to burn the Arduino firmware on there anyway. I launched the Arduino IDE and hit the &#8220;Burn Bootloader&#8221; button and the status LED began flashing! Yay!</p>

<p>I wondered what was wrong with power LED, so I took another LED out of the bag and touched the leads to the pads, thinking I had inserted the LED backwards, and it lit up. I checked the orientation and the LED was in the right way, but was either defective or burned up from soldering too long. I sucked the solder out and put the new LED and everything was operational with the default Arduino blinky sketch.</p>

<p>It was time to put MultiWii on. I downloaded the Arduino MultiWii project and customized the config to match up with the hardware and used my Sparkfun FTDI Basic to program it. Since I did not implement auto-reset, I had to hold the reset button until the Arduino IDE says it is uploading to the board.</p>

<p>I then launched the MultiWiiConfig application on my computer and saw the orientation of the sensors were wrong, so I fiddled with them for about and hour, re-flashing every time I tested a change. Once the orientation was correct, I decided it was time for a test.</p>

<h2>Step 8: Installation</h2>

<p>I hot-glued some standoffs on the plastic container and screwed the board onto the standoffs. Plugged in the BEC for power, plugged in the motors (easy thanks to the silkscreen) and plugged in the serial PPM receiver. Easy as pie, compared to using an Arduino where you have to constantly check out the MultiWii site to figure out which pins were which.</p>

<p><img src="https://github.com/mattwilliamson/aimatt.com/raw/gh-pages/images/posts/quadcopter/pcb_installed.jpg" alt="PCB Installed" /></p>

<p>Then I plugged in the battery and, amazingly, I heard beeps from all 4 ESCs. Success!</p>

<p>I figured I had to make sure they were all working, so I armed to motors and all spun up. I took it out back and practiced my hover until my battery died.</p>

<p>This was my first PCB and my first quadcopter, though I have had the copter for a while now and I was able to get it working. If I could design a PCB and have it work on the first try, anyone can. Hobbyist electronics has really come a long way in the past few years.</p>

<p>Thank you to the open source community and a <em>huge</em> thank you goes out to <a href="http://sparkfun.com">Sparkfun</a> for sharing all of their secrets with the general public.</p>

<p>As a side note, I had a Hawaiian themed party last week and we have a left over fake parrot. I figured it could help me keep track of the orientation of my quadcopter instead of forgetting which way it&#8217;s facing. Here&#8217;s how it looks:</p>

<p><img src="https://github.com/mattwilliamson/aimatt.com/raw/gh-pages/images/posts/quadcopter/quadcopter_parrot.jpg" alt="PCB Installed" /></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[I can program a robotic car]]></title>
    <link href="/archive/2012/05/06/i-completed-udacity-cs373/"/>
    <updated>2012-05-06T15:25:00-04:00</updated>
    <id>http://aimatt.com/2012/05/06/i-completed-udacity-cs373</id>
    <content type="html"><![CDATA[<p>It&#8217;s official. I now know how to program a robotic car.</p>

<p><img src="https://github.com/mattwilliamson/aimatt.com/raw/gh-pages/images/posts/cs373_certificate.png" alt="Certificate" /></p>

<p>It was not easy by any means, but I aced Udacity&#8217;s seven-week class, <a href="http://www.udacity.com/view#Course/cs373/CourseRev/feb2012">CS373: Programming a Robotic Car</a>. I spent a few hours a week on homework and a few hours a week on classwork, with the seventh week being the final exam.</p>

<p>I had to brush up on some math concepts I started to forget, like matrix arithmetic and probabilities, but I was able to get through, thanks to the <a href="http://www.khanacademy.org/">Khan Academy</a>. Some of the topics I learned about were:</p>

<p><img class="right" src="https://github.com/mattwilliamson/aimatt.com/raw/gh-pages/images/posts/google_car.jpg" title="Google Self Driving Car" ></p>

<ul>
<li><a href="http://en.wikipedia.org/wiki/Monte_Carlo_localization">Markov localization</a></li>
<li><a href="http://en.wikipedia.org/wiki/Kalman_filter">Kalman Filters</a></li>
<li><a href="http://en.wikipedia.org/wiki/PID_controller">PID Controllers</a></li>
<li><a href="http://en.wikipedia.org/wiki/Simultaneous_localization_and_mapping">Simultaneous Localization and Mapping (SLAM)</a></li>
<li><a href="http://en.wikipedia.org/wiki/A_star">A* Pathfinding</a></li>
<li><a href="http://en.wikipedia.org/wiki/Dynamic_programming">Dynamic programming</a></li>
</ul>


<p>All in all, I learned a ton and I&#8217;m looking forward to trying out some of these concepts with quadcopters. I wish Udacity the best of luck and I&#8217;m looking forward to new and exciting classes from them and I hope they make Computer Vision one of them.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Arduino Burglar Alarm with SMS]]></title>
    <link href="/archive/2012/05/05/arduino-burglar-alarm-with-sms/"/>
    <updated>2012-05-05T11:17:00-04:00</updated>
    <id>http://aimatt.com/2012/05/05/arduino-burglar-alarm-with-sms</id>
    <content type="html"><![CDATA[<p><img class="right" src="https://github.com/mattwilliamson/arduino-sms-alarm/raw/master/action_shots/sms.png" title="SMS Burglar Alert" ></p>

<p>I made a simple Arduino project, using a motion sensor and the <a href="http://goo.gl/A36VN">TelAPI</a> web service
to send me an SMS when motion (cat/burglar/child) triggers the Arduino. You can view the source at <a href="http://goo.gl/iQMTh">https://github.com/mattwilliamson/arduino-sms-alarm</a></p>

<!--more-->


<h2>Arduino SMS Alarm</h2>

<p>An Arduino based burglar alarm that sends an SMS when motion is detected.
It will send an SMS to you every 30 minutes while motion is detected (configurable).</p>

<h2>Requirements</h2>

<ul>
<li>Python</li>
<li>Python library <em>pyserial</em> installed</li>
<li>Python library <em>requests</em> installed</li>
<li>A <a href="http://goo.gl/A36VN">TelAPI</a> account</li>
<li>An <a href="http://arduino.cc">Arduino</a></li>
<li>A <a href="http://www.parallax.com/tabid/768/ProductID/83/Default.aspx">Parallax PIR sensor</a></li>
<li>Some <a href="http://adafruit.com/products/266">female-female jumper wires</a></li>
<li>Some <a href="http://www.adafruit.com/products/400">break-away headers</a> (to convert female to male)</li>
</ul>


<p><img src="https://raw.github.com/mattwilliamson/arduino-sms-alarm/master/action_shots/pir_sensor.png" alt="PIR Sensor" /></p>

<h1>Set up</h1>

<h2>Wire it up!</h2>

<ol>
<li>Attach <strong>+</strong> on the PIR sensor to <strong>5v</strong> on the Arduino</li>
<li>Attach <strong>-</strong> on the PIR sensor to <strong>GND</strong> on the Arduino</li>
<li>Attach <strong>OUT</strong> on the PIR sensor to <strong>DIGITAL 2</strong> on the Arduino</li>
</ol>


<p><img src="https://raw.github.com/mattwilliamson/arduino-sms-alarm/master/action_shots/Schematic_bb.png" alt="Schematic" />
<img src="https://raw.github.com/mattwilliamson/arduino-sms-alarm/master/action_shots/wired_up.png" alt="Wired Up" /></p>

<h2>Upload the sketch</h2>

<ol>
<li>Plug your Arduino into your computer</li>
<li>Open the <code>arduino_pir/arduino_pit.ino</code> sketch with the <a href="http://arduino.cc/hu/Main/Software">Arduino IDE</a></li>
<li>Select your serial port (Tools>Serial Port) and click Upload</li>
</ol>


<p>Your arduino LED will now be blnking. This means the PIR sensor is calibrating.</p>

<h2>Setup the server</h2>

<ol>
<li>Open server.py with a text editor</li>
<li>Change the value of <code>SERIAL_PORT</code> to the serial port you set in the <a href="http://arduino.cc/hu/Main/Software">Arduino IDE</a>. For Windows it might look like <em>COM2</em>, for Posix systems, it might look like <em>/dev/tty.usbserial-AH00PP05</em></li>
<li>Change the value of <code>SMS_FROM</code> to the number in your <a href="http://www.telapi.com/numbers/">TelAPI account numbers</a> (You can set this to another number, such as your own phone and it will cost a little extra. This is what I do.)</li>
<li>Change the value <code>SMS_TO</code> to your cell phone</li>
<li>Change the value of <code>TELAPI_ACCOUNT_SID</code> to your <code>Account SID</code> as found at <a href="http://www.telapi.com/dashboard">your TelAPI dashboard</a></li>
<li>Change the value of <code>TELAPI_TOKEN</code> to your <code>Account Token</code> as found at <a href="http://www.telapi.com/dashboard">your TelAPI dashboard</a></li>
</ol>


<h2>Run it!</h2>

<ol>
<li>Open up your terminal and run <code>python server.py</code> (assuming the terminal is CD&#8217;d to the directory where server.py is)</li>
<li>The Arduino will blink it&#8217;s LED for 60 seconds. Get out of the sensor&#8217;s sight while it calibrates.</li>
</ol>


<p>Now, whevever motion is detected in the infra-red spectrum (think body heat), <code>server.py</code> will send you an SMS up to once every 30 minutes.</p>

<h2>Put it in a case (Optional)</h2>

<ol>
<li>Get some plastic case, like one from a hummus &amp; pretzel snack</li>
<li>Cut a hole in the top for the sensor to be exposed (like R2D2 in an X-Wing)</li>
<li>Cut a hole for the USB cable to stick out</li>
<li>Tape or screw the sensor to the top</li>
<li>Finit!</li>
</ol>


<p><img src="https://raw.github.com/mattwilliamson/arduino-sms-alarm/master/action_shots/case.png" alt="Cut a hole" />
<img src="https://raw.github.com/mattwilliamson/arduino-sms-alarm/master/action_shots/complete.png" alt="Cut a hole" /></p>

<h1>Video</h1>

<iframe width="640" height="390" src="http://www.youtube.com/embed/9AuOZ4iV9zY " frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>


<p><strong>BEEP BEEP WHISTLE</strong></p>

<p><img src="https://raw.github.com/mattwilliamson/arduino-sms-alarm/master/action_shots/xwingcar.jpg" alt="X-Wing Car" /></p>

<p><strong>YUM</strong> (Makes a nice case)</p>

<p><img src="https://raw.github.com/mattwilliamson/arduino-sms-alarm/master/action_shots/sabra.jpg" alt="Sabra Hummus Single Serve" /></p>

<p>Free $25 credit when you sign up for a <a href="http://goo.gl/A36VN">TelAPI</a> account!</p>

<hr />

<p><a href="http://goo.gl/iQMTh">https://github.com/mattwilliamson/arduino-sms-alarm</a></p>
]]></content>
  </entry>
  
</feed>
