<?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>Jochen Toppe&#039;s Blog &#187; Electronics</title>
	<atom:link href="http://jtoee.com/category/tinker/feed/" rel="self" type="application/rss+xml" />
	<link>http://jtoee.com</link>
	<description>Putting the &#62;O&#60; in technology</description>
	<lastBuildDate>Mon, 22 Feb 2010 21:48:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Launching Open Source Home Automation Site!</title>
		<link>http://jtoee.com/2010/01/launching-open-source-home-automation-site/</link>
		<comments>http://jtoee.com/2010/01/launching-open-source-home-automation-site/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 18:07:43 +0000</pubDate>
		<dc:creator>Jochen</dc:creator>
				<category><![CDATA[Electronics]]></category>

		<guid isPermaLink="false">http://jtoee.com/?p=759</guid>
		<description><![CDATA[Taking my home automation tinkering to the next level, I am launching  catrpillr.com as an open-source solution to home automation. The site contains circuits, software, firmware, and documentation. Be advised that you currently still need at least intermediate knowledge of electronics to put these pieces together. The current solution allows you to fairly easily [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jtoee.com/wp-content/uploads/2010/01/attiny.jpg"><img class="alignright size-full wp-image-761" title="attiny" src="http://jtoee.com/wp-content/uploads/2010/01/attiny.jpg" alt="" width="116" height="116" /></a>Taking my home automation tinkering to the next level, I am launching <a href="http://www.catrpillr.com"> catrpillr.com</a> as an open-source solution to home automation. The site contains circuits, software, firmware, and documentation. Be advised that you currently still need at least intermediate knowledge of electronics to put these pieces together. The current solution allows you to fairly easily link together devices through low-cost radio-frequency receivers and transmitters, a few sample circuits such as a generic binary sensor and a relay-based remote switch are included.</p>
<p>A lot of the Arduino and hardware-related posts as of late will start going over onto the new site, freeing this site back up for things relating to (enterprise) software development.</p>
<p style="text-align: right;"><a href="http://www.catrpillr.com">Read More ></a></p>
]]></content:encoded>
			<wfw:commentRss>http://jtoee.com/2010/01/launching-open-source-home-automation-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Connecting Multiple AVR/Arduinos via I2C/TWI</title>
		<link>http://jtoee.com/2009/12/connecting-multiple-avrarduinos-via-i2ctwi/</link>
		<comments>http://jtoee.com/2009/12/connecting-multiple-avrarduinos-via-i2ctwi/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 20:09:59 +0000</pubDate>
		<dc:creator>Jochen</dc:creator>
				<category><![CDATA[Electronics]]></category>

		<guid isPermaLink="false">http://jtoee.com/?p=748</guid>
		<description><![CDATA[Since my RF receivers require a full hardware-based UART to function reliably, I decided to opt for adding a simple attiny2313 as a controller connected to an Arduino. Ready to build a simple protocol, I decided to do a little more research into I2C &#8212; the inter-integrated-circuit protocol which puts multiple digital micro-controllers on a [...]]]></description>
			<content:encoded><![CDATA[<p>Since my RF receivers require a full hardware-based UART to function reliably, I decided to opt for adding a simple attiny2313 as a controller connected to an Arduino. Ready to build a simple protocol, I decided to do a little more research into <strong>I2C</strong> &#8212; the inter-integrated-circuit protocol which puts multiple digital micro-controllers on a low-speed bus. As it turns out, the attiny controllers actually implement the full protocol, even if Atmel calls it TWI (two-wire-interface). The protocol defines a master device as well as up to 127 slave devices (7-bit addressing).</p>
<p>The hardware is very easy to hook up and it simply requires two wires (TWI is not just a clever name) &#8211; one called SDA, to transmit the data, and one called SCL, to transmit a clock signal. On an Arduino Duemilanove SDA is analog pin 4 and SCL is analog pin 5. On the attiny2313 controller, SDA is pin B5 (pin 17, also MOSI), and SCL is on pin B7 (pin 19) &#8212; also refer to <a href="http://tinkerlog.com/2009/06/18/microcontroller-cheat-sheet/" target="_blank">Alex&#8217;s cheat sheet</a> for the pins. Just connect SDA to SDA and SCL to SCL.</p>
<p>Arduinos have the <strong><a href="http://www.arduino.cc/en/Reference/Wire" target="_blank">Wire</a> </strong>library built straight into them, and after some hunting I found a small library for atttiny adapted from the <a href="http://www.avrfreaks.net/index.php?module=Freaks%20Tools&amp;func=viewItem&amp;item_id=664" target="_blank">original Atmel code</a> by a Donald Blake (can be found on avrfreaks.net or <a href="http://code.google.com/p/tinkercode/source/browse/#svn/trunk/automation-framework/i2c" target="_blank">my subversion repository</a>). The Arduino is quickly configured as a master and set up to send and receive characters typed into the serial console to and from the slave controller:</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode"><span class="rem">// Arduino Code</span>
<span class="kwrd">void</span>
  setup()   {
  Serial.begin(57600);
  <span class="rem">// initialize as i2c master</span>
  Wire.begin();
  Serial.println(<span class="str">"OK&gt;"</span>);
}
<span class="rem">// loop forever..</span>
<span class="kwrd">void</span> loop()
{
  <span class="rem">// data available from computer?</span>
  <span class="kwrd">if</span> (Serial.available()) {
    <span class="rem">// read the incoming byte from the serial port</span>
    sByte = Serial.read();
    <span class="rem">// begin transmission to device 1    </span>
    Wire.beginTransmission(1);
    <span class="rem">// send</span>
    Wire.send(sByte);
    <span class="rem">// done</span>
    Wire.endTransmission();

    <span class="rem">// request data from device 1</span>
    Wire.requestFrom(1,1);
    <span class="rem">// echo out whatever we get back</span>
    <span class="kwrd">while</span>(Wire.available()) {
      Serial.print(Wire.receive());
      Serial.print(<span class="str">"-"</span>);
    }
  }
  delay(100);
}</pre>
<p>On the slave, simply link the Donald Blake&#8217;s library into the code and this then does all the magic:</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode"><span class="rem">// attiny2313 code</span>
<span class="kwrd">int</span> main(<span class="kwrd">void</span>)
{
  <span class="rem">// initialize as slave with id 1</span>
  usiTwiSlaveInit(1);

  <span class="rem">// enable interrupts (must be there, i2c needs them!)</span>
  sei();

  <span class="rem">// handle commands</span>
  <span class="kwrd">while</span> (1)
  {
    <span class="rem">// check if data is in the i2c receive buffer</span>
    <span class="kwrd">if</span>(usiTwiDataInReceiveBuffer())
    {
      <span class="rem">// get it</span>
      uint8_t b = usiTwiReceiveByte();
      <span class="rem">// echo it back</span>
      usiTwiTransmitByte(b);
    }
    <span class="rem">// Do something else while waiting for the TWI transceiver to complete.</span>

    asm <span class="kwrd">volatile</span> (<span class="str">"NOP"</span> ::);
  }
  <span class="kwrd">return</span> 0;
}</pre>
<p>Works like a charm!</p>
]]></content:encoded>
			<wfw:commentRss>http://jtoee.com/2009/12/connecting-multiple-avrarduinos-via-i2ctwi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Atmega/Arduino (Soft-) Serial Ports</title>
		<link>http://jtoee.com/2009/12/atmegaarduino-soft-serial-ports/</link>
		<comments>http://jtoee.com/2009/12/atmegaarduino-soft-serial-ports/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 14:02:11 +0000</pubDate>
		<dc:creator>Jochen</dc:creator>
				<category><![CDATA[Electronics]]></category>

		<guid isPermaLink="false">http://jtoee.com/?p=744</guid>
		<description><![CDATA[In the implementation of the &#8220;reverse&#8221; channel of my home automation system, the RF receiver will transmit radio data back to the master controller which in return sends it to the computer. Since the atmega168/328&#8217;s processors used in the standard Arduino only have one hardware-based serial port (UART), I tried for the software-based serial that [...]]]></description>
			<content:encoded><![CDATA[<p>In the implementation of the &#8220;reverse&#8221; channel of my <a href="http://jtoee.com/rf-automation-libary/">home automation system</a>, the <a href="http://www.sparkfun.com/commerce/product_info.php?products_id=8948" target="_blank">RF receiver</a> will transmit radio data back to the master controller which in return sends it to the computer. Since the atmega168/328&#8217;s processors used in the standard Arduino only have one hardware-based serial port (UART), I tried for the software-based serial that ships with the Arduino IDEs. Transmitting data out works like a charm (as seen previously), but receiving it is quite a challenge, mostly due to timing problems. The software serial port doesn&#8217;t work unless all the sketch does is gather data &#8212; there&#8217;s no time for processing or it will start losing data.</p>
<p>My next attempt was to use an interrupt-based version of the software serial port. I briefly thought about writing one, but then I found this great libary, the <a href="http://arduiniana.org/libraries/NewSoftSerial/" target="_blank">New SoftSerial</a>. It is as simple to use as the original library, but unfortunately once I connect the RF receiver, the processor is too busy handling interrupts and nothing really works. The noise picked up by the RF module must simply overwhelm it. That&#8217;s too bad, this works beautifully on my attiny2313-based receiver when using the hardware UART.</p>
<p>A software-based solution is clearly not the answer, some hardware is required. I can think of a few options</p>
<ol>
<li>Abandon the Arduino altogether and use an AVR controller with multiple UARTs &#8212; not ideal, I like the idea of basing the master on Arduino for the hackability factor</li>
<li>Use a logic gate and an external clock generator to sample/filter the signal exactly at the right timing required for 1200 bps (the maximum reliable speed I could get to work for the RF modules) &#8211; this could still lead to timing issues</li>
<li>Create an attiny2313-based &#8220;daughter-board&#8221; which handles all the nitty gritty of the RF communication using the hardware-UART and then communicates to the Arduino via a few of the regular digital ports (I&#8217;m thinking asynchronously via about 4 pins)</li>
</ol>
<p>Clearly this requires a little more thinking, but I&#8217;m leaning towards the third option &#8212; it encapsulates all the protocol logic on the attiny&#8217;s and the Arduino library that would need to be written to communicate with it would be very light-weight. And let&#8217;s not forget the attiny&#8217;s are only about two bucks.</p>
]]></content:encoded>
			<wfw:commentRss>http://jtoee.com/2009/12/atmegaarduino-soft-serial-ports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone Garage Door Opener</title>
		<link>http://jtoee.com/2009/12/iphone-garage-door-opener/</link>
		<comments>http://jtoee.com/2009/12/iphone-garage-door-opener/#comments</comments>
		<pubDate>Thu, 24 Dec 2009 14:42:38 +0000</pubDate>
		<dc:creator>Jochen</dc:creator>
				<category><![CDATA[Electronics]]></category>

		<guid isPermaLink="false">http://jtoee.com/?p=708</guid>
		<description><![CDATA[You keep forgetting your keys but would never let your precious iPhone out of sight? Then nothing should seem more obvious than the need to open your garage door with your iPhone. An Arduino and a few microcontrollers, relays, rf link transmitters and receivers and some firmware later, it&#8217;s now reality. Check out the prototype [...]]]></description>
			<content:encoded><![CDATA[<p>You keep forgetting your keys but would never let your precious iPhone out of sight? Then nothing should seem more obvious than the need to open your garage door with your iPhone. An Arduino and a few microcontrollers, relays, rf link transmitters and receivers and some firmware later, it&#8217;s now reality. Check out the prototype (and excuse the slightly shaky video, it was bitter cold outside):</p>
<p align="center">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=8355064&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="300" src="http://vimeo.com/moogaloop.swf?clip_id=8355064&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object>
</p>
<p>Read more about the <a href="http://www.catrpillr.com/">setup and software here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jtoee.com/2009/12/iphone-garage-door-opener/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Talking to an Arduino from Ruby/Rails</title>
		<link>http://jtoee.com/2009/12/talking-to-an-arduino-from-rubyrails/</link>
		<comments>http://jtoee.com/2009/12/talking-to-an-arduino-from-rubyrails/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 13:36:26 +0000</pubDate>
		<dc:creator>Jochen</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://jtoee.com/?p=671</guid>
		<description><![CDATA[As I&#8217;m in the process of building a full home-automation suite so I can finally open my garage door with my iPhone (stay tuned, more on that soon), I wanted to quickly post this since it actually wasn&#8217;t really easily found online and I spent a few minutes (ok, more like an hour) fiddling with [...]]]></description>
			<content:encoded><![CDATA[<p>As I&#8217;m in the process of building a full home-automation suite so I can finally open my garage door with my iPhone (stay tuned, more on that soon), I wanted to quickly post this since it actually wasn&#8217;t really easily found online and I spent a few minutes (ok, more like an hour) fiddling with this before I got it to work.</p>
<p>The code below takes data (you should pass in numeric 8-bit values, i.e. between 0&#215;0 and 0xFF) and then read them out on the Arduino as usual. As a general note, working in dynamically typed language like Ruby is a major pain in the a** when you&#8217;re trying to fiddle with every bit and work with an 8-bit microcontroller on the other side of the wire. On a positive note,  Ruby has bit manipulation capabilities and it&#8217;s just so easy to build webapps with it&#8230;</p>
<p>The gist of the code below: Put the data into an array, pack it as unsigned characters, and then pump it into the serial port. The code below requires the ruby-serial gem.</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre class="csharpcode"><span class="kwrd">class</span> SerialGateway

  def initialize()
    puts <span class="str">"Starting serial gateway"</span>
    begin
      # 9600, 8N1 on USB0
      @sp = SerialPort.<span class="kwrd">new</span> <span class="str">"/dev/ttyUSB0"</span>, 9600, 8, 1, SerialPort::NONE
      # release port on shutdown
      at_exit { do_at_exit() }
    rescue =&gt; e
      # sophisticated error handling
      puts <span class="str">"Cannot initialize usb device"</span>
    end
    # only one serial access per time
    @send_mutex = Mutex.<span class="kwrd">new</span>
  end

  #
  # Send a command to the master device.
  #
  def sendCommand(command, targetAddress, data=[])

    <span class="kwrd">if</span>(data.length &gt;4)
      raise <span class="str">"Sorry, maximum command data length is 4."</span>
    end    

    # first one ASCII R (remote, 0x52)
    cmd = [ 0x52, command, targetAddress, data.size()]
    # add data array
    data.each { |d| cmd &lt;&lt; d}
    # pack it into unsigned chars
    cmd = cmd.pack(<span class="str">"C*"</span>)

    @send_mutex.synchronize <span class="kwrd">do</span>
     cmd.each_byte { |c| @sp.putc c }
    end

  end

end</pre>
<p><br class="spacer_" /></p>
<p>Oh, and flipping back and forth between Ruby and C is a little weird :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://jtoee.com/2009/12/talking-to-an-arduino-from-rubyrails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Taking an Open-Source Approach to Hardware (WSJ)</title>
		<link>http://jtoee.com/2009/11/taking-an-open-source-approach-to-hardware-wsj/</link>
		<comments>http://jtoee.com/2009/11/taking-an-open-source-approach-to-hardware-wsj/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 13:25:18 +0000</pubDate>
		<dc:creator>Jochen</dc:creator>
				<category><![CDATA[Electronics]]></category>

		<guid isPermaLink="false">http://jtoee.com/?p=663</guid>
		<description><![CDATA[The Wall Street Journal has another article on open source hardware and Arduinos up today.
The palm-sized Arduino serves as an electronic brain running everything from high schoolers&#8217; robots to high-end art installations. But perhaps the oddest thing about the device is the business model behind it.

Read it here.

]]></description>
			<content:encoded><![CDATA[<p>The Wall Street Journal has another article on open source hardware and Arduinos up today.</p>
<blockquote><p>The palm-sized Arduino serves as an electronic brain running everything from high schoolers&#8217; robots to high-end art installations. But perhaps the oddest thing about the device is the business model behind it.</p>
</blockquote>
<p><a href="http://online.wsj.com/article/SB10001424052748703499404574559960271468066.html?mod=WSJ_hps_sections_tech" target="_blank">Read it here</a>.</p>
<p><br class="spacer_" /></p>
]]></content:encoded>
			<wfw:commentRss>http://jtoee.com/2009/11/taking-an-open-source-approach-to-hardware-wsj/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Arduino IDE on Ubuntu Karmic Koala 9.10</title>
		<link>http://jtoee.com/2009/11/installing-arduino-ide-on-ubuntu-karmic-koala-9-10/</link>
		<comments>http://jtoee.com/2009/11/installing-arduino-ide-on-ubuntu-karmic-koala-9-10/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 22:58:38 +0000</pubDate>
		<dc:creator>Jochen</dc:creator>
				<category><![CDATA[Electronics]]></category>

		<guid isPermaLink="false">http://jtoee.com/?p=658</guid>
		<description><![CDATA[Worth re-posting. The rxtx lib shipped with the 64bit Koala seems busted.  Thanks!
 http://chemicaloliver.net/programming/fixing-arduino-on-ubuntu-9-10-karmic-x64/
]]></description>
			<content:encoded><![CDATA[<p>Worth re-posting. The rxtx lib shipped with the 64bit Koala seems busted.  Thanks!<br />
<a href="http://chemicaloliver.net/programming/fixing-arduino-on-ubuntu-9-10-karmic-x64/" target="_blank"> http://chemicaloliver.net/programming/fixing-arduino-on-ubuntu-9-10-karmic-x64/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jtoee.com/2009/11/installing-arduino-ide-on-ubuntu-karmic-koala-9-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tinkering Makes Comeback Amid Crisis</title>
		<link>http://jtoee.com/2009/11/tinkering-makes-comeback-amid-crisis/</link>
		<comments>http://jtoee.com/2009/11/tinkering-makes-comeback-amid-crisis/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 14:45:05 +0000</pubDate>
		<dc:creator>Jochen</dc:creator>
				<category><![CDATA[Electronics]]></category>

		<guid isPermaLink="false">http://jtoee.com/?p=646</guid>
		<description><![CDATA[The Wall Street Journal has an article today about tinkering, real hardware, and Arduinos. It&#8217;s trying to link it to the financial crisis, more power to them. I started playing with light bulbs and batteries when I was 7 (or was it 8? ;-) and the Arduino is the microcontroller electronics kit I never got [...]]]></description>
			<content:encoded><![CDATA[<p>The Wall Street Journal has an article today about tinkering, real hardware, and Arduinos. It&#8217;s trying to link it to the financial crisis, more power to them. I started playing with light bulbs and batteries when I was 7 (or was it 8? ;-) and the Arduino is the microcontroller electronics kit I never got in the 80s (right <a href="http://de.wikipedia.org/wiki/Kosmos_CP1" target="_blank">here</a>, I feel old). Has nothing to do with the crisis :-)</p>
<p>See: <a href="http://online.wsj.com/article/SB125798004542744219.html" target="_blank">http://online.wsj.com/article/SB125798004542744219.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jtoee.com/2009/11/tinkering-makes-comeback-amid-crisis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remote Controlled Arduinos</title>
		<link>http://jtoee.com/2009/11/remote-controlled-arduinos/</link>
		<comments>http://jtoee.com/2009/11/remote-controlled-arduinos/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 01:00:13 +0000</pubDate>
		<dc:creator>Jochen</dc:creator>
				<category><![CDATA[Electronics]]></category>

		<guid isPermaLink="false">http://jtoee.com/?p=616</guid>
		<description><![CDATA[I got a pair of these extremely cheap RF Link receiver and transmitter pairs for under $5 each. They operate at 434 MHz and supposedly can transmit at up to 2400bps. I was hoping to be able to build some nifty firmware which allowed these things to flawlessly communicate bidirectionally (well, one at a time), [...]]]></description>
			<content:encoded><![CDATA[<p>I got a pair of these extremely cheap RF Link <a href="http://www.sparkfun.com/commerce/product_info.php?products_id=8949" target="_blank">receiver </a>and <a href="http://www.sparkfun.com/commerce/product_info.php?products_id=8946" target="_blank">transmitter </a>pairs for under $5 each. They operate at 434 MHz and supposedly can transmit at up to 2400bps. I was hoping to be able to build some nifty firmware which allowed these things to flawlessly communicate bidirectionally (well, one at a time), essentially making them into a cheap variant of the XBees. It turns out, these little devices are not quite as stable as I hoped they would be. But there&#8217;s still a lot of cool stuff that can be done with them.</p>
<p><strong>The Hardware</strong></p>
<table border="0">
<tbody>
<tr style="text-align: center;">
<td>
<p><img class="aligncenter size-full wp-image-617" title="08946-03-L_i_ma" src="http://jtoee.com/wp-content/uploads/2009/11/08946-03-L_i_ma.jpg" alt="08946-03-L_i_ma" width="188" height="188" /></p>
<p>434 MHz Transmitter</p>
</td>
<td>
<p><img class="aligncenter size-full wp-image-618" title="08949-03-L_i_ma" src="http://jtoee.com/wp-content/uploads/2009/11/08949-03-L_i_ma.jpg" alt="08949-03-L_i_ma" width="188" height="188" /></p>
<p>434 MHz Receiver</p>
</td>
</tr>
</tbody>
</table>
<p>They can easily be hooked up to the Arduino data pins. If you want to boost the transmitter&#8217;s power, hook the third pin (Vcc) to more than 5V. It can take up to 12V and the more juice you give it the more power it has to transmit, the less dropped data.</p>
<p><img class="aligncenter size-full wp-image-639" title="rf_links" src="http://jtoee.com/wp-content/uploads/2009/11/rf_links4.png" alt="rf_links" width="630" height="610" /></p>
<p><strong>The Software</strong></p>
<p>Here is where all the fun started. Hooking it up was easy, using the Arduino software serial library to establish the communication is also a no-brainer. Yet if the receiver finds no signal for 10ms, it automatically turns itself into an auto-sensing mode in which is cranks up the antenna gain and starts just outputting noise. This is not only annoying, but also very counterproductive when trying to get a clean transmission. Also keep in mind that these modules are really bare-bones. They send and receive data. There&#8217;s no automatic receipt acknowledgement, no automatic resending of packets, nothing. That&#8217;s especially hard considering that these devices only provide a one-way communication path.</p>
<p>The easiest way to go around this is to just have the transmitter continuously transmit data, even if it&#8217;s just empty bytes. While I got this to work just fine, I didn&#8217;t think this was very practical.</p>
<p>My second attempt created an elaborate packet structure around the data and the receiver software parses the packets that come across the wire and rejects them if it can&#8217;t parse them. I also ended up having to prepend the packets with a number of unused initialization bytes just to get the receiver to listen again. And since there&#8217;s no way to know whether the package made it, I ended up re-sending them a bunch of times to actually get the receiver to acknowledge. From a software perspective that means you have to make sure the commands you send are idempotent.</p>
<p>With all this error correcting logic and re-sending I can easily transmit across the entire room, probably further than that.</p>
<p>I am getting pretty good results with this, but the main takeaway is really already written into the data sheets. The manufacturer outlines that the main application for these modules are remote controls. For anything more advanced which includes multiple transmitter/receiver endpoints and clean easy data communications, XBees are really the way to go (and they&#8217;re only around $20).</p>
<p>Feel free to grab the <a href="http://jtoee.com/wp-content/uploads/2009/11/rflink_src.zip" target="_blank">source code</a> .</p>
<p><strong>The Entire Thing in Action</strong></p>
<p>Watch the top Arduino&#8217;s built-in LED go on and off and the bottom one follow (top &#8211; transmitter, bottom &#8211; receiver).<strong><br />
 </strong></p>
<p align="center">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=7435655&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="300" src="http://vimeo.com/moogaloop.swf?clip_id=7435655&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object>
</p>
<p><a href="http://vimeo.com/7435655">RF-Remote Controlled Arduinos</a> from <a href="http://vimeo.com/user1241541">Jochen Toppe</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p><br class="spacer_" /></p>
]]></content:encoded>
			<wfw:commentRss>http://jtoee.com/2009/11/remote-controlled-arduinos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Connecting Relays to Arduinos</title>
		<link>http://jtoee.com/2009/11/connecting-relays-to-arduinos/</link>
		<comments>http://jtoee.com/2009/11/connecting-relays-to-arduinos/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 21:01:07 +0000</pubDate>
		<dc:creator>Jochen</dc:creator>
				<category><![CDATA[Electronics]]></category>

		<guid isPermaLink="false">http://jtoee.com/?p=601</guid>
		<description><![CDATA[Finally having re-submerged from project chaos, I finally have a little time to spend playing with circuits again. While I&#8217;m toying with pieces to ultimately automate the entire house, like an RFID-based garage door opener. I figured I might as well post about individual pieces along the way.
The first one is a relay driving circuit. [...]]]></description>
			<content:encoded><![CDATA[<p>Finally having re-submerged from project chaos, I finally have a little time to spend playing with circuits again. While I&#8217;m toying with pieces to ultimately automate the entire house, like an RFID-based garage door opener. I figured I might as well post about individual pieces along the way.</p>
<p>The first one is a relay driving circuit. The goal is to simply drive a single relay (for now) from one of the Arduino data pins. Since I want to use the built-in 5V power, I opted for a simple 5V relay. It&#8217;s powerful enough to drive 5 amps on 220V, so that should be enough for most applications. I can&#8217;t recommend you hooking up 110V or 220V to a breadboard though! Getting circuit boards printed for this will be my next undertaking, but let&#8217;s dive into the circuit a little first.</p>
<p><strong>Part List</strong></p>
<ul>
<li>A 5V Relay like the Omron G5SB (<a href="http://www.sparkfun.com/commerce/product_info.php?products_id=100" target="_blank">$1.95 at Sparkfun</a>)</li>
<li>470Ω, 1kΩ, 10kΩ resistors (one each)</li>
<li>A NPN resistor capable of driving the relay (2n2222 or <a href="http://www.sparkfun.com/commerce/product_info.php?products_id=521" target="_blank">these</a> do the trick)</li>
<li>A diode such as a 1N4001 or 1N4148 (like <a href="http://www.sparkfun.com/commerce/product_info.php?products_id=8588" target="_blank">this </a>one or <a href="http://www.sparkfun.com/commerce/product_info.php?products_id=8589" target="_blank">this</a> one)</li>
<li>An LED (every circuit needs LEDs!)</li>
<li>A breadboard and some cables</li>
</ul>
<p><strong>The Circuit</strong></p>
<p><img class="aligncenter size-full wp-image-607" title="single_relay_driver" src="http://jtoee.com/wp-content/uploads/2009/11/single_relay_driver2.png" alt="single_relay_driver" width="544" height="387" /></p>
<p>The circuit itself is fairly simple. The signal from the Arduino data pin goes into pin 4 via the resistor R1 to the transistor which switches the relay on and off. Notice R3 which is pulls the data line to ground (reduces unwanted triggering of the Relay while the Arduino is not initialized). The diode is also required as it protects the circuit and ultimately the Arduino from so-called back EMF current.</p>
<p><strong>Result</strong></p>
<p align="center">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=7420356&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="300" src="http://vimeo.com/moogaloop.swf?clip_id=7420356&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object>
</p>
<p><a href="http://vimeo.com/7420356">Arduino LED Driver</a> from <a href="http://vimeo.com/user1241541">Jochen Toppe</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>Fun stuff, but all it really does it go click-click-click. But it is controlled via C-code! I omitted the code here because it&#8217;s as simple as 1-2-3. If needed, go to the Arduino <a href="http://www.arduino.cc" target="_blank">site </a>and read about how to make an LED blink.</p>
<p>Stay tuned for a write-up about getting the RF Link transmitter-receiver pairs going and hooked up to this.</p>
]]></content:encoded>
			<wfw:commentRss>http://jtoee.com/2009/11/connecting-relays-to-arduinos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
