<?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>kill-9 &#187; on4tux</title>
	<atom:link href="http://www.kill-9.be/?author=1&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.kill-9.be</link>
	<description>sharing my arduino, Raspberry PI, linux and HAM radio projects</description>
	<lastBuildDate>Wed, 27 Aug 2014 20:24:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.2</generator>
		<item>
		<title>1st code</title>
		<link>http://www.kill-9.be/?p=15</link>
		<comments>http://www.kill-9.be/?p=15#comments</comments>
		<pubDate>Sun, 23 Jun 2013 20:36:55 +0000</pubDate>
		<dc:creator>on4tux</dc:creator>
				<category><![CDATA[TV remote extender]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[domotica]]></category>
		<category><![CDATA[ir]]></category>

		<guid isPermaLink="false">http://www.kill-9.be/?p=15</guid>
		<description><![CDATA[As I moved all my electronic equipment in a cabinet, I had to foresee an IR extender. I first looked at commercial devices or ones that are based on a 555 timer, but wanted to keep the amount of components at a minimum. Hence, Arduino to the rescue: This project is currently running on a [...]]]></description>
				<content:encoded><![CDATA[<p>As I moved all my electronic equipment in a cabinet, I had to foresee an IR extender. I first looked at commercial devices or ones that are based on a 555 timer, but wanted to keep the amount of components at a minimum. Hence, Arduino to the rescue:</p>
<p>This project is currently running on a full Arduino, but I&#8217;m going to port it to a barebone soon. Right now, it is capturing IR via a TSOP alike IR receiver connected to pin 2. As these signals are demodulated, I had to regenerate the 36kHz carrier via timer 2 and turn it on/off depending on the the captured signal. This seems to work fine for most of my devices, except for the Belgacom setup box, which reacts very slow for the moment.</p>
<p>Todo:</p>
<ul>
<li>try to combine this code with the IRremote library, so I can remotely control a led strip.</li>
<li>debug the Belgacom setup box issues</li>
<li>mount everything in a permanent enclosure</li>
<li>add an enc28j60 interface for future domotica enhancements</li>
</ul>
<blockquote><p>const byte LED = 10;  // Timer 2 &#8220;A&#8221; output: OC2A<br />
int sensePin = 2;        // This is the INT0 Pin of the ATMega328<br />
int sensePinInt = 0; // INT0 zit op pin 2, INT1 op pin 3</p>
<p>volatile int value = 0;  // Sense value</p>
<p>void setup() {<br />
pinMode (LED, OUTPUT);<br />
pinMode(sensePin, INPUT);   // read from the sense pin<br />
attachInterrupt(sensePinInt, state, CHANGE);</p>
<p>// set up Timer 2<br />
TCCR2A = _BV (COM2A0) | _BV(WGM21);  // CTC, toggle OC2A on Compare Match<br />
TCCR2B = _BV (CS20);   // No prescaler<br />
OCR2A = 220; // 36khz<br />
//  OCR2A =  209;          // compare A register value (210 * clock speed)<br />
//  = 13.125 nS , so frequency is 1 / (2 * 13.125) = 38095<br />
}  // end of setup</p>
<p>void loop() { }</p>
<p>void state() {<br />
value = digitalRead(sensePin);</p>
<p>if (value)<br />
{<br />
TCCR2A &amp;= !(_BV(COM2A0) | COM2A1); // PWM off<br />
}<br />
else<br />
{<br />
TCCR2A = _BV (COM2A0) | _BV(WGM21);  // PWM on<br />
}<br />
}</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.kill-9.be/?feed=rss2&#038;p=15</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
