<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Playwithmyled.com</title>
	
	<link>http://playwithmyled.com</link>
	<description />
	<lastBuildDate>Mon, 05 Dec 2011 03:30:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/playwithmyled" /><feedburner:info uri="playwithmyled" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>The emergence of a flower robot</title>
		<link>http://feedproxy.google.com/~r/playwithmyled/~3/TSgUAItkZ6M/</link>
		<comments>http://playwithmyled.com/2011/11/its-a-flower-robot/#comments</comments>
		<pubDate>Sun, 06 Nov 2011 16:15:56 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[LILA]]></category>

		<guid isPermaLink="false">http://playwithmyled.com/?p=401</guid>
		<description />
			<content:encoded><![CDATA[<p><iframe src="http://www.youtube.com/embed/K9nNkCqT9rk?hd=1" frameborder="0" width="550" height="309"></iframe></p>
<img src="http://feeds.feedburner.com/~r/playwithmyled/~4/TSgUAItkZ6M" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://playwithmyled.com/2011/11/its-a-flower-robot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://playwithmyled.com/2011/11/its-a-flower-robot/</feedburner:origLink></item>
		<item>
		<title>Swash plate actuated by three servos</title>
		<link>http://feedproxy.google.com/~r/playwithmyled/~3/3huGvDKddps/</link>
		<comments>http://playwithmyled.com/2011/09/swash-plate-actuated-by-three-servos/#comments</comments>
		<pubDate>Sat, 01 Oct 2011 00:34:07 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://playwithmyled.com/?p=358</guid>
		<description><![CDATA[These lasts weeks, I work a little on the first idea that makes me renew with DIY electronics. I won&#8217;t currently tell what it is all about, I&#8217;m not ready for that now. But I want to share what giving me a headache for now. The idea is to make a plane tilt and lift, [...]]]></description>
			<content:encoded><![CDATA[<div>
<p>These lasts weeks, I work a little on the first idea that makes me renew with DIY electronics. I won&#8217;t currently tell what it is all about, I&#8217;m not ready for that now. But I want to share what giving me a headache for now. The idea is to make a plane tilt and lift, following the movement of three servo actuators. The following video of the cardboard prototype demonstrate the mechanism.</p>
</div>
<p class="youtube_sc" style="width:530px; height:319px;"><noscript><style type="text/css">iframe.youtube-player{width:0;height:0;display:none;}</style><object width="530" height="319"><param name="movie" value="http://www.youtube.com/v/z3BwXRyAc1k?version=2&amp;hl=en_US"></param><param name="allowscriptaccess" value="always"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/z3BwXRyAc1k?version=2&amp;hl=en_US" type="application/x-shockwave-flash" wmode="transparent" allowscriptaccess="always" width="530" height="319"></embed></object></noscript><iframe title="YouTube video player" class="youtube-player" type="text/html" width="530" height="319" src="http://www.youtube.com/embed/z3BwXRyAc1k?version=2&amp;hl=en_US&amp;wmode=transparent" frameborder="0"></iframe></p>
<div>
<p>Recently I replace the mechanical part with a RC helicopter swash plate. It&#8217;s much more efficient for this prototype.</p>
</div>
<p><img class="alignnone size-medium wp-image-380" title="The swash plate" src="http://playwithmyled.com/wp-content/uploads/2011/09/IMG_3580-530x397.jpg" alt="The swash plate" width="530" height="397" /></p>
<p><img class="alignnone size-medium wp-image-381" title="Servos, linkages and swash plate" src="http://playwithmyled.com/wp-content/uploads/2011/09/IMG_3584-530x706.jpg" alt="Servos, linkages and swash plate" width="530" height="706" /></p>
<p><img class="alignnone size-medium wp-image-382" title="The body and the servos linked to the Arduino" src="http://playwithmyled.com/wp-content/uploads/2011/09/IMG_3605-530x397.jpg" alt="The body and the servos linked to the Arduino" width="530" height="397" /></p>
<div>
<p>I tried to do the formula myself, but I&#8217;m really rusted in trigonometry. A friend&#8217;s coworker give me great help. He wrote the formula I needed to make the motor move like I imagine.</p>
<p>I wanted the servo motors to be actuated from a given angle of inclination, the direction of this inclination and an offset in height. There is the formula. It needs some adjustment for the offset. I still don&#8217;t really understand how to calculate it. I want the height to be relative to the ray of the swash plate.</p>
</div>
<pre>void calculateHeights( double phi, double theta, double H, double R, double &amp;L1, double &amp;L2, double &amp;L3 )
{
	const double phi1 =   0*pi/180;
	const double phi2 = 120*pi/180;
	const double phi3 = 240*pi/180;

	double x1 = R*cos(phi1);
	double y1 = R*sin(phi1);

	double x2 = R*cos(phi2);
	double y2 = R*sin(phi2);

	double x3 = R*cos(phi3);
	double y3 = R*sin(phi3);

	double nx = cos(theta)*sin(phi);
	double ny = sin(theta)*sin(phi);
	double nz = cos(phi);

	double D = nz*H;

	L1 = ( D - nx*x1 - ny*y1 ) / nz;
	L2 = ( D - nx*x2 - ny*y2 ) / nz;
	L3 = ( D - nx*x3 - ny*y3 ) / nz;
}</pre>
<p class="youtube_sc" style="width:530px; height:319px;"><noscript><style type="text/css">iframe.youtube-player{width:0;height:0;display:none;}</style><object width="530" height="319"><param name="movie" value="http://www.youtube.com/v/JsY3YQOyAPw?version=2&amp;hl=en_US"></param><param name="allowscriptaccess" value="always"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/JsY3YQOyAPw?version=2&amp;hl=en_US" type="application/x-shockwave-flash" wmode="transparent" allowscriptaccess="always" width="530" height="319"></embed></object></noscript><iframe title="YouTube video player" class="youtube-player" type="text/html" width="530" height="319" src="http://www.youtube.com/embed/JsY3YQOyAPw?version=2&amp;hl=en_US&amp;wmode=transparent" frameborder="0"></iframe></p>
<p>This is it for now. I&#8217;ll work on the function and get back with it. If you understand more than me, any help is welcome!</p>
<img src="http://feeds.feedburner.com/~r/playwithmyled/~4/3huGvDKddps" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://playwithmyled.com/2011/09/swash-plate-actuated-by-three-servos/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://playwithmyled.com/2011/09/swash-plate-actuated-by-three-servos/</feedburner:origLink></item>
		<item>
		<title>Buttons box for my son</title>
		<link>http://feedproxy.google.com/~r/playwithmyled/~3/B_kAc0W68Gg/</link>
		<comments>http://playwithmyled.com/2010/12/buttons-box-for-my-son/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 08:32:34 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Kid's Buttons Box]]></category>

		<guid isPermaLink="false">http://playwithmyled.com/?p=315</guid>
		<description><![CDATA[There is the project I&#8217;m going to give to my two years old son this Christmas. He like playing with all kinds of buttons he found everywhere. But they almost done nothing for him, except the ones on my dryer. So I decided to give him an experience box made of many kinds of button [...]]]></description>
			<content:encoded><![CDATA[<p>There is the project I&#8217;m going to give to my two years old son this Christmas. He like playing with all kinds of buttons he found everywhere. But they almost done nothing for him, except the ones on my dryer. So I decided to give him an experience box made of many kinds of button that take different action on lights and a motor.</p>
<p>There are only three little electronic circuits in the box. The rest is only wiring. One circuit is a flip flop to make the two red leds flashes and the other one is an And Gate to make the two arcade button light up the yellow led only when the two button are pressed, the last one is a bicycle flash hacked to fit the panic button.</p>
<p>There are nothing much more to explain about this box, the pictures and the video will tell you all.</p>
<h3>The final product</h3>
<p><img title="The final product" src="http://playwithmyled.com/wp-content/uploads/2010/12/IMG_0902-530x397.jpg" alt="The final product" width="530" height="397" /></p>
<h3>Purchased buttons and other parts</h3>
<p><img class="alignnone size-medium wp-image-320" title="Purchased buttons and other parts" src="http://playwithmyled.com/wp-content/uploads/2010/12/IMG_0620-530x397.jpg" alt="Purchased buttons and other parts" width="530" height="397" /></p>
<h3>Mesuring parts</h3>
<p><img class="alignnone size-medium wp-image-319" title="Mesure all parts" src="http://playwithmyled.com/wp-content/uploads/2010/12/IMG_0617-530x397.jpg" alt="Mesure all parts" width="530" height="397" /></p>
<h3>Buttons and lights placement</h3>
<p><img class="alignnone size-medium wp-image-325" title="Buttons and lights placement" src="http://playwithmyled.com/wp-content/uploads/2010/12/IMG_0654-530x706.jpg" alt="Buttons and lights placement" width="530" height="706" /></p>
<h3>The box</h3>
<p><img class="alignnone size-medium wp-image-322" title="The box" src="http://playwithmyled.com/wp-content/uploads/2010/12/IMG_0627-530x397.jpg" alt="The box" width="530" height="397" /></p>
<h3>Drilling the holes</h3>
<p><img class="alignnone size-medium wp-image-326" title="Drilling the holes" src="http://playwithmyled.com/wp-content/uploads/2010/12/IMG_0657-530x397.jpg" alt="Drilling the holes" width="530" height="397" /></p>
<h3>Prototyping the flip flip and the gate circuit</h3>
<p><img class="alignnone size-medium wp-image-323" title="Prototyping the flip flip and the gate circuit" src="http://playwithmyled.com/wp-content/uploads/2010/12/IMG_0628-530x397.jpg" alt="Prototyping the flip flip and the gate circuit" width="530" height="397" /></p>
<h3>Building the final circuit board</h3>
<p><img class="alignnone size-medium wp-image-327" title="Building the final circuit board" src="http://playwithmyled.com/wp-content/uploads/2010/12/IMG_0667-530x397.jpg" alt="Building the final circuit board" width="530" height="397" /></p>
<h3>The completed circuit board</h3>
<p><img class="alignnone size-medium wp-image-331" title="The completed circuit board" src="http://playwithmyled.com/wp-content/uploads/2010/12/IMG_0897-530x397.jpg" alt="The completed circuit board" width="530" height="397" /></p>
<h3>The circuit is packed in an antistatic bag. This is for isolate it from the mess of wires you will see on the next picture.</h3>
<p><img class="alignnone size-medium wp-image-330" title="The circuit packed in an antistatic bag" src="http://playwithmyled.com/wp-content/uploads/2010/12/IMG_0895-530x397.jpg" alt="The circuit packed in an antistatic bag" width="530" height="397" /></p>
<h3>The wiring inside the box</h3>
<p><img class="alignnone size-medium wp-image-329" title="The wiring inside the box" src="http://playwithmyled.com/wp-content/uploads/2010/12/IMG_0894-530x397.jpg" alt="The wiring inside the box" width="530" height="397" /></p>
<h3>And finally a demo</h3>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="530" height="422" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/FFig4PHs8Js?fs=1&amp;hl=en_US" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="530" height="422" src="http://www.youtube.com/v/FFig4PHs8Js?fs=1&amp;hl=en_US" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<img src="http://feeds.feedburner.com/~r/playwithmyled/~4/B_kAc0W68Gg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://playwithmyled.com/2010/12/buttons-box-for-my-son/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://playwithmyled.com/2010/12/buttons-box-for-my-son/</feedburner:origLink></item>
		<item>
		<title>Please follow the protocol</title>
		<link>http://feedproxy.google.com/~r/playwithmyled/~3/6QIqMkdVoQQ/</link>
		<comments>http://playwithmyled.com/2010/11/please-follow-the-protocol/#comments</comments>
		<pubDate>Sun, 07 Nov 2010 00:49:50 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Glowing Marquee]]></category>
		<category><![CDATA[Insek]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://playwithmyled.com/?p=292</guid>
		<description><![CDATA[As you have seen, the hardware part of the Glowing Marque prototype, build from an old scanner, is functioning. The last step I did is the programming of a protocol to communicate with the Arduino by the Insek Proxy. The first issue is that I want to send a string of hexadecimal values and then [...]]]></description>
			<content:encoded><![CDATA[<p>As you have seen, the hardware part of the Glowing Marque prototype, build from an old scanner, is functioning. The last step I did is the programming of a protocol to communicate with the Arduino by the Insek Proxy.</p>
<p>The first issue is that I want to send a string of hexadecimal values and then convert it to real hex in the Arduino for displaying this data. The second problem to solve is to send a longer string that the serial buffer and the buffer of the Messenger library.</p>
<p>There is the piece of code I did for the protocol:</p>
<pre>#include &lt;Messenger.h&gt;

#define DATASIZE 70
unsigned char data[DATASIZE+1]; // + 1 space for the closing \0 char.

Messenger message = Messenger();

/*
	2010-11-03: Append data.
	Args: source, target, position to start from zero to DATASIZE.
*/
void appendData(char * s, unsigned char * dp, int pos) {

	// Create and reset the pointer to display data.
	dp = dp + pos; // Move to starting position.

	char monkey[3];
	long chimp;
	for (int i=0; i&lt;strlen(s); i=i+2) {
		monkey[0] = s[i];
		monkey[1] = s[i+1];
		monkey[2] = '\0';

		// Convert the monkey string to long int.
		chimp = strtol(monkey, NULL, 16);

		// Append chimp to displayData;
		*dp++ = (unsigned char)chimp; // Cast the long to an unsigned char.

		//Serial.print(chimp, BYTE);
	}

	*dp = '\0'; // Close the string.

}

void messageCompleted() {

	//Serial.println("Message completed.");

	while ( message.available() ) {
		//Serial.print(".");
		if ( message.checkString("data") ) { // Show text.

			if( message.checkString("flush")) {
				flushData();
				Serial.println("\nData flushed.");

			} else {
				// 1st get position
				int pos = message.readInt();

				// 2nd get length
				int length = message.readInt();

				// 3rd get data
				char tmp_data[128];

				// Move data to the temps string.
				message.copyString(tmp_data, 128);

				// Check if data length
				// Find the first position of the \0.
				int data_length = strlen(tmp_data);

				// Data are always 2 char to build one hex value.
				if( length*2 == data_length) {

						if( pos + data_length - 1 &gt; DATASIZE) {
							Serial.println("\nData overflow.");
						} else {

						//Serial.println(strlen(tmp_data));

						//Serial.println(tmp_data);

						appendData(tmp_data, &amp;data[0], pos);

						Serial.println("");
						Serial.println("Data:");

						for(int a=0; a &lt; DATASIZE; a++) {
							if( data[a] == '\0' ) {
								Serial.print("-");
							} else {
								Serial.print(data[a], BYTE);
							}
						}
					}
				} else {
					Serial.println("Bad checksum.");
				}

			} // End append data.

		} else {
			message.readChar(); // Flush the rest of the message buffer.
		}

	}
}

void flushData() {
	for(int i=0; i&lt;DATASIZE+1; i++) {
		data[i] = '\0';
	}
}

void setup() {

	Serial.begin(9600);
	message.attach(messageCompleted);

}
void loop() {
	while ( Serial.available( ) ) message.process(Serial.read( ) );
}</pre>
<p>The protocol is relatively simple, there is the structure:</p>
<pre>header position length data</pre>
<ul>
<li>The &#8216;header&#8217; is the command, what the Arduino have to do with that string. I use &#8216;data&#8217; as the header to send data.</li>
<li>The &#8216;position&#8217; is the position in the array the data will be copied.</li>
<li>The &#8216;length&#8217; is the quantity of numbers to send. It&#8217;s used to check if the Arduino received the right length of data and to verify if the data will not overflow the data array.</li>
</ul>
<p>There is an example to send a first packet of data:</p>
<pre>data 0 4 ff00ff00</pre>
<p>Here I send four numbers build with two hexadecimal characters (from 00 to ff). They will be placed at the beginning of the array.</p>
<p>If I want to append &#8216;ddee33&#8242; to this value in the array, I shall use this call:</p>
<pre>data 4 3 ddee</pre>
<p>So this way I can send many blocks of data and built an array longer than the serial buffer.</p>
<p>After that I can implement other calls to work with this data. A sample call can be (not built in this sample code): show data. I did that in code of the Glowing Marquee project, so I send packets of hex data, and ask the Arduino to show it. I will be back with more on this project in my next posts.</p>
<img src="http://feeds.feedburner.com/~r/playwithmyled/~4/6QIqMkdVoQQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://playwithmyled.com/2010/11/please-follow-the-protocol/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://playwithmyled.com/2010/11/please-follow-the-protocol/</feedburner:origLink></item>
		<item>
		<title>Array of function pointers with mixed parameters</title>
		<link>http://feedproxy.google.com/~r/playwithmyled/~3/7gSviPTs_VY/</link>
		<comments>http://playwithmyled.com/2010/10/arrays-of-function-pointers-with-mixed-parameters/#comments</comments>
		<pubDate>Tue, 19 Oct 2010 00:55:18 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://playwithmyled.com/?p=278</guid>
		<description><![CDATA[This is my work to create an array of function pointers which they can accept one parameter of any kind. /* 2010-10-18: Basics of array of function pointers. The trick here is to make these functions accept different types of parameters using a void pointer. */ // Define the function pointer type. // The void [...]]]></description>
			<content:encoded><![CDATA[<p>This is my work to create an array of function pointers which they can accept one parameter of any kind.</p>
<pre>
/*
	2010-10-18: Basics of array of function pointers.
	The trick here is to make these functions accept different
	types of parameters using a void pointer.
*/

// Define the function pointer type.
// The void pointer can be casted to any type of value.
typedef void(*fctPtr)(void *);

// Declare the functions.
void fA(void *arg);
void fB(void *arg);
void fC(void *arg);

// Declare an array of functions pointers.
fctPtr f[3] = {fA,fB,fC}; // Array of function name (the pointer to that name).

// The functions.
void fA(void *arg) {

	// Cast as a pointer to an int and assign it's value to r.
	int r = *(int*)arg;

	Serial.print(&quot;fA:&quot;);
	Serial.println(r);
}
void fB(void *arg) {

	// Cast as a pointer to a string of chars.
	char * str = (char*)arg;

	Serial.print(&quot;fB:&quot;);
	Serial.println(str);
}
void fC(void *arg) {
	Serial.println(&quot;fC:Called with no parameter.&quot;);
}

void setup() {
	Serial.begin(9600);
	delay(1000); // Wait a second.

	int a = 123;
	(*f[0])(&amp;a); // Call the first function of the array of functions.

	char b[] = &quot;This is a test!&quot;;
	(*f[1])(&amp;b);

	// Calling a function with no parameter.
	(*f[2])(NULL);
	// This call also work : (*f[2])(0).
}

void loop() {}
</pre>
<img src="http://feeds.feedburner.com/~r/playwithmyled/~4/7gSviPTs_VY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://playwithmyled.com/2010/10/arrays-of-function-pointers-with-mixed-parameters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://playwithmyled.com/2010/10/arrays-of-function-pointers-with-mixed-parameters/</feedburner:origLink></item>
		<item>
		<title>Insek Internet to serial relay 02 released</title>
		<link>http://feedproxy.google.com/~r/playwithmyled/~3/qT2AuqB-jUY/</link>
		<comments>http://playwithmyled.com/2010/10/insek-internet-to-serial-relay-02-released/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 04:38:10 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Insek]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://playwithmyled.com/?p=275</guid>
		<description><![CDATA[After many hours of coding, the version 02 is now out! The application now make the relay in both direction. You can send string from the net to your Arduino, and send string from this serial device to your Web API. I invite you to try it and share your comments!]]></description>
			<content:encoded><![CDATA[<p>After many hours of coding, the version 02 is now out! The application now make the relay in both direction. You can send string from the net to your Arduino, and send string from this serial device to your Web API. I invite you to try it and share your comments!</p>
<img src="http://feeds.feedburner.com/~r/playwithmyled/~4/qT2AuqB-jUY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://playwithmyled.com/2010/10/insek-internet-to-serial-relay-02-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://playwithmyled.com/2010/10/insek-internet-to-serial-relay-02-released/</feedburner:origLink></item>
		<item>
		<title>A work in progress</title>
		<link>http://feedproxy.google.com/~r/playwithmyled/~3/kcj6LxmiIwg/</link>
		<comments>http://playwithmyled.com/2010/09/a-work-in-progress/#comments</comments>
		<pubDate>Wed, 29 Sep 2010 21:24:57 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Insek]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://playwithmyled.com/?p=237</guid>
		<description><![CDATA[The summer is over, so much time to type some lines of code. I work hard to make an updated version of my little Integer to serial relay, Insek. Obj-c is not familiar for me, but I like to lern it. I&#8217;ve just created a project page on Google code to distribute the files, show code [...]]]></description>
			<content:encoded><![CDATA[<p>The summer is over, so much time to type some lines of code. I work hard to make an updated version of my little Integer to serial relay, Insek. Obj-c is not familiar for me, but I like to lern it. I&#8217;ve just created a project page on Google code to distribute the files, show code examples, and maintain the development. Currently, I&#8217;m working on the communication from the serial device (the Arduino) to the computer (Insek). It&#8217;s work, but I have many issue with the the data inputs buffering. Follow the development on <a href="http://code.google.com/p/insek">Insek project home page</a>. If you can help developing this project, you are welcome!</p>
<img src="http://feeds.feedburner.com/~r/playwithmyled/~4/kcj6LxmiIwg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://playwithmyled.com/2010/09/a-work-in-progress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://playwithmyled.com/2010/09/a-work-in-progress/</feedburner:origLink></item>
		<item>
		<title>Canon SX10 remote control for 3 bucks</title>
		<link>http://feedproxy.google.com/~r/playwithmyled/~3/85fJtwOl3dw/</link>
		<comments>http://playwithmyled.com/2010/06/canon-sx10-remote-control-for-3-bucks/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 16:35:28 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Mixed]]></category>

		<guid isPermaLink="false">http://playwithmyled.com/?p=226</guid>
		<description><![CDATA[I recently hacked my Canon SX10 IS with the CHDK pack. This add the nice feature to remotely trigger the camera. Really useful to do night shooting. I wanted to make a cheap but efficient remote control. I found all the needed parts in a Dollarama dollar store for only 3$. In the headlamp we [...]]]></description>
			<content:encoded><![CDATA[<p>I recently hacked my Canon SX10 IS with the CHDK pack. This add the nice feature to remotely trigger the camera. Really useful to do night shooting. I wanted to make a cheap but efficient remote control. I found all the needed parts in a Dollarama dollar store for only 3$. In the headlamp we have all I needed: a 3 AAA battery holder and a trigger push button. I simply replaced de leds circuit by the USB extension cable. And now, I&#8217;m ready to do long exposition steady shots!</p>
<p><a href="http://playwithmyled.com/2010/06/canon-sx10-remote-control-for-3-bucks/img_8668/" rel="attachment wp-att-228"><img src="http://playwithmyled.com/wp-content/uploads/2010/06/IMG_8668-530x397.jpg" alt="Cheap digital camera USB remote control" title="Cheap digital camera USB remote control" width="530" height="397" class="alignnone size-medium wp-image-228" /></a></p>
<img src="http://feeds.feedburner.com/~r/playwithmyled/~4/85fJtwOl3dw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://playwithmyled.com/2010/06/canon-sx10-remote-control-for-3-bucks/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://playwithmyled.com/2010/06/canon-sx10-remote-control-for-3-bucks/</feedburner:origLink></item>
		<item>
		<title>A teaser of the Glowing Marquee</title>
		<link>http://feedproxy.google.com/~r/playwithmyled/~3/mQTQd4QRTwg/</link>
		<comments>http://playwithmyled.com/2010/06/a-teaser-of-the-glowing-marquee/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 05:29:08 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Glowing Marquee]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://playwithmyled.com/?p=219</guid>
		<description />
			<content:encoded><![CDATA[<p><object width="530" height="425"><param name="movie" value="http://www.youtube.com/v/FmZBUPVNsL8&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/FmZBUPVNsL8&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="530" height="425"></embed></object></p>
<img src="http://feeds.feedburner.com/~r/playwithmyled/~4/mQTQd4QRTwg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://playwithmyled.com/2010/06/a-teaser-of-the-glowing-marquee/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://playwithmyled.com/2010/06/a-teaser-of-the-glowing-marquee/</feedburner:origLink></item>
		<item>
		<title>Stepper motor controller circuit and code</title>
		<link>http://feedproxy.google.com/~r/playwithmyled/~3/Rm9rxv2lzEw/</link>
		<comments>http://playwithmyled.com/2010/05/stepper-motor-controller-circuit-and-code/#comments</comments>
		<pubDate>Sun, 30 May 2010 02:04:28 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Glowing Marquee]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://playwithmyled.com/?p=99</guid>
		<description><![CDATA[I build a step motor controller based on the schematics found on the Arduino Web site. First I try the 2 pins one for bipolar stepper motor. I wont be able to make it work, even less with the library available on the site. Maybe I&#8217;m dumb and I really dont understand something, but this [...]]]></description>
			<content:encoded><![CDATA[<p>I build a step motor controller based on the <a href="http://arduino.cc/en/Reference/StepperBipolarCircuit">schematics</a> found on the Arduino Web site. First I try the 2 pins one for bipolar stepper motor. I wont be able to make it work, even less with the library available on the site. Maybe I&#8217;m dumb and I really dont understand something, but this circuit keeps both coils active at the same time.</p>
<p>So I tried the second circuit, the 4 pins one. With the same library I wasn&#8217;t able to make it work either. So I create a piece of code of my own and I finally managed to make the motor run correctly.</p>
<p>After that, I realize that I can merge the to circuits to possibly create a PWM abled bipolar motor controller with the L297D. A somewhat bizzare idea, but I think it&#8217;s possible if we can program the Arduino to send 4 synced PWM signals. I&#8217;ll come back later (maybe never) with this thought. After some research I found that the TI DRV8811 and the Allegro A3977 are much more appropriate chips to do microstepping.</p>
<p>But for now, there is my circuit. It&#8217;s advantage is that it can release the coils. <a href="http://playwithmyled.com/2010/05/stepper-motor-controller-circuit-and-code/steppercontroller-fz/">Download the schematics</a> (Fritzing format).</p>
<p><a rel="attachment wp-att-108" href="http://playwithmyled.com/2010/05/stepper-motor-controller-circuit-and-code/stepper-controller-2/"><img class="alignnone size-medium wp-image-108" title="Stepper motor controller" src="http://playwithmyled.com/wp-content/uploads/2010/05/Stepper-Controller-530x397.jpg" alt="" width="530" height="397" /></a></p>
<p>The two PNP transistors are connected like the circuit proposed on the Arduino Web site. Plus, I use the enable pins. So my circuit needs four pins, and I don&#8217;t found a way to use less.</p>
<h3>Parts list</h3>
<p><!-- p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 17.0px Helvetica} --></p>
<ul>
<li>1 x Arduino</li>
<li>1 x L293 Quadruple Half H-Bridge</li>
<li>2 x 1K Ohm Resistors</li>
<li>2 x 10K Ohm Resistors</li>
<li>2 x 2N2222 PnP Transistors</li>
<li>1 x Bipolar Step Motor</li>
</ul>
<p>There is the sequence to make the motor turn one direction, invert it to make it turn the other.</p>
<table class="table-wh control">
<caption> Control sequence<br />
</caption>
<tbody>
<tr>
<th scope="col">CTRL A</th>
<th scope="col">EN A</th>
<th scope="col">CTRL B</th>
<th scope="col">EN B</th>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>0</td>
<td>0</td>
<td>0</td>
<td>1</td>
</tr>
<tr>
<td>0</td>
<td>1</td>
<td>0</td>
<td>0</td>
</tr>
</tbody>
</table>
<p>There is my code to control the stepper motor. Like you see in my code I use direct port command to take less processor time. And I create a function called in the main loop for each steps. This way the code can do something else when the motor is running.</p>
<pre>/*
	Stepper Motor Controller
	by Kevin Filteau 2010-05-29
	Playwithmyled.com
*/

// Motor controller pins.
#define pinMotorCtrlA 4
#define pinMotorCtrlB 7
#define pinMotorEnA 5
#define pinMotorEnB 6

// Direction constants.
#define GOLEFT 0
#define GORIGHT 1

// Motor states and position.
boolean motorRunning = false;
int motorMax = 700;
int motorPos = 0;

/**********************************************
	MOTOR
**********************************************/

// Setup the motor.
void motorSetup() {
  pinMode(pinMotorCtrlA, OUTPUT);
  pinMode(pinMotorCtrlB, OUTPUT);
  pinMode(pinMotorEnA, OUTPUT);
  pinMode(pinMotorEnB, OUTPUT);
  // Everybody to LOW.
  digitalWrite(pinMotorCtrlA, LOW);
  digitalWrite(pinMotorCtrlB, LOW);
  digitalWrite(pinMotorEnA, LOW);
  digitalWrite(pinMotorEnB, LOW);
}

// Free the motor.
void motorFree() {
  digitalWrite(pinMotorEnA, LOW);
  digitalWrite(pinMotorEnB, LOW);
}

// Make the motor spin one step in the direction specified.
// Pins    7654 ----
// Binary 0000 0000
void motorSpin(boolean dir) {

	static int pos = 0; // Starting step pos.

	int stepsSeq[] = {0xC0,0x30,0x40,0x20}; // Registry value.
	int st;

  // Timing
  static unsigned long previousMillis;
  long interval = 3;

	if(millis() - previousMillis &gt; interval) {
		previousMillis = millis();

		st = stepsSeq[pos];
		if( dir == GOLEFT ) {
			pos++; if(pos&gt;3) pos=0;
			motorPos++;
		} else {
			pos--; if(pos&lt;0) pos=3;
			motorPos--;
		}
		PORTD &amp;= 0xF;
		PORTD |= st;
	}

}

/**********************************************
	MAIN FUNCTIONS.
**********************************************/
void setup() {
	motorSetup();

}

void loop() {
	motorSpin(GOLEFT);
	// motorSpin(GORIGHT);
}</pre>
<p>And to close this post. Some pictures of the prototype, the finalized circuit board (useful for the pinout) and a video taken while testing the circuit.</p>
<p><a rel="attachment wp-att-131" href="http://playwithmyled.com/2010/05/stepper-motor-controller-circuit-and-code/l293d-motor-controller-proto-1/"><img class="alignnone size-medium wp-image-131" title="L293D stepper motor controller proto" src="http://playwithmyled.com/wp-content/uploads/2010/05/l293d-motor-controller-proto-1-530x397.jpg" alt="" width="530" height="397" /></a></p>
<p><a rel="attachment wp-att-132" href="http://playwithmyled.com/2010/05/stepper-motor-controller-circuit-and-code/l293d-motor-controller-proto-2/"><img class="alignnone size-medium wp-image-132" title="L293D stepper motor controller proto 2" src="http://playwithmyled.com/wp-content/uploads/2010/05/l293d-motor-controller-proto-2-530x397.jpg" alt="" width="530" height="397" /></a></p>
<p><a rel="attachment wp-att-135" href="http://playwithmyled.com/2010/05/stepper-motor-controller-circuit-and-code/l293d-motor-controller-circuit-board/"><img class="alignnone size-medium wp-image-135" title="L293D stepper motor controller circuit board and pinout" src="http://playwithmyled.com/wp-content/uploads/2010/05/l293d-motor-controller-circuit-board-530x397.jpg" alt="" width="530" height="397" /></a></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="530" height="425" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube-nocookie.com/v/euxCAeJZmCE&amp;hl=en_US&amp;fs=1&amp;rel=0" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="530" height="425" src="http://www.youtube-nocookie.com/v/euxCAeJZmCE&amp;hl=en_US&amp;fs=1&amp;rel=0" allowfullscreen="true" allowscriptaccess="always"></embed></object></p>
<img src="http://feeds.feedburner.com/~r/playwithmyled/~4/Rm9rxv2lzEw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://playwithmyled.com/2010/05/stepper-motor-controller-circuit-and-code/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		<feedburner:origLink>http://playwithmyled.com/2010/05/stepper-motor-controller-circuit-and-code/</feedburner:origLink></item>
	</channel>
</rss>

