<?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>FettesPS &#187; ftdi</title>
	<atom:link href="http://www.fettesps.com/tag/ftdi/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fettesps.com</link>
	<description>Fettes Programming Solutions</description>
	<lastBuildDate>Sun, 22 Jan 2012 18:21:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Hello World on the Arduino</title>
		<link>http://www.fettesps.com/hello-world-on-the-arduino/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=hello-world-on-the-arduino</link>
		<comments>http://www.fettesps.com/hello-world-on-the-arduino/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 19:36:06 +0000</pubDate>
		<dc:creator>FettesPS</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[ATmega]]></category>
		<category><![CDATA[ftdi]]></category>
		<category><![CDATA[Hello World]]></category>
		<category><![CDATA[Serial]]></category>

		<guid isPermaLink="false">http://www.fettesps.com/?p=556</guid>
		<description><![CDATA[Love it or hate it, every programmer typically wets their feet by writing a &#8220;hello world&#8221; program in their new programming environment. Since unlike with the type of code I&#8217;m used to writing the Arduino board doesn&#8217;t come with a CRT or LCD screen to output this text, we have to find a more creative [...]]]></description>
			<content:encoded><![CDATA[<p>Love it or hate it, every programmer typically wets their feet by writing a &#8220;hello world&#8221; program in their new programming environment.  Since unlike with the type of code I&#8217;m used to writing the Arduino board doesn&#8217;t come with a CRT or LCD screen to output this text, we have to find a more creative way to do this.  There are many options, such as LEDs, peizo buzzers, small LCD pannels and speakers that could be used to output a message.  The Hello World sketchbook found in the examples outputs the text &#8220;Hello World&#8221; to the serial port monitor, we will be building upon this example and using an LED to output this same message. The Duemilanove comes with an LED build into the board and is attached to PIN 13.  This is very convenient as the experimentation kit did not come with even a single LED to play with.  I did, however, order a couple different types of LEDs with my order as I knew I wanted them to play around with.  For this example we will use the onboard LED as it requires no wiring and gives you a good way to get comfortable with uploading your program to the board and the basic structure of the code.</p>
<p>Start off by loading the Arduino development environment and on the main menu select File-&gt;Examples-&gt;Stubs-&gt;HelloWorld.  The following project will be loaded into your sketchbook:</p>
<pre class="brush: cpp; title: ; notranslate">void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println(&quot;Hello World!&quot;);
}
</pre>
<p>This is the basic structure of all Ardino programs.  These two functions are the heart of every program you will write, so it doesn&#8217;t hurt to take a moment and discuss them.  Both functions must be declared outside of the scope of all other functions.  They are declared as void so they are not expected to return any value and they do not require any parameters.  The setup funciton is called once when your board first powers up, and is used to initialize any devices or pins that are going to be used in your program.  After the setup function executes the loop function begins to run, and it will continue to run endlessly until you power off your board.  When first beginning to work with microcontrollers it takes a bit of time to wrap your head around the way the execute code, in an infinite loop, as this is somewhat different from the way any programs would run on your desktop or server computer.</p>
<p>In the setup function you will see that the board is configured for serial communications with the command <em>Serial.begin(9600);</em>.  It is set to communicate at 9600 baud and it is important to note that even though we are using an emulated serial port over USB that pins 0 (Rx) and 1 (Tx) are wired to the FTDI USB-to-TTL Serial chip so they will be unavailable whenever you are performing serial communication over USB.</p>
<p>In the loop function <em>Serial.println(&#8220;Hello World!&#8221;);</em> is used to echo Hello World back to the computer over the serial connection.  In order to see this message you will have to hit the Serial Monitor button on your toolbar.  The serial monitor provides us with one of our only ways to debug our code, by echoing debug information back to our computer.  And of course the serial communication ports on the Arduino can be used for more advanced purposes.</p>
<p>So how can we make this example a little more interesting?  How about programming the onboard LED to flash Hello World in morse code?  If you have a pack of LEDs and transistors you could also set up an array of LEDs to spell it out in binary.  Since the Experiementation Kit did not include these, I will stick with using the LED connected to pin 13.  The first step was to find a reference for morse code, a quick trip to <a href="http://en.wikipedia.org/wiki/Morse_code">Wikipedia</a> gave me everything I needed. After that you will need a quick intro to working with LEDs, the best way to do that is to select File-&gt;Examples-&gt;Digital-&gt;Blink from the menu and take a look at the code there.</p>
<pre class="brush: cpp; title: ; notranslate">/*
Blink

Turns on an LED on for one second, then off for one second,
repeatedly.

The circuit:
* LED connected from digital pin 13 to ground.

* Note: On most Arduino boards, there is already an LED on the
board connected to pin 13, so you don't need any extra components
for this example.

Created 1 June 2005
By David Cuartielles

http://arduino.cc/en/Tutorial/Blink

based on an orginal by H. Barragan for the Wiring i/o board
*/

int ledPin =  13;    // LED connected to digital pin 13

void setup()  {
  // initialize the digital pin as an output:
  pinMode(ledPin, OUTPUT);
}

// the loop() method runs over and over again,
// as long as the Arduino has power
void loop() {
  digitalWrite(ledPin, HIGH);   // set the LED on
  delay(1000);                  // wait for a second
  digitalWrite(ledPin, LOW);    // set the LED off
  delay(1000);                  // wait for a second
}</pre>
<p>The command <em>pinMode</em> in the setup function is used to tell the micro that pin 13 is going to be used for output.  In your main loop you are simply telling it to turn on (HIGH) and off (LOW) by passing the pin number and mode to the <em>digitalWrite</em> command.  You could also use the <em>analogWrite</em> command but since pin 13 does not support PWM you would only be able to set it to on or off, rather than adjust the brightness.  Pins 3, 5, 6, 9, 10, and 11 on the Duemilanove support PWM and if you need to create a pulsing effect with your LEDs you will have to to hook up an LED and 1K Ohm resistor to one of those pins.  At this point, stick with pin 13, and hit the upload button again and watch what happens.  From there I would suggest tweaking the delays to create different blinking patterns if you feel you need to get a bit more comfortable with LEDs before moving on.</p>
<p>When you&#8217;re ready, we&#8217;ll begin splicing these two examples together and creating our morse code flasher.  If you have an extra LED sitting around feel free to plug the long leg into pin 13 and the short leg into the ground (GND) beside it.  Since pin 13 has a resistor built in we to not need to do anything more than that.  At the top of your project declare some new variables.  We&#8217;re going to do this before any of the core functions as they need to be accissible by all of them.</p>
<pre class="brush: cpp; title: ; notranslate">int delayDot = 200;
int delayDash = 500;
int delayLetter = 250;
int delayWord = 500;</pre>
<p>These variables store the delay time in milliseconds for the two different &#8220;characters&#8221; and the spacing between them.  These can be tweaked to your liking, I personally don&#8217;t know Morse Code so I&#8217;m not sure how acturate the timings are.</p>
<p>Next you will be adding some code to the setup() and loop() functions.  </p>
<pre class="brush: cpp; title: ; notranslate">void setup() {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  print_morse_code(&quot;h&quot;);
  print_morse_code(&quot;e&quot;);
  print_morse_code(&quot;l&quot;);
  print_morse_code(&quot;l&quot;);
  print_morse_code(&quot;o&quot;);
  print_space(1);
  print_morse_code(&quot;w&quot;);
  print_morse_code(&quot;o&quot;);
  print_morse_code(&quot;r&quot;);
  print_morse_code(&quot;l&quot;);
  print_morse_code(&quot;d&quot;);
  delay(1000);
}</pre>
<p>The setup() function tells the board it will be outputting over the FTDI bus and prepares Pin 13 for output.  The loop calls a function called print_morse_code() which is a very basic character map for the differenet pulses, it simply masses the character passed in with its list of options and outputs the proper sequence for each. At the end of the main loop is a 1 second delay before it starts over from the beginning.</p>
<p>Before we look at the print_morse_code() function lets look at the functions that create the characters.</p>
<pre class="brush: cpp; title: ; notranslate">
void print_dot() {
  digitalWrite(ledPin, HIGH);   // set the LED on
  delay(delayDot);                  // wait for a second
}

void print_dash() {
  digitalWrite(ledPin, HIGH);   // set the LED on
  delay(delayDot);                  // wait for a second
}

// Turn off LED
// 0 = Letter
// 1 = Word
void print_space(byte len) {
  digitalWrite(ledPin, LOW); // set LED off
  if(len) {
      delay(delayWord);
  } else {
      delay(delayLetter);
  }
}</pre>
<p>They&#8217;re quite simple functions.  The LED is set to HIGH and the module waits 250ms for a dot and 500ms for a dash before it moves on to the next digit.  The next function, print_space(), is a bit more intricate.  It requires a parameter to be passed in to determine which delay is going to be used after turning the LED off.  We want a 200ms space between each letter and a 500ms space between each word.</p>
<p>The last function we need is print_more_code() which ties it all together.  It&#8217;s not pretty, but it works.</p>
<pre class="brush: cpp; title: ; notranslate">// Convert letters to to morse code via LED and Serial echos
void print_morse_code(char* letter) {
  // Hello
  // ****  *  *-**  *-**  ---

  // World
  // *--  ---  *-*  *-**  -**

  if(letter==&quot;h&quot;) {
      Serial.println(&quot;****&quot;);
      print_dot();
      print_dot();
      print_dot();
      print_dot(); 

  } else if (letter==&quot;e&quot;) {
      Serial.println(&quot;*&quot;);
      print_dot();

  } else if (letter==&quot;l&quot;) {
      Serial.println(&quot;*-**&quot;);
      print_dot();
      print_dash();
      print_dash();
      print_dash();

  } else if (letter==&quot;o&quot;) {
      Serial.println(&quot;---&quot;);
      print_dash();
      print_dash();
      print_dash();

  } else if (letter==&quot;w&quot;) {
      Serial.println(&quot;*--&quot;);
      print_dot();
      print_dash();
      print_dash();

  } else if (letter==&quot;r&quot;) {
      Serial.println(&quot;*-*&quot;);
      print_dot();
      print_dash();
      print_dot();

  } else if (letter==&quot;d&quot;) {
      Serial.println(&quot;-**&quot;);
      print_dash();
      print_dot();
      print_dot();
  }

  print_space(0);
}</pre>
<p>A character is passed in and matched to a sequence of calls to print_dot() and print_dash() to create the desired letter.  At the end a letter space is added for padding making it easier to understand the transmission.  And just to help out with decrypting the message I output the currect character to the serial port so you can follow along on your computer.</p>
<p>The code for this entire project is available on <a href="http://code.google.com/p/arduino-morse-code-hello-world/">Google Code</a> for reference.  I encourage anyone to build off of it or optimize it.  Just keep in mind I&#8217;m not a C programmer <img src='http://www.fettesps.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.fettesps.com/hello-world-on-the-arduino/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arduino Experimentation Kit Review</title>
		<link>http://www.fettesps.com/arduino-experimentation-kit-review/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=arduino-experimentation-kit-review</link>
		<comments>http://www.fettesps.com/arduino-experimentation-kit-review/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 00:15:13 +0000</pubDate>
		<dc:creator>FettesPS</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[ATMega328]]></category>
		<category><![CDATA[Duemilanove]]></category>
		<category><![CDATA[ftdi]]></category>
		<category><![CDATA[microcontroller]]></category>

		<guid isPermaLink="false">http://www.fettesps.com/?p=535</guid>
		<description><![CDATA[I recently got my hands on the Arduino Experimentation Kit from RobotShop.ca and have been tinkering away all weekend. There are many Arduino starting kits available out there and it&#8217;s somewhat overwhelming for someone like myself with very little experience in the field of microcontrollers to decide which to order. In the end I chose [...]]]></description>
			<content:encoded><![CDATA[<p>I recently got my hands on the Arduino Experimentation Kit from <a href="http://www.robotshop.ca">RobotShop.ca</a> and have been tinkering away all weekend. There are many Arduino starting kits available out there and it&#8217;s somewhat overwhelming for someone like myself with very little experience in the field of microcontrollers to decide which to order.  In the end I chose to go with RobotShop&#8217;s kit because they were local to me (Canada) and when it came time to expand upon my kit they had every sensor and part I could ever imagine needing.</p>
<h3>Comparison</h3>
<p>They had two packages available, the <a href="http://www.robotshop.ca/arduino-experimentation-kit.html">Arduino Experiementation Kit</a> for $85 CDN and the <a href="http://www.robotshop.ca/robotshop-arduino-basic-kit.html">Arduino Basic Kit</a> for $55 CDN.  Both kits come with the Arduino Duemilanove board, a mini solderless breadboard, a USB cable for power and programming the micro and a jumper wire kit.  The basic kit also comes with a power supply, which for some reason the more expensive kit lacks.  The experimentation kit adds a servo, rotation sensor, infrared sensor and some break away headers.  Since I wanted to be able to actually make something with my micro and not need to pick up tons of extra parts from elsewhere I went with the experimentation kit.</p>
<h3>Analysis</h3>
<h4>Arduino Duemilanove USB Microcontroller Module</h4>
<p>Comes fully assembled and the ATMega328 is pre-loaded with the Arduino bootoader. I was immediately disappointed by the fact that my row of 6 analog connectors was soldered in crooked.  Rather than be at a 90 degree angle with the board it is sitting at about 75 degrees.  The solder joint is solid enough that I can&#8217;t just bend it back in to position, and I&#8217;m confident that in its current state I will not be able to snap on any shields unless I heat up the solder joint and reposition it.  The board is usuable, however I don&#8217;t feel it should have made it past quality control.</p>
<h4>Sharp GP2D12 IR Range Sensor</h4>
<p>Definitely a fun sensor to play with.  One of my first designs was a motion sensor that lights up an LED when you put your hand in front of the sensor.  From there I improved it by changing the brightness of the LED based on the distance from the sensor.  A quick Google search for this sensor and you will find the datasheet as well as plenty of code examples as it seems to be a very common choice.</p>
<h4>Phidgets Rotation Sensor</h4>
<p><img src="http://www.fettesps.com/wp-content/uploads/2009/08/arduino-experimentation-kit-B-150x150.jpg" alt="arduino-experimentation-kit-B" title="arduino-experimentation-kit-B" width="150" height="150" class="size-medium wp-image-563" style="float:right; padding: 0px 0px 10px 15px;" /></p>
<p>All my research on this device has told me to use it with the Phidgets Interface Kit.  So it was like they had a bunch of these lying around and just tossed them in to get rid of them. I did manage to find a Product Manual for it thankfully and was able to determine that it used the analog pins and returned a value between 0 and 1000 based on the position of the knob.</p>
<h4>Hitec HS-422 Servo Motor</h4>
<p>Haven&#8217;t played with this part much yet, sometime this week I will hook it up and the rotation sensor and see if I can get the two working together.  Other than that, it looks well made and its by a reputable manufacturor.</p>
<h4>Mini Self Adheasive Solderless Breadboard</h4>
<p>I&#8217;d be lost without this component.  I am the worst at soldering and I certainly don&#8217;t want to make any of my circuits permanent at this point.  The breadboard allows me to prototype out all my little ideas and make mistakes along the way. It does seem weird to be using it without the Proto Shield though, as it is forced to sit to the side rather than on top of the module.</p>
<h4>Pre-formed Jumper Wire Kit</h4>
<p>Wasn&#8217;t really sure what these were going to be until I got them.  Now that I know what they are I love them.  No need to measure, cut or strip wires &#8212; just find the right jumper and plug it in.  It&#8217;s really simple.</p>
<h4>Break Away Headers</h4>
<p>Haven&#8217;t found these to be very useful.  So far I&#8217;ve only broken off 3 and it was to use to connect the IR sensor to the breadboard. Problem is the plastic strip that divides the two ends isn&#8217;t centered.  So either I get a good connection on the breadboard or a good connection on the IR sensor, not both.  As a result I&#8217;ve knocked the sensor out many times while playing with it.</p>
<h3>Getting Set Up</h3>
<p>Since right now my main OS is Windows 7 I will be doing all of my development under it.  The development environment is written in Java so if you are more at home in OSX or Linux then you can just as easily do your development there.  The software package can be download directly from <a href="http://arduino.cc/en/Main/Software">Arduino.cc</a> where you can also look up code examples and anything else you need to get going.</p>
<p>The Arduino works be emulating a serial port over USB and uses the FTDI drivers which come packaged with the development software.  Unfortunately this bundled set of drivers is out dated and would not work with my computer.  I had to try several sets of drivers before I found ones that worked with Windows 7 x64.  The most up-to-date drivers can be obtained from <a href="http://www.ftdichip.com/Drivers/VCP.htm">FTDI&#8217;s website</a>. One thing to note is that when installing virtual com port drivers you will notice that after the first device is installed you will again be prompted to install another set of drivers.  One is the USB Serial Converter and the second is the USB Serial Port.  I personally didn&#8217;t like the port that was auto assigned to my Arduino so I went into device manager and disabled what was already on COM1 (which I was not using) and opened up the properties of the USB Serial Port, clicked the Port Settings tab, then Advanced.  Here I selected COM1 and hit ok, after accepting the warning that another device was using that port I was back to Device Manager. From there I right clicked Communications Port (COM1) and selected disable.  Even if you don&#8217;t want to change the port it is running under you would still be wise to go into Device Manager and find out for sure which port it is using as you will need to know this when it comes time to upload your program to your Arduino.</p>
<p>After installing both the FTDI drivers and the Arduino development environment all that&#8217;s left is a small amount of configuration.  Start up Arduino 0017 and select Tools -&gt; Board -&gt; Arduino Duemilanove or Nano w/ ATmega328.  Then again under the Toosl menu select Serial Port and the port you are using (in my case COM1).  Your software is now configured, at this point I would recommend reading some  of the examples found under the file menu.</p>
<h3>Conclusion</h3>
<p>Overall I&#8217;m happy with the kit, I&#8217;ve been itching to get my hands on a Arduino board for some time now and they had it in my hands just two days after ordering the kit online.  On top of that it came with two sensors and one device to output through (not including the onboard LED).  The devices it came with are certainly not the ones I would have picked if I was building a kit of my own they are definitely handy and I will have lots of fun finding a use for them.</p>
<p>I would have liked to have seen three things included in this kit, as they were strangely absent.  The first is the power supply.  It strikes me as very odd that it would be offered in the cheaper package but not the high end package.  The second is a pack of LEDs, they&#8217;re cheap enough that they should have thrown in at least two or three different colours to play with.  To go with those you would have needed a pack of resistors, they are also quite cheap and are essential for lighting LEDs without blowing them.  I picked up a pack of both at Radio Shack as I felt lost without them. There are other things, such as a proto shield, that I would have loved to have in my starter kit but those are a fair bit more expensive and would have certainly raised the price of the kit. My biggest gripe would definitely be the crooked row of analog Pins.  I was extremely disappointed to discover this.</p>
<p>The Arduino Experimentation Kit offers a beginner developer enough to get started, and it is packaged at a reasonable price. If you know specifically what you&#8217;d like to start building you&#8217;d be better off to build your own kit out of parts that are easily available on their website.  I will definitely be going back to RobotShop.ca for some more supplies as their prices are reasonable and they are conveniently quite close to me.  However if you live in the states, or you don&#8217;t have tons of random electrical components laying around your apartment waiting for you to build something out of them like I do, then you&#8217;d probably be wiser to order <a href="http://www.makershed.com/ProductDetails.asp?ProductCode=MSAPK2">The Advanced Arduino Starter Kit</a> from MakerShed which would come with almost everything you could possibly need in your early stages of Arduino proto-typing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fettesps.com/arduino-experimentation-kit-review/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

