<?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.elasticsheep.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/" version="2.0">

<channel>
	<title>Elastic Sheep</title>
	
	<link>http://elasticsheep.com</link>
	<description>Because elasticdog was already taken</description>
	<lastBuildDate>Tue, 31 Jan 2012 19:09:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="elasticsheep" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://elasticsheep.com/feed/" /><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Felasticsheep.com%2Ffeed%2F" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Felasticsheep.com%2Ffeed%2F" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Felasticsheep.com%2Ffeed%2F" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.bloglines.com/sub/http://elasticsheep.com/feed/" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Felasticsheep.com%2Ffeed%2F" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://fusion.google.com/add?feedurl=http%3A%2F%2Felasticsheep.com%2Ffeed%2F" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Felasticsheep.com%2Ffeed%2F" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.plusmo.com/add?url=http%3A%2F%2Felasticsheep.com%2Ffeed%2F" src="http://plusmo.com/res/graphics/fbplusmo.gif">Subscribe with Plusmo</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.thefreedictionary.com/_/hp/AddRSS.aspx?http%3A%2F%2Felasticsheep.com%2Ffeed%2F" src="http://img.tfd.com/hp/addToTheFreeDictionary.gif">Subscribe with The Free Dictionary</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.bitty.com/manual/?contenttype=rssfeed&amp;contentvalue=http%3A%2F%2Felasticsheep.com%2Ffeed%2F" src="http://www.bitty.com/img/bittychicklet_91x17.gif">Subscribe with Bitty Browser</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.live.com/?add=http%3A%2F%2Felasticsheep.com%2Ffeed%2F" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://mix.excite.eu/add?feedurl=http%3A%2F%2Felasticsheep.com%2Ffeed%2F" src="http://image.excite.co.uk/mix/addtomix.gif">Subscribe with Excite MIX</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.webwag.com/wwgthis.php?url=http%3A%2F%2Felasticsheep.com%2Ffeed%2F" src="http://www.webwag.com/images/wwgthis.gif">Subscribe with Webwag</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.podcastready.com/oneclick_bookmark.php?url=http%3A%2F%2Felasticsheep.com%2Ffeed%2F" src="http://www.podcastready.com/images/podcastready_button.gif">Subscribe with Podcast Ready</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.wikio.com/subscribe?url=http%3A%2F%2Felasticsheep.com%2Ffeed%2F" src="http://www.wikio.com/shared/img/add2wikio.gif">Subscribe with Wikio</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.dailyrotation.com/index.php?feed=http%3A%2F%2Felasticsheep.com%2Ffeed%2F" src="http://www.dailyrotation.com/rss-dr2.gif">Subscribe with Daily Rotation</feedburner:feedFlare><item>
		<title>Babyphone hardware design</title>
		<link>http://elasticsheep.com/2012/01/babyphone-hardware-design/</link>
		<comments>http://elasticsheep.com/2012/01/babyphone-hardware-design/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 21:03:18 +0000</pubDate>
		<dc:creator>The Chief Sheep</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://elasticsheep.com/?p=995</guid>
		<description><![CDATA[Here are some details about the hardware design of my babyphone project. Case reuse One of the project goal was to reuse as much of the original speakerphone case as possible, including the power switch, volume control potentiometer, front leds and keyboard. I though that as the box already contained amplifiers circuits for the speaker [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Here are some details about the hardware design of my babyphone project.</strong></p>
<h3>Case reuse</h3>
<p>One of the project goal was to reuse as much of the original speakerphone case as possible, including the power switch, volume control potentiometer, front leds and keyboard. I though that as the box already contained amplifiers circuits for the speaker and the internal microphone, I could try to reuse those as well and design my project around them&#8230;</p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2012/01/original-circuit-1.jpg"><img class="aligncenter size-large wp-image-996" title="Speakerphone original circuit" src="http://elasticsheep.com/wp-content/uploads/2012/01/original-circuit-1-500x333.jpg" alt="" width="500" height="333" /></a></p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2012/01/original-circuit-2.jpg"><img class="aligncenter size-large wp-image-997" title="Speakerphone original circuit main board" src="http://elasticsheep.com/wp-content/uploads/2012/01/original-circuit-2-500x333.jpg" alt="" width="500" height="333" /></a></p>
<p>I first poked inside the existing circuit to find a way to simply insert my circuit in the amplifier paths. But I quickly realize I would use more time trying to reverse-engineering the design instead of building my own.</p>
<p>Then the only constraint was to keep the existing PCB footprint to ease the integration with the original switches.</p>
<h3>Prototyping</h3>
<p>Here is the breadboard prototype in its final stage:</p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2012/01/breadboard-prototype.jpg"><img class="aligncenter size-large wp-image-1004" title="Babyphone breadboard prototype" src="http://elasticsheep.com/wp-content/uploads/2012/01/breadboard-prototype-500x381.jpg" alt="" width="500" height="381" /></a></p>
<p>The design is build around an ATMEGA328 connected to an SD card through the SPI interface. Like in my previous audio player circuit, audio samples are played on a PWM output. The signal is filtered with an RC circuit and amplified by a LM386 to drive a 0.3W speaker.</p>
<p>The sound from the electret microphone is amplified by a <a href="http://www.sparkfun.com/products/8872">simple transistor circuit found on Sparkfun.com</a> and then connected to an ADC input of the microcontroller to be sampled.</p>
<p>The circuit is powered by a single 9V battery that provides a “high” voltage for the LM386 amplifier. A 3.3V regulator provides the digital power supply to the microcontroller and to the SD card.</p>
<p>I am using a 16MHz crystal for the extra speed bump despite the 3.3V voltage that would qualify this as “overclocking”.</p>
<h3>High current draw from the SD card</h3>
<p>One difficulty I met was having spike noise in the audio recorded by the microphone on the SD card. It appears the SD card draws a high level of current during write operations and this was affecting the stability of the microphone amplifier power supply.</p>
<p>Here is a capture of the signals on an oscilloscope while writing sectors on the SD card. The blue signal is the output of the microphone and the yellow signal is the input of the ADC pin:</p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2012/01/adc-noise-with-sd.jpg"><img class="aligncenter size-large wp-image-1007" title="Noise on ADC input while recording on the SD card" src="http://elasticsheep.com/wp-content/uploads/2012/01/adc-noise-with-sd-500x333.jpg" alt="" width="500" height="333" /></a></p>
<p>I tried to add decoupling capacitors around the SD card VCC and around the microphone amplifier to no avail. One solution I finally found in an <a href="www.actel.com/documents/PowerSupply_AN.pdf">application note from Actel</a>: use separate regulators for the digital and analog domains.</p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2012/01/separate-power-supplies.png"><img class="aligncenter size-full wp-image-1008" title="separate-power-supplies" src="http://elasticsheep.com/wp-content/uploads/2012/01/separate-power-supplies.png" alt="" width="450" height="202" /></a></p>
<p>So I added a second 3.3V regulator to provide an AVCC power supply to my microphone amplifier and an AREF reference voltage for the microcontroller.</p>
<p>No more noise, problem solved.</p>
<h3>Connection of the matrix keyboard</h3>
<p>The keyboard of the phone is on a separate PCB including two leds. This keyboard is using a matrix configuration with 19 keys arranged in 5 columns and 4 rows. The handsfree key is surprisingly wired separately. Four separate wires allow to control 2 front leds, a green one and a red one.</p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2012/01/matrix-keyboard-topology.png"><img class="aligncenter size-large wp-image-1010" title="Topology of the speakerphone matrix keyboard" src="http://elasticsheep.com/wp-content/uploads/2012/01/matrix-keyboard-topology-470x500.png" alt="" width="470" height="500" /></a></p>
<p>The keyboard PCB was connected to the main PCB through to a 17-wire ribbon cable. I reuse this cable by soldering a 0.1” header on it.</p>
<h3>Fitting the circuit inside the phone</h3>
<p>Considering the project is a one-shot, I choosed to use veroboards to solder my circuits.</p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2012/01/veroboard-fit.jpg"><img class="aligncenter size-large wp-image-1012" title="Veroboards cut to fit into the speakerphone case" src="http://elasticsheep.com/wp-content/uploads/2012/01/veroboard-fit-500x333.jpg" alt="" width="500" height="333" /></a></p>
<p>The big one will be the main board supporting the microcontroller, the SD card slot and a female header for the keyboard connection.</p>
<p>The upper-right board will be a power board supporting the two voltage regulator and the main power switch.</p>
<p>The lower-right board will be the analog board containing both amplifiers circuits and a slide potentiometer to adjust the speaker level. It will be connected to the microphone already molded into the case and from whom you can see the black and red wires on the picture.</p>
<p>The 9V battery will fit at the bottom of the case.</p>
<p>To ease the maintenance of the circuit, the boards will be connected together by wires secured by screw terminals.</p>
<h3>Building the boards</h3>
<p>Here is the power supply board:</p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2012/01/power-supply-board.jpg"><img class="aligncenter size-large wp-image-1013" title="Power supply board" src="http://elasticsheep.com/wp-content/uploads/2012/01/power-supply-board-500x333.jpg" alt="" width="500" height="333" /></a></p>
<p>The amplifier board connected to the power supply board:</p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2012/01/amplifier-board-1.jpg"><img class="aligncenter size-large wp-image-1015" title="Amplifier board" src="http://elasticsheep.com/wp-content/uploads/2012/01/amplifier-board-1-500x333.jpg" alt="" width="500" height="333" /></a></p>
<p>The amplifier in action playing a sinus signal coming from my laptop audio output:</p>
<p>
<p class="vimeo">
<object width="500" height="375">
  <param name="allowfullscreen" value="true" />
  <param name="allowscriptaccess" value="always" />
  <param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=30975820&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1" />
  <embed src="http://vimeo.com/moogaloop.swf?clip_id=30975820&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="500" height="375">
  </embed>
</object>
</p>
</p>
<p>And here is the main board. The SD card slot is a holder for a microSD. It is soldered on a right angle pin header.</p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2012/01/main-board.jpg"><img class="aligncenter size-large wp-image-1016" title="Main board with ATMEGA328 and SD card slot" src="http://elasticsheep.com/wp-content/uploads/2012/01/main-board-500x333.jpg" alt="" width="500" height="333" /></a></p>
<p>The main board has been cut to fit the prominent speaker magnet.</p>
<p>At the end everything fit together inside the case:</p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2012/01/circuit-in-case.jpg"><img class="aligncenter size-large wp-image-1017" title="Final babyphone circuit inside case" src="http://elasticsheep.com/wp-content/uploads/2012/01/circuit-in-case-500x333.jpg" alt="" width="500" height="333" /></a></p>
<p>Wires everywhere. In fact I am not really a fan of veroboards. It is a little tedious to assemble without proper planning&#8230;</p>
<h3>Hardware schematic</h3>
<p><a href="http://elasticsheep.com/wp-content/uploads/2012/01/babyphone-hw-schematic.jpg"><img class="aligncenter size-large wp-image-1018" title="Babyphone circuit HW schematic" src="http://elasticsheep.com/wp-content/uploads/2012/01/babyphone-hw-schematic-500x333.jpg" alt="" width="500" height="333" /></a></p>
<p>You could find the EagleCAD schematic along the source code files on the project repository: <a href="http://github.com/elasticsheep/babyphone">http://github.com/elasticsheep/babyphone</a></p>
<h3>Coming next</h3>
<p>The next post will details the software design side of the project. Stay tuned&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://elasticsheep.com/2012/01/babyphone-hardware-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Babyphone audio playback</title>
		<link>http://elasticsheep.com/2012/01/babyphone-audio-playback/</link>
		<comments>http://elasticsheep.com/2012/01/babyphone-audio-playback/#comments</comments>
		<pubDate>Sat, 21 Jan 2012 10:34:50 +0000</pubDate>
		<dc:creator>The Chief Sheep</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Audio]]></category>
		<category><![CDATA[Babyphone]]></category>

		<guid isPermaLink="false">http://elasticsheep.com/?p=979</guid>
		<description><![CDATA[The final circuit has been built inside the phone enclosure, including amplifiers for the speaker and the microphone. Playback and record modules are developped an tested but the application code only supports playback for the moment. Next I need to improve the matrix keyboard driver to allow multiple key detection to trigger the record of [...]]]></description>
			<content:encoded><![CDATA[<p>
<p class="vimeo">
<object width="500" height="375">
  <param name="allowfullscreen" value="true" />
  <param name="allowscriptaccess" value="always" />
  <param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=35164412&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1" />
  <embed src="http://vimeo.com/moogaloop.swf?clip_id=35164412&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="500" height="375">
  </embed>
</object>
</p>
</p>
<p>The final circuit has been built inside the phone enclosure, including amplifiers for the speaker and the microphone.</p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2012/01/inside_the_phone.jpg"><img src="http://elasticsheep.com/wp-content/uploads/2012/01/inside_the_phone-500x333.jpg" alt="" title="Circuit inside phone enclosure" width="500" height="333" class="aligncenter size-large wp-image-980" /></a></p>
<p>Playback and record modules are developped an tested but the application code only supports playback for the moment.</p>
<p>Next I need to improve the matrix keyboard driver to allow multiple key detection to trigger the record of a new sound. The key combination should be hard enough to prevent the boy from erasing existing message. </p>
]]></content:encoded>
			<wfw:commentRss>http://elasticsheep.com/2012/01/babyphone-audio-playback/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Current project</title>
		<link>http://elasticsheep.com/2011/09/current-project/</link>
		<comments>http://elasticsheep.com/2011/09/current-project/#comments</comments>
		<pubDate>Tue, 27 Sep 2011 10:04:42 +0000</pubDate>
		<dc:creator>The Chief Sheep</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Audio]]></category>
		<category><![CDATA[Babyphone]]></category>

		<guid isPermaLink="false">http://elasticsheep.com/?p=964</guid>
		<description><![CDATA[I am currently building a &#8220;baby phone&#8221; toy for my son based on a discarded landline phone enclosure. The toy will feature record and playback on SD card to allow family members to record messages on the device. Voice messages would be played back when pressing a key of the original phone keyboard. The plan [...]]]></description>
			<content:encoded><![CDATA[<p>I am currently building a &#8220;baby phone&#8221; toy for my son based on a discarded landline phone enclosure. The toy will feature record and playback on SD card to allow family members to record messages on the device. Voice messages would be played back when pressing a key of the original phone keyboard.</p>
<p>The plan has been to reuse as much of the old phone as possible : speaker, microphone, keyboard.</p>
<p><img src="http://elasticsheep.com/wp-content/uploads/2011/09/phone-front-500x333.jpg" alt="" title="Landline phone keyboard" width="500" height="333" class="aligncenter size-large wp-image-965" /></p>
<p>The prototyping began on a Teensy2 board starting from my previous WAV player project. It has now moved on an ATmega328 because USB Mass Storage is not required and I want to keep my Teensy for other projects.</p>
<p><img src="http://elasticsheep.com/wp-content/uploads/2011/09/babyphone-prototype-breadboard-500x500.jpg" alt="" title="Babyphone prototype on breadboard" width="500" height="500" class="aligncenter size-large wp-image-966" /></p>
<p>Hardware is done. Software is almost done. I am now soldering the design on a veroboard to fit it inside its final case.</p>
<p>More details and pictures to come&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://elasticsheep.com/2011/09/current-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bluetooth module breakout boards are back in stock</title>
		<link>http://elasticsheep.com/2011/09/bluetooth-module-breakout-boards-are-back-in-stock/</link>
		<comments>http://elasticsheep.com/2011/09/bluetooth-module-breakout-boards-are-back-in-stock/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 18:38:37 +0000</pubDate>
		<dc:creator>The Chief Sheep</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Bluetooth]]></category>
		<category><![CDATA[PCB Design]]></category>
		<category><![CDATA[Shop]]></category>

		<guid isPermaLink="false">http://elasticsheep.com/?p=944</guid>
		<description><![CDATA[My initial production was only a short run to prototype the board for my personal use. Having sold out the stock and seeing the interest for the board, I have ordered a new batch that is now available for sale. The price at Olimex was interesting for prototyping but not for producing greater quantity. This [...]]]></description>
			<content:encoded><![CDATA[<p>My initial production was only a short run to prototype the board for my personal use.</p>
<p>Having sold out the stock and seeing the interest for the board, I have ordered a new batch that is now available for sale.</p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2011/09/bob-new-batch.jpg"><img src="http://elasticsheep.com/wp-content/uploads/2011/09/bob-new-batch-500x333.jpg" alt="" title="Bluetooth module breakout board new batch" width="500" height="333" class="aligncenter size-large wp-image-948" /></a></p>
<p>The price at Olimex was interesting for prototyping but not for producing greater quantity. This new batch has been produced by PCBCart instead with same specification.</p>
<p><a href="http://elasticsheep.com/shop/">Order your board in the shop page.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://elasticsheep.com/2011/09/bluetooth-module-breakout-boards-are-back-in-stock/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Serial Bluetooth module – Master/Slave connection</title>
		<link>http://elasticsheep.com/2011/05/serial-bluetooth-module-masterslave-connection/</link>
		<comments>http://elasticsheep.com/2011/05/serial-bluetooth-module-masterslave-connection/#comments</comments>
		<pubDate>Fri, 20 May 2011 20:15:36 +0000</pubDate>
		<dc:creator>The Chief Sheep</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[avr]]></category>
		<category><![CDATA[Bluetooth]]></category>
		<category><![CDATA[serial]]></category>
		<category><![CDATA[Teensy2]]></category>

		<guid isPermaLink="false">http://elasticsheep.com/?p=916</guid>
		<description><![CDATA[I have soldered a second serial Bluetooth module. I am now going to test them in a master/slave configuration. The test boards The first test board is the one already used for my slave test with a Teensy 2 as USB to serial adapter and power supply. This board will be the master one. The [...]]]></description>
			<content:encoded><![CDATA[<p><strong>I have soldered a second serial Bluetooth module. I am now going to test them in a master/slave configuration.</strong></p>
<h3>The test boards</h3>
<p><a href="http://elasticsheep.com/wp-content/uploads/2011/05/Master-and-Slave-Bluetooth-modules.jpg"><img src="http://elasticsheep.com/wp-content/uploads/2011/05/Master-and-Slave-Bluetooth-modules-500x333.jpg" alt="" title="Master and slave serial Bluetooth modules" width="500" height="333" class="aligncenter size-large wp-image-918" /></a></p>
<p>The first test board is the one already used for my slave test with a Teensy 2 as USB to serial adapter and power supply. This board will be the master one.</p>
<p>The second test board is powered by a USB connector and a 3.3V regulator. A serial connection is establish with my laptop through a Prolific PL2303 adapter. This board will be the slave one.</p>
<h3>Slave module configuration</h3>
<p>The slave module is powered up in command mode. Cu does not seem to work correctly anymore with the PL2303 so I use screen instead:</p>
<pre>
$>screen /dev/cu.serial 38400
AT+ADDR?
+ADDR:11:3:252002
OK
AT+UART?
+UART:9600,0,0
OK
AT+ROLE?
+ROLE:0
OK
</pre>
<p>Role=0 is for the slave mode. I keep the default 9600 baud UART speed.</p>
<p>The module Bluetooth address will be useful to establish the connection from the master module.</p>
<h3>Master module configuration</h3>
<p>The master module is powered up in command mode. The role is changed to 1 for master. The UART baudrate is set to the same as the slave module.</p>
<pre>
$>sudo cu –s 38400 –l /dev/cu.usbmodemXXXX
AT+UART?
+UART:115200,0,0
OK
AT+UART=9600,0,0
OK
AT+UART?
+UART:9600,0,0
OK
AT+ROLE?
+ROLE:0
OK
AT+ROLE=1
+ROLE:1
OK
AT+ROLE?
+ROLE:1
OK
</pre>
<p>To establish an automatic connection to a slave module, the master module must know the slave address. This is configured with the AT+BIND command with CMODE=0 (Use a predefined address).</p>
<pre>
AT+CMODE?
+CMOD:0
OK
AT+BIND=11,3,252002
OK
AT+BIND?
+BIND:11:3:252002
OK
</pre>
<p>With CMODE=1, the master can connect to any device in its transmission range, so it is a much less secure configuration.</p>
<h3>Master/Slave automatic connection</h3>
<p>Now that the two modules are setup, I power up them in automatic mode (PIO11 = 0).</p>
<p>On each module, the red leds connected to PIO8 blinks quickly. After less than 2 seconds, the green led connected to PIO9 is shining on both modules indicating that they are now paired and connected, ready to transmit data.</p>
<p>I connect a terminal to the serial port of each module with their respective adapter to test the communication:</p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2011/05/full_duplex_between_bt_master_and_bt_slave.png"><img src="http://elasticsheep.com/wp-content/uploads/2011/05/full_duplex_between_bt_master_and_bt_slave-500x252.png" alt="" title="full_duplex_between_bt_master_and_bt_slave" width="500" height="252" class="aligncenter size-large wp-image-919" /></a></p>
<p>The first window displays the connection to the master BT module. The second window displays the connection to the slave BT module.</p>
<p>The connection is successful at 9600 bauds. I also successfully tested the communication at 115200 bauds.</p>
]]></content:encoded>
			<wfw:commentRss>http://elasticsheep.com/2011/05/serial-bluetooth-module-masterslave-connection/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Serial Bluetooth module slave test</title>
		<link>http://elasticsheep.com/2011/05/serial-bluetooth-module-slave-test/</link>
		<comments>http://elasticsheep.com/2011/05/serial-bluetooth-module-slave-test/#comments</comments>
		<pubDate>Sun, 08 May 2011 13:20:11 +0000</pubDate>
		<dc:creator>The Chief Sheep</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[atmega32u4]]></category>
		<category><![CDATA[Bluetooth]]></category>
		<category><![CDATA[LUFA]]></category>
		<category><![CDATA[serial]]></category>
		<category><![CDATA[Teensy2]]></category>

		<guid isPermaLink="false">http://elasticsheep.com/?p=865</guid>
		<description><![CDATA[I am going to test the connection of a serial Bluetooth module to my Mac laptop. Serial data will be provided to the module through a Teensy 2 used as a USB-to-Serial adapter. Soldering the module on a breakout board The difficulty is to correctly align all the module pins to the breakout pads. The [...]]]></description>
			<content:encoded><![CDATA[<p><strong>I am going to test the connection of a serial Bluetooth module to my Mac laptop. Serial data will be provided to the module through a Teensy 2 used as a USB-to-Serial adapter.</strong></p>
<h3>Soldering the module on a breakout board</h3>
<p><a href="http://elasticsheep.com/wp-content/uploads/2011/05/preparing_for_soldering.jpg"><img src="http://elasticsheep.com/wp-content/uploads/2011/05/preparing_for_soldering-500x333.jpg" alt="" title="Preparing for soldering the BT module to a breakout board" width="500" height="333" class="aligncenter size-large wp-image-867" /></a></p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2011/05/BT_module_soldered_on_breakout_board.jpg"><img src="http://elasticsheep.com/wp-content/uploads/2011/05/BT_module_soldered_on_breakout_board-500x333.jpg" alt="" title="BT module soldered on breakout board" width="500" height="333" class="aligncenter size-large wp-image-868" /></a></p>
<p>The difficulty is to correctly align all the module pins to the breakout pads. The module is so light that it can moves just because of the solder surface tension.</p>
<p>Two rows of header are added to fit in a prototyping breadboard.</p>
<h3>Teensy 2 USB-to-Serial profile</h3>
<p>I use the USBtoSerial project from <a href="http://lufa-lib.googlecode.com/files/LUFA-101122.zip">LUFA 101122</a>.</p>
<p>I already covered how to compile this project for the original Teensy in this previous post (<a href="http://elasticsheep.com/2009/05/testing-the-lufa-usb-serial-with-gps-data/">Testing the LUFA USB Serial with GPS data</a>). I apply the following modifications to the makefile:</p>
<pre>
MCU = atmega32u4
F_CPU = 16000000
</pre>
<p>Here is the binary: <a href='http://elasticsheep.com/wp-content/uploads/2011/05/Teensy2-USBtoSerial.hex_.zip'>Teensy2-USBtoSerial.hex</a></p>
<p>To connect to the virtual serial port on a Mac:</p>
<pre>
$> sudo cu –s 9600 –l /dev/cu.usbmodemXXXX
</pre>
<p>A quick loopback test (direct wire from TX to RX) confirms that the profile is correctly working.</p>
<p>Useful to exit cu: ~.</p>
<h3>Connections between the Teensy 2 and the BT module</h3>
<p><a href="http://elasticsheep.com/wp-content/uploads/2011/05/BTM-and-Teensy-on-breadboard.jpg"><img src="http://elasticsheep.com/wp-content/uploads/2011/05/BTM-and-Teensy-on-breadboard-500x333.jpg" alt="" title="BT module connected to Teensy 2.0 on breadboard" width="500" height="333" class="aligncenter size-large wp-image-872" /></a></p>
<p>The TX pin of the BT module is connected to the RX pin of the Teensy 2, and the RX pin on the TX pin.</p>
<p>My Teensy 2 board has been patched with a 3.3V regulator (see <a href="http://elasticsheep.com/2010/01/reading-an-sd-card-part-2-teensy-2-0/">Converting the Teensy2 to 3.3V</a>). I will use it to power the BT module.</p>
<p>The TX pin of the BT module is connected to the RX pin of the Teensy, and the RX pin on the TX pin.</p>
<p>Two leds are connected on PIO8 and PIO9 to display the status of the BT link.</p>
<p>The PIO11 pin is used to select the boot mode:</p>
<ul>
<li>High => Command/Response mode where you can issue AT command to setup the module.</li>
<li>Low => Slave or master automatic operation.</li>
</ul>
<h3>Module configuration</h3>
<p>I connect the PIO11 pin to the 3.3V rail. In this mode, the baud rate is 38400.</p>
<p>I open a cu session in the terminal and communicate with the BT module over its serial interface:</p>
<pre>
$>sudo cu –s 38400 –l /dev/cu.usbmodemXXXX
Connected.
AT
OK
OK
OK
OK
</pre>
<p>The module sends the OK response repeatedly. Sending Ctrl-C can stop it. Then you can enter another commands.</p>
<pre>
AT+VERSION?
+VERSION:2.0-20100601
OK
AT+NAME?
+NAME:HC-05
OK
AT+ADDR?
+ADDR:11:3:252009
OK
AT+UART?
+UART:9600,0,0
OK
</pre>
<p>We can see that the module is currently configured for 9600 bauds operations with 1 stop bit, no parity.</p>
<p>I speedup the baudrate to 115200 bauds.</p>
<pre>
AT+UART=115200,0,0
OK
AT+UART?
+UART:115200,0,0
OK
</pre>
<p>I also change the role to slave-loop. In this mode, the module sends back all data it receives over the BT link. It is useful to check that the module can correctly receive and send data over the BT link before connecting it to your system.</p>
<pre>
AT+ROLE=2
OK
AT+ROLE?
+ROLE:2
OK
</pre>
<p>Now I power up the module with the PIO11 connected to GND to boot in autoconnect mode.</p>
<h3>Pairing with a Mac</h3>
<p>The connection of Bluetooth devices is handled by the System Preferences/Bluetooth panel.</p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2011/05/mac_bluetooth_setup1.png"><img src="http://elasticsheep.com/wp-content/uploads/2011/05/mac_bluetooth_setup1-400x284.png" alt="" title="mac_bluetooth_setup1" width="400" height="284" class="aligncenter size-medium wp-image-881" /></a></p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2011/05/mac_bluetooth_setup2.png"><img src="http://elasticsheep.com/wp-content/uploads/2011/05/mac_bluetooth_setup2-400x261.png" alt="" title="mac_bluetooth_setup2" width="400" height="261" class="aligncenter size-medium wp-image-882" /></a></p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2011/05/mac_bluetooth_setup3.png"><img src="http://elasticsheep.com/wp-content/uploads/2011/05/mac_bluetooth_setup3-400x261.png" alt="" title="mac_bluetooth_setup3" width="400" height="261" class="aligncenter size-medium wp-image-883" /></a></p>
<p>The connection fails because the default passkey of the module is 1234. It can be changed with the AT+PSWD command.</p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2011/05/mac_bluetooth_setup4.png"><img src="http://elasticsheep.com/wp-content/uploads/2011/05/mac_bluetooth_setup4-400x261.png" alt="" title="mac_bluetooth_setup4" width="400" height="261" class="aligncenter size-medium wp-image-884" /></a></p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2011/05/mac_bluetooth_setup5.png"><img src="http://elasticsheep.com/wp-content/uploads/2011/05/mac_bluetooth_setup5-400x282.png" alt="" title="mac_bluetooth_setup5" width="400" height="282" class="aligncenter size-medium wp-image-885" /></a></p>
<p>The module is now successfully paired with the Mac but currently not connected.</p>
<p>It is recognized as a virtual serial port and corresponding devices are automatically created in the /dev directory:</p>
<pre>
$> ls /dev/*HC*
/dev/cu.HC-05-DevB	/dev/tty.HC-05-DevB
</pre>
<h3>Slave-loop connection</h3>
<p>I can now connect to the BT device and use it as a classic serial interface. In slave-loop mode, the characters are echoed back to the terminal.</p>
<pre>
$> sudo cu –s 115200 –l /dev/cu.HC-05-DevB
Connected.
ABCDEFGHIJKLM
</pre>
<p>The status of the bluetooth connection is reflected in the System Preferences panel.</p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2011/05/mac_bluetooth_setup6.png"><img src="http://elasticsheep.com/wp-content/uploads/2011/05/mac_bluetooth_setup6-400x282.png" alt="" title="mac_bluetooth_setup6" width="400" height="282" class="aligncenter size-medium wp-image-886" /></a></p>
<h3>Slave mode</h3>
<p>I switch to the command/response mode and change back the role to slave:</p>
<pre>
AT+ROLE=0
OK
AT+ROLE?
+ROLE:0
OK
</pre>
<p>In this mode, the BT module acts as a full duplex serial interface. The data received over the BT link are forwarded to the its TX pin, while the RX pin incoming data are sent over the BT link.<br />
So to test the connection I open two cu sessions. One is connected to the BT module, the other one to the Teensy 2 serial emulation. As the 2 devices serial pins are connected together, I am able to send characters on one session and receive them on the other sessions.</p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2011/05/full_duplex_between_teensy_and_bt.png"><img src="http://elasticsheep.com/wp-content/uploads/2011/05/full_duplex_between_teensy_and_bt-500x239.png" alt="" title="Full duplex serial communication between Teensy and BT module" width="500" height="239" class="aligncenter size-large wp-image-888" /></a></p>
<p>The first window displays the connection to the Teensy 2. The second window displays the connection to the BT module.</p>
]]></content:encoded>
			<wfw:commentRss>http://elasticsheep.com/2011/05/serial-bluetooth-module-slave-test/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Bluetooth module breakout boards received</title>
		<link>http://elasticsheep.com/2011/05/bluetooth-module-breakout-boards-received/</link>
		<comments>http://elasticsheep.com/2011/05/bluetooth-module-breakout-boards-received/#comments</comments>
		<pubDate>Mon, 02 May 2011 21:30:36 +0000</pubDate>
		<dc:creator>The Chief Sheep</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Bluetooth]]></category>
		<category><![CDATA[PCB Design]]></category>
		<category><![CDATA[Shop]]></category>

		<guid isPermaLink="false">http://elasticsheep.com/?p=852</guid>
		<description><![CDATA[Go to the Shop page if you want to get one.]]></description>
			<content:encoded><![CDATA[<p><a href="http://elasticsheep.com/wp-content/uploads/2011/05/BTM_breakout_closeup.jpg"><img src="http://elasticsheep.com/wp-content/uploads/2011/05/BTM_breakout_closeup-500x333.jpg" alt="" title="BTM Bluetooth module breakout board" width="500" height="333" class="aligncenter size-large wp-image-853" /></a></p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2011/05/BTM_breakout_boards1.jpg"><img src="http://elasticsheep.com/wp-content/uploads/2011/05/BTM_breakout_boards1-500x333.jpg" alt="" title="BTM Bluetooth module breakout boards" width="500" height="333" class="aligncenter size-large wp-image-975" /></a></p>
<p>Go to the <a href="http://elasticsheep.com/shop">Shop</a> page if you want to get one.</p>
]]></content:encoded>
			<wfw:commentRss>http://elasticsheep.com/2011/05/bluetooth-module-breakout-boards-received/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Serial Port Bluetooth module</title>
		<link>http://elasticsheep.com/2011/04/serial-port-bluetooth-module/</link>
		<comments>http://elasticsheep.com/2011/04/serial-port-bluetooth-module/#comments</comments>
		<pubDate>Sat, 16 Apr 2011 20:50:19 +0000</pubDate>
		<dc:creator>The Chief Sheep</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Bluetooth]]></category>
		<category><![CDATA[PCB Design]]></category>

		<guid isPermaLink="false">http://elasticsheep.com/?p=838</guid>
		<description><![CDATA[I recently ordered a couple of serial Bluetooth module on Ebay. You can find the same board with different names and different flash memories on the net but they all are based on the same design. The main chip is a CSR BC417143 a.k.a. BlueCore4-External connected to a 8Mbit parallel Flash memory containing the firmware. [...]]]></description>
			<content:encoded><![CDATA[<p>I recently ordered a couple of serial Bluetooth module on Ebay.</p>
<p>You can find the same board with different names and different flash memories on the net but they all are based on the same design. The main chip is a CSR BC417143 a.k.a. BlueCore4-External connected to a 8Mbit parallel Flash memory containing the firmware.</p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2011/04/bt_module.jpg"><img src="http://elasticsheep.com/wp-content/uploads/2011/04/bt_module-500x333.jpg" alt="" title="Serial Port Bluetooth Module" width="500" height="333" class="aligncenter size-large wp-image-839" /></a></p>
<p>Here is the system architecture of the chip from the CSR datasheet:</p>
<p><img src="http://elasticsheep.com/wp-content/uploads/2011/04/BlueCore4-Ext-System-Architecture.png" alt="" title="BlueCore4-Ext System Architecture" width="415" height="345" class="aligncenter size-full wp-image-840" /></p>
<p>The BlueCore4-Ext is a generic Bluetooth 2.0 EDR chip with a bunch of interfaces. The USB interface allows to use it in a USB BT dongle design. When integrating it in a microcontroller-based design, you could use the serial interface instead. The SPI interface allows the programming and configuration of the chip using CSR tools.<br />
The provided firmware implements a Serial Port Profile based on a RFCOMM stack. But in theory this hardware could run other firmwares from CSR, for example a HCI stack  to connect the chip as a generic BT USB dongle. </p>
<p>The module hardware is very small. The footprint is made to be soldered on another PCB. A serial breakout board is available with RX/TX connections and a 5V to 3.3V regulator. As I would like to tinker with the module to investigate its capabilities, I instead designed a breakout board allowing access to all the pins on a standard header.</p>
<p><img src="http://elasticsheep.com/wp-content/uploads/2011/04/Breakout-board-Gerbv.png" alt="" title="Serial Bluetooth Module BTM400 Breakout board" width="297" height="373" class="aligncenter size-full wp-image-843" /></p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2011/04/bt_module_with_breakout.jpg"><img src="http://elasticsheep.com/wp-content/uploads/2011/04/bt_module_with_breakout-500x333.jpg" alt="" title="BTM400 Serial Bluetooth module breakout board prototype" width="500" height="333" class="aligncenter size-large wp-image-844" /></a></p>
<p>I just ordered a batch of breakout boards from Olimex. I should receive them in a few weeks. If anyone is interested to get one, <strike>leave me a message.</strike> <strong>[Update 2011-05-06]</strong> Ordering informations are on the <a href="http://elasticsheep.com/shop">Shop</a> page.</p>
<h3>Update 2011-05-02</h3>
<p>Here is the module datasheet provided by hongkong_electronics<br />
<a href='http://elasticsheep.com/wp-content/uploads/2011/04/BC4_Bluetooth-Module-Datasheet.zip'>BC4_Bluetooth Module Datasheet.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://elasticsheep.com/2011/04/serial-port-bluetooth-module/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>My blog mentioned in Open Silicium magazine</title>
		<link>http://elasticsheep.com/2011/01/my-blog-mentioned-in-open-silicium-magazine/</link>
		<comments>http://elasticsheep.com/2011/01/my-blog-mentioned-in-open-silicium-magazine/#comments</comments>
		<pubDate>Sat, 29 Jan 2011 14:11:01 +0000</pubDate>
		<dc:creator>The Chief Sheep</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://elasticsheep.com/?p=819</guid>
		<description><![CDATA[ background in ]]></description>
			<content:encoded><![CDATA[<p><a href="http://elasticsheep.com/wp-content/uploads/2011/01/capture_couverture.jpg"><img src="http://elasticsheep.com/wp-content/uploads/2011/01/capture_couverture-500x243.jpg" alt="" title="Open Silicium magazine cover - Issue 1" width="500" height="243" class="aligncenter size-large wp-image-820" /></a></p>
<p>Open Silicium is a new french magazine about open source and embedded system/hardware. It is published by the editor of Linux Magazine France. It is an interesting reading with eclectic articles that does not hesitate to dig into the hardware side.</p>
<p>But I think some of the articles may be difficult to grasp without a background in computer/electrical engineering. It reminds me of the magazines I was reading 15 years ago trying and often failing to make sense of articles about Turbo Pascal programming, entering program from paper to the computer. When the program worked you didn&#8217;t know why, and when it didn&#8217;t work you didn&#8217;t know why either!</p>
<p>What I was missing was good fundamentals on software and computer engineering. But at that time, the magazines where the only source of information I had, with local libraries very poorly filled with computer programming resources.</p>
<p>Now that the training knowledge is widespread and easily accessible through Internet, this kind of magazine is still useful to provide insight about different environment/tools/techniques. But if you are a beginner, you need to expect digging about the subjects you are interested in on your own.</p>
<p><a href="http://elasticsheep.com/wp-content/uploads/2011/01/capture_article.jpg"><img src="http://elasticsheep.com/wp-content/uploads/2011/01/capture_article-500x328.jpg" alt="" title="Open Silicium article about Teensy 2.0" width="500" height="328" class="aligncenter size-large wp-image-824" /></a></p>
<p>Anyway thanks to the buzz around the Teensy2 and the PSGroove projet, I got a mention in this first issue. So thanks Open Silicium and keep up the good work!</p>
]]></content:encoded>
			<wfw:commentRss>http://elasticsheep.com/2011/01/my-blog-mentioned-in-open-silicium-magazine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding alsa audio support to a Buildroot-based system</title>
		<link>http://elasticsheep.com/2011/01/adding-alsa-audio-support-to-a-buildroot-based-system/</link>
		<comments>http://elasticsheep.com/2011/01/adding-alsa-audio-support-to-a-buildroot-based-system/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 16:14:57 +0000</pubDate>
		<dc:creator>The Chief Sheep</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[Audio]]></category>
		<category><![CDATA[Buildroot]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[QEMU]]></category>
		<category><![CDATA[VersatilePB]]></category>

		<guid isPermaLink="false">http://elasticsheep.com/?p=801</guid>
		<description><![CDATA[I have tested the building of a basic Linux system with Buildroot. I would like now to add audio support to this system with mp3 decoding capabilities. The mp3 decoding will be handled by the mpg123 application. The decoded audio playback will go through the alsa-lib userland interface that communicates with the alsa kernel subsystem. [...]]]></description>
			<content:encoded><![CDATA[<p>I have tested the building of a basic Linux system with Buildroot. I would like now to add audio support to this system with mp3 decoding capabilities.</p>
<p>The mp3 decoding will be handled by the mpg123 application. The decoded audio playback will go through the alsa-lib userland interface that communicates with the alsa kernel subsystem.</p>
<p>The target hardware is the Versatile/PB platform emulated in QEMU.</p>
<h3>System base configuration</h3>
<p>The Builroot base configuration is the same as in <a href="http://elasticsheep.com/2011/01/building-and-emulating-a-basic-arm-linux-system/">my previous post</a>:</p>
<ul>
<li>Target Architecture: arm</li>
<li>Target Architecture Variant: arm926t</li>
<li>Target ABI: EABI</li>
<li>Toolchain/Kernel Headers: 2.6.36.x (I could specify a path to my kernel sources)</li>
<li>Package Selection for the Target/Busybox 1.17.x</li>
<li>Target Fileystem Options/cpio the root filesystem and Compression method: gzip</li>
</ul>
<p>I select those options in the Buildroot configuration menu and then save the resulting config file in the configs directory.</p>
<pre>
$> cd buildroot-2010.11
$> make menuconfig
$> cp .config configs/versatilepb926_defconfig
</pre>
<p>The saved configuration can be directly applied from <strong>make</strong> if you want to return to a known state:</p>
<pre>
$> make versatilepb926_defconfig
#
# configuration written to [...]/buildroot-2010.11/.config
#
</pre>
<h3>Adding the alsa and mpg123 support</h3>
<p>To enable the alsa and mpg123 support:</p>
<ul>
<li>Toolchain/Enable large file (file > 2GB) support</li>
<li>Package Selection for the target/Audio and Video libraries
<ul>
<li>alsa-lib</li>
<li>alsa-utils / aplay</li>
<li>mpg123</li>
</ul>
</li>
</ul>
<p><strong>aplay</strong> is useful to check if simple WAV files can be played by the system. The Large File support is a dependency requirement from the alsa-utils package.</p>
<h3>Adding the /dev/snd/* entries</h3>
<p>By default, Buildroot does not add create audio device files. It uses the default device table that is located in target/generic/device_table.txt.</p>
<p>To add the /dev/audio and /dev/snd/* device files, I create a new device table file derived from the generic one adding the entries required by Alsa: target/generic/alsa_device_table.txt.</p>
<p>Then I change the selected device table in the Buildroot configuration:</p>
<ul>
<li>Target Filesystem options/Path to the device table
<ul>
<li>target/generic/alsa_device_table.txt</li>
</ul>
</li>
</ul>
<p><a href="http://elasticsheep.com/wp-content/uploads/2011/01/config_device_table_outlined.png"><img src="http://elasticsheep.com/wp-content/uploads/2011/01/config_device_table_outlined-500x352.png" alt="" title="Buildroot device table configuration with ALSA devices" width="500" height="352" class="aligncenter size-large wp-image-807" /></a></p>
<p>Here is the updated audio section of the device table:</p>
<pre>
# Audio stuff
/dev/audio	c	666	0	29	14	4	-	-	-
#/dev/audio1	c	666	0	29	14	20	-	-	-
/dev/dsp	c	666	0	29	14	3	-	-	-
#/dev/dsp1	c	666	0	29	14	19	-	-	-
#/dev/sndstat	c	666	0	29	14	6	-	-	-
/dev/mixer	c	666	0	29	14	0	-	-	-
/dev/snd	d	755	0	29	-	-	-	-	-
/dev/snd/controlC0	c	666	0	29	116	0	-	-	-
/dev/snd/pcmC0D0c	c	666	0	29	116	24	-	-	-
/dev/snd/pcmC0D0p	c	666	0	29	116	16	-	-	-
/dev/snd/seq	c	666	0	29	116	1	-	-	-
/dev/snd/timer	c	666	0	29	116	33	-	-	-
</pre>
<p>My patched file for buildroot-2010.11: <a href='http://elasticsheep.com/wp-content/uploads/2011/01/alsa_device_table.txt'>alsa_device_table.txt</a></p>
<p>Sorry I don’t remember the original source from where I copied those major/minor device numbers.</p>
<h3>Saving the updated configuration</h3>
<pre>
$> cp .config configs/versatilepb926_alsa_defconfig
</pre>
<h3>Copying audio files in the root filesystem</h3>
<p>Audio files can be directly copied in the output/target/root directory of Buildroot for test purposes.</p>
<p>When running <strong>make</strong> again, buildroot includes those files in the CPIO archive of the rootfs.</p>
]]></content:encoded>
			<wfw:commentRss>http://elasticsheep.com/2011/01/adding-alsa-audio-support-to-a-buildroot-based-system/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss><!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Object Caching 551/653 objects using disk: basic

Served from: elasticsheep.com @ 2012-02-02 07:15:45 -->

