<?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/" version="2.0">

<channel>
	<title>Circuits@Home</title>
	
	<link>http://www.circuitsathome.com</link>
	<description>A Solder Joint</description>
	<lastBuildDate>Tue, 18 Jun 2013 01:41:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/chome" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="chome" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Mass Storage Support for USB Host Library 2.0 released!</title>
		<link>http://www.circuitsathome.com/mcu/mass-storage-support-for-usb-host-library-2-0-released</link>
		<comments>http://www.circuitsathome.com/mcu/mass-storage-support-for-usb-host-library-2-0-released#comments</comments>
		<pubDate>Tue, 18 Jun 2013 01:41:06 +0000</pubDate>
		<dc:creator>oleg</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[MCU]]></category>
		<category><![CDATA[USB Shield]]></category>
		<category><![CDATA[mass storage]]></category>
		<category><![CDATA[MAX3421E]]></category>
		<category><![CDATA[usb flash drive]]></category>
		<category><![CDATA[USB Host Shield]]></category>

		<guid isPermaLink="false">https://www.circuitsathome.com/?p=8505</guid>
		<description><![CDATA[<p class="wp-caption-text">Mass Storage</p> <p>The code supporting USB Mass Storage Class of devices has been added to USB Host Shield 2.0 library and is available to download on GitHub. Mass storage devices include USB Flash drives, memory card readers, external hard drives/CD-ROMs, smartphones/tablets, and some others &#8211; almost anything that shows as a drive while connected [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_8506" class="wp-caption alignleft" style="width: 298px"><a href="/wp/wp-content/uploads/2013/06/mass_storage_announcement.jpg"><img src="/wp/wp-content/uploads/2013/06/mass_storage_announcement-288x216.jpg" alt="Mass Storage" title="Mass Storage" width="288" height="216" class="size-thumbnail wp-image-8506" /></a><p class="wp-caption-text">Mass Storage</p></div>
<p>The code supporting USB Mass Storage Class of devices has been added to <a href="/arduino_usb_host_shield_projects">USB Host Shield 2.0</a> library and is <a href="https://github.com/felis/USB_Host_Shield_2.0">available to download</a> on GitHub. Mass storage devices include USB Flash drives, memory card readers, external hard drives/CD-ROMs, smartphones/tablets, and some others &#8211; almost anything that shows as a drive while connected to a PC (exceptions are digital cameras as well as some phones pretending to be digital cameras). <a href="https://plus.google.com/u/0/117277519030803787958/posts">Andrew Kroll</a> (who made this release possible) &#8211; thank you very much!</p>
<p>At present, the <a href="https://github.com/felis/USB_Host_Shield_2.0/tree/master/examples/testusbhostFAT">code example</a>, also featuring Andrew&#8217;s FAT and extended memory implementation, can only be run on &#8220;big&#8221; Arduinos such as Mega and Mega 2560. Another FAT implementation, developed by Alex Glushchenko, is being tested &#8211; there is a slight possibility that at least some functionality can be demonstrated on a regular UNO board. On the other hand, the mass storage component can be used without a file system by simply reading/writing physical sectors; this approach can save a lot of memory. The documentation for the mass storage class code is available <a href="http://felis.github.io/USB_Host_Shield_2.0/class_bulk_only.html">here</a>.</p>
<p>Many hours has been spent testing the code; it should work with any device which claims to support &#8220;mass storage bulk only&#8221; transport. While newer (less than 5 years old) won&#8217;t cause any problems, older ones could be finicky. If your device shows odd behaviour with this code, please let me know &#8211; I will trade it for the good working one.</p>
<p>Enjoy!</p>
<p>Oleg.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.circuitsathome.com/mcu/mass-storage-support-for-usb-host-library-2-0-released/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reflow Soldering in Inert Atmosphere</title>
		<link>http://www.circuitsathome.com/production/reflow-soldering-in-inert-atmosphere</link>
		<comments>http://www.circuitsathome.com/production/reflow-soldering-in-inert-atmosphere#comments</comments>
		<pubDate>Sat, 25 May 2013 03:32:23 +0000</pubDate>
		<dc:creator>oleg</dc:creator>
				<category><![CDATA[Production]]></category>
		<category><![CDATA[CO2]]></category>
		<category><![CDATA[inert]]></category>
		<category><![CDATA[reflow soldering]]></category>
		<category><![CDATA[toaster oven]]></category>

		<guid isPermaLink="false">https://www.circuitsathome.com/?p=8485</guid>
		<description><![CDATA[<p><p class="wp-caption-text">CO2 Soldering</p> Reflow soldering in toaster oven or on a skillet is popular among hobbyists and small-scale manufacturers. The process is simple and the equipment necessary is inexpensive and readily available. The results are very good if several simple rules are followed. One of these rules is to use freshly made PCBs &#8211; the [...]]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_8486" class="wp-caption alignright" style="width: 298px"><a href="/wp/wp-content/uploads/2013/05/co2_soldering.jpg"><img src="/wp/wp-content/uploads/2013/05/co2_soldering-288x216.jpg" alt="CO2 Soldering" title="CO2 Soldering" width="288" height="216" class="size-thumbnail wp-image-8486" /></a><p class="wp-caption-text">CO2 Soldering</p></div><br />
Reflow soldering in toaster oven or on a skillet is popular among hobbyists and small-scale manufacturers. The process is simple and the equipment necessary is inexpensive and readily available. The results are very good if several simple rules are followed. One of these rules is to use freshly made PCBs &#8211; the shelf life of hot air leveled tin PCB finish is 6 months. A PCB which was used close to the end or past its shelf life will exhibit poor solder wetting resulting in bad joints.</p>
<p>Poor wetting can be overcome by increasing soak time and/or rising reflow temperature to give solder flux more time to act on oxide layer formed on the PCB finish during storage and reflow. This approach worked well in good old times of leaded solder, however, modern lead free solder reflow temperature is already quite high and increasing it may not be possible. In this case, soldering in inert atmosphere could be better option. In this article I will explain the process that I have started using some time ago &#8211; with great success.</p>
<p>Conceptually, soldering in inert atmosphere is easy: substituting air (which contains oxygen) in the oven with inert gas eliminates the cause of oxidation. The best gas for this purpose is nitrogen; it is non-reactive at soldering temperatures and being the major component of air it is the cheapest of all industrial gases. Being air-like it is also easy to use &#8211; all that is needed is a constant low volume flow into the oven during soldering cycle.<br />
<span id="more-8485"></span><br />
Nitrogen is available in several forms, the most suitable for soldering applications is compressed in a cylinder. Additionally, a regulator is needed to drop down high cylinder pressure. The price for the set starts at about $150. The cylinder can be refilled in places like Airgas for about $10.</p>
<p>Another gas suitable for creating inert environment is carbon dioxide or CO2. Unlike nitrogen, this gas has household uses. It is widely used to fertilize planted aquariums, carbonize beer, grow plants and several other things. Since I already own CO2 cylinders and regulators my reflow process uses this gas to create inert atmosphere. For volumes I use the difference in nitrogen/CO2 refill prices is insignificant.</p>
<p>The setup is very simple and is shown on the title picture. It consists of a toaster oven placed in a large plastic storage box, 5lb CO2 cylinder/regulator/needle valve, a length of silicone tubing and a box of matches. Since CO2 is heavier than air it won&#8217;t stay in the oven if pumped directly into it. Therefore, a container around the oven is needed. Since CO2 is not that much heavier than air it will raise when heated therefore a lid covering the container is helpful. A tube runs from a cylinder to the bottom of the box. Matches are used to check the inert atmosphere. I light a match and put it under the lid &#8211; if CO2 is there it will extinguish the match. Needle valve on the cylinder allows me to fine tune the flow, the heaviest gas loss will be during reflow peak when the temperature is the highest.</p>
<p>I tested the system with some pretty stale boards with were lying around for a couple of years. The wetting was excellent even with standard soak time of 3 minutes. For soldering normal PCBs no changes in profile were necessary. The overall process doesn&#8217;t change too much either: I place a board in the oven and start it, then I open the cylinder and keep it open until the oven temperature has dropped to about 170C after reflow peak. I haven&#8217;t noticed any change in oven dynamics, however, opening oven lid after the peak increases cooling rate.</p>
<p>If you already have a CO2 cylinder, this setup is inexpensive, quick to make and gives excellent results. I&#8217;m hoping to solder many boards with it &#8211; after about a hundred cycles the cylinder, which was about half empty when I started experimenting, still have plenty of CO2 in it. When I replace it with a fresh one I&#8217;ll start counting cycles to get a better idea of how long it will last. </p>
<p>Enjoy,<br />
Oleg.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.circuitsathome.com/production/reflow-soldering-in-inert-atmosphere/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Neoden TM240A Pick and Place machine – first impressions</title>
		<link>http://www.circuitsathome.com/production/neoden-tm240a-pick-and-place-machine-first-impressions</link>
		<comments>http://www.circuitsathome.com/production/neoden-tm240a-pick-and-place-machine-first-impressions#comments</comments>
		<pubDate>Sat, 11 May 2013 06:53:11 +0000</pubDate>
		<dc:creator>oleg</dc:creator>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[Production]]></category>
		<category><![CDATA[neoden]]></category>
		<category><![CDATA[pick and place]]></category>
		<category><![CDATA[tm220a]]></category>
		<category><![CDATA[tm240a]]></category>

		<guid isPermaLink="false">https://www.circuitsathome.com/?p=8441</guid>
		<description><![CDATA[<p class="wp-caption-text">TM240A building USB Host Shields</p> <p>Some time ago I noticed that I&#8217;m spending more time building boards and less time developing and needed to increase my manufacturing capabilities. After thorough reading Dangerous Prototypes&#8217; Chinese desktop pick and place machine forum thread I got in contact with a factory and bought TM240A &#8211; the big [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_8442" class="wp-caption alignleft" style="width: 298px"><a href="/wp/wp-content/uploads/2013/05/max_nozzle.jpg"><img src="/wp/wp-content/uploads/2013/05/max_nozzle-288x216.jpg" alt="TM240A building USB Host Shields" title="TM240A building USB Host Shields" width="288" height="216" class="size-thumbnail wp-image-8442" /></a><p class="wp-caption-text">TM240A building USB Host Shields</p></div>
<p>Some time ago I noticed that I&#8217;m spending more time building boards and less time developing and needed to increase my manufacturing capabilities. After thorough reading <a href="http://dangerousprototypes.com/forum/viewtopic.php?f=68&#038;t=4903&#038;sid=5b12951d249b0ac4590b2f8dd49b83df">Dangerous Prototypes&#8217;</a> Chinese desktop pick and place machine forum thread I got in contact with a factory and bought TM240A &#8211; the big brother of TM220A. Earlier this week a DHL van carrying 70kg crate pulled in my driveway. After a day of hands-on learning I started building boards. This article was written after 2 days of using the machine and contains my first impressions as well as a couple of hints.</p>
<p>First, it is a real Chinese machine &#8211; well built, simple, and reasonably priced. At the same time, an owner must be prepared to fix mechanical issues and work around software bugs without relying on manufacturer&#8217;s support &#8211; the folks at Neoden are helpful but due to a time difference a reply to an e-mail would arrive the next day. Fortunately, the user base for these machines is expanding and the thread linked above as well as videos by Ian@DP and other people provide lots of useful info.</p>
<p>I was ready to face issues like air lines clogged by small pieces of styrofoam, non-functioning vacuum pumps and such; luckily, the only problem out-of-the box was racked gantry causing feeding fault. Thanks to <a href="http://dangerousprototypes.com/forum/viewtopic.php?f=68&#038;t=4903&#038;start=225#p51400">this post</a> in DP thread I was already aware about the symptoms as well as the fix &#8211; so I fixed it. While doing this I learned that to implement the fix no tools were necessary &#8211; a typical human finger jammed between the front support and the gantry works just as well as originally specified screwdriver.</p>
<p>I loaded some tapes and proceeded to stuffing boards. During test runs double sided removable scotch tape placed over the pads helped keeping parts in place. &#8220;Removable&#8221; type is preferable since it leaves no residue. Also, since the machine has no vision, accurate board registration is paramount. Here is how I do it.<br />
<span id="more-8441"></span><br />
The machine has a laser pointer shaped as crosshairs. With this shape it is easier to aim if a reference board feature AKA fiducial resembles a cross. When there is no fiducial, a reference point can be produced from existing land pattern, as follows.</p>
<p>A picture below shows the Eagle file for a panel of <a href="/products-page/arduino-shields/usb-host-shield-for-arduino-pro-mini">USB Host Minis</a>. Each board contains MAX3421E chip packaged in TQFP-32.</p>
<div id="attachment_8464" class="wp-caption aligncenter" style="width: 650px"><a href="/wp/wp-content/uploads/2013/05/UHM_panel.jpg"><img src="/wp/wp-content/uploads/2013/05/UHM_panel.jpg" alt="A panel of USB Host Minis" title="A panel of USB Host Minis" width="640" height="480" class="size-full wp-image-8464" /></a><p class="wp-caption-text">A panel of USB Host Minis</p></div>
<p>Next picture shows closeup of MAX3421E land pattern on lower left board in the panel. I need coordinates of intersection of a grid lines passing through centers of pads 16 and 17. The coordinates can be derived from the library part (it is X of pad 17 and Y of pad 16 subtracted from the position of the center of the part itself) or simply read from the Eagle screen by placing a cursor on the intersection. This gives me one fiducial. Second one can be obtained from the MAX3421E land pattern on the upper right board in a similar manner.</p>
<div id="attachment_8467" class="wp-caption aligncenter" style="width: 650px"><a href="/wp-content/uploads/2013/05/fid.jpg"><img src="/wp/wp-content/uploads/2013/05/fid.jpg" alt="Reference point" title="Reference point" width="640" height="480" class="size-full wp-image-8467" /></a><p class="wp-caption-text">Reference point</p></div>
<p>After that, both pairs of coordinates can be used to produce fiducial parts in a placement file ( see <a href="http://dangerousprototypes.com/docs/TM220A_Pick_and_Place_resources#Placement_file_format">DP TM220A wiki</a> for more information about file format). Here&#8217;s the fragment of mine:</p>

<div class="wp_syntax"><div class="code"><pre class="basic" style="font-family:monospace;">109,1,0,7,18.5,0,0,1,F1,Fiducial1
110,1,0,99.68,57.7,0,0,1,F2,Fiducial2</pre></div></div>

<p>When file is loaded in the machine the parts can be used to check/adjust board alignment. Next picture shows laser pointer showing position of Fiducial1. The difference between tinned pad and surrounding solder mask is clearly visible, especially when USB microscope (not shown) is used.</p>
<div id="attachment_8472" class="wp-caption aligncenter" style="width: 1034px"><a href="/wp/wp-content/uploads/2013/05/board_align.jpg"><img src="https://www.circuitsathome.com/wp/wp-content/uploads/2013/05/board_align.jpg" alt="Board alignment" title="Board alignment" width="1024" height="768" class="size-full wp-image-8472" /></a><p class="wp-caption-text">Board alignment</p></div>
<p>After one diagonal point is aligned the machine can be moved to the second one to check. The issue with registration on this machine is that one side of a board will always be parallel to the gantry. Some of my boards are cut at a slight angle due to the boardhouse being sloppy &#8211; for those I will need to fabricate a jig which would allow board rotation. This is going to be my next project. Stay tuned!</p>
<p>Oleg.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.circuitsathome.com/production/neoden-tm240a-pick-and-place-machine-first-impressions/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Hantek DSO5000 series oscilloscope modifications. Part 2 – reducing fan noise.</title>
		<link>http://www.circuitsathome.com/measurements/hantek-dso5000-series-oscilloscope-modifications-part-2-reducing-fan-noise</link>
		<comments>http://www.circuitsathome.com/measurements/hantek-dso5000-series-oscilloscope-modifications-part-2-reducing-fan-noise#comments</comments>
		<pubDate>Thu, 18 Apr 2013 18:54:29 +0000</pubDate>
		<dc:creator>oleg</dc:creator>
				<category><![CDATA[Measurements]]></category>
		<category><![CDATA[5062]]></category>
		<category><![CDATA[5102]]></category>
		<category><![CDATA[5202]]></category>
		<category><![CDATA[7805]]></category>
		<category><![CDATA[7812]]></category>
		<category><![CDATA[DSO]]></category>
		<category><![CDATA[fan]]></category>
		<category><![CDATA[Hantek]]></category>

		<guid isPermaLink="false">https://www.circuitsathome.com/?p=8415</guid>
		<description><![CDATA[<p><p class="wp-caption-text">Fan regulator</p> This simple mod, originally described by tinhead on EEVBlog forum, is intended to make built-in cooing fan quieter. Typical problem with cooling fans is the noise they make and typical solution is to decrease voltage (and therefore current) to the fan to make it rotate slower. Hantek DSO5000-series oscilloscopes have 3 terminal [...]]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_8417" class="wp-caption alignright" style="width: 298px"><a href="/wp/wp-content/uploads/2013/04/7812_top.jpg"><img src="/wp/wp-content/uploads/2013/04/7812_top-288x216.jpg" alt="Fan regulator" title="Fan regulator" width="288" height="216" class="size-thumbnail wp-image-8417" /></a><p class="wp-caption-text">Fan regulator</p></div><br />
This simple mod, originally described by tinhead on <a href="http://www.eevblog.com/forum/testgear/hantek-tekway-dso-hack-get-200mhz-bw-for-free/">EEVBlog forum</a>, is intended to make built-in cooing fan quieter.  Typical problem with cooling fans is the noise they make and typical solution is to decrease voltage (and therefore current) to the fan to make it rotate slower. Hantek DSO5000-series oscilloscopes have 3 terminal 12V regulator dedicated for the fan (pointed at by an arrow on the title picture). To change the fan voltage I simply need to replace the regulator  marked U7 on the power supply PCB.</p>
<p>Tinhead&#8217;s original mod was to replace 7812 (12V) regulator with 7805 (5V). It will work assuming good quality fan. Mine refused to start from 5V so I used MC7808 &#8211;  a 8V regulator. Another good candidates were 7806 and 7809 but after first try I decided 8V is good enough &#8211; the fan is spinning well and the noise level is low.</p>
<p>The following picture shows power supply PCB unscrewed from the chassis and turned upside down. Again, an arrow shows the regulator. The PCB is single layer; replacing the regulator is a simple matter of removing solder with a solder wick, pulling the original regulator out and soldering on the replacement. If everything is at hand, the mod takes about 15 minutes to complete, including testing. </p>
<p>Enjoy!</p>
<p>Oleg.<br />
<div id="attachment_8428" class="wp-caption alignleft" style="width: 298px"><a href="/wp/wp-content/uploads/2013/04/7812_bottom.jpg"><img src="/wp/wp-content/uploads/2013/04/7812_bottom-288x216.jpg" alt="Bottom side of the PCB" title="Bottom side of the PCB" width="288" height="216" class="size-thumbnail wp-image-8428" /></a><p class="wp-caption-text">Bottom side of the PCB</p></div></p>
]]></content:encoded>
			<wfw:commentRss>http://www.circuitsathome.com/measurements/hantek-dso5000-series-oscilloscope-modifications-part-2-reducing-fan-noise/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Hantek DSO5000 series oscilloscope modifications. Part 1 – doubling the bandwidth of DSO5102B.</title>
		<link>http://www.circuitsathome.com/measurements/hantek-dso5000-series-oscilloscope-modifications-part-1-doubling-the-bandwidth-of-dso5102b</link>
		<comments>http://www.circuitsathome.com/measurements/hantek-dso5000-series-oscilloscope-modifications-part-1-doubling-the-bandwidth-of-dso5102b#comments</comments>
		<pubDate>Wed, 13 Mar 2013 07:20:55 +0000</pubDate>
		<dc:creator>oleg</dc:creator>
				<category><![CDATA[Measurements]]></category>
		<category><![CDATA[DSO]]></category>
		<category><![CDATA[DSO5102B]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[Hantek]]></category>
		<category><![CDATA[oscilloscope]]></category>

		<guid isPermaLink="false">https://www.circuitsathome.com/?p=8307</guid>
		<description><![CDATA[<p class="wp-caption-text">Hantek DSO5000 screen</p> <p>Some time ago I realized that I need to add digital oscilloscope to my set of instruments. DSO is handy for measurements and taking screenshots and this is what I have been doing a lot lately. After comparing specs of current models from several manufacturers I picked Hantek DSO5102B scope. The [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_8308" class="wp-caption alignright" style="width: 298px"><a href="/wp/wp-content/uploads/2013/03/hantek_title.jpg"><img src="/wp/wp-content/uploads/2013/03/hantek_title-288x216.jpg" alt="Hantek DSO5000 screen" title="Hantek DSO5000 screen " width="288" height="216" class="size-thumbnail wp-image-8308" /></a><p class="wp-caption-text">Hantek DSO5000 screen</p></div>
<p>Some time ago I realized that I need to add digital oscilloscope to my set of instruments. DSO is handy for measurements and taking screenshots and this is what I have been doing a lot lately. After comparing specs of current models from several manufacturers I picked Hantek DSO5102B scope. The main reasons to choose this model were cost, screen size, and rich potential for hacking &#8211; in no particular order.</p>
<p>Hantek DSO5000-series scopes come in 3 bandwidth variants &#8211; DSO5062B(60MHz), DSO5102B(100MHz), and DSO5202B(200MHz). They are identical or nearly identical (early production scopes of different bandwidth had different value resistors soldered in analog front end but that&#8217;s the only difference), and making one from another is a simple matter of editing certain configuration files inside the scope. In addition to that, many other modifications can be made, including fan speed, low jitter ADC clock, low noise power supplies, and many others (see the EEVblog thread &#8211; the first link in the list at the end of this post). Newer benchtop DSO/MSO oscilloscopes from Hantek are based on the same hardware and there were successful attempts to <a href="http://embdev.net/articles/Tekway_MSO">make a MSO from this scope</a> by adding a logic analyzer PCB.</p>
<p>As is often the case with Chinese products, the oscilloscope is also available under brand names Tekway, Voltcraft and some others with model numbers different from Hantek. The firmware has been originally developed by Tekway and uses Tekway model numbers &#8211; DST1062B(60MHz), DST1102B(100MHz), DST1202B(200MHz). Out of many brand names, Hantek seems to be the cheapest. Also, where I live (the US) Hantek can be bought locally. When I was shopping around, 60MHz models were more expensive than 100MHz so I ended up buying DSO5102B from Hong Kong for $388.88 shipped by UPS Global Express.</p>
<p>After receiving the instrument I checked the functionality. The scope worked well, the screen was large, and bugs were tolerable. I then proceeded to &#8220;modify&#8221; the device to 200MHz model; what follows is the detailed description of the steps I took to implement the mod outlined in EEVblog thread (Tinhead, you are the man!) &#8211; proceed at your own risk! The instrument has no &#8220;warranty void&#8221; stickers and I&#8217;m assuming that from the warranty standpoint opening the case is OK but I never bothered to actually check this assumption. In the worst case the instrument would have to be shipped to the seller/manufacturer for repair or replacement. Also, the procedure involves operating the device with power supply exposed &#8211; please be careful!<br />
<span id="more-8307"></span><br />
<strong>Step 1. Backup</strong></p>
<div id="attachment_8334" class="wp-caption alignleft" style="width: 298px"><a href="/wp/wp-content/uploads/2013/03/original_risetime.jpg"><img src="/wp/wp-content/uploads/2013/03/original_risetime-288x216.jpg" alt="100MHz risetime" title="100MHz risetime" width="288" height="216" class="size-thumbnail wp-image-8334" /></a><p class="wp-caption-text">100MHz risetime</p></div>
<p>First thing to do before making any firmware modifications is to establish known good state in case the mod is unsuccessful and a roll back is necessary. The backup is done to a USB flash drive. Download the <a href="http://www.eevblog.com/forum/chat/hantek-tekway-dso-hack-get-200mhz-bw-for-free/msg35683/#msg35683">Tools_B_models.zip</a> archive, extract it and read <code>how_to_backup.txt</code> in <code>Backup_B_models</code> subdirectory. Then copy <code>dst1kb_b_backup_tool.up</code> file to an empty USB flash drive (128Mb or larger) and insert the drive to the USB connector on the front of the instrument. Wait for the floopy icon on the top of the screen to change color to blue, then press &#8220;UTILITY&#8221; button and then &#8220;F2&#8243;. Even though the function name is &#8220;Firmware Update&#8221; the file on the USB drive doesn&#8217;t update anything &#8211; we are making backup. Follow instructions on the screen, wait for backup to finish (it takes a while, don&#8217;t panic), then copy the contents of the flash drive to a safe place.</p>
<p>It is also a good idea to test the capabilities of the instrument before the mod. To do this I connected very fast pulse generator ( <100ps rise time ) to channel 1 of the scope and took the following screenshot. The fastest timebase setting is 4ns/div and measured risetime is 2.7ns.</p>
<p><strong>Step 2. The Mod</strong></p>
<p>As I mentioned, 60, 100 and 200MHz scopes are all the same; to change the bandwidth several files need to be modified. The scope runs Linux internally and serial console connection is available on the main PCB. In order to access it, I needed a) remove the case and b) pull the EM shield from the main PCB. The case can easily be removed by unscrewing 4 screws, two next to retractable front legs and other two under the carrying handle. Link #3 has pictures showing locations of the screws.</p>
<p>The shield is secured by 5 screws &#8211; 2 at the top and 3 at the bottom. After screws are removed the shield can be pulled off without much difficulty. With the screen facing away the input stages are on the left under another shield and the console connector is to the right of the input stages.</p>
<p>Since I was curious about my input stages I pulled the shield from them as well and <a href="/wp/wp-content/uploads/2013/03/input_stage_resistors.jpg">took a picture</a>. What I needed to know were values of certain resistors around the variable gain amplifier &#8211; see link #1 for detailed discussion.</p>
<p>The following picture shows the oscilloscope with the case and shield removed. A place where to look for console connector is pointed at with an arrow.<br />
<div id="attachment_8357" class="wp-caption aligncenter" style="width: 1034px"><a href="/wp/wp-content/uploads/2013/03/console_location.jpg"><img src="https://www.circuitsathome.com/wp/wp-content/uploads/2013/03/console_location.jpg" alt="Console connector Location" title="Console connector Location" width="1024" height="768" class="size-full wp-image-8357" /></a><p class="wp-caption-text">Console connector Location</p></div></p>
<p>Next picture is a closeup of the connector. My copy of the scope has this place populated with a pin header therefore connection is very easy. Positions of relevant signals are shown &#8211; they need to go to 3.3V USB to serial TTL converter (I used Sparkfun FT232R Basic Breakout). Note that Tx pin on the board must go to Rx pin of the converter and Rx pin on the board must go to Tx pin of the converter. <a href="/wp/wp-content/uploads/2013/03/hantek_console.jpg">This picture</a> shows converter connected to the board.</p>
<div id="attachment_8365" class="wp-caption aligncenter" style="width: 1034px"><a href="/wp/wp-content/uploads/2013/03/console_pinout.jpg"><img src="/wp/wp-content/uploads/2013/03/console_pinout.jpg" alt="Console Pinout" title="Console Pinout" width="1024" height="768" class="size-full wp-image-8365" /></a><p class="wp-caption-text">Console Pinout</p></div>
<p>It&#8217;s now time to start hacking. A terminal session to the USB to serial converter&#8217;s COM port needs to be open &#8211; the serial port parameters for the terminal are 115200, 8N1. Then, the power must be applied to the scope. Again, be careful with exposed power supply! Because the instrument is lightweight it is difficult to plug anything into it with one hand. This is what I did: first, I made sure the power cord is disconnected on both sides, second, I pushed the power button in, and lastly, I connected the instrument end of the power cord, and then the other end &#8211; I&#8217;ve never even touched the powered device <img src='http://www.circuitsathome.com/wp/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .</p>
<p>The oscilloscope will now start <a href="/wp/wp-content/uploads/2013/03/hantek_boot.jpg">booting Linux OS</a>.  After some time, the output will stop; after pressing &#8216;Ctrl-C&#8217; I got the following message:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">Please press Enter to activate this console.</pre></div></div>

<p>which I did. After pressing &#8216;Enter&#8217; I got a console prompt on the screen which looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #009900;">&#91;</span>root@Tekway<span style="color: #339933;">-</span>dso <span style="color: #339933;">/</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">#</span></pre></div></div>

<p>We are now in the root directory. Enter <code>ls</code> command. My (already hacked) root directory looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #009900;">&#91;</span>root@Tekway<span style="color: #339933;">-</span>dso <span style="color: #339933;">/</span><span style="color: #009900;">&#93;</span><span style="color: #339933;"># ls</span>
OurLanguages      fpgabank.<span style="color: #202020;">conf</span>     lost<span style="color: #339933;">+</span>found        tdc_edge125M
bin               help.<span style="color: #202020;">db</span>           mnt               tdc_overtime125M
chk_base_volt     home              msg               tdc_pulse125M
cur_acq.<span style="color: #202020;">type</span>      i2c.<span style="color: #202020;">log</span>           mult_adc.<span style="color: #202020;">log</span>      test
dev               icon              nfs               tmp
disk_sta.<span style="color: #202020;">info</span>     keyprotocol.<span style="color: #202020;">inf</span>   opt               tmpdst
dn.<span style="color: #202020;">rbf</span>            language.<span style="color: #202020;">img</span>      param             ubdb.<span style="color: #202020;">swi</span>
dso               lib               proc              usbsavefile.<span style="color: #202020;">tmp</span>
dso.<span style="color: #202020;">exe</span>           linuxrc           protocol.<span style="color: #202020;">inf</span>      usr
dst1202b          logo              sbin              var
etc               logotype          sys.<span style="color: #202020;">inf</span>
fpga.<span style="color: #202020;">exe</span>          logotype.<span style="color: #202020;">dis</span>      tdc.<span style="color: #202020;">log</span>
<span style="color: #009900;">&#91;</span>root@Tekway<span style="color: #339933;">-</span>dso <span style="color: #339933;">/</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">#</span></pre></div></div>

<p>As can bee seen, the directory contains file named <code>dst1202b</code> &#8211; this is an indicator to the firmware to treat the hardware as 200MHz instrument. Lower-bandwidth instruments will have a file named <code>dst1102b</code> or <code>dst1062b</code>. The file itself is empty, only file name matters. First step of the hack is to change the name. The Linux command to do this (for 100MHz scope) is:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #009900;">&#91;</span>root@Tekway<span style="color: #339933;">-</span>dso <span style="color: #339933;">/</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">#mv dst1102b dst1202b</span></pre></div></div>

<p>Next step is to modify 4 files to contain the new name. The files are <code>sys.inf</code>, <code>tmpdst</code>, <code>logotype</code>, and <code>logotype.dis</code>. In the first three files, the &#8216;dst1102b&#8217; needs to be changed to &#8216;dst1202b&#8217;, the fourth depends on a vendor, mine contained &#8216;hantek_DSO5102B&#8217; and needed to be changed to &#8216;hantek_DSO5202B&#8217;. The vi editor is available, it is not very user-friendly so if you are not familiar with it I suggest reading the manual and practicing using it first on some other Linux system. In any of the files, only one symbol needs to be edited, so general sequence of keystrokes after opening the file is this: using the cursor keys, position the cursor under the character &#8217;1&#8242; which needs to be changed to &#8217;2&#8242;, press &#8216;r&#8217;, then &#8217;2&#8242;, then &#8216;Esc&#8217;, &#8216;:&#8217;, &#8216;w&#8217;, &#8216;q&#8217;, and &#8216;Enter&#8217;.</p>
<p>After all files are changed, I simply rebooted my scope and enjoyed extra bandwidth. The following screenshot shows the same fast pulse that was used for baseline measurement &#8211; I now have 2ns timebase setting and ~1.8ns measured rise time.<br />
<a href="/wp/wp-content/uploads/2013/03/risetime_posthack.jpg"><img src="/wp/wp-content/uploads/2013/03/risetime_posthack.jpg" alt="" title="risetime_posthack" width="800" height="480" class="aligncenter size-full wp-image-8382" /></a></p>
<p>Modified instrument maintains the &#8220;new&#8221; bandwidth after loading official firmware updates. This is just the first of many possible hacks &#8211; stay tuned!</p>
<p>Oleg.</p>
<p>Links to information about Hantek scopes describing this and other hacks:</p>
<ul>
<li><a href="http://www.eevblog.com/forum/chat/hantek-tekway-dso-hack-get-200mhz-bw-for-free/">Tinhead&#8217;s EEVblog thread</a> containing current information about the mods</li>
<li><a href="http://elinux.org/Das_Oszi">Das Oszi </a>project page</li>
<li><a href="http://randomprojects.org/wiki/Voltcraft_DSO-3062C">Uwe Hermann&#8217;s </a>page</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.circuitsathome.com/measurements/hantek-dso5000-series-oscilloscope-modifications-part-1-doubling-the-bandwidth-of-dso5102b/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Installing SSH server on pcDuino</title>
		<link>http://www.circuitsathome.com/mini-pc/installing-ssh-server-on-pcduino</link>
		<comments>http://www.circuitsathome.com/mini-pc/installing-ssh-server-on-pcduino#comments</comments>
		<pubDate>Fri, 08 Mar 2013 06:04:51 +0000</pubDate>
		<dc:creator>oleg</dc:creator>
				<category><![CDATA[mini PC]]></category>
		<category><![CDATA[pcDuino]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">https://www.circuitsathome.com/?p=8267</guid>
		<description><![CDATA[<p class="wp-caption-text">pcDuino board out of the box</p> <p>At the end of February I received an e-mail from Jingfeng Liu of Linksprite informing me that they are launching a new product called pcDuino and offering a free sample. Two days ago I got a package in the mail containing the board, a WiFi dongle and a [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_8268" class="wp-caption alignleft" style="width: 298px"><a href="/wp/wp-content/uploads/2013/03/pcduino.jpg"><img src="/wp/wp-content/uploads/2013/03/pcduino-288x216.jpg" alt="pcDuino board out of the box" title="pcDuino board out of the box" width="288" height="216" class="size-thumbnail wp-image-8268" /></a><p class="wp-caption-text">pcDuino board out of the box</p></div>
<p>At the end of February I received an e-mail from Jingfeng Liu of <a href="http://www.linksprite.com">Linksprite</a> informing me that they are launching a new product called <a href="http://www.pcduino.com/">pcDuino</a> and offering a free sample. Two days ago I got a package in the mail containing the board, a WiFi dongle and a bag of cables. In ten minutes, most of them spent looking for spare keyboard and mouse, the system was up and running.</p>
<p>pcDuino is a mini PC platform based on 1GHz ARM Cortex A8 processor. It has 1GB of RAM, 2GB of Flash, 2 USB Host ports, 1 USB OTG port, HDMI video, Ethernet and Micro-SD slot. It comes with Ubuntu pre-installed and its graphic desktop is surprisingly responsive for such a small machine.</p>
<p>After an uneventful start &#8211; all you need to do is connect a keyboard, mouse and HDMI monitor &#8211; I started looking into ways to control my pcDuino remotely. Ethernet worked out of the box so physical connectivity was not really an issue. However, I haven&#8217;t found any access control tools and even root account is set up with no terminal password (and in KDE, the root password is &#8216;ubuntu&#8217; &#8211; I managed to guess it at first attempt without ever looking in the doc). No remote access tool were installed either, which was actually a good thing since I needed to secure the root account first.</p>
<p>Even though pcDuino comes with graphic desktop, I prefer working with command line. I launched the <code>LXTerminal</code> application from the desktop and typed <code>sudo su</code>. This command switches current user to root. Now it&#8217;s time to give it a password. The command for it is <code>passwd</code>. It will prompt for a new password and then will ask to confirm. The root is now password protected.</p>
<p>Now I needed an account for myself. On Linux machines my nickname is &#8216;felis&#8217; so I typed:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">adduser felis</pre></div></div>

<p><span id="more-8267"></span></p>
<p>The command asks several questions, one of them being a password for the user. Once this is done, I need to add myself to administrator group &#8211; this will allow me to use <code>sudo</code> from my account. The command is similar to the previous one and looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">adduser felis admin</pre></div></div>

<p>The next step is to find out the IP address of Ethernet interface. The pcDuino is connected to a router which acts as DHCP server assigning dynamic IP addresses to the hosts on the LAN. I typed</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">ifconfig</pre></div></div>

<p>and saw the following output:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="sh" style="font-family:monospace;">eth0      Link encap:Ethernet  HWaddr ea:54:d8:39:2b:f7
          inet addr:192.168.255.25  Bcast:192.168.255.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
&nbsp;
...
(truncated)</pre></td></tr></table></div>

<p><code>inet addr</code> is my IP address. Typically, DHCP server tries to assign the same IP address to the host if it has enough addresses in the pool so I expect my Ethernet interface to have the same address after reboot. I now know the IP address to connect to and it&#8217;s time to add a service.</p>
<p>To install ssh, first I needed to update repositories by typing</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">apt-get update</pre></div></div>

<p>After the update is finished (this could take a while), I installed ssh, like that:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">apt-get install ssh</pre></div></div>

<p>and also Joe text editor:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">apt-get install joe</pre></div></div>

<p>With just installed editor (hardcore UNIX types may prefer using <code>vi</code> instead) I opened <code>sshd_config</code> by typing</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">joe /etc/ssh/sshd_config</pre></div></div>

<p>and adding what looks like line 12 in the following listing. It instructs ssh server to only allow user felis to login via ssh. Once the line is added, press <code>Ctrl-K</code> and then <code>X</code> &#8211; this will save the config.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="sh" style="font-family:monospace;">ServerKeyBits 768
&nbsp;
# Logging
SyslogFacility AUTH
LogLevel INFO
&nbsp;
# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
&nbsp;
AllowUsers felis</pre></td></tr></table></div>

<p>The simplest way to apply new config is to reboot the machine by typing</p>
<pre lang'"sh">
shutdown -r now
</pre>
<p>After the pcDuino has rebooted, I launched <code>putty</code> on my desktop PC and opened a shh session to the IP address I discovered earlier. At the prompt, I entered my username, password, and was logged in. I opened another window, tried to login as root and was denied access, as expected. The ssh works just like I wanted.</p>
<p>The next step is to configure Wi-Fi adapter. Unlike Ethernet it won&#8217;t work out of the box &#8211; the device gets initialized and goes up but it refuses to associate with the access point. For now, the pcDuino sits atop of the router powered from router&#8217;s USB flash drive port. Once I figure out how to configure Wi-Fi, I&#8217;ll write another post about it &#8211; stay tuned!</p>
<p>Oleg.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.circuitsathome.com/mini-pc/installing-ssh-server-on-pcduino/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Running multiple slave devices on Arduino SPI bus – data formats</title>
		<link>http://www.circuitsathome.com/mcu/running-multiple-slave-devices-on-arduino-spi-bus-data-formats</link>
		<comments>http://www.circuitsathome.com/mcu/running-multiple-slave-devices-on-arduino-spi-bus-data-formats#comments</comments>
		<pubDate>Thu, 28 Feb 2013 00:42:33 +0000</pubDate>
		<dc:creator>oleg</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[MCU]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[LSB]]></category>
		<category><![CDATA[MSB]]></category>
		<category><![CDATA[NFC Shield]]></category>
		<category><![CDATA[PN532]]></category>
		<category><![CDATA[SPI]]></category>

		<guid isPermaLink="false">https://www.circuitsathome.com/?p=8247</guid>
		<description><![CDATA[<p><p class="wp-caption-text">Bit reversal code</p> After finishing hardware modifications for my three-SPI-device setup I started coding and hit a snag. Any device would happily work by its own, WiFi and SD were also happy together, however, adding NFC Shield to the mix would disable other two. If I moved NFC initialization to the beginnig, other two [...]]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_8248" class="wp-caption alignright" style="width: 298px"><a href="/wp/wp-content/uploads/2013/02/spi_bit-_reversal.jpg"><img src="/wp/wp-content/uploads/2013/02/spi_bit-_reversal-288x216.jpg" alt="Bit reversal code" title="Bit reversal code" width="288" height="216" class="size-thumbnail wp-image-8248" /></a><p class="wp-caption-text">Bit reversal code</p></div><br />
After finishing <a href="/mcu/running-multiple-slave-devices-on-arduino-spi-bus-hardware-modifications">hardware modifications</a> for my three-SPI-device setup I started coding and hit a snag. Any device would happily work by its own, WiFi and SD were also happy together, however, adding NFC Shield to the mix would disable other two. If I moved NFC initialization to the beginnig, other two devices would work but NFC would not. At the same time, if a device was just present on a bus and not initialized, other two devices were not affected. It became clear that initialization itself was the source of error.</p>
<p>Seeedstudio NFC Shield uses NXP PN532 transmission module. This module supports several communication interfaces, namely SPI, I2C, and HSU. In SPI mode the data format is &#8216;LSB first&#8217;, i.e., transmission starts from bit 0. Such format is uncommon; all other SPI shields I&#8217;m aware of &#8211; Ethernet, WiFi, USB Host, etc., are using &#8216;MSB first&#8217; format &#8211; the transmission starts with bit 7.</p>
<p>A quick look into NFC library source code revealed the following line in <code>PN532::begin()</code> function:</p>
<p><code>pn532_SPI.setBitOrder(LSBFIRST);</code></p>
<p>This line sets the data format. In Atmega microcontrollers the default SPI data format is &#8216;MSB first&#8217; &#8211; all other SPI devices don&#8217;t have to set it during initalization. Initial revision of PN532 code ( written by <a href="http://www.adafruit.com/">Adafruit</a> ) was using software SPI and awkward bit order was dealt with in <code>write()</code> and <code>read()</code> functions. When Seeedstudio modified the code to work with hardware SPI, they just switched SPI to &#8216;LSB first&#8217; format without much thinking, breaking compatibility with the rest of the world. Surely, when I commented out this line, NFC initialization stopped breaking WiFi. Predictably, NFC also stopped working.</p>
<p>Luckily for me, the SPI is pretty basic protocol and bit order setting in SPI controller doesn&#8217;t mean much. It really doesn&#8217;t matter how the bit order is set; if we need &#8216;MSB first&#8217; for the majority of the devices we can initialize SPI in a normal way and then modify <code>write()</code> and <code>read()</code> functions for &#8216;LSB first&#8217; device to serve it reversed bytes. This is exactly what I did. Below is modified version of Seeedstudio PN532 library (also presented on a title screenshot) &#8211; lines 6 and 16 perform bit reversing:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/************** low level SPI ********/</span>
<span style="color: #808080; font-style: italic;">/*Function:Transmit a byte to PN532 through the SPI interface. */</span>
<span style="color: #000000; font-weight: bold;">inline</span> <span style="color: #993333;">void</span> PN532<span style="color: #339933;">::</span><span style="color: #202020;">write</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">uint8_t</span> _data<span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span>
  <span style="color: #808080; font-style: italic;">/* bit reversing code copied vetbatim from http://graphics.stanford.edu/~seander/bithacks.html#BitReverseObvious */</span>
  _data  <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>_data <span style="color: #339933;">*</span> 0x0802LU <span style="color: #339933;">&amp;</span> 0x22110LU<span style="color: #009900;">&#41;</span> <span style="color: #339933;">|</span> <span style="color: #009900;">&#40;</span>_data <span style="color: #339933;">*</span> 0x8020LU <span style="color: #339933;">&amp;</span> 0x88440LU<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> 0x10101LU <span style="color: #339933;">&gt;&gt;</span> <span style="color: #0000dd;">16</span><span style="color: #339933;">;</span>
&nbsp;
  pn532_SPI.<span style="color: #202020;">transfer</span><span style="color: #009900;">&#40;</span>_data<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*Function:Receive a byte from PN532 through the SPI interface */</span>
<span style="color: #000000; font-weight: bold;">inline</span> <span style="color: #993333;">uint8_t</span> PN532<span style="color: #339933;">::</span><span style="color: #202020;">read</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span>
  <span style="color: #993333;">uint8_t</span> data_ <span style="color: #339933;">=</span> pn532_SPI.<span style="color: #202020;">transfer</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #808080; font-style: italic;">/* bit reversing code copied vetbatim from http://graphics.stanford.edu/~seander/bithacks.html#BitReverseObvious */</span>
  data_  <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>data_ <span style="color: #339933;">*</span> 0x0802LU <span style="color: #339933;">&amp;</span> 0x22110LU<span style="color: #009900;">&#41;</span> <span style="color: #339933;">|</span> <span style="color: #009900;">&#40;</span>data_ <span style="color: #339933;">*</span> 0x8020LU <span style="color: #339933;">&amp;</span> 0x88440LU<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> 0x10101LU <span style="color: #339933;">&gt;&gt;</span> <span style="color: #0000dd;">16</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">return</span> data_<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>After making these modifications, commenting out the &#8216;LSB first&#8217; setting in the <code>PN532:begin()</code> and also modifying WiFi code to stay away from pin 9 (see <a href="/mcu/running-multiple-slave-devices-on-arduino-spi-bus">this article</a> for discussion) all three devices are happily working together without conflicts. The library mod for PN532 can be left there permanently &#8211; the chip will never know that it is communicating  with &#8220;misconfigured&#8221; SPI host. I&#8217;m hoping Seeedstudio will fix their code eventually; in the mean time, if you have SPI compatibility issues, simply make code modifications presented in this article.</p>
<p>Enjoy,<br />
Oleg.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.circuitsathome.com/mcu/running-multiple-slave-devices-on-arduino-spi-bus-data-formats/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Running multiple slave devices on Arduino SPI bus – hardware modifications.</title>
		<link>http://www.circuitsathome.com/mcu/running-multiple-slave-devices-on-arduino-spi-bus-hardware-modifications</link>
		<comments>http://www.circuitsathome.com/mcu/running-multiple-slave-devices-on-arduino-spi-bus-hardware-modifications#comments</comments>
		<pubDate>Tue, 26 Feb 2013 01:42:46 +0000</pubDate>
		<dc:creator>oleg</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[MCU]]></category>
		<category><![CDATA[NFC Shield]]></category>
		<category><![CDATA[SPI]]></category>
		<category><![CDATA[Wifi SHield]]></category>

		<guid isPermaLink="false">https://www.circuitsathome.com/?p=8199</guid>
		<description><![CDATA[<p class="wp-caption-text">WiFi and NFC shield stack</p> <p>Add-on boards AKA &#8220;shields&#8221; greatly expand the capabilities of standard Arduino platform. Typically, a shield adds a specific peripheral interface; if you need several peripherals you may need to use several shields. The biggest problem in this approach is shield compatibility. Shield developers don&#8217;t care much about interoperability and [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_8200" class="wp-caption alignleft" style="width: 298px"><a href="wp/wp-content/uploads/2013/02/stack.jpg"><img src="/wp/wp-content/uploads/2013/02/stack-288x216.jpg" alt="WiFi and NFC shield stack" title="WiFi and NFC shield stack" width="288" height="216" class="size-thumbnail wp-image-8200" /></a><p class="wp-caption-text">WiFi and NFC shield stack</p></div>
<p>Add-on boards AKA &#8220;shields&#8221; greatly expand the capabilities of standard Arduino platform. Typically, a shield adds a specific peripheral interface; if you need several peripherals you may need to use several shields. The biggest problem in this approach is shield compatibility. Shield developers don&#8217;t care much about interoperability and sometimes making several shields work together is difficult. In the <a href="/mcu/running-multiple-slave-devices-on-arduino-spi-bus">previous article on the topic</a> I described a project where USB Host and WiFi shields were made to share the same SPI bus. I have been recently tasked with similar project which required rather heavy hardware modifications. This article shows the necessary steps to build a system consisting of Arduino board, <a href="http://arduino.cc/en/Main/ArduinoWiFiShield">official WiFi Shield</a> and <a href="http://www.seeedstudio.com/depot/nfc-shield-p-916.html">Seeedstudio NFC Shield</a>.</p>
<p>Here is the hardware configuration. Both shields come with stackable headers so they can be plugged into each other. Both shields use ICSP for SPI but connectors are non-stackable so at least one of the shields must have its ICSP connector replaced with the stackable variant ( <a href="http://www.circuitsathome.com/products-page/components/stackable-2x3-header">I sell them</a>). Also, both shields use pin 10 for CS so this pin needs to be re-assigned on one of the shields.</p>
<p>NFC shield has offset female connectors therefore if another shield is placed on top of it ICSP connector won&#8217;t mate. It means that stackable ICSP connector shall be placed on WiFi shield. At the same time, since NFC Shield does have a second row of contacts re-assigning pin 10 on this board is easy.</p>
<p>Before we start cutting traces and desoldering connectors, let&#8217;s establish a baseline or &#8220;a known good state&#8221;. I simply grabbed an example from NFC shield library distro called <code>readMifareMemory</code>, compiled, loaded and ran it. I was able to read the card and now I know that my NFC shield is functional.</p>
<p>One other note &#8211; both shields are assembled using lead-free solder which has higher melting point. Don&#8217;t forget to set the temperature of your soldering iron accordingly &#8211; between 700F and 750F.<br />
<span id="more-8199"></span></p>
<table align="right">
<tr>
<td>
<div id="attachment_8214" class="wp-caption alignright" style="width: 298px"><a href="/wp/wp-content/uploads/2013/02/pin10_remove.jpg"><img src="/wp/wp-content/uploads/2013/02/pin10_remove-288x216.jpg" alt="Pin 10 removed" title="Pin 10 removed" width="288" height="216" class="size-thumbnail wp-image-8214" /></a><p class="wp-caption-text">Pin 10 removed</p></div>
</td>
<td>
<div id="attachment_8215" class="wp-caption alignright" style="width: 298px"><a href="/wp/wp-content/uploads/2013/02/pin10_redirect.jpg"><img src="/wp/wp-content/uploads/2013/02/pin10_redirect-288x216.jpg" alt="Pin 10 re-assigned" title="Pin 10 re-assigned" width="288" height="216" class="size-thumbnail wp-image-8215" /></a><p class="wp-caption-text">Pin 10 re-assigned</p></div>
</td>
</tr>
</table>
<p>Cutting a CS trace on NFC shield is not convenient &#8211; the trace is thin and has ground plane close to it. Instead of cutting it, I simply removed the pin 10 from the header to break the connection between this pin and Arduino. Next two pictures show the mod. First, remove the pin by heating it up with a soldering iron from the top and pulling it down with a small pliers. Heat up the pin until it starts moving then pull quickly (but gently). When the pin is removed solder a jumper between pins 9 and 10 on the NFC shield.</p>
<p>Now it&#8217;s time to test the mod. In the sketch, find a line near the beginning which looks like this one :</p>
<p><code>#define PN532_CS 10</code></p>
<p>and change &#8217;10&#8242; to &#8217;9&#8242;. Then compile the sketch, upload and run. The sketch should function just like before the mod using just modified CS at pin 9.</p>
<p>The next step is to modify the WiFi shield. What we need to do is replace the standard 2&#215;3 ICSP connector with one which have long pins facing up to mate with the shield placed on top of it (see <a href="/mcu/running-multiple-slave-devices-on-arduino-spi-bus">previous article</a> on the topic for pictures). The modification must be done very carefully &#8211; a damaged PCB often means the whole board is ruined. The following procedure typically works well:</p>
<ol>
<li>It is much easier to desolder pins one by one. On the left picture below the black case is pulled off the connector exposing the pins. This can be achieved by carefully prying the case out working from the sides of the connector between case and a spacer underneath it with a pair of small screwdrivers.</li>
<li>When this is done, the shield can be turned upside down and pins pulled one by one using the technique used earlier when removing pin 10 on the NFC Shield. One of the pins is soldered to the ground plane and it needs more time to heat up &#8211; be prepared for it and don&#8217;t start pulling out the pin before it&#8217;s loose.</li>
<li>The picture below on the right shows the empty place on the board with excessive solder cleaned from holes with a toothpick. It also shows the connector I just removed and put back together &#8211; perfectly usable.</li>
<li>The stackable 2&#215;3 connector can now be placed. Before doing this it is a good idea to assemble the stack and see if anything else needs to be added. My copy of WiFi Shield has extra long pins so I needed to add a spacer between 2&#215;3 connector and the board &#8211; see the title picture. Put it on 2&#215;3 connector pins, insert the connector and solder it on paying extra attention to the ground pin, as ususal.</li>
</ol>
<table>
<tr>
<td>
<div id="attachment_8229" class="wp-caption alignleft" style="width: 298px"><a href="/wp/wp-content/uploads/2013/02/2x3_remove.jpg"><img src="/wp/wp-content/uploads/2013/02/2x3_remove-288x216.jpg" alt="2x3 connector removal" title="2x3 connector removal" width="288" height="216" class="size-thumbnail wp-image-8229" /></a><p class="wp-caption-text">2x3 connector removal</p></div>
</td>
<td>
<div id="attachment_8230" class="wp-caption alignleft" style="width: 298px"><a href="/wp/wp-content/uploads/2013/02/2x3_cleanup.jpg"><img src="https://www.circuitsathome.com/wp/wp-content/uploads/2013/02/2x3_cleanup-288x216.jpg" alt="2x3 cleanup" title="2x3 cleanup" width="288" height="216" class="size-thumbnail wp-image-8230" /></a><p class="wp-caption-text">2x3 cleanup</p></div>
</td>
</tr>
</table>
<p>The last step before using the setup is to run checks once again. The stack can be plugged into Arduino which at this time should still contain NFC sketch. Running this sketch once again would ensure that the NFC shield can communicate via the new connector. After this is done, WiFi shield can be checked as well using any of the sample sketches from the WiFi library.</p>
<p>This finishes the hardware modifications. Now it&#8217;s time to write the code which uses both devices to check compatibility between libraries. If anything interesting comes up, I&#8217;ll write about it.</p>
<p>Oleg.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.circuitsathome.com/mcu/running-multiple-slave-devices-on-arduino-spi-bus-hardware-modifications/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>USB Host Shield Illustrated Assembly Guide</title>
		<link>http://www.circuitsathome.com/mcu/usb-host-shield-illustrated-assembly-guide</link>
		<comments>http://www.circuitsathome.com/mcu/usb-host-shield-illustrated-assembly-guide#comments</comments>
		<pubDate>Fri, 22 Feb 2013 02:19:16 +0000</pubDate>
		<dc:creator>oleg</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[MCU]]></category>
		<category><![CDATA[USB Shield]]></category>
		<category><![CDATA[assembly guide]]></category>
		<category><![CDATA[MAX3421E]]></category>
		<category><![CDATA[USB Host Shield]]></category>

		<guid isPermaLink="false">https://www.circuitsathome.com/?p=8177</guid>
		<description><![CDATA[<p>Allan Caplan sent me a write-up and pictures of putting together headers on USB Host Shield 2.0. The post can be used as an assembly guide for the shield. The following text and pictures were taken straight from Allan&#8217;s Evernote which he kindly shared with me and gave me permission to repost. I just wanted [...]]]></description>
			<content:encoded><![CDATA[<p>Allan Caplan sent me a write-up and pictures of putting together headers on <a href="https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-2-0-for-arduino">USB Host Shield 2.0</a>. The post can be used as an assembly guide for the shield. The following text and pictures were taken straight from Allan&#8217;s Evernote which he kindly shared with me and gave me permission to repost. I just wanted to add that after assembly is is a good idea to load and run the <a href="https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/board_qc/board_qc.pde">quality control routine</a> to make sure the shield works.</p>
<p>Enjoy!</p>
<p>Assembling the USB Host Shield (v2.0) is pretty well straight forward, even without instructions. Some people have complained about the lack of instructions, so here goes. This guide assumes you are familiar with basic soldering techniques, and basic Arduino know-how.</p>
<p>1. Unpack the shield. You should see something similar to this: two 8 pin headers; two 6 pin headers; one 2X3 pin header</p>
<div id="attachment_8185" class="wp-caption aligncenter" style="width: 810px"><a href="/wp/wp-content/uploads/2013/02/kit.jpg"><img src="/wp/wp-content/uploads/2013/02/kit.jpg" alt="Kit" title="Kit" width="800" height="444" class="size-full wp-image-8185" /></a><p class="wp-caption-text">Kit</p></div>
<p>2. Insert the pins. It should be explanatory where they go &#8211; along the outer rows, one side has two banks of 8 and the other has 2 banks of 6. Now, if you have a third hand this may get easy. When I do soldering like this I like to insert all the headers and turn the card upside down, like this:</p>
<div id="attachment_8188" class="wp-caption aligncenter" style="width: 520px"><a href="/wp/wp-content/uploads/2013/02/6_8_headers_bottom.jpg"><img src="/wp/wp-content/uploads/2013/02/6_8_headers_bottom.jpg" alt="6x and 8x headers from the bottom" title="6x and 8x headers from the bottom" width="510" height="488" class="size-full wp-image-8188" /></a><p class="wp-caption-text">6x and 8x headers from the bottom</p></div>
<p>3. Before you start soldering, make sure the header you are working on is straight!</p>
<p>4. Did you check that your header is straight?</p>
<p>5. OK, go ahead and solder. I like to work on each header at a time, making sure it&#8217;s straight before starting. Once done, you should have something that looks like this (from the top)</p>
<div id="attachment_8192" class="wp-caption aligncenter" style="width: 571px"><a href="/wp/wp-content/uploads/2013/02/6_8_headers_top.jpg"><img src="/wp/wp-content/uploads/2013/02/6_8_headers_top.jpg" alt="6x, 8x headers from the top" title="6x, 8x headers from the top" width="561" height="488" class="size-full wp-image-8192" /></a><p class="wp-caption-text">6x, 8x headers from the top</p></div>
<p>6. Time for the 2&#215;3 header. Insert it like so. Again if you have a third hand this will be easier, if you don&#8217;t make sure your header is straight before soldering!</p>
<div id="attachment_8194" class="wp-caption aligncenter" style="width: 576px"><a href="/wp/wp-content/uploads/2013/02/2_3_header.jpg"><img src="/wp/wp-content/uploads/2013/02/2_3_header.jpg" alt="2x3 header" title="2x3 header" width="566" height="488" class="size-full wp-image-8194" /></a><p class="wp-caption-text">2x3 header</p></div>
<p>7. That&#8217;s it! If you did things correctly you should have a functioning USB Host Shield! Go ahead and fit it on your Arduino board (make sure it&#8217;s straight, I didn&#8217;t realize mine was crooked in the picture)</p>
<div id="attachment_8178" class="wp-caption aligncenter" style="width: 298px"><a href="/wp/wp-content/uploads/2013/02/sandwich.jpg"><img src="/wp/wp-content/uploads/2013/02/sandwich-288x216.jpg" alt="Final alignment check" title="Final alignment check" width="288" height="216" class="size-thumbnail wp-image-8178" /></a><p class="wp-caption-text">Final alignment check</p></div>
<p>8. You just soldered, clean up your workspace and go wash your hands.</p>
<p>9. Find the instructions for uploading software and running the QC program.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.circuitsathome.com/mcu/usb-host-shield-illustrated-assembly-guide/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>A documentation project for USB Host Library 2.0 has begun!</title>
		<link>http://www.circuitsathome.com/mcu/a-documentation-project-for-usb-host-library-2-0-has-begun</link>
		<comments>http://www.circuitsathome.com/mcu/a-documentation-project-for-usb-host-library-2-0-has-begun#comments</comments>
		<pubDate>Thu, 21 Feb 2013 05:38:00 +0000</pubDate>
		<dc:creator>oleg</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[MCU]]></category>
		<category><![CDATA[USB Shield]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[MAX3421E]]></category>
		<category><![CDATA[USB Host Shield]]></category>

		<guid isPermaLink="false">https://www.circuitsathome.com/?p=8156</guid>
		<description><![CDATA[<p class="wp-caption-text">USB Host Library Documentation</p> <p>This is short but very important announcement. Kristian from TKJ Electronics started a documentation project &#8211; here is the link to the post on his blog. Kristian configured Doxygen and set up the framework to build the documentation from the source code of the library. In addition to all that, [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_8159" class="wp-caption alignright" style="width: 298px"><a href="/wp/wp-content/uploads/2013/02/uhl_docs.jpg"><img src="/wp/wp-content/uploads/2013/02/uhl_docs-288x216.jpg" alt="USB Host Library Documentation" title="USB Host Library Documentation" width="288" height="216" class="size-thumbnail wp-image-8159" /></a><p class="wp-caption-text">USB Host Library Documentation</p></div>
<p>This is short but very important announcement. Kristian from TKJ Electronics started a documentation project &#8211; here is the link to the <a href="http://blog.tkjelectronics.dk/2013/02/documentation-added-for-the-usb-host-library/">post </a> on his blog. Kristian configured Doxygen and set up the framework to build the documentation from the source code of the library. In addition to all that, Kristian documented all the code he has contributed to the USB Host library 2.0. Results can be seen <a href="http://felis.github.com/USB_Host_Shield_2.0/">here</a>.</p>
<p> Documenting a function is now as easy as adding a specially-formatted comment at the beginning of the function. In the near future, I will start adding comments to the core USB functions as well to help people understand the internals of the library. It is going to take a bit of time to document everything but even what is available now is a very good beginning &#8211; thank you, Kristian!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.circuitsathome.com/mcu/a-documentation-project-for-usb-host-library-2-0-has-begun/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
