<?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>Maartendamen&#039;s blog &#187; arduino</title>
	<atom:link href="http://www.maartendamen.com/tag/arduino/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.maartendamen.com</link>
	<description>Blogging on various IT subjects</description>
	<lastBuildDate>Tue, 22 Nov 2011 21:27:03 +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>Programming and debugging an ATtiny85 using USBTinyISP and an USB-BUB</title>
		<link>http://www.maartendamen.com/2011/10/programming-and-debugging-an-attiny85-using-usbtinyisp-and-an-usb-bub/</link>
		<comments>http://www.maartendamen.com/2011/10/programming-and-debugging-an-attiny85-using-usbtinyisp-and-an-usb-bub/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 18:29:49 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[arduino-tiny]]></category>
		<category><![CDATA[attiny]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[isp]]></category>
		<category><![CDATA[programmer]]></category>
		<category><![CDATA[usbtinyisp]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=994</guid>
		<description><![CDATA[I have been working a bit on hardware again lately, and I am currently playing around with ATtiny micro controllers These tiny little buggers have 8 pins, out of these pins a maximum of 6 I/O pins can be used (you would have to re-purpose the reset pin for 6th I/O pin, which is a [...]]]></description>
			<content:encoded><![CDATA[<p>I have been working a bit on hardware again lately, and I am currently playing around with ATtiny micro controllers<br />
These tiny little buggers have 8 pins, out of these pins a maximum of 6 I/O pins can be used (you would have to re-purpose the reset pin for 6th I/O pin, which is a very bad idea! This basically makes the chip unprogrammable from an ISP. So just stick with 5 I/O pins.). Some other specs of this of this MCU:</p>
<p>- 8Kb flash (yes, space does matter!)<br />
- 0.5Kb SRAM<br />
- Maximum operating frequency (20Mhz, using an external crystal)</p>
<p>Here&#8217;s a picture of this MCU:</p>
<p><a href="http://www.maartendamen.com/2011/10/programming-and-debugging-an-attiny85-using-usbtinyisp-and-an-usb-bub/attiny85_900/" rel="attachment wp-att-995"><img src="http://www.maartendamen.com/wp-content/uploads/2011/10/ATtiny85_900-150x150.jpg" alt="" title="ATtiny85_900" width="150" height="150" class="alignnone size-thumbnail wp-image-995" /></a><br />
<span id="more-994"></span><br />
To program this MCU you have to use an ISP (In System Programmer) programmer. I own an <a href="http://www.ladyada.net/make/usbtinyisp/">USBTinyISP </a> produced by Adafruit, which is perfect for this job. There is a minor drawback though: the ATtiny chips are not supported out of the box within the Arduino IDE. However, there is a perfect open source library by the name of <a href="http://code.google.com/p/arduino-tiny/">arduino-tiny</a> available to support this MCU within the Arduino IDE. </p>
<p>Here&#8217;s a picture of my test setup with the USBTinyISP (on the right) connected:</p>
<p><a href="http://www.maartendamen.com/2011/10/programming-and-debugging-an-attiny85-using-usbtinyisp-and-an-usb-bub/img_20111019_233422/" rel="attachment wp-att-1000"><img src="http://www.maartendamen.com/wp-content/uploads/2011/10/IMG_20111019_233422-620x463.jpg" alt="" title="IMG_20111019_233422" width="620" height="463" class="alignnone size-medium wp-image-1000" /></a></p>
<p>The pins are connected as follows: </p>
<ul>
<li>ATtiny Pin 2 to USBTinyISP SCK</li>
<li>ATtiny Pin 1 to USBTinyISP MISO</li>
<li>ATtiny Pin 0 to USBTinyISP MOSI</li>
<li>ATtiny RST pin to USBTinyISP RESET</li>
</ul>
<p>After getting the connections right, I started my first programming attempt. The test sketch blink, which is the &#8220;hello world&#8221; for MCU&#8217;s compiled correctly but then: </p>
<p><a href="http://www.maartendamen.com/2011/10/programming-and-debugging-an-attiny85-using-usbtinyisp-and-an-usb-bub/20-10-2011-0-07-13/" rel="attachment wp-att-1005"><img src="http://www.maartendamen.com/wp-content/uploads/2011/10/20-10-2011-0-07-13-523x600.png" alt="" title="20-10-2011 0-07-13" width="523" height="600" class="alignnone size-medium wp-image-1005" /></a></p>
<p>Hmm, nasty java exception there. After some digging around I figured out the incorrect programmer was getting addressed in the boards.txt file coming with the arduino-tiny project. This file is located under in the Arduino hardware/tiny/ folder. In order to make it work with the USBTinyISP, you have to change the following line for each target board (the ATtiny85 at 1mhz is illustrated here):</p>
<p><code>attiny85at1.upload.using=pololu</code></p>
<p>Into the following:</p>
<p><code>attiny85at1.upload.using=arduino:usbtinyisp</code></p>
<p>After restarting the IDE, I was able to program the sketch!</p>
<p><strong>Debugging</strong></p>
<p>For standard Arduino&#8217;s, you can use a  built in serial interface to debug. There is no such thing available for ATtiny chips. However, the arduino-tiny library does offer a debug interface. I used the USB-BUB from Modern Device to setup a debug interface. For the ATtiny85 the standard arduino-tiny debug interface is tied to PB3 of the ATtiny.<br />
Once setup, you can use the regular Serial.begin() and Serial.print/println() functions. I connected PB3 to the RX pin of the USB-bub, off course there&#8217;s also a ground connection required so I connected the GND of the USB-BUB to the GND of my ATtiny. After that I was ready to start debugging&#8230;</p>
<p>So, here we go.. ready to start tinkering!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2011/10/programming-and-debugging-an-attiny85-using-usbtinyisp-and-an-usb-bub/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jeenode infrared project part 4: a better home&#8230;</title>
		<link>http://www.maartendamen.com/2010/06/jeenode-infrared-project-part-4-a-better-home/</link>
		<comments>http://www.maartendamen.com/2010/06/jeenode-infrared-project-part-4-a-better-home/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 20:10:03 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Home automation]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[hotglue]]></category>
		<category><![CDATA[infrared]]></category>
		<category><![CDATA[jeenode]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=321</guid>
		<description><![CDATA[Agreed, a breadboard looks nice and &#8220;hacky&#8221;. But, it doesn&#8217;t really fit nicely into my interior :-) It&#8217;s time to give the Jeenode infrared sender/receiver a better home! The main ingredients to get this going are: Hot glue (love that stuff) Solder Some wires A Jeelabs carrier board with case A drill A lot of [...]]]></description>
			<content:encoded><![CDATA[<p>Agreed, a breadboard looks nice and &#8220;hacky&#8221;. But, it doesn&#8217;t really fit nicely into my interior :-)<br />
It&#8217;s time to give the Jeenode infrared sender/receiver a better home!</p>
<p>The main ingredients to get this going are: </p>
<ul>
<li>Hot glue (love that stuff)</li>
<li>Solder</li>
<li>Some wires</li>
<li><a href="http://cafe.jeelabs.net/lab/cb1/">A Jeelabs carrier board with case</a></li>
<li>A drill</li>
<li>A lot of patience&#8230;</li>
</ul>
<p><span id="more-321"></span></p>
<p>I started out drilling a hole for the power supply. I used an USB cable to power the Jeenode (I cut the unused wires). USB is on a lot of devices nowadays (media boxes, media tanks, sat receivers you name it) so this is an ideal power source for my IR box.</p>
<p>Here is the hole in place (one part of the box is shown):<br />
<a href="http://www.maartendamen.com/wp-content/uploads/2010/06/box1.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2010/06/box1-300x168.jpg" alt="" title="box1" width="300" height="168" class="alignnone size-medium wp-image-323" /></a></p>
<p>And here is the result of the closed box:<br />
<a href="http://www.maartendamen.com/wp-content/uploads/2010/06/box2.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2010/06/box2-300x168.jpg" alt="" title="box2" width="300" height="168" class="alignnone size-medium wp-image-326" /></a></p>
<p>The next step I took was to give the IR receiver a nice position, I choose the opposite of the power connector. I did this because I want the power connector, and other connectors out of sight.<br />
Once again I drilled a hole, inside the box I had to make a little piece of plastic tube to lift the IR sensor (I soldered it to a little hobby print board)</p>
<p>Here&#8217;s a picture of the plastic tube, and the IR sensor soldered on the hobby print board:<br />
<a href="http://www.maartendamen.com/wp-content/uploads/2010/06/box3.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2010/06/box3-300x168.jpg" alt="" title="box3" width="300" height="168" class="alignnone size-medium wp-image-327" /></a></p>
<p>And here is it glued to the box (I am a sloppy solderer, but hey it&#8217;s inside a box anyway :-) )</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/06/box4.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2010/06/box4-300x168.jpg" alt="" title="box4" width="300" height="168" class="alignnone size-medium wp-image-328" /></a></p>
<p>And this is how it looks on the outside:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/06/box5.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2010/06/box5-300x168.jpg" alt="" title="box5" width="300" height="168" class="alignnone size-medium wp-image-329" /></a></p>
<p>Next up was wiring the cables the same way as on the breadboard, this was more work then I expected it to be. Took me quite a while to get everything wired up.<br />
Here&#8217;s the result of the wiring inside the box:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/06/box6.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2010/06/box6-300x168.jpg" alt="" title="box6" width="300" height="168" class="alignnone size-medium wp-image-332" /></a></p>
<p>And this is how it looks from the outside:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/06/box8.jpg"><img src="http://www.maartendamen.com/wp-content/uploads/2010/06/box8-300x168.jpg" alt="" title="box8" width="300" height="168" class="alignnone size-medium wp-image-336" /></a></p>
<p>That&#8217;s it! The receiver has been put inside the box, I need some more time to fit the sender inside the box. I have some different idea&#8217;s for that instead of drilling holes.<br />
This step in the project required quite some different skills (drilling, glue&#8217;ing, soldering etc)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/06/jeenode-infrared-project-part-4-a-better-home/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Jeenode infrared project part 3: sending test</title>
		<link>http://www.maartendamen.com/2010/06/jeenode-infrared-project-part-3-sending-test/</link>
		<comments>http://www.maartendamen.com/2010/06/jeenode-infrared-project-part-3-sending-test/#comments</comments>
		<pubDate>Sun, 06 Jun 2010 16:03:51 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Home automation]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[infrared]]></category>
		<category><![CDATA[jeenode]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=280</guid>
		<description><![CDATA[In the first and second part of this series I introduced my idea&#8217;s about the IR project.I also showed some basic receiving, and even receiving over the air.What was left out, was the sending part. Today I found some time to get a sending setup together.Here&#8217;s the setup: A Jeelink containing a sketch which translates serial [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://www.maartendamen.com/?p=257">first</a> and <a href="http://www.maartendamen.com/?p=265">second</a> part of this series I introduced my idea&#8217;s about the IR project.<br />I also showed some basic receiving, and even receiving over the air.<br />What was left out, was the sending part. <br />Today I found some time to get a sending setup together.<br /><span id="more-280"></span>Here&#8217;s the setup:</p>
<ul>
<li>A Jeelink containing a sketch which translates serial commands to IR codes and sends them over the air;</li>
<li>A Jeenode on the receiving side, which receives the IR commands and sends them out to an IR led;</li>
<li>A python script to send commands to the serial port, to create a basic zapping demo.</li>
</ul>
<p>Here&#8217;s a little video demonstrating the sketches and python script below:</p>
<p><object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/-pKP8Yxzwjo&#038;hl=nl_NL&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/-pKP8Yxzwjo&#038;hl=nl_NL&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object></p>
<p>The Jeelink has the following sketch:</p>
<pre class="brush: cpp; title: ; notranslate">
/*
 * mdRFReceive - Generic home automation RF12 receiver.
 * Version 0.1 June, 2010
 * Copyright 2010 Maarten Damen
 * http://www.maartendamen.com
*/
#include &lt;Ports.h&gt;
#include &lt;RF12.h&gt;

#define MAX_STRING_LEN  20

byte needToSend;
long unsigned int sendbuf;
char buffer[MAX_STRING_LEN];
int bufferIndex = 0;

void setup() {
  Serial.begin(57600);
  rf12_config();
}

static void sendIR(long unsigned int code) {
  sendbuf = code;
  needToSend = 1;
}

char* subStr (char* str, char *delim, int index) {
   char *act, *sub, *ptr;
   char output;
   static char copy[MAX_STRING_LEN];
   int i;

   // Since strtok consumes the first arg, make a copy
   strcpy(copy, str);

   for (i = 1, act = copy; i &lt;= index; i++, act = NULL) {
	sub = strtok_r(act, delim, &amp;ptr);
	if (sub == NULL) break;
   }
   return sub;
}

unsigned long long conv64(char* str)
{
    unsigned long long res = 0;

    // remove 0x or 0X part
    if((strstr(str, &quot;0x&quot;) == str) || (strstr(str, &quot;0X&quot;) == str))
        str += 2;

    // do the conversion...
    for(; *str != 0; str++)
    {
        // multiply by 16 (remember, hexadecimal == base 16)
        res &lt;&lt;= 4;
        if(strchr(&quot;0123456789&quot;, *str) != NULL) // if within 0-9...
            res |= *str - '0';
        else if(strchr(&quot;ABCDEF&quot;, *str) != NULL) // if within A-F...
            res |= *str + 10 - 'A';
        else if(strchr(&quot;abcdef&quot;, *str) != NULL) // if within a-f...
            res |= *str + 10 - 'a';
        else
        {
            res &gt;&gt;= 4;
            break;
        }
    }

    return res;
}

static void handleInput (char* command, char* argument) {
  if (strcmp(command, &quot;send_tv&quot;)  == 0)
  {
    long unsigned int test = conv64(argument);
    sendIR(test);
  }
}

void loop() {
    if (Serial.available())
    {
      char ch = Serial.read();
      if (ch == '\n')
      {
        bufferIndex = 0;
        handleInput(subStr(buffer, &quot; &quot;, 1), subStr(buffer, &quot; &quot;, 2));
      } else {
        buffer[bufferIndex++] = ch;
      }
    }

  if (rf12_recvDone() &amp;&amp; rf12_crc == 0) {
    byte n = rf12_len;
    Serial.println(&quot;Packet CRC OK&quot;);
    Serial.print((int) rf12_hdr);
    for (byte i = 0; i &lt; n; i++) {
      Serial.print(' ');
      Serial.print((int) rf12_data[i]);
    }
    Serial.println();
  }

  if (needToSend &amp;&amp; rf12_canSend()) {
    needToSend = 0;
    rf12_sendStart(0, &amp;sendbuf, sizeof sendbuf);
  }
}
</pre>
<p>The Jeenode has the following receiving sketch:</p>
<pre class="brush: cpp; title: ; notranslate">
/*
 * mdIR - IR interface for home automation.
 * Version 0.1 May, 2010
 * Copyright 2010 Maarten Damen
 * http://www.maartendamen.com
*/

#include &lt;RF12.h&gt;
#include &lt;Ports.h&gt;
#include &lt;IRremote.h&gt;

IRsend irsend;

int RECV_PIN = 4;
IRrecv irrecv(RECV_PIN);

MilliTimer sendTimer;

byte needToSend;
decode_results results;

long unsigned int sendbuf;
long unsigned int received;

struct {
    byte decode;     // IR decode
} payload;

void setup () {
    Serial.begin(57600);
    Serial.println(57600);
    Serial.println(&quot;mdIR started...&quot;);
    rf12_config();
    irrecv.enableIRIn(); // Start the IR receiver
}

void loop () {
    if (irrecv.decode(&amp;results)) {
      needToSend = 1;
      sendbuf = results.value;

      Serial.println(results.value);
      Serial.println(results.value, HEX);
      irrecv.resume(); // Receive the next value
    }

    /* TODO: rf12_canSend doesn't work if I remove this... (needs to check incoming packets?) */
    if (rf12_recvDone() &amp;&amp; rf12_crc == 0 &amp;&amp; (int) rf12_hdr == 10) {
      byte n = rf12_len;
      Serial.println(&quot;Packet CRC OK&quot;);
      Serial.println((int) n);
      for (byte i = 0; i &lt; n; i++) {
        Serial.print(' ');
        Serial.print((int) rf12_data[i]);
      }
      Serial.println();

      received = ( ((long) rf12_data[3] &lt;&lt; 24)
                       + ((long) rf12_data[2] &lt;&lt; 16)
                       + ((long) rf12_data[1] &lt;&lt; 8)
                       + ((long) rf12_data[0] ) );

      irsend.sendSamsung(received, 32);
      /* Re-enable receiving mode */
      irrecv.enableIRIn();
      Serial.println();
    }

    if (needToSend &amp;&amp; rf12_canSend()) {
        needToSend = 0;
        Serial.println(&quot;need to send&quot;);
        rf12_sendStart(0, &amp;sendbuf, sizeof sendbuf);
    }
}
</pre>
<p>The python scripts looks like this:</p>
<pre class="brush: python; title: ; notranslate">
from twisted.internet.serialport import SerialPort
import sys
from twisted.protocols import basic
if sys.platform == 'win32':
    from twisted.internet import win32eventreactor
    win32eventreactor.install()
from twisted.internet import reactor

class IRProtocol(basic.LineReceiver):
    def __init__(self):
        # Power on the tv
        reactor.callLater(10.0, self.send_tv, &quot;0xE0E040BF&quot;)

        # Zap a bit
        reactor.callLater(15.0, self.send_tv, &quot;0xE0E020DF&quot;)
        reactor.callLater(20.0, self.send_tv, &quot;0xE0E0A05F&quot;)
        reactor.callLater(25.0, self.send_tv, &quot;0xE0E0609F&quot;)
        reactor.callLater(30.0, self.send_tv, &quot;0xE0E010EF&quot;)
        reactor.callLater(35.0, self.send_tv, &quot;0xE0E0906F&quot;) 

    def lineReceived(self, line):
        &quot;&quot;&quot; Do nothing with received lines yet &quot;&quot;&quot;

    def send_tv(self, command):
        &quot;&quot;&quot;
        Send's an IR command.
        &quot;&quot;&quot;
        self.transport.write('send_tv ' + command + '\n')            

SerialPort(IRProtocol(), 6 , reactor, '57600')
reactor.run()
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/06/jeenode-infrared-project-part-3-sending-test/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Green Jeenode</title>
		<link>http://www.maartendamen.com/2010/06/green-jeenode/</link>
		<comments>http://www.maartendamen.com/2010/06/green-jeenode/#comments</comments>
		<pubDate>Mon, 31 May 2010 23:30:43 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Home automation]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[green]]></category>
		<category><![CDATA[it]]></category>
		<category><![CDATA[jeenode]]></category>
		<category><![CDATA[power]]></category>
		<category><![CDATA[solar]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=275</guid>
		<description><![CDATA[I have just powered my first Jeenode with solar power.This node has been running for 5 days now. The solar panel is one normally used to charge cell phones.It supplies 5v and has a accu pack of 2800mah, this should keep this node running for quite a while&#8230;Click on &#8220;More&#8221; for a image of this [...]]]></description>
			<content:encoded><![CDATA[<p>I have just powered my first Jeenode with solar power.<br />This node has been running for 5 days now. <br />The solar panel is one normally used to charge cell phones.<br />It supplies 5v and has a accu pack of 2800mah, this should keep this node running for quite a while&#8230;<br />Click on &#8220;More&#8221; for a image of this Jeenode.<br /><span id="more-275"></span></p>
<p><img class="alignnone" style="display: block;" src="http://www.maartendamen.com/wp-content/uploads/2010/06/wpid-2010-05-31-20.19.38.jpg" alt="image" width="499" height="373" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/06/green-jeenode/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Jeenode infrared project part 2: going wireless</title>
		<link>http://www.maartendamen.com/2010/05/jeenode-infrared-project-part-2-going-wireless/</link>
		<comments>http://www.maartendamen.com/2010/05/jeenode-infrared-project-part-2-going-wireless/#comments</comments>
		<pubDate>Mon, 31 May 2010 17:09:42 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Home automation]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[infrared]]></category>
		<category><![CDATA[jeenode]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=265</guid>
		<description><![CDATA[In part 1 of this series I blogged about receiving infrared signals using an IR led. This blog post will focus on getting the signals up in the air (and off course receiving them on the other side, in my case my home automation server with a Jeelink attached) The Jeenode&#8217;s have a HopeRF wireless [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.maartendamen.com/?p=257">In part 1 of this series</a> I blogged about receiving infrared signals using an IR led. This blog post will focus on getting the signals up in the air (and off course receiving them on the other side, in my case my home automation server with a Jeelink attached)<br />
The Jeenode&#8217;s have a HopeRF wireless receiver/transmitter on board, which makes life easy.<br />
<span id="more-265"></span>Jeelabs provides a RF12 library for really easy sending over the air, the receiver in my case is a Jeelink (which is basically a Jeenode but in nice small USB stick format)</p>
<p>I modified my existing source code to enable wireless transmitting:</p>
<pre class="brush: cpp; title: ; notranslate">
/*
 * mdIR - IR interface for home automation.
 * Version 0.1 May, 2010
 * Copyright 2010 Maarten Damen
 * http://www.maartendamen.com
*/

#include &lt;RF12.h&gt;
#include &lt;Ports.h&gt;
#include &lt;IRremote.h&gt;

int RECV_PIN = 4;
IRrecv irrecv(RECV_PIN);

MilliTimer sendTimer;

byte needToSend;
decode_results results;

long unsigned int sendbuf;

struct {
    byte decode;     // IR decode
} payload;

void setup () {
    Serial.begin(57600);
    Serial.println(57600);
    Serial.println(&quot;mdIR started...&quot;);
    rf12_config();
    irrecv.enableIRIn(); // Start the IR receiver
}

void loop () {
    if (irrecv.decode(&amp;results)) {
      needToSend = 1;
      sendbuf = results.value;

      Serial.println(results.value);
      Serial.println(results.value, HEX);
      irrecv.resume(); // Receive the next value
    }

    /* TODO: rf12_canSend doesn't work if I remove this... (needs to check incoming packets?) */
    if (rf12_recvDone() &amp;&amp; rf12_crc == 0) {
    }

    if (needToSend &amp;&amp; rf12_canSend()) {
        needToSend = 0;
        Serial.println(&quot;need to send&quot;);
        rf12_sendStart(0, &amp;sendbuf, sizeof sendbuf);
    }
}
</pre>
<p>Here&#8217;s a screenshot of my Jeelink receiving the packets send by the Jeenode receiving the infrared signals:</p>
<p><img class="alignnone size-full wp-image-268" title="jeelink_ir" src="http://www.maartendamen.com/wp-content/uploads/2010/05/jeelink_ir.png" alt="jeelink_ir" width="518" height="598" /><br />
<em>Image 1: Jeelink receiving IR signals send by another Jeenode.</em> Notice the different buttons pressed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/05/jeenode-infrared-project-part-2-going-wireless/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Automating/reading sensorbin status using JeeNode/Arduino</title>
		<link>http://www.maartendamen.com/2010/01/automating-a-sensor-bin-using-jeenodearduino/</link>
		<comments>http://www.maartendamen.com/2010/01/automating-a-sensor-bin-using-jeenodearduino/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 13:16:31 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Home automation]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[jeenode]]></category>
		<category><![CDATA[sensorbin]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=129</guid>
		<description><![CDATA[I&#8217;m currently playing around with Jeenode boards. The JeeNode is a small wireless board with an 8-bit Atmel RISC microprocessor. JeeNodes are compatible with the Arduino platform and can be programmed under Windows, Mac OS X, or Linux using sketches created with the Arduino IDE. As a first test of it&#8217;s capabilities, I wanted to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently playing around with Jeenode boards. The JeeNode is a small wireless board with an 8-bit Atmel RISC microprocessor. <a href="http://www.jeelabs.org">JeeNodes</a> are compatible with the <a href="http://arduino.cc/">Arduino</a> platform and can be programmed under Windows, Mac OS X, or Linux using sketches created with the Arduino IDE. As a first test of it&#8217;s capabilities, I wanted to read out the state of the cover of my recycle bin.</p>
<p>I have one of these recycle bins:<br />
<a href="http://www.easybin.nl/Easybin_2009-2010/assortiment.html">http://www.easybin.nl/Easybin_2009-2010/assortiment.html</a><br />
(deluxe 50)</p>
<p>The cover automatically opens when it detects motion over it.. this is nice and hygienic.</p>
<p>I decided to open up my bin. Once opened I quickly notices the most interesting part of the bin.. the motion sensor and the LED that flashes when the bin is in the open state.</p>
<p><span id="more-129"></span></p>
<p>The LED has the following states:</p>
<ul>
<li>Short red flashes when the device is alive;</li>
<li>constantly green lid when the cover is open;</li>
<li>constant red lid when the cover is closing.</li>
</ul>
<p>This led is a so called bi-color LED. It has 3 pins, one pin supplies power for the green color.. the other pin supplies power for the red color. The middle pin is the neutral/GND pin.<br />
Using a multimeter I measured the voltages on the pins.. turns out there was 2 volt on it. Great! This could be connected to the analog ports of the JeeNode.</p>
<p>I soldered some leads on the existing sensorbin board:<br />
<img class="alignnone size-full wp-image-131" title="sesnsorbin1" src="http://www.maartendamen.com/wp-content/uploads/2010/01/sesnsorbin1.png" alt="sesnsorbin1" width="563" height="422" /></p>
<p><em>Image 1: the sensorbin board with additional wires connected.</em></p>
<p>The orange wire is the green led color, the middle wire is the ground and the blue wire is the red color.<br />
Now that I connected the leads to the exisiting board I connected the orange wire to analog port 1 of the jeenode. The middle wire to ground port 1. And the blue wire to analog port 2.</p>
<p>I was now ready to go ahead and upload a &#8216;sketch&#8217; (this is a program that runs on the microprocessor) to my JeeNode.<br />
This is what I came up with:</p>
<pre class="brush: cpp; title: ; notranslate">
#include &lt;Ports.h&gt;
#include &lt;RF12.h&gt;

Port input (1);

/* is the bin open? */
byte isopen = 0;

void setup () {
 // initialize the serial port and the RF12 driver
 Serial.begin(57600);
 Serial.print(&quot;\n[SensorBin]&quot;);
 rf12_config();
 // set up easy transmissions at maximum rate
 rf12_easyInit(0);
}

void loop () {
 int state = input.anaRead();

 if (state &gt; 600 &amp;&amp; isopen == 0) {
 Serial.print(&quot;Cover is opened!&quot;);
 Serial.println();
 isopen = 1;
 } else if (state &lt; 600 &amp;&amp; isopen == 1) {
 Serial.print(&quot;Cover is closed again..&quot;);
 Serial.println();
 isopen = 0;
 }

 delay(1000);
}
</pre>
<p>And here is the test result:</p>
<p><img src="file:///C:/Users/Maarten/AppData/Local/Temp/moz-screenshot-3.png" alt="" /><img class="alignnone size-full wp-image-134" title="sensorbin2" src="http://www.maartendamen.com/wp-content/uploads/2010/01/sensorbin2.png" alt="sensorbin2" width="654" height="608" /></p>
<p><em>Image 2: output log from Arduino serial port monitor</em></p>
<p>Excellent! So, I can now read the status of my recycle bin.. is this life saving? No.. not really but atleast it gave me some insight on the JeeNode and Arduino platform.<br />
I want to extend this concept with the following:</p>
<ul>
<li>Sending the status of RF;</li>
<li>reading out the battery status (percentage left) of the recycle bin (this is handy to get e-mail notifications from home automation software);</li>
<li>putting in a light sensor so I can read the light status of the room the recycle bin is placed in;</li>
<li>putting in a motion sensor so I can get the motion status of the room the recycle bin is placed in;</li>
<li>etc.</li>
</ul>
<p>Oh btw.. just for for fun.. this is my test setup (JeeNode connected to USB-BUB in front, sensorbin hardware board in the back):</p>
<p><img class="alignnone size-full wp-image-135" title="sensorbin3" src="http://www.maartendamen.com/wp-content/uploads/2010/01/sensorbin3.png" alt="sensorbin3" width="704" height="528" /></p>
<p><em>Image 3: test setup in action :-)</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/01/automating-a-sensor-bin-using-jeenodearduino/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

