<?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>TinkerKit</title>
	<atom:link href="http://www.tinkerkit.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tinkerkit.com</link>
	<description>Electronics made easy</description>
	<lastBuildDate>Mon, 20 May 2013 15:27:54 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Arduino Motor Shield</title>
		<link>http://www.tinkerkit.com/arduino-motor-shield/</link>
		<comments>http://www.tinkerkit.com/arduino-motor-shield/#comments</comments>
		<pubDate>Thu, 16 May 2013 11:15:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.tinkerkit.com/?p=2907</guid>
		<description><![CDATA[Continuous Servo The Arduino Motor shield comes with TinkerKit! connectors on the board. They can be used to control inputs, outputs and TWI TinkerKit! devices. In this tutorial we&#8217;ll be driving a DC motor with a potentiometer, changing its direction and even printing the output values on an LCD. Your browser does not support the video tag. In order to see the rotation of the DC motor, we designed a blade, that you can download here, and a base. Basically the support is a piece of wood to which we drilled two holes, one for the motor and one for the cables. Then we plugged the DC motor&#8217;s cables into the A port of the motor shield. Polarity is not important with DC motors, so you can plug plus and minus in any order. In order to control the motor without TinkerKit!, we need to use two pins of the shield, one for direction and one for speed. To find out the number of the pins, we followed the Arduino Motor Shield Documentation. We can even brake using pin number 9. So this is our first code, to make it spin in one direction: On the pin 12 we write HIGH or LOW to make it spin left or right. Now we can plug a TinkerKit! linear potentiometer to control the direction and speed of the rotation. Let&#8217;s plug it on an input port. In order to use the module, we have to include the TinkerKit! library, then declare it ...]]></description>
				<content:encoded><![CDATA[<div class="lazysocialbuttons" data-float="left" data-buttons="google,twitter,facebook" data-twshareurl="http://www.tinkerkit.com/arduino-motor-shield/" data-twtext="Arduino Motor Shield" data-shareurl="http://www.tinkerkit.com/arduino-motor-shield/" data-fbhideflyout="false" data-backgroundtype="light"></div><div class="tutorials-nav">
<a href="http://www.tinkerkit.com/continuous-servo-tutorial/"></p>
<div class="tutnav-button tutnav-button-left left">
		<span>Continuous Servo</span>
		</div>
<p>	</a>
</div>
<p>The <a href="http://www.arduino.cc/en/Main/ArduinoMotorShieldR3" target="_blank">Arduino Motor shield</a> comes with <strong>TinkerKit! connectors</strong> on the board. They can be used to control inputs, outputs and TWI TinkerKit! devices. In this tutorial we&#8217;ll be driving a DC motor with a potentiometer, changing its direction and even printing the output values on an LCD. </p>
<p><video width="734" loop="loop" autoplay="autoplay"><br />
  <source src="http://tinkerkit.com/bp/video/tutorials/motorLCD/motorLCD.mp4" type="video/mp4"><br />
  <source src="http://tinkerkit.com/bp/video/tutorials/motorLCD/motorLCD.webm" type="video/ogg"><br />
  Your browser does not support the video tag.<br />
</video></p>
<p>In order to see the rotation of the DC motor, we designed a blade, that you can <a href="http://www.thingiverse.com/thing:89726" target="_blank">download here</a>, and a base. Basically the support is a piece of wood to which we drilled two holes, one for the motor and one for the cables.</p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2013/05/web3.jpg" alt="web3" width="734" height="493" class="alignnone size-full wp-image-2910" /></p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2013/05/web2.jpg" alt="web2" width="734" height="501" class="alignnone size-full wp-image-2909" /> </p>
<p>Then we plugged the DC motor&#8217;s cables into the <strong>A port</strong> of the motor shield. Polarity is not important with DC motors, so you can plug plus and minus in any order.</p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2013/05/web1.jpg" alt="web1" width="734" height="489" class="alignnone size-full wp-image-2908" /></p>
<p>In order to control the motor without TinkerKit!, we need to use two pins of the shield, one for <strong>direction</strong> and one for <strong>speed</strong>. To find out the number of the pins, we followed the <a href="http://www.arduino.cc/en/Main/ArduinoMotorShieldR3" target="_blank">Arduino Motor Shield Documentation</a>. We can even <strong>brake</strong> using pin number 9. So this is our first code, to make it spin in one direction:</p>
<pre class="brush: arduino; title: ; notranslate">
void setup() {
   //Setup Channel A
  pinMode(12, OUTPUT); //Initiates Motor Channel A
  pinMode(9, OUTPUT); //Initiates Brake Channel A

  digitalWrite(9, LOW);   //Disengage the Brake
  
  digitalWrite(12, LOW);   //Set direction
  analogWrite(3, 255);   //Channel A at full speed
}

void loop() {
}
</pre>
<p>On the pin 12 we write <strong>HIGH</strong> or <strong>LOW</strong> to make it spin <strong>left</strong> or <strong>right</strong>. Now we can plug a <a href="http://www.tinkerkit.com/linear-pot/" target="_blank">TinkerKit! linear potentiometer</a> to control the direction and speed of the rotation. Let&#8217;s plug it on an input port.</p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2013/05/web4.jpg" alt="web4" width="734" height="489" class="alignnone size-full wp-image-2911" /></p>
<p>In order to use the module, we have to <strong>include the TinkerKit! library</strong>, then declare it as a regular TKPotentiometer. The port used, in our case, is the number 2.</p>
<pre class="brush: arduino; title: ; notranslate">
#include &lt;TinkerKit.h&gt;

TKPotentiometer pot(2);
</pre>
<p>We can <strong>map</strong> the value of the potentiometer on a range that goes from -255 to 255, then we check if it&#8217;s positive or negative for the direction, and use the <strong>absolute</strong> value (without the sign) to set the rotation <strong>speed</strong>.</p>
<pre class="brush: arduino; title: ; notranslate">
#include &lt;TinkerKit.h&gt;

TKPotentiometer pot(2);

void setup() {
  //Setup Channel A
  pinMode(12, OUTPUT); //Initiates Motor Channel A
  pinMode(9, OUTPUT); //Initiates Brake Channel A

  digitalWrite(9, LOW);   //Disengage the Brake

  digitalWrite(12, LOW);   //Set direction
  analogWrite(3, 255);   //Channel A at full speed
}

void loop() {
  int val = pot.get(); //8-896
  delay(30);

  //our potentiometer goes from 8 to 896
  //use serial print to check the values
  val = map(val, 8, 896, -255, 255);

  if (val &lt; 0) {
    //spin left
    digitalWrite(12, HIGH); 
  } 
  else {
    //spin right
    digitalWrite(12, LOW); 
  }
  
  //val without sign 
  int abso = abs(val);
  
  //constrain it to 0-255 to be sure
  constrain(abso,0,255);  

  //set speed
  analogWrite(3, abso);  
  
}
</pre>
<p>Now we can even plug a <a href="http://www.tinkerkit.com/lcd" target="_blank">TinkerKit! LCD</a> on the <strong>TWI</strong> port, to read the values of speed and direction. In order to use the LCD as a TWI device, we have to upload the <strong>TWIFirmware</strong> on it, that can be found in the examples of the TKLCD library. Follow <a href="http://www.tinkerkit.com/twi-lcd/" target="_blank">this tutorial</a> for more information. </p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2013/05/web5.jpg" alt="web5" width="734" height="489" class="alignnone size-full wp-image-2912" /></p>
<p>In our code, we have to include <a href="http://www.tinkerkit.com/tklcd-library/" target="_blank">TKLCD library</a>, Wire and LiquidCrystal in our sketch, then declare it as a TKLCD_Twi.</p>
<pre class="brush: arduino; title: ; notranslate">
#include &lt;LiquidCrystal.h&gt;
#include &lt;Wire.h&gt;
#include &lt;matrix_lcd_commands.h&gt;
#include &lt;TKLCD.h&gt;
#include &lt;TinkerKit.h&gt;

TKPotentiometer pot(2);
TKLCD_Twi lcd = TKLCD_Twi();
</pre>
<p>Then in our code, we can create a <strong>string</strong> for direction that can be LEFT or RIGHT, then print it on the LCD with the absolute value of the potentiometer:</p>
<div class="coduino">
<div class="codutop"></div>
<div class="codumid">
<pre class="brush: arduino; title: ; notranslate">
#include &lt;LiquidCrystal.h&gt;
#include &lt;Wire.h&gt;
#include &lt;matrix_lcd_commands.h&gt;
#include &lt;TKLCD.h&gt;
#include &lt;TinkerKit.h&gt;

TKPotentiometer pot(2);
TKLCD_Twi lcd = TKLCD_Twi();

void setup() {
  //Setup Channel A
  pinMode(12, OUTPUT); //Initiates Motor Channel A
  pinMode(9, OUTPUT); //Initiates Brake Channel A

  digitalWrite(9, LOW);   //Disengage the Brake

  digitalWrite(12, LOW);   //Set direction
  analogWrite(3, 255);   //Channel A at full speed

  lcd.begin();
}

void loop() {
  int val = pot.get(); //8-896
  delay(30);

  //our potentiometer goes from 8 to 896
  //use serial print to check the values
  val = map(val, 8, 896, -255, 255);

  String dir;

  if (val &lt; 0) {
    //spin left
    digitalWrite(12, HIGH); 
    dir = &quot;LEFT&quot;;
  } 
  else {
    //spin right
    digitalWrite(12, LOW); 
    dir = &quot;RIGHT&quot;;
  }

  //val without sign 
  int abso = abs(val);

  //constrain it to 0-255 to be sure
  constrain(abso,0,255);  

  //set speed
  analogWrite(3, abso); 
  
  //write on the lcd
  lcd.clear();  
  lcd.print(dir + &quot; &quot; + abso); 

}</pre>
</div>
<div class="codubot"></div>
</div>
<p>Once we have uploaded the firmware on the LCD, we can connect the TWI out port of the shield, to the TWI1 port on the LCD. <strong>Mind that</strong> if you are powering the Arduino, the LCD and the motor just from the USB port of your computer, <strong>you will face some uploading issues</strong>. <strong>We recommend to upload the skecth on the Arduino, then connect the TWI cable and motor.</strong> Use it with external power for best results.</p>
<div class="tutorials-nav">
<a href="http://www.tinkerkit.com/continuous-servo-tutorial/"></p>
<div class="tutnav-button tutnav-button-left left">
		<span>Continuous Servo</span>
		</div>
<p>	</a>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.tinkerkit.com/arduino-motor-shield/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://tinkerkit.com/bp/video/tutorials/motorLCD/motorLCD.mp4" length="2816597" type="video/mp4" />
<enclosure url="http://tinkerkit.com/bp/video/tutorials/motorLCD/motorLCD.webm" length="866838" type="application/wordperfect" />
		</item>
		<item>
		<title>DMX</title>
		<link>http://www.tinkerkit.com/dmx/</link>
		<comments>http://www.tinkerkit.com/dmx/#comments</comments>
		<pubDate>Mon, 22 Apr 2013 11:18:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial-category]]></category>

		<guid isPermaLink="false">http://www.tinkerkit.com/?p=2810</guid>
		<description><![CDATA[DMX get started! In this tutorials you&#8217;ll learn how to use the TinkerKit! DMX modules. You can use them to connect and control large arrays of actuators, individually. In this series we&#8217;ll see how to control some lamps with the Relay Receiver and a RGB led strip with a MosFet receiever!]]></description>
				<content:encoded><![CDATA[<div class="lazysocialbuttons" data-float="left" data-buttons="google,twitter,facebook" data-twshareurl="http://www.tinkerkit.com/dmx/" data-twtext="DMX" data-shareurl="http://www.tinkerkit.com/dmx/" data-fbhideflyout="false" data-backgroundtype="light"></div><div class="tutorials-cover" style="background:url('http://www.tinkerkit.com/wp-content/uploads/2013/04/dmx-cover.jpg');">
<p class="cover-title">DMX</p>
<p><a href="http://www.tinkerkit.com/introduction-to-dmx/">
<div class="cover-button">
<span>get started!</span>
</div>
<p></a>
<div class="cover-desc">
<p>
In this tutorials you&#8217;ll learn how to use the TinkerKit! DMX modules. You can use them to connect and control large arrays of actuators, individually. In this series we&#8217;ll see how to control some lamps with the Relay Receiver and a RGB led strip with a MosFet receiever!
</p>
</div>
</div>
<p><br /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tinkerkit.com/dmx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DMX Relay Receiver</title>
		<link>http://www.tinkerkit.com/dmx-relay-receiver-3/</link>
		<comments>http://www.tinkerkit.com/dmx-relay-receiver-3/#comments</comments>
		<pubDate>Mon, 22 Apr 2013 10:47:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.tinkerkit.com/?p=2087</guid>
		<description><![CDATA[Introduction to DMX MosFet receiver In this tutorial we are using the DMX Relay Receiver to control a couple of high-voltage outputs; the board mounts four relays that can be individually controlled to control an output. In this example we are using it with the DMX Master Shield but it&#8217;s also possible to use it independently, by uploading your own custom firmware on the board. We are working on a tutorial for that so stay tuned. a small reminder: First we connect the outputs; in our case we decided to connect a lamp and an extension cable (the same of the relay module tutorial), to two of the board&#8217;s relays. Once you chose the device that you want to plug, cut the cable&#8217;s sheath to see the wires inside (always working without any electricity inside of course). What we see is two wires; in order to open the circuit we cut one of them and peel a small portion of the rubber (around 5mm) from both sides, so that the copper inside is visible Each relay has three output ports that are C (common), NO (normally open) and NC (normally closed). Look at the Relay tutorial and documentation for more detailed information about them. The relay opens and closes the circuit when triggered, what it does in details is closing the NO and opening the NC. In this way we can create a series of non-invasive domotic devices by connecting them to the NC port of a relay, so that ...]]></description>
				<content:encoded><![CDATA[<div class="lazysocialbuttons" data-float="left" data-buttons="google,twitter,facebook" data-twshareurl="http://www.tinkerkit.com/dmx-relay-receiver-3/" data-twtext="DMX Relay Receiver" data-shareurl="http://www.tinkerkit.com/dmx-relay-receiver-3/" data-fbhideflyout="false" data-backgroundtype="light"></div><div class="tutorials-nav">
<a href="http://www.tinkerkit.com/introduction-to-dmx/"></p>
<div class="tutnav-button tutnav-button-left left">
		<span>Introduction to DMX</span>
		</div>
<p>	</a><a href="http://www.tinkerkit.com/dmx-mosfet/"></p>
<div class="tutnav-button tutnav-button-right right">
		<span>MosFet receiver</span>
		</div>
<p>	</a>
</div>
<p>In this tutorial we are using the <a href="http://www.tinkerkit.com/dmx-relay-receiver-2/" target="_blank">DMX Relay Receiver</a> to control a couple of high-voltage outputs; the board mounts <strong>four relays</strong> that can be individually controlled to control an output.</p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2013/04/dmx-relay-receiver.png" alt="dmx-relay-receiver" width="734" height="584" class="alignnone size-full wp-image-2792" /></p>
<p>In this example we are using it with the <a href="http://www.tinkerkit.com/dmx-master-shield/" target="_blank">DMX Master Shield</a> but it&#8217;s also possible to use it independently, by uploading your own custom firmware on the board. We are working on a tutorial for that so stay tuned.</p>
<p>a small reminder:<br />
<div class="messageBox alert icon"><span>ALWAYS BE SAFE WHEN WORKING WITH HIGH VOLTAGES, DON&#8217;T PLUG THE POWER UNTIL ALL THE CONNECTIONS ARE MADE AND DISCONNECT IT BEFORE TOUCHING THE BOARD</span></div></p>
<p>First we connect the outputs; in our case we decided to connect <strong>a lamp and an extension cable</strong> (the same of the relay module tutorial), to two of the board&#8217;s relays. Once you chose the device that you want to plug, cut the cable&#8217;s sheath to see the wires inside (always working <strong>without any electricity</strong> inside of course).</p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2012/12/relay-tutorial-1.jpg" alt="" title="relay-tutorial-1" width="734" height="454" class="alignnone size-full wp-image-2088" /></p>
<p>What we see is two wires; in order to <strong>open the circuit</strong> we cut one of them and peel a small portion of the rubber (around 5mm) from both sides, so that the copper inside is visible</p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2012/12/relay-tutorial-2.jpg" alt="" title="relay-tutorial-2" width="734" height="489" class="alignnone size-full wp-image-2089" /></p>
<p>Each relay has three output ports that are <strong>C</strong> (common), <strong>NO</strong> (normally open) and <strong>NC</strong> (normally closed). Look at the Relay <a href="http://www.tinkerkit.com/relay-tutorial/" target="_blank">tutorial</a> and <a href="http://www.tinkerkit.com/relay/" target="_blank">documentation</a> for more detailed information about them. The relay opens and closes the circuit when triggered, what it does in details is closing the NO and opening the NC.<br />
In this way we can create a series of non-invasive domotic devices by connecting them to the NC port of a relay, so that we can continue to use them as regular devices until we want to control them.</p>
<p>Back to our receiver, chose a relay then plug one side of the wire into the <strong>middle</strong> port (C) and the other on one of the remaining two sides. </p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2012/12/relay-tutorial-3.jpg" alt="" title="relay-tutorial-3" width="734" height="489" class="alignnone size-full wp-image-2090" /></p>
<p>Do the same with another device if you want.</p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2012/12/relay-tutorial-4.jpg" alt="" title="relay-tutorial-4" width="734" height="489" class="alignnone size-full wp-image-2091" /></p>
<p>This is what we have so far</p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2012/12/relay-tutorial-5.jpg" alt="" title="relay-tutorial-5" width="734" height="441" class="alignnone size-full wp-image-2092" /></p>
<p>The DMX Relay Recevier requires <strong>12V</strong> of external power to work, as usual we supply this with a recycled transformer, to which we <strong>cut the wire</strong> so that we can fit the smaller inner wires in the <strong>VIN</strong> connectors. Remember to <strong>identify correctly + and -</strong> because they&#8217;re not exchangeable.</p>
<p>Now we connect the Receiver with the Master, matching the Master&#8217;s OUT ports D+ D- and GND with the same-named ports on the Receiver.</p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2012/12/relay-tutorial-6.jpg" alt="" title="relay-tutorial-6" width="734" height="489" class="alignnone size-full wp-image-2093" /></p>
<p>Then we set the address of the receiver, to make it simple we set it to <strong>1</strong>. In this way when we can write</p>
<pre class="brush: arduino; title: ; notranslate">DmxMaster.write(1,HIGH);</pre>
<p>to target the first relay on the board, then the others are sequential. In our case we are using relays number 1 and 4.</p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2012/12/tutorial-mosfet-71.jpg" alt="" title="tutorial-mosfet-7" width="734" height="489" class="alignnone size-full wp-image-2069" /><br />
(this is a picture of another module, but never mind, what&#8217;s important is the address)</p>
<p>Let&#8217;s start with something basic, like turning on each of the two relay individually; try to write it by yourself first, then keep reading for the solution. Remember to <strong>include the DMX library</strong>.</p>
<div class = wavy-module></div>
<p>Ok, first of all we have to <strong>include</strong> the <strong>DMX library</strong>, that allows us to use the DmxMaster object. Then in the setup() function, we can use the maxChannel method to define the top channel that we are using, in our case is 4 because we hooked up the extension cable on the fourth relay. </p>
<pre class="brush: arduino; title: ; notranslate">
#include &lt;DmxMaster.h&gt;

void setup() {
  DmxMaster.maxChannel(4);
}
</pre>
<p>Then in the loop we turn on one lamp, wait five seconds then turn on the other lamp</p>
<pre class="brush: arduino; title: ; notranslate">

DmxMaster.write(1, HIGH);
delay(5000);  
DmxMaster.write(1,LOW);
DmxMaster.write(4, HIGH);
delay(5000);  
DmxMaster.write(4,LOW);

</pre>
<p>And that&#8217;s basically it, take a look at the result and the full code after the video. </p>
<p><video width="734" loop="loop" autoplay="autoplay"><br />
  <source src="http://tinkerkit.com/bp/video/tutorials/DMX-relay/DMX-relay.mp4" type="video/mp4"><br />
  <source src="http://tinkerkit.com/bp/video/tutorials/DMX-relay/DMX-relay.webm" type="video/ogg"><br />
  Your browser does not support the video tag.<br />
</video></p>
<p>Here we connected <strong>another lamp</strong> to the extension cable but you can plug anything you want (<strong>except from a multiple socket</strong> of course; in fact doing so will burn the relay, your house and probably you&#8217;ll die in agony (seriously, don&#8217;t plug a multiple socket in a single relay)</p>
<div class="coduino">
<div class="codutop"></div>
<div class="codumid">
<pre class="brush: arduino; title: ; notranslate">
/*channel: 
 1: SMALL LAMP
 4: SOCKET 
 */

#include &lt;DmxMaster.h&gt;

void setup() {
  DmxMaster.maxChannel(4);
}

void loop() {
  DmxMaster.write(1,HIGH);
  DmxMaster.write(4,LOW);
  delay(5000);
  DmxMaster.write(4,HIGH);
  DmxMaster.write(1,LOW);
  delay(5000);  
}
</pre>
</div>
<div class="codubot"></div>
</div>
<div class="tutorials-nav">
<a href="http://www.tinkerkit.com/introduction-to-dmx/"></p>
<div class="tutnav-button tutnav-button-left left">
		<span>Introduction to DMX</span>
		</div>
<p>	</a><a href="http://www.tinkerkit.com/dmx-mosfet/"></p>
<div class="tutnav-button tutnav-button-right right">
		<span>MosFet receiver</span>
		</div>
<p>	</a>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.tinkerkit.com/dmx-relay-receiver-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://tinkerkit.com/bp/video/tutorials/DMX-relay/DMX-relay.mp4" length="1631109" type="video/mp4" />
<enclosure url="http://tinkerkit.com/bp/video/tutorials/DMX-relay/DMX-relay.webm" length="240376" type="application/wordperfect" />
		</item>
		<item>
		<title>DMX MosFet</title>
		<link>http://www.tinkerkit.com/dmx-mosfet/</link>
		<comments>http://www.tinkerkit.com/dmx-mosfet/#comments</comments>
		<pubDate>Mon, 22 Apr 2013 10:47:15 +0000</pubDate>
		<dc:creator>matteo</dc:creator>
				<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.tinkerkit.com/?p=2060</guid>
		<description><![CDATA[Relay Receiver In this tutorial we are using the DMX MosFet Receiver to control an RGB LED strip. The board mounts four mosfets while the strip has three outputs, one for each color. You can evend find more advanced strips that have four outputs, three for RGB and one for the white. In both cases, the DMX MosFet Receiver is a compact solution to control the strip. In this example we are using it with the DMX Master, but it&#8217;s also possible to use it independently, by uploading your own custom firmware on the board. We are working on a tutorial for that so stay tuned. First of all we connect the Receiver with the Master, matching the Master&#8217;s OUT ports D+ D- and GND with the same-named ports on the Receiver. Then we have to connect the LED strip, if you look on the receiver&#8217;s OUTPUT ports, each mosfet has two outputs (+ and -), but all the ports labeled C are connected (C is for COMMON). In this way we can plug the power (or ground) to any of the C ports and it&#8217;s like connecting all of them to the same ground or power. In our picture the power is the red cable, that we are connecting on a C port, while the blue ones are the individual GND for red, green and blue. Then we have to supply the voltage required by our LED strip. In our case it&#8217;s 12V that we&#8217;re getting from a transformer ...]]></description>
				<content:encoded><![CDATA[<div class="lazysocialbuttons" data-float="left" data-buttons="google,twitter,facebook" data-twshareurl="http://www.tinkerkit.com/dmx-mosfet/" data-twtext="DMX MosFet" data-shareurl="http://www.tinkerkit.com/dmx-mosfet/" data-fbhideflyout="false" data-backgroundtype="light"></div><div class="tutorials-nav">
<a href="http://www.tinkerkit.com/dmx-relay-receiver-3/"></p>
<div class="tutnav-button tutnav-button-left left">
		<span>Relay Receiver</span>
		</div>
<p>	</a>
</div>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2012/12/tutorial-mosfet-12.jpg" alt="" title="tutorial-mosfet-1" width="734" height="489" class="alignnone size-full wp-image-2062" /></p>
<p>In this tutorial we are using the <a href="http://www.tinkerkit.com/dmx-mosfet-receiver/" target="_blank">DMX MosFet Receiver</a> to control an <strong>RGB LED</strong> strip. The board mounts four mosfets while the strip has <strong>three outputs</strong>, one for each color. You can evend find more advanced strips that have four outputs, three for RGB and one for the white. In both cases, the DMX MosFet Receiver is a compact solution to control the strip. </p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2012/12/tutorial-mosfet-22.jpg" alt="" title="tutorial-mosfet-2" width="734" height="489" class="alignnone size-full wp-image-2063" /></p>
<p>In this example we are using it with the <a href="http://www.tinkerkit.com/dmx-master-shield/" target="_blank">DMX Master</a>, but it&#8217;s also possible to use it independently, by uploading your own <strong>custom firmware </strong>on the board. We are working on a tutorial for that so stay tuned.</p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2012/12/tutorial-mosfet-31.jpg" alt="" title="tutorial-mosfet-3" width="734" height="489" class="alignnone size-full wp-image-2065" /></p>
<p>First of all we connect the Receiver with the Master, matching the Master&#8217;s OUT ports <strong>D+ D-</strong> and <strong>GND</strong> with the same-named ports on the Receiver.</p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2012/12/tutorial-mosfet-42.jpg" alt="" title="tutorial-mosfet-4" width="734" height="489" class="alignnone size-full wp-image-2066" /></p>
<p>Then we have to connect the LED strip, if you look on the receiver&#8217;s OUTPUT ports, each mosfet has two outputs (+ and -), but all the ports labeled <strong>C </strong>are connected (C is for COMMON). In this way we can plug the power (or ground) to any of the C ports and it&#8217;s like connecting all of them to the <strong>same ground or power.</strong><br />
In our picture the <strong>power</strong> is the <strong>red</strong> cable, that we are connecting on a <strong>C</strong> port, while the <strong>blue</strong> ones are the individual <strong>GND</strong> for red, green and blue.</p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2012/12/tutorial-mosfet-5.jpg" alt="" title="tutorial-mosfet-5" width="734" height="489" class="alignnone size-full wp-image-2067" /></p>
<p>Then we have to supply the voltage required by our LED strip. In our case it&#8217;s <strong>12V</strong> that we&#8217;re getting from a transformer to which we <strong>cut the wire</strong> so that we can fit them in the &#8220;EXTERNAL POWER&#8221; connector. Remember to <strong>identify correctly + and -</strong> because they&#8217;re not exchangeable. </p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2012/12/tutorial-mosfet-61.jpg" alt="" title="tutorial-mosfet-6" width="734" height="489" class="alignnone size-full wp-image-2068" /></p>
<p>Then we set the <strong>address</strong> of the receiver, to make it simple we set it to <strong>1</strong>. In this way when we write</p>
<pre class="brush: arduino; title: ; notranslate">DmxMaster.write(1,128);</pre>
<p>we are addressing to the first mosfet on the board and the others are sequential. In our case it&#8217;s 1 for red, 2 for blue and 3 for green.</p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2012/12/tutorial-mosfet-71.jpg" alt="" title="tutorial-mosfet-7" width="734" height="489" class="alignnone size-full wp-image-2069" /><br />
<img src="http://www.tinkerkit.com/wp-content/uploads/2012/12/tutorial-mosfet-8_1.jpg" alt="" title="tutorial-mosfet-8_1" width="734" height="489" class="alignnone size-full wp-image-2070" /></p>
<p>Let&#8217;s start with something basic, like turning on each color individually; try to write it by yourself first, then keep reading for the solution. Remember to <strong>include the DMX library</strong>.</p>
<div class="wavy-module"></div>
<p>Ok, first of all we have to include the DMX library, that allows us to use the <strong>DmxMaster</strong> object. Then in the setup() function, we can use the maxChannel method to define the top channel that we are using, in our case is 3 because we&#8217;re not the last mosfet, but let&#8217;s write 4 so that if we want we can use all of them.</p>
<pre class="brush: arduino; title: ; notranslate">
#include &lt;DmxMaster.h&gt;

void setup() {
  DmxMaster.maxChannel(4);
}
</pre>
<p>Then in the loop we nest another loop that turns on each channel every second.</p>
<pre class="brush: arduino; title: ; notranslate">
for(int i = 1; i &lt; 4; i++) {
    DmxMaster.write(i, 255);
    delay(1000);  
    DmxMaster.write(i,0);
  }
</pre>
<p>And that&#8217;s basically it, take a look at the result and the full code after the break.</p>
<p><video width="734" loop="loop" autoplay="autoplay"><br />
  <source src="http://tinkerkit.com/bp/video/tutorials/DMX-mosfet/ledstripe.mp4" type="video/mp4"><br />
  <source src="http://tinkerkit.com/bp/video/tutorials/DMX-mosfet/ledstripe.webm"" type="video/ogg"><br />
  Your browser does not support the video tag.<br />
</video></p>
<div class="coduino">
<div class="codutop"></div>
<div class="codumid">
<pre class="brush: arduino; title: ; notranslate">
/*channel: 
 1: RED
 2: BLU
 3: GREEN
 */

#include &lt;DmxMaster.h&gt;

void setup() {
  /*also if we are using only three channels,
   we set the maximum to four so that we can still 
   use the last mosfet if we want */
  DmxMaster.maxChannel(4);
}

void loop() {
  for(int i = 1; i &lt; 4; i++) {
    DmxMaster.write(i, 255); //full on
    delay(1000);  
    DmxMaster.write(i,0); //off
  }
}
</pre>
</div>
<div class="codubot"></div>
</div>
<div class="tutorials-nav">
<a href="http://www.tinkerkit.com/dmx-relay-receiver-3/"></p>
<div class="tutnav-button tutnav-button-left left">
		<span>Relay Receiver</span>
		</div>
<p>	</a>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.tinkerkit.com/dmx-mosfet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://tinkerkit.com/bp/video/tutorials/DMX-mosfet/ledstripe.mp4" length="735962" type="video/mp4" />
<enclosure url="http://tinkerkit.com/bp/video/tutorials/DMX-mosfet/ledstripe.webm" length="112733" type="application/wordperfect" />
		</item>
		<item>
		<title>DMX Relay Receiver</title>
		<link>http://www.tinkerkit.com/dmx-relay-receiver-2/</link>
		<comments>http://www.tinkerkit.com/dmx-relay-receiver-2/#comments</comments>
		<pubDate>Mon, 22 Apr 2013 09:59:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[hubs]]></category>

		<guid isPermaLink="false">http://www.tinkerkit.com/?p=2034</guid>
		<description><![CDATA[The DMX Relay Receiver is a DMX module that mounts four relays; they can be individually controlled using a DMX master like TinkerKit!&#8217;s DMX Master Shield. Each Relay supports up to 220V at 10A. The board itself is divided in three parts: 1. Relay output Where the high-voltages connections are made. Each Relay has three outputs: the one in the middle is the common line, while the external ones are normally-open and normally-closed. Refer to the relay tutorial for more detailed information on hot to wire a relay properly. 2. DMX connections Plug in here the wires from the Master Shield or another DMX Receiver. The connections are easy, D+ goes to D+, D- to D- and GND to GND. For the external power, the Relay module requires 12V. 3. Address DMX works with one master and up to 128 receivers, all connected to a single line. In order to send signals to the right output, each receiver is identified by an address from 0 to 512. Each receiver has an address that is set from this pin interface. The address is expressed with a binary number where each pin correspond to a digit. As you probably understood from the pictures, if the pin is down that digit is 0, while if it&#8217;s up it is 1. Mind that the number is written from right to left; the most significant digit is in fact on the far right. If you notice in the last example, where we select an address ...]]></description>
				<content:encoded><![CDATA[<div class="lazysocialbuttons" data-float="left" data-buttons="google,twitter,facebook" data-twshareurl="http://www.tinkerkit.com/dmx-relay-receiver-2/" data-twtext="DMX Relay Receiver" data-shareurl="http://www.tinkerkit.com/dmx-relay-receiver-2/" data-fbhideflyout="false" data-backgroundtype="light"></div><p><img src="http://www.tinkerkit.com/wp-content/uploads/2013/04/dmx-relay-receiver.png" alt="dmx-relay-receiver" width="734" height="584" class="alignnone size-full wp-image-2792" /></p>
<p>The DMX Relay Receiver is a DMX module that mounts four relays; they can be individually controlled using a DMX master like TinkerKit!&#8217;s DMX Master Shield. Each Relay supports up to 220V at 10A.</p>
<p>The board itself is divided in three parts:</p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2012/11/dmx-relay-division.png" alt="" title="dmx-relay-division" width="734" height="515" class="alignnone size-full wp-image-2024" /></p>
<h3><strong>1. Relay output</strong></h3>
<p>Where the high-voltages connections are made. Each Relay has three outputs: the one in the middle is the common line, while the external ones are normally-open and normally-closed. Refer to the relay tutorial for more detailed information on hot to wire a relay properly.</p>
<div class="messageBox alert icon"><span>BE ALWAYS SAFE WHEN WORKING WITH HIGH VOLTAGES, NEVER TOUCH THIS PART OF THE BOARD WHEN THE HIGH VOLTAGE CURRENT IS RUNNING THROUGH IT. ALWAYS DISCONNECT THE POWER FIRST!</span></div>
<h3><strong>2. DMX connections</strong></h3>
<p>Plug in here the wires from the Master Shield or another DMX Receiver. The connections are easy, <strong>D+</strong> goes to <strong>D+</strong>, <strong>D-</strong> to <strong>D-</strong> and <strong>GND</strong> to <strong>GND</strong>. For the external power, the Relay module requires <strong>12V</strong>.</p>
<h3><strong>3. Address</strong></h3>
<p>DMX works with one master and up to 128 receivers, all connected to a single line. In order to send signals to the right output, each receiver is identified by an address from 0 to 512.<br />
Each receiver has an <strong>address </strong>that is set from this pin interface. The address is expressed with a <strong>binary number</strong> where each pin correspond to a digit. </p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2012/11/addresses.png" alt="" title="addresses" width="734" height="322" class="alignnone size-full wp-image-2030" /></p>
<p>As you probably understood from the pictures, if the pin is <strong>down </strong>that digit is<strong> 0</strong>, while if it&#8217;s <strong>up</strong> it is <strong>1</strong>. Mind that the number is written <strong>from right to left</strong>; the most significant digit is in fact on the far right. If you notice in the last example, where we select an address with the number 20 (10100 in binary), we start writing it from right to left. This address refers to the first relay on the board (the one with the number 1 label), all the others have addresses that are sequential to the first one. </p>
<p>e.g. if set the address of the board on 3 (101), if you want to turn on the first relay you have to write:</p>
<pre class="brush: arduino; title: ; notranslate">DmxMaster.write(3,HIGH)</pre>
<p>if you want to turn on the second:</p>
<pre class="brush: arduino; title: ; notranslate">DmxMaster.write(4,HIGH)</pre>
<p>and so on. This means that if you have multiple DMX receivers, you have to set their addresses with a gap of four numbers, in order to have full control on all the modules on the board. </p>
<p>This way of setting addresses can be a bit confusing at the beginning, that&#8217;s why we created this <strong>visual tool</strong> that helps to understand how it works.</p>
<p><script src="http://www.tinkerkit.com/custom-js/processing.js" type="text/javascript"></script><br />
		<script type="text/javascript">
function getProcessingSketchId () { return 'pinweb'; }
</script></p>
<p><script type="text/javascript" src="http://www.tinkerkit.com/custom-js/pinweb.js"></script></p>
<div style="float:left;">
<span style="color:#E75204" class="dmx-span">DmxMaster</span><span class="dmx-span">.</span><span style="color:#E75204" class="dmx-span">write</span><span class="dmx-span">(</span><input class="dmx-input" id="inval" value="0" oninput="getInt()" onclick ="empty()"><span class="dmx-span">, </span><span style="color:teal;" class="dmx-span">HIGH</span><span class="dmx-span">);</span></p>
<p><canvas style="	display: block; outline: 0px; margin-bottom: 1.5em; " id="pinweb" data-processing-sources="http://www.tinkerkit.com/custom-js/pinweb.txt" width="420" height="150"><br />
</canvas></p>
<p><span class="dmx-out">Binary Value: </span><span class="dmx-out" id ="printval">0</span>
</div>
<div class="dmx-relay-address">
<div class="relay-addresses">
<div id="dmx-address-1">0</div>
<div id="dmx-address-2">1</div>
<div id="dmx-address-3">2</div>
<div id="dmx-address-4">3</div>
</div>
</div>
<p><br /></p>
<p>This is an example code used to control a DMX Relay Receiver with an address of 5, we turn each relay on sequentially and then off altogether.</p>
<div class="coduino">
<div class="codutop"></div>
<div class="codumid">
<pre class="brush: arduino; title: ; notranslate">
/*
Relay sequential &amp;quot;blink&amp;quot;
 use this with a DMX Relay Receiver (it works also with the MosFet)
 receiver. The address of the board is set into the ADDRESS variable 
 */

#include &amp;lt;DmxMaster.h&amp;gt;

int ADDRESS = 3; //the address of the board in decimal system

void setup() {
  /*set the max channel, in this way that the module
  doesn't have to cycle through all the possible
  channels every time*/
  DmxMaster.maxChannel(ADDRESS + 3);
}

void loop() {

  for (int i = ADDRESS; i &amp;lt; ADDRESS + 4; i++) { 
    DmxMaster.write(i, HIGH);
    delay(1000);
    DmxMaster.write(i, LOW);
  }

}
</pre>
</div>
<div class="codubot"></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.tinkerkit.com/dmx-relay-receiver-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TWI</title>
		<link>http://www.tinkerkit.com/twi-lcd/</link>
		<comments>http://www.tinkerkit.com/twi-lcd/#comments</comments>
		<pubDate>Fri, 22 Mar 2013 16:53:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.tinkerkit.com/?p=2753</guid>
		<description><![CDATA[Arduino RXTX The TinkerKit! LCD also supports TWI connections. TWI stands for &#8220;Two-Wire Interface&#8221; and it&#8217;s another way to call the I2C bus technology. Basically it allows to connect multiple devices in series. This means that you can hook a large number of LCD screens, connecting them &#8220;in-line&#8221; using the two TWI ports, one for input and one for output. One of them must be the master (or you can use a TInkerKit! shield), while the others must run the TWI firmware. The TWI port has four pins, that&#8217;s why we need the 4-pin cable to connect them. First of all let&#8217;s connect two modules, then we move to the code. We need the TKLCD library that you can download from the library section of the website. If you downloaded it already, be sure to have the last version because TWI support has been added only recently. Between the examples of the TKLCD library, there is one that is called TwiFirmware. We have to load it into one of or our LCD modules, the other module doesn&#8217;t need a firmware. Now we have to declare our LCDs. One is a regular TKLCD_Local, while the TWI, it&#8217;s a TKLCD_Twi Then in the setup we initialize them normally After this we can use them in the loop as a normal TKLCD, let&#8217;s try to write somthing on them: Ok, that was rather easy, but the cool thing about TWI is that you can connect as much modules as you want. Now we ...]]></description>
				<content:encoded><![CDATA[<div class="lazysocialbuttons" data-float="left" data-buttons="google,twitter,facebook" data-twshareurl="http://www.tinkerkit.com/twi-lcd/" data-twtext="TWI" data-shareurl="http://www.tinkerkit.com/twi-lcd/" data-fbhideflyout="false" data-backgroundtype="light"></div><div class="tutorials-nav">
<a href="http://www.tinkerkit.com/3-local-usb/"></p>
<div class="tutnav-button tutnav-button-left left">
		<span>Arduino RXTX</span>
		</div>
<p>	</a>
</div>
<p>The TinkerKit! LCD also supports TWI connections. TWI stands for &#8220;Two-Wire Interface&#8221; and it&#8217;s another way to call the I2C bus technology. Basically it allows to connect multiple devices in series. This means that you can hook a large number of LCD screens, connecting them &#8220;in-line&#8221; using the two TWI ports, one for input and one for output. One of them must be the master (or you can use a TInkerKit! shield), while the others must run the TWI firmware. The TWI port has four pins, that&#8217;s why we need the 4-pin cable to connect them.</p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2013/03/twi-zoom.jpg" alt="twi-zoom" width="734" height="489" class="alignnone size-full wp-image-2755" /></p>
<p>First of all let&#8217;s connect two modules, then we move to the code. We need the TKLCD library that you can download from the <a href="http://tinkerkit.com/bp/Downloads/TKLCD.zip">library</a> section of the website. If you downloaded it already, be sure to have the last version because TWI support has been added only recently.</p>
<p>Between the examples of the TKLCD library, there is one that is called TwiFirmware. We have to load it into one of or our LCD modules, the other module doesn&#8217;t need a firmware.</p>
<p>Now we have to declare our LCDs. One is a regular TKLCD_Local, while the TWI, it&#8217;s a TKLCD_Twi</p>
<pre class="brush: arduino; title: ; notranslate">
TKLCD_Local local;
TKLCD_Twi twi;
</pre>
<p>Then in the setup we initialize them normally</p>
<pre class="brush: arduino; title: ; notranslate">
local.begin();
twi.begin();
</pre>
<p>After this we can use them in the loop as a normal TKLCD, let&#8217;s try to write somthing on them: </p>
<pre class="brush: arduino; title: ; notranslate">
local.print(&quot;Hi TWI&quot;);
delay(2000);
local.clear();

twi.println(&quot;Hi Local&quot;);
delay(2000);
twi.clear();
</pre>
<p>Ok, that was rather easy, but the cool thing about TWI is that you can connect as much modules as you want. Now we try to connect three LCD modules. One will be the local master and the other two are TWI slaves. We have to load them with the TWI firmware. <br /></p>
<p><img src="http://www.tinkerkit.com/wp-content/uploads/2013/03/twi-chain.jpg" alt="twi-chain" width="734" height="489" class="alignnone size-full wp-image-2754" /></p>
<p>If we have more than one TWI, in order to understand which one we are controlling we need to define a different address for each. Let&#8217;s open the TwiFirmware example in the TKLCD library and then, at line 88, there&#8217;s this command:</p>
<pre class="brush: arduino; title: ; notranslate">
#define MATRIX_I2CADDR 0x33 // change this in order to communicate with another LCD
</pre>
<p>Every TWI module has an address that is defined in this line of the firmware program. By default it&#8217;s 0&#215;33 but we can change it. If we have more than one module we have to define a different address for each module. Now we set one address to 0&#215;33 and the other to 0&#215;44, then we upload them.</p>
<p>Now all we have to do is program the master module. We don&#8217;t have to change barely anything from our program, we still have to declare just one TWI, but in the loop we have to set a different address everytime that we want to change the target TWI LCD. This is done using lcd.setActiveAddress(NEW_ADDRESS).</p>
<p>Here what we do is writing on the three screens in sequence:</p>
<pre class="brush: arduino; title: ; notranslate">
local.print(&quot;I'm a local&quot;);
delay(2000);
local.clear();

twi.setActiveAddress(0x33);
twi.println(&quot;I'm TWI 0x33&quot;);
delay(2000);
twi.clear();

twi.setActiveAddress(0x44);
twi.println(&quot;I'm TWI 0x44&quot;);
delay(2000);
twi.clear();
</pre>
<p><video width="734" loop="loop" autoplay="autoplay"><br />
  <source src="http://tinkerkit.com/bp/video/tutorials/LCD/TWI.mp4" type="video/mp4"><br />
  <source src="http://tinkerkit.com/bp/video/tutorials/LCD/TWI.webm" type="video/ogg"><br />
  Your browser does not support the video tag.<br />
</video></p>
<p>By changing addresses, you can connect a large array of TWI devices.</p>
<div class="tutorials-nav">
<a href="http://www.tinkerkit.com/lcd-arduino-two-wires-tutorial/"></p>
<div class="tutnav-button tutnav-button-left left">
		<span>Arduino RXTX</span>
		</div>
<p>	</a>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.tinkerkit.com/twi-lcd/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
<enclosure url="http://tinkerkit.com/bp/video/tutorials/LCD/TWI.mp4" length="541919" type="video/mp4" />
<enclosure url="http://tinkerkit.com/bp/video/tutorials/LCD/TWI.webm" length="148562" type="application/wordperfect" />
		</item>
		<item>
		<title>DMX Master Shield</title>
		<link>http://www.tinkerkit.com/dmx-master-shield-2/</link>
		<comments>http://www.tinkerkit.com/dmx-master-shield-2/#comments</comments>
		<pubDate>Tue, 19 Mar 2013 10:00:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://www.tinkerkit.com/?p=2747</guid>
		<description><![CDATA[Today the DMX Master Shield is officially available worldwide on the Arduino Store! For the ones who don&#8217;t know the possibilities of this shield, it is able to control a series of 512 DMX outputs, individually, using Arduino and TinkerKit! It is part of the TinkerKit DMX family, new toys will be available for the end of April, stay tuned!]]></description>
				<content:encoded><![CDATA[<div class="lazysocialbuttons" data-float="left" data-buttons="google,twitter,facebook" data-twshareurl="http://www.tinkerkit.com/dmx-master-shield-2/" data-twtext="DMX Master Shield" data-shareurl="http://www.tinkerkit.com/dmx-master-shield-2/" data-fbhideflyout="false" data-backgroundtype="light"></div><p><br /><br />
<img src="http://www.tinkerkit.com/wp-content/uploads/2012/11/dmx_r_tk.png" alt="dmx_r_tk" width="734" height="534" class="alignnone size-full wp-image-1758" /></p>
<p>Today the <a href="http://www.tinkerkit.com/dmx-master-shield/" target="_blank">DMX Master Shield</a> is officially available worldwide on the <a href="http://store.arduino.cc/it/index.php?main_page=product_info&#038;cPath=16_18&#038;products_id=267" target="_blank">Arduino Store</a>! For the ones who don&#8217;t know the possibilities of this shield, it is able to control a series of 512 DMX outputs, individually, using Arduino and TinkerKit! <br /><br />
It is part of the TinkerKit DMX family, new toys will be available for the end of April, stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tinkerkit.com/dmx-master-shield-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Processing Tutorials!</title>
		<link>http://www.tinkerkit.com/processing-tutorials-2/</link>
		<comments>http://www.tinkerkit.com/processing-tutorials-2/#comments</comments>
		<pubDate>Wed, 13 Mar 2013 18:24:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://www.tinkerkit.com/?p=2732</guid>
		<description><![CDATA[Good news! We just released a series of lessons about how to interface processing with your TinkerKit!, take a look in the tutorials section. They start from a basic introduction to the brand new Processing Library, then they move on to something more specific, like how to map and calibrate your sensors. In the end you&#8217;ll also interface with a pong game taken from openProcessing!]]></description>
				<content:encoded><![CDATA[<div class="lazysocialbuttons" data-float="left" data-buttons="google,twitter,facebook" data-twshareurl="http://www.tinkerkit.com/processing-tutorials-2/" data-twtext="Processing Tutorials!" data-shareurl="http://www.tinkerkit.com/processing-tutorials-2/" data-fbhideflyout="false" data-backgroundtype="light"></div><p><br /><br />
<img src="http://www.tinkerkit.com/wp-content/uploads/2013/03/vlcsnap-2013-03-13-16h59m55s161.png" alt="vlcsnap-2013-03-13-16h59m55s161" width="734" height="413" class="alignnone size-full wp-image-2738" /><br />
<br /></p>
<p>Good news! We just released a series of lessons about how to interface processing with your TinkerKit!, take a look in the <a href="http://tinkerkit.com/tutorials" target="_blank">tutorials section</a>. They start from a basic introduction to the brand new Processing Library, then they move on to something more specific, like how to map and calibrate your sensors. In the end you&#8217;ll also interface with a pong game taken from openProcessing!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tinkerkit.com/processing-tutorials-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Processing Tutorials</title>
		<link>http://www.tinkerkit.com/processing-tutorials/</link>
		<comments>http://www.tinkerkit.com/processing-tutorials/#comments</comments>
		<pubDate>Wed, 13 Mar 2013 18:11:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial-category]]></category>

		<guid isPermaLink="false">http://www.tinkerkit.com/?p=2709</guid>
		<description><![CDATA[Processing get started! In this series you&#8217;ll learn how to get started with Processing using TinkerKit!. We start from the natural passage between Arduino and Processing, then we&#8217;ll move to something more specific. We&#8217;ll learn some basic functions that are very useful when working with sensors, like smoothing and mapping.]]></description>
				<content:encoded><![CDATA[<div class="lazysocialbuttons" data-float="left" data-buttons="google,twitter,facebook" data-twshareurl="http://www.tinkerkit.com/processing-tutorials/" data-twtext="Processing Tutorials" data-shareurl="http://www.tinkerkit.com/processing-tutorials/" data-fbhideflyout="false" data-backgroundtype="light"></div><div class="tutorials-cover" style="background:url('http://www.tinkerkit.com/wp-content/uploads/2013/03/p5-cover.jpg');">
<p class="cover-title">Processing</p>
<p><a href="http://www.tinkerkit.com/processing/"></p>
<div class="cover-button">
<span>get started!</span>
</div>
<p></a></p>
<div class="cover-desc">
<p>In this series you&#8217;ll learn how to get started with Processing using TinkerKit!. We start from the natural passage between Arduino and Processing, then we&#8217;ll move to something more specific. We&#8217;ll learn some basic functions that are very useful when working with sensors, like smoothing and mapping. </p>
</div>
</div>
<p><br /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tinkerkit.com/processing-tutorials/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Existing Sketches</title>
		<link>http://www.tinkerkit.com/existing-sketches/</link>
		<comments>http://www.tinkerkit.com/existing-sketches/#comments</comments>
		<pubDate>Tue, 12 Mar 2013 17:28:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.tinkerkit.com/?p=2699</guid>
		<description><![CDATA[Map &#038; Calibration In this tutorial we&#8217;ll see how to adapt an existing processing sketch that uses regular inputs like keyboard and mouse, to TinkerKit! sensors. We are going to use OpenProcessing, a website where Processing users can upload their creations and the source is available to anybody. Let&#8217;s get started: go on openprocessing.org and browse for a game. We start with pong, something basic that everyone knows. Type &#8220;pong&#8221; in the search bar, then open an example that you like. We chose classic pong by David Avetisyan; now copy the code and paste it in a new processing window. Run it to verify that it works. It&#8217;s a simple one-player pong, where you can move the rectangle left and right using two keys, A and D. We don&#8217;t like that button-based interaction, now that we know the possibilities that we have with the TinkerKit sensors! We can start with a potentiometer to understand the logic, then we change to something more interesting. Hook up a potentiometer (better linear but also rotary is fine) to an input port and follow these steps. Include and Declare First we have to include the libraries that we normally use for TinkerKit and Arduino. Open any example of the TinkerKit! library for processing, then copy the first three lines, the ones with the &#8220;include&#8221; and paste them into our pong sketch, right at the beginnning. After these lines declare an arduino object In the setup, we have to initialize the arduino object, like we ...]]></description>
				<content:encoded><![CDATA[<div class="lazysocialbuttons" data-float="left" data-buttons="google,twitter,facebook" data-twshareurl="http://www.tinkerkit.com/existing-sketches/" data-twtext="Existing Sketches" data-shareurl="http://www.tinkerkit.com/existing-sketches/" data-fbhideflyout="false" data-backgroundtype="light"></div><div class="tutorials-nav">
<a href="http://www.tinkerkit.com/map-and-calibration/"></p>
<div class="tutnav-button tutnav-button-left left">
		<span>Map &#038; Calibration</span>
		</div>
<p>	</a>
</div>
<p>In this tutorial we&#8217;ll see how to adapt an <strong>existing</strong> processing sketch that uses regular inputs like <strong>keyboard</strong> and <strong>mouse</strong>, to TinkerKit! <strong>sensors</strong>. We are going to use <a href="http://www.openprocessing.org/" target="_blank">OpenProcessing</a>, a website where Processing users can upload their creations and the source is available to anybody.</p>
<p>Let&#8217;s get started: go on <a href="http://www.openprocessing.org/" target="_blank">openprocessing.org</a> and browse for a game. We start with <strong>pong</strong>, something basic that everyone knows. Type &#8220;pong&#8221; in the search bar, then open an example that you like. We chose <a href="http://www.openprocessing.org/sketch/83981" target="_blank">classic pong by David Avetisyan</a>; now copy the code and <strong>paste</strong> it in a new processing window. Run it to verify that it works. It&#8217;s a simple one-player pong, where you can move the rectangle left and right using two keys, A and D. </p>
<p>We don&#8217;t like that button-based interaction, now that we know the possibilities that we have with the TinkerKit sensors! We can start with a potentiometer to understand the logic, then we change to something more interesting. Hook up a <strong>potentiometer</strong> (better linear but also rotary is fine) to an input port and follow these steps.</p>
<h1>Include and Declare</h1>
<p>First we have to <strong>include the libraries</strong> that we normally use for TinkerKit and Arduino. Open any example of the TinkerKit! library for processing, then copy the first three lines, the ones with the &#8220;include&#8221; and paste them into our pong sketch, right at the beginnning. After these lines declare an arduino object</p>
<pre class="brush: arduino; title: ; notranslate">
arduino Arduino;
</pre>
<p>In the setup, we have to initialize the arduino object, like we normally do. We can paste the line from the example.</p>
<pre class="brush: arduino; title: ; notranslate">
arduino = new Arduino(this, Arduino.list()[0], 57600);
</pre>
<p>Now we are set. If we run this sketch, it should work. Even though the lines we added don&#8217;t change anything in terms of behavior, our sketch is configured to work with TinkerKit!. The next step is to identify the variable that is used to control the player&#8217;s rectangle. We can start to look for where the <strong>keyPressed</strong> functions are and see which variable they change. In the paddle class there are some keyPressed functions:</p>
<pre class="brush: arduino; title: ; notranslate">
 if ( keyPressed== true &amp;&amp; key=='a')
    {
      x=x-10;
    }
    if ( keyPressed==true &amp;&amp; key=='d')
    {
      x=x+10;
    }
</pre>
<p>As we can see from the code, the rectangle horizontal position is determined by the <strong>x</strong> variable, that is changed once we press &#8216;a&#8217; or &#8216;d&#8217;. What we can do is change the x using the potentiometer. Let&#8217;s start by declaring it at the top, then in the move() function of the paddle object (where the keyPressed are), we can comment the keyPressed lines and add a new float variable for the potentiometer.</p>
<pre class="brush: arduino; title: ; notranslate">
float val = pot.get();
</pre>
<p>Then what we have to do is assign to x the mapped value of the potentiometer. Considering that the paddle moves from 0 to width, our map function will look like</p>
<pre class="brush: arduino; title: ; notranslate">
x = map(val,0,1023,0,width);
</pre>
<p>Now if we try to run this sketch, we get an <strong>error</strong>, it says &#8220;cannot converto from float to int&#8221;. That&#8217;s because the x variable has been declared as int and the map function returns a float value. The simplest way to fix this is to <strong>change</strong> the declaration of x as <strong>float</strong>. Run the sketch and you should have a pong controlled by a tinkerkit sensor. </p>
<p><video width="734" loop="loop" autoplay="autoplay"><br />
  <source src="http://tinkerkit.com/bp/video/tutorials/processing/pong-p5.mp4" type="video/mp4"><br />
  <source src="http://tinkerkit.com/bp/video/tutorials/processing/pong-p5.webm" type="video/ogg"><br />
  Your browser does not support the video tag.<br />
</video></p>
<p>here&#8217;s the full code:</p>
<div class="coduino">
<div class="codutop-p"></div>
<div class="codumid">
<pre class="brush: arduino; title: ; notranslate">
/* edit of the pong sketch by 
//David Avetisyan, CP1, (4/5)
found on openprocessing.org

We changed the input control for
the paddle from keyboard to a 
linear potentiometer
*/

import processing.serial.*;
import cc.arduino.*;
import com.tinkerkit.*;

Arduino arduino;

TKPotentiometer pot;

Ball bally;
Paddle pongy;
int t= 1;
int p=255;
void setup()
{

  arduino = new Arduino(this, Arduino.list()[0], 57600);    

  smooth();
  size(600, 500);
  bally= new Ball();
  pongy= new Paddle();
  
  pot = new TKPotentiometer(arduino, TK.I0);
}

void draw()
{
  background(0);
  pongy.show();
  pongy.move();
  bally.show();
  bally.bounce();
  bally.move();
}
class Ball
{
  int x, y;
  boolean Up, Right;
  Ball()
  {

    x= 250;
    y= 0;
    boolean Up= false;
    boolean Right= true ;
  }
  void show()
  {

    fill(255, 255, 255);

    ellipse(x, y, 20, 20);
  }
  void bounce()
  {
    if (get(x, y+16) == color(0, 255, 0))
    {
      Up=true;
      p=-10;
    }
    if (y&gt;500)
    {
      x=250;
      y=0;
    }

    if (x==0)
    {
      Right=true;
    }
    if (x==600)
    {
      Right=false;
    }

    if (y==0)
    {
      Up=false;
    }
  }
  void move()
  {
    if (Right== true)
    {
      x=x+5;
    }
    else
    {
      x=x-5;
    }
    if (Up== true)
    {
      y=y-5;
    }
    else
    {
      y=y+5;
    }
  }
}

class Paddle
{
  int x, y;
  boolean left, right;
  Paddle()
  {

    x= 100;
    y= 480;
    boolean left= false;
    boolean right= true ;
  }
  void show()
  {

    fill(0, 255, 0);
    rect(x, y, 100, 25);
  }
  void move()
  {

    if (x&gt;495)
    {
      x=500;
    }
    if (x&lt;0)
    {
      x=0;
    }

  float val = pot.get();
  
  x = map(val,0,1023,0,width);

//    if ( keyPressed== true &amp;&amp; key=='a')
//    {
//      x=x-10;
//    }
//    if ( keyPressed==true &amp;&amp; key=='d')
//    {
//      x=x+10;
//    }
//    if (keyPressed==true &amp;&amp; key=='r')
//    {
//    }
  }
}

</pre>
</div>
<div class="codubot-p"></div>
</div>
<div class="tutorials-nav">
<a href="http://www.tinkerkit.com/map-and-calibration/"></p>
<div class="tutnav-button tutnav-button-left left">
		<span>Map &#038; Calibration</span>
		</div>
<p>	</a>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.tinkerkit.com/existing-sketches/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://tinkerkit.com/bp/video/tutorials/processing/pong-p5.mp4" length="312857" type="video/mp4" />
<enclosure url="http://tinkerkit.com/bp/video/tutorials/processing/pong-p5.webm" length="83858" type="application/wordperfect" />
		</item>
	</channel>
</rss>
