<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Electronics &#8211; semifluid.com</title>
	<atom:link href="/category/electronics/feed/" rel="self" type="application/rss+xml" />
	<link>/</link>
	<description>Intermediate in flow properties between solids and liquids; highly viscous.</description>
	<lastBuildDate>Mon, 23 Jan 2017 14:46:36 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.1</generator>
	<item>
		<title>Raspberry Pi Camera Comparison</title>
		<link>/2017/01/23/raspberry-pi-camera-comparison/</link>
		
		<dc:creator><![CDATA[Steven A. Cholewiak]]></dc:creator>
		<pubDate>Mon, 23 Jan 2017 14:46:36 +0000</pubDate>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Personal]]></category>
		<guid isPermaLink="false">/?p=5916</guid>

					<description><![CDATA[I use a number of Raspberry Pi 3 Model B ARM-based Linux computers to help simplify my day-to-day life. Because I live in an urban area, I have been interested in setting up a security camera that could alert me to any issues that might arise when I&#8217;m not in the house. Most recent Raspberry [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I use a number of <a href="https://www.raspberrypi.org/products/raspberry-pi-3-model-b/">Raspberry Pi 3 Model B</a> ARM-based Linux computers to help simplify my day-to-day life. Because I live in an urban area, I have been interested in setting up a security camera that could alert me to any issues that might arise when I&#8217;m not in the house. Most recent Raspberry Pis also include a <a href="https://en.wikipedia.org/wiki/Camera_Serial_Interface">CSI</a> connector, meaning that it is easy to connect a high-resolution camera that can be easily accessed via <a href="https://picamera.readthedocs.io/">python</a> or via <a href="https://www.raspberrypi.org/documentation/usage/camera/raspicam/raspistill.md">bash</a>. This would also be helpful for any other computer vision setup, including <a href="http://octoprint.org/">OctoPrint</a>. Since the <a href="http://www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbian-jessie-opencv-3/">Raspberry Pi runs OpenCV</a>, I can use open source computer vision source code to quick and easily setup a security system. The first step is selecting a camera.</p>
<p>I plan on using a <a href="http://amzn.to/2jH3h5K">Raspberry Pi 3</a> or <a href="http://amzn.to/2iq8YDZ">Raspberry Pi Zero v1.3 (with camera connector)</a> as the base machine. However, there are a number of 3rd party cameras available. As is often the case, I was not able to find a comparison of the options available online, so today I am going to do a quick and dirty look at the following cameras:</p>
<table  class=" table table-hover" >
<thead>
<tr>
<th>Model</th>
<th>Chipset</th>
<th>Megapixels</th>
<th>Advertised FOV</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="http://amzn.to/2iqbMRo" title="Raspberry Pi Camera">Raspberry Pi Camera</a></td>
<td>OV5647</td>
<td>5MP</td>
<td>54° (h) x 41° (v)</td>
</tr>
<tr>
<td><a href="http://amzn.to/2jGTeO6" title="Raspberry Pi v2 Camera">Raspberry Pi v2 Camera</a></td>
<td>IMX219</td>
<td>8MP</td>
<td>62.2° (h) x 48.8° (v)</td>
</tr>
<tr>
<td><a href="http://amzn.to/2jGSRmj" title="Arducam 5MP Camera">Arducam 5MP RPi Camera</a></td>
<td>OV5647</td>
<td>5MP</td>
<td>54° (h) x 41° (v)</td>
</tr>
<tr>
<td><a href="http://amzn.to/2jGUktd" title="Waveshare RPi Camera (I)">Waveshare RPi Camera (I)</a></td>
<td>OV5647</td>
<td>5MP</td>
<td>170°</td>
</tr>
<tr>
<td><a href="http://amzn.to/2jGYrW9" title="Waveshare RPi Camera (J)">Waveshare RPi Camera (J)</a></td>
<td>OV5647</td>
<td>5MP</td>
<td>222°</td>
</tr>
<tr>
<td><a href="http://amzn.to/2jGZnK2" title="Waveshare RPi Camera IR-CUT">Waveshare RPi Camera IR-CUT</a></td>
<td>OV5647</td>
<td>5MP</td>
<td>75.7°</td>
</tr>
</tbody>
</table>
<p><a href="/wp-content/uploads/2017/01/rpi-cameras-in-a-row.jpg"><img fetchpriority="high" decoding="async" src="/wp-content/uploads/2017/01/rpi-cameras-in-a-row-1024x557.jpg" alt="" width="648" height="352" class="aligncenter size-large wp-image-6008" srcset="/wp-content/uploads/2017/01/rpi-cameras-in-a-row-1024x557.jpg 1024w, /wp-content/uploads/2017/01/rpi-cameras-in-a-row-300x163.jpg 300w, /wp-content/uploads/2017/01/rpi-cameras-in-a-row-768x418.jpg 768w" sizes="(max-width: 648px) 100vw, 648px" /></a></p>
<p>In this post, I provide some demonstration photos for outdoor, indoor, and low-light scenarios for the modules.</p>
<p><span id="more-5916"></span></p>
<p>The basic testing rig uses a <a href="http://amzn.to/2jH3h5K">Raspberry Pi 3</a> as the processor. I mounted the cameras onto a piece of cardboard so that they would have roughly the same origin and orientation. Images were captured through an SSH connection to my laptop and transferred via <a href="http://www.hypexr.org/linux_scp_help.php"><code>scp</code></a>. Finally, I strapped on a portable battery (<a href="https://www.amazon.com/gp/product/B00SSY1AJU">AUKEY 12000mAh powerbank</a>) and the entire setup was portable. Since this is a headless machine, I streamed video from the Raspberry Pi to my laptop with the <a href="http://www.linux-projects.org/uv4l/tutorials/rtsp-server/">UV4L</a> package to make sure that the image was sharp, especially for the Waveshare cameras, which required some focusing. Here&#8217;s a photo of the &#8220;test setup&#8221;:</p>
<p><a href="/wp-content/uploads/2017/01/rpi-cameras-setup.jpg"><img decoding="async" src="/wp-content/uploads/2017/01/rpi-cameras-setup-1024x599.jpg" alt="" width="648" height="379" class="aligncenter size-large wp-image-6009" srcset="/wp-content/uploads/2017/01/rpi-cameras-setup-1024x599.jpg 1024w, /wp-content/uploads/2017/01/rpi-cameras-setup-300x176.jpg 300w, /wp-content/uploads/2017/01/rpi-cameras-setup-768x449.jpg 768w, /wp-content/uploads/2017/01/rpi-cameras-setup.jpg 1993w" sizes="(max-width: 648px) 100vw, 648px" /></a></p>
<p>Each module has different specifications and features, so it&#8217;s worthwhile to weigh the pros and cons when choosing one for your application. All of the modules are effectively plug-and-play with the CSI connector; however, the <a href="http://amzn.to/2jGZnK2" title="Waveshare RPi Camera IR-CUT">Waveshare RPi Camera IR-CUT</a> also has a neat feature where the LED signal toggles a mechanical IR filter. This means that with some creative coding, you can use it as a day and night camera (it even includes high power IR LEDs, which I did not include in the comparison shots). However, the image quality is a bit worse and the IR filter is not terribly effective (meaning colors are washed-out in daytime shots).</p>
<p>All photos were taken with:</p>
<pre><code>raspistill -o photo.jpg --vflip --hflip
</code></pre>
<p>Here are all of photos in a mosaic for quick comparison:</p>
<p><a href="/wp-content/uploads/2017/01/semifluid.com-camera-comparison.jpg"><img decoding="async" src="/wp-content/uploads/2017/01/semifluid.com-camera-comparison-1024x635.jpg" alt="" width="648" height="402" class="aligncenter size-large wp-image-6007" srcset="/wp-content/uploads/2017/01/semifluid.com-camera-comparison-1024x635.jpg 1024w, /wp-content/uploads/2017/01/semifluid.com-camera-comparison-300x186.jpg 300w, /wp-content/uploads/2017/01/semifluid.com-camera-comparison-768x476.jpg 768w" sizes="(max-width: 648px) 100vw, 648px" /></a></p>
<p>Image quality for the <a href="http://amzn.to/2iqbMRo" title="Raspberry Pi Camera">Raspberry Pi Camera</a> and the <a href="http://amzn.to/2jGSRmj" title="Arducam 5MP Camera">Arducam 5MP RPi Camera</a> were practically identical, which would be expected since they share the same sensor and lens setup. The <a href="http://amzn.to/2jGZnK2" title="Waveshare RPi Camera IR-CUT">Waveshare RPi Camera IR-CUT</a> was disappointing and even after dialing in the focus there were still regions that were blurry when the IR filter was enabled. I really liked the field-of-view for the <a href="http://amzn.to/2jGUktd" title="Waveshare RPi Camera (I)">Waveshare RPi Camera (I)</a> and <a href="http://amzn.to/2jGYrW9" title="Waveshare RPi Camera (J)">Waveshare RPi Camera (J)</a> and the image was quite sharp once the focus was adjusted. These would be ideal cameras for a home security solution. The <a href="http://amzn.to/2jGTeO6" title="Raspberry Pi v2 Camera">Raspberry Pi v2 Camera</a> performance was anti-climactic. Its dynamic range appears to be a bit wider, but it would often under-expose photos. This could probably be corrected by adjusting the parameters in <code>raspistill</code>.  Bang for buck, the <a href="http://amzn.to/2jGSRmj" title="Arducam 5MP Camera">Arducam 5MP RPi Camera</a> is best, but for shear field-of-view, the <a href="http://amzn.to/2jGYrW9" title="Waveshare RPi Camera (J)">Waveshare RPi Camera (J)</a> is pretty awesome.</p>
<p>And here are the full-resolution shots in each of the situations:</p>
<h3>Outdoor (day)</h3>
<table  class=" table table-hover" >
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="/wp-content/uploads/2017/01/cam_day_rpi.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_day_rpi-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5998" srcset="/wp-content/uploads/2017/01/cam_day_rpi-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_day_rpi-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_day_rpi-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Raspberry Pi Camera</td>
<td><a href="/wp-content/uploads/2017/01/cam_day_arducam.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_day_arducam-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5997" srcset="/wp-content/uploads/2017/01/cam_day_arducam-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_day_arducam-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_day_arducam-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Arducam 5MP RPi Camera</td>
</tr>
<tr>
<td><a href="/wp-content/uploads/2017/01/cam_day_waveshare_ir.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_day_waveshare_ir-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-6001" srcset="/wp-content/uploads/2017/01/cam_day_waveshare_ir-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_day_waveshare_ir-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_day_waveshare_ir-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Waveshare RPi Camera IR-CUT (on)</td>
<td><a href="/wp-content/uploads/2017/01/cam_day_waveshare_iroff.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_day_waveshare_iroff-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-6002" srcset="/wp-content/uploads/2017/01/cam_day_waveshare_iroff-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_day_waveshare_iroff-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_day_waveshare_iroff-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Waveshare RPi Camera IR-CUT (off)</td>
</tr>
<tr>
<td><a href="/wp-content/uploads/2017/01/cam_day_waveshare_i.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_day_waveshare_i-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-6000" srcset="/wp-content/uploads/2017/01/cam_day_waveshare_i-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_day_waveshare_i-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_day_waveshare_i-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Waveshare RPi Camera (I)</td>
<td><a href="/wp-content/uploads/2017/01/cam_day_waveshare_j.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_day_waveshare_j-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-6003" srcset="/wp-content/uploads/2017/01/cam_day_waveshare_j-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_day_waveshare_j-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_day_waveshare_j-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Waveshare RPi Camera (J)</td>
</tr>
<tr>
<td><a href="/wp-content/uploads/2017/01/cam_day_rpiv2.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_day_rpiv2-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5999" srcset="/wp-content/uploads/2017/01/cam_day_rpiv2-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_day_rpiv2-768x577.jpg 768w, /wp-content/uploads/2017/01/cam_day_rpiv2-1024x769.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Raspberry Pi v2 Camera</td>
<td></td>
</tr>
</tbody>
</table>
<h3>Outdoor (night)</h3>
<table  class=" table table-hover" >
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="/wp-content/uploads/2017/01/cam_carport_rpi.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_carport_rpi-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5989" srcset="/wp-content/uploads/2017/01/cam_carport_rpi-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_carport_rpi-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_carport_rpi-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Raspberry Pi Camera</td>
<td><a href="/wp-content/uploads/2017/01/cam_carport_arducam.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_carport_arducam-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5988" srcset="/wp-content/uploads/2017/01/cam_carport_arducam-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_carport_arducam-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_carport_arducam-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Arducam 5MP RPi Camera</td>
</tr>
<tr>
<td><a href="/wp-content/uploads/2017/01/cam_carport_waveshare_ir.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_carport_waveshare_ir-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5992" srcset="/wp-content/uploads/2017/01/cam_carport_waveshare_ir-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_carport_waveshare_ir-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_carport_waveshare_ir-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Waveshare RPi Camera IR-CUT (on)</td>
<td><a href="/wp-content/uploads/2017/01/cam_carport_waveshare_iroff.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_carport_waveshare_iroff-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5993" srcset="/wp-content/uploads/2017/01/cam_carport_waveshare_iroff-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_carport_waveshare_iroff-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_carport_waveshare_iroff-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Waveshare RPi Camera IR-CUT (off)</td>
</tr>
<tr>
<td><a href="/wp-content/uploads/2017/01/cam_carport_waveshare_i.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_carport_waveshare_i-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5991" srcset="/wp-content/uploads/2017/01/cam_carport_waveshare_i-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_carport_waveshare_i-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_carport_waveshare_i-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Waveshare RPi Camera (I)</td>
<td><a href="/wp-content/uploads/2017/01/cam_carport_waveshare_j.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_carport_waveshare_j-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5994" srcset="/wp-content/uploads/2017/01/cam_carport_waveshare_j-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_carport_waveshare_j-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_carport_waveshare_j-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Waveshare RPi Camera (J)</td>
</tr>
<tr>
<td><a href="/wp-content/uploads/2017/01/cam_carport_rpiv2.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_carport_rpiv2-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5990" srcset="/wp-content/uploads/2017/01/cam_carport_rpiv2-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_carport_rpiv2-768x577.jpg 768w, /wp-content/uploads/2017/01/cam_carport_rpiv2-1024x769.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Raspberry Pi v2 Camera</td>
<td></td>
</tr>
</tbody>
</table>
<h3>Indoor (day)</h3>
<table  class=" table table-hover" >
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="/wp-content/uploads/2017/01/cam_indoors_rpi.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_indoors_rpi-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5961" srcset="/wp-content/uploads/2017/01/cam_indoors_rpi-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_indoors_rpi-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_indoors_rpi-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a> <br /> Raspberry Pi Camera</td>
<td><a href="/wp-content/uploads/2017/01/cam_indoors_arducam.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_indoors_arducam-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5960" srcset="/wp-content/uploads/2017/01/cam_indoors_arducam-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_indoors_arducam-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_indoors_arducam-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a> <br /> Arducam 5MP RPi Camera</td>
</tr>
<tr>
<td><a href="/wp-content/uploads/2017/01/cam_indoors_waveshare_ir.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_indoors_waveshare_ir-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5964" srcset="/wp-content/uploads/2017/01/cam_indoors_waveshare_ir-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_indoors_waveshare_ir-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_indoors_waveshare_ir-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Waveshare RPi Camera IR-CUT (on)</td>
<td><a href="/wp-content/uploads/2017/01/cam_indoors_waveshare_iroff.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_indoors_waveshare_iroff-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5965" srcset="/wp-content/uploads/2017/01/cam_indoors_waveshare_iroff-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_indoors_waveshare_iroff-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_indoors_waveshare_iroff-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Waveshare RPi Camera IR-CUT (off)</td>
</tr>
<tr>
<td><a href="/wp-content/uploads/2017/01/cam_indoors_waveshare_i.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_indoors_waveshare_i-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5963" srcset="/wp-content/uploads/2017/01/cam_indoors_waveshare_i-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_indoors_waveshare_i-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_indoors_waveshare_i-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Waveshare RPi Camera (I)</td>
<td><a href="/wp-content/uploads/2017/01/cam_indoors_waveshare_j.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_indoors_waveshare_j-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5966" srcset="/wp-content/uploads/2017/01/cam_indoors_waveshare_j-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_indoors_waveshare_j-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_indoors_waveshare_j-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Waveshare RPi Camera (J)</td>
</tr>
<tr>
<td><a href="/wp-content/uploads/2017/01/cam_indoors_rpiv2.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_indoors_rpiv2-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5962" srcset="/wp-content/uploads/2017/01/cam_indoors_rpiv2-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_indoors_rpiv2-768x577.jpg 768w, /wp-content/uploads/2017/01/cam_indoors_rpiv2-1024x769.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Raspberry Pi v2 Camera</td>
<td></td>
</tr>
</tbody>
</table>
<h3>Indoor (night)</h3>
<table  class=" table table-hover" >
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="/wp-content/uploads/2017/01/cam_nightindoors_rpi.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_nightindoors_rpi-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5981" srcset="/wp-content/uploads/2017/01/cam_nightindoors_rpi-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_nightindoors_rpi-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_nightindoors_rpi-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Raspberry Pi Camera</td>
<td><a href="/wp-content/uploads/2017/01/cam_nightindoors_arducam.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_nightindoors_arducam-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5980" srcset="/wp-content/uploads/2017/01/cam_nightindoors_arducam-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_nightindoors_arducam-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_nightindoors_arducam-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Arducam 5MP RPi Camera</td>
</tr>
<tr>
<td><a href="/wp-content/uploads/2017/01/cam_nightindoors_waveshare_ir.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_nightindoors_waveshare_ir-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5984" srcset="/wp-content/uploads/2017/01/cam_nightindoors_waveshare_ir-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_nightindoors_waveshare_ir-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_nightindoors_waveshare_ir-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Waveshare RPi Camera IR-CUT (on)</td>
<td><a href="/wp-content/uploads/2017/01/cam_nightindoors_waveshare_iroff.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_nightindoors_waveshare_iroff-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5985" srcset="/wp-content/uploads/2017/01/cam_nightindoors_waveshare_iroff-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_nightindoors_waveshare_iroff-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_nightindoors_waveshare_iroff-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Waveshare RPi Camera IR-CUT (off)</td>
</tr>
<tr>
<td><a href="/wp-content/uploads/2017/01/cam_nightindoors_waveshare_i.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_nightindoors_waveshare_i-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5983" srcset="/wp-content/uploads/2017/01/cam_nightindoors_waveshare_i-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_nightindoors_waveshare_i-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_nightindoors_waveshare_i-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Waveshare RPi Camera (I)</td>
<td><a href="/wp-content/uploads/2017/01/cam_nightindoors_waveshare_j.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_nightindoors_waveshare_j-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5986" srcset="/wp-content/uploads/2017/01/cam_nightindoors_waveshare_j-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_nightindoors_waveshare_j-768x576.jpg 768w, /wp-content/uploads/2017/01/cam_nightindoors_waveshare_j-1024x768.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Waveshare RPi Camera (J)</td>
</tr>
<tr>
<td><a href="/wp-content/uploads/2017/01/cam_nightindoors_rpiv2.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/cam_nightindoors_rpiv2-300x225.jpg" alt="" width="300" height="225" class="aligncenter size-medium wp-image-5982" srcset="/wp-content/uploads/2017/01/cam_nightindoors_rpiv2-300x225.jpg 300w, /wp-content/uploads/2017/01/cam_nightindoors_rpiv2-768x577.jpg 768w, /wp-content/uploads/2017/01/cam_nightindoors_rpiv2-1024x769.jpg 1024w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><br /> Raspberry Pi v2 Camera</td>
<td></td>
</tr>
</tbody>
</table>
<p><!-- I also tested the accuracy of the advertised FOVs for most of the lenses (&lt;170°). I used OpenCV to calculate the [intrinsic camera matrix](https://en.wikipedia.org/wiki/Camera_resectioning#Intrinsic_parameters) and [lens distortion parameters](https://en.wikipedia.org/wiki/Distortion_(optics)). To do this, I took 40 images of a calibration grid at different orientations and locations and then bootstrap 1000 samples of the 40 images (with replacement) to calculate the camera's horizontal, vertical, and diagonal field of view, focal length, [principal point](https://en.wikipedia.org/wiki/Pinhole_camera_model#The_geometry_and_mathematics_of_the_pinhole_camera), and aspect ratio. The 5MP OV5647 modules were tested at 1296x972 ([2x2 binning](https://picamera.readthedocs.io/en/release-1.12/fov.html#camera-modes)) and the Raspberry Pi v2 Camera was tested at 1640x1232 ([2x2 binning](https://picamera.readthedocs.io/en/release-1.12/fov.html#camera-modes)). Both picture modes record at the full field of view. --></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Replacing Battery in Apple MacBook Pro Retina (Late 2012)</title>
		<link>/2017/01/13/replacing-battery-in-apple-macbook-pro-retina-late-2012/</link>
		
		<dc:creator><![CDATA[Steven A. Cholewiak]]></dc:creator>
		<pubDate>Sat, 14 Jan 2017 05:03:05 +0000</pubDate>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Personal]]></category>
		<guid isPermaLink="false">/?p=5897</guid>

					<description><![CDATA[The battery on my Late 2012 Apple MacBook Pro Retina is garbage. It holds a charge for no more than 20 minutes, completely dies at approximately 50% reported battery charge remaining, and the menu has an exclamation point noting that I need to service my battery. Admittedly, this is after over four years of continuous [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>The battery on my Late 2012 Apple MacBook Pro Retina is garbage. It holds a charge for no more than 20 minutes, completely dies at approximately 50% reported battery charge remaining, and the menu has an <a href="https://support.apple.com/en-us/HT204054">exclamation point</a> noting that I need to service my battery. Admittedly, this is after over four years of continuous usage for my research and studies and I&#8217;ve downplayed the warnings for almost a year now. I have avoided replacing the battery because I was nowhere near the maximum number of cycles that <a href="https://support.apple.com/en-us/HT201585">Apple claims</a> I should be able to reach before the battery is considered &#8220;consumed&#8221; (~600 charge cycles vs. Apple&#8217;s stated max. of 1000). But I could not stand the fact that I can&#8217;t use my laptop without a power cable and none of the fixes suggested online were working (e.g., <a href="https://support.apple.com/en-us/HT201295">resetting the SMC</a>). So, it was time to replace the battery.</p>
<p><a href="/wp-content/uploads/2017/01/battery_replacement_open_overview.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/battery_replacement_open_overview-1024x575.jpg" alt="" width="648" height="364" class="aligncenter size-large wp-image-5904" srcset="/wp-content/uploads/2017/01/battery_replacement_open_overview-1024x575.jpg 1024w, /wp-content/uploads/2017/01/battery_replacement_open_overview-300x169.jpg 300w, /wp-content/uploads/2017/01/battery_replacement_open_overview-768x431.jpg 768w" sizes="auto, (max-width: 648px) 100vw, 648px" /></a></p>
<p><span id="more-5897"></span></p>
<p>Apple charges <a href="https://support.apple.com/mac-notebooks/repair/service/pricing">$199</a> (+ tax) to replace a 13-inch/15-inch MacBook Pro with Retina display battery. However there are a number of 3rd party batteries available on Amazon that cost ~<a href="http://amzn.to/2jBqCWl">$50</a>&#8211;<a href="http://amzn.to/2jBsqP3">$80</a> with Prime shipping, meaning that I could save $125+ by doing the repair myself. After a <a href="/2016/04/03/upgrading-ssd-in-apple-macbook-pro-retina-late-2012/">very successful SSD transplant</a>, I decided to try out iFixit&#8217;s <a href="https://www.ifixit.com/Guide/MacBook+Pro+13-Inch+Retina+Display+Late+2012+Battery+Replacement/13076">MacBook Pro 13&#8243; Retina Display Late 2012 Battery Replacement guide</a>.</p>
<p>My old batteries are from September 2012 and have gotten some good use out of them, so it&#8217;s about time for retirement:</p>
<p><a href="/wp-content/uploads/2017/01/battery_replacement_old_cell.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/battery_replacement_old_cell-1024x577.jpg" alt="" width="648" height="365" class="aligncenter size-large wp-image-5902" srcset="/wp-content/uploads/2017/01/battery_replacement_old_cell-1024x577.jpg 1024w, /wp-content/uploads/2017/01/battery_replacement_old_cell-300x169.jpg 300w, /wp-content/uploads/2017/01/battery_replacement_old_cell-768x432.jpg 768w" sizes="auto, (max-width: 648px) 100vw, 648px" /></a></p>
<p>There are a number of batteries available, but all appear to be from no-name 3rd parties:</p>
<ul>
<li><a href="http://amzn.to/2jBgDQK">LQM New Laptop Battery for Apple MacBook Pro Retina 13&#8243; A1437 A1425,Compatible 020-7652-A MD101 MD101LL/A MD101ZP/A MD102 MD102LL/A MD102ZP/A MD212 MD213 ME662 with Four Free Screwdrivers</a> &#8211; $79.99</li>
<li><a href="http://amzn.to/2jcD9D2">Lizone New Laptop Battery for Apple MacBook Pro 13 inch Retina Mid 2012 A1425 MD212 MD213 MD212LL/A MD213CH/A / Apple A1437 Laptop Notebook battery / Li-Polymer 11.21V 74Wh</a> &#8211; $69.99</li>
<li><a href="http://amzn.to/2jBrB8Z">SIKER11.21V 74WH High Performance Battery for Apple Macbook Pro Retina 13&#8243; A1437 A1425 020-7652-A , fits MD101, MD101LL/A, MD101ZP/A, MD102, MD102LL/A, MD102ZP/A, MD212, MD213, ME662</a> &#8211; $69.99</li>
<li><a href="http://amzn.to/2jBjJUR">Egoway MacBook Pro Retina 13&#8243; Battery for Apple A1437 A1425 (Late 2012, Early 2013 Version) &#8211; [Li-Polymer 11.21V 74Wh]</a> &#8211; $59.99</li>
<li><a href="http://amzn.to/2jBn9Hk">BRTONG® High Performance New Laptop Battery for Apple MacBook Pro Retina 13&#8243; A1437 A1425 020-7652-A 020-7653-A MD212CH/A MD212 MD213 MD212LL/A MD213CH/A [Li-ion 11.21V 74Wh/6600mAh] &#8211; 18 Months Warranty</a> &#8211; $49.99</li>
</ul>
<p>Many of the links have the same product photos, so I suspect there are a number of &#8220;companies&#8221; reselling the same batteries. I ended up purchasing the <a href="http://amzn.to/2jBn9Hk">BRTONG battery</a> for $49.99 with a credit card that offers an additional 1 year extended warranty, so if I have any issues in 30 months (2.5 years), I should be covered for repair/replacement. My one complaint is that the battery I received has a manufacture date from 2013(!). Hopefully there are no issues, but I&#8217;ll keep an eye on it.</p>
<p><a href="/wp-content/uploads/2017/01/battery_replacement_new_cell.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/battery_replacement_new_cell-1024x768.jpg" alt="" width="648" height="486" class="aligncenter size-large wp-image-5901" srcset="/wp-content/uploads/2017/01/battery_replacement_new_cell-1024x768.jpg 1024w, /wp-content/uploads/2017/01/battery_replacement_new_cell-300x225.jpg 300w, /wp-content/uploads/2017/01/battery_replacement_new_cell-768x576.jpg 768w" sizes="auto, (max-width: 648px) 100vw, 648px" /></a></p>
<p>There are also some oddities with the controller (note the white epoxy and the replacement information sticker), so I am suspecting that the battery may be remanufactured:</p>
<p><a href="/wp-content/uploads/2017/01/connector_comparison.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/connector_comparison-1024x576.jpg" alt="" width="648" height="365" class="aligncenter size-large wp-image-5906" srcset="/wp-content/uploads/2017/01/connector_comparison-1024x576.jpg 1024w, /wp-content/uploads/2017/01/connector_comparison-300x169.jpg 300w, /wp-content/uploads/2017/01/connector_comparison-768x432.jpg 768w" sizes="auto, (max-width: 648px) 100vw, 648px" /></a></p>
<p>One more weird aspect is that the batteries were very difficult to remove from the protective backing, leaving quite a bit of remnants on the protective sheet:</p>
<p><a href="/wp-content/uploads/2017/01/battery_replacement_leftover_residue.jpg"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/battery_replacement_leftover_residue-1024x576.jpg" alt="" width="648" height="365" class="aligncenter size-large wp-image-5900" srcset="/wp-content/uploads/2017/01/battery_replacement_leftover_residue-1024x576.jpg 1024w, /wp-content/uploads/2017/01/battery_replacement_leftover_residue-300x169.jpg 300w, /wp-content/uploads/2017/01/battery_replacement_leftover_residue-768x432.jpg 768w" sizes="auto, (max-width: 648px) 100vw, 648px" /></a></p>
<p>Following the <a href="https://www.ifixit.com/Guide/MacBook+Pro+13-Inch+Retina+Display+Late+2012+Battery+Replacement/13076">iFixit guide</a>, I disassembled the laptop, carefully removed the old battery, and installed the new one.</p>
<p>And it worked!  The hardest part of the procedure was removing the old batteries and the old adhesive from the Macbook&#8217;s case. However, it took about 30 minutes to complete, so I would highly recommend this fix for anyone having battery issues with their older Macbook Pro Retina.</p>
<p>Here&#8217;s my battery stats from the Apple System Information, with the old battery on the left and the new battery on the right (interesting info highlighted in yellow):</p>
<p><a href="/wp-content/uploads/2017/01/battery_replacement_system_info.png"><img loading="lazy" decoding="async" src="/wp-content/uploads/2017/01/battery_replacement_system_info-1024x781.png" alt="" width="648" height="494" class="aligncenter size-large wp-image-5912" srcset="/wp-content/uploads/2017/01/battery_replacement_system_info-1024x781.png 1024w, /wp-content/uploads/2017/01/battery_replacement_system_info-300x229.png 300w, /wp-content/uploads/2017/01/battery_replacement_system_info-768x586.png 768w" sizes="auto, (max-width: 648px) 100vw, 648px" /></a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>WiFi-Enabled Arduino Fio using the WiFly RN-XV (RN171XV)</title>
		<link>/2013/10/20/wifi-enabled-arduino-fio-using-the-wifly-rn-xv-rn171xv/</link>
		
		<dc:creator><![CDATA[Steven A. Cholewiak]]></dc:creator>
		<pubDate>Sun, 20 Oct 2013 17:31:12 +0000</pubDate>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[GLCD]]></category>
		<guid isPermaLink="false">/?p=3759</guid>

					<description><![CDATA[The Arduino Fio is a nice little Arduino board designed specifically to interface with XBee devices. I think it&#8217;s a great little board and have used it quite a bit in the past. BUT, I haven&#8217;t talked too much about the XBee interface, so for this post, I wanted to demonstrate an example utilizing the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>The <a href="http://arduino.cc/en/Main/ArduinoBoardFio">Arduino Fio</a> is a nice little Arduino board designed specifically to interface with XBee devices. I think it&#8217;s a great little board and have used it quite a bit in the past. BUT, I haven&#8217;t talked too much about the XBee interface, so for this post, I wanted to demonstrate an example utilizing the XBee socket to get an Arduino Fio onto the web. This is a simple example, just demonstrating communication with the Microchip RN171XV (previously Roving Networks RN-XV) wifi module.</p>
<p><a href="/2013/10/20/wifi-enabled-arduino-fio-using-the-wifly-rn-xv-rn171xv/"><img decoding="async" src="/wp-content/uploads/2013/10/IMG_8040-1024x623.jpg" alt="WiFlyTimeWithConsole Example" /></a></p>
<p>Click through the break for information on the setup and source code to get the Arduino Fio onto the web.<br />
<span id="more-3759"></span></p>
<p>The project uses an Arduino Fio as the microcontroller, a <a href="https://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en560635">Microchip RN171XV</a> wifi module to connect to the internet (hereafter described using the old part name, RN-XV), and a Mini12864 graphical LCD to show debug information.  Here&#8217;s a part list for this project (assuming you already have a USB -&gt; Micro USB cable):</p>
<ul>
<li>Arduino Fio (available on <a href="https://www.amazon.com/dp/B005K0O1PA/?tag=semifluidcom-20">Amazon</a> &amp; <a href="https://www.sparkfun.com/products/10116">Sparkfun</a>)</li>
<li>Mini12864 graphical LCD (available on <a href="http://www.amazon.com/dp/B005K0O1PA/?tag=semifluidcom-20">Amazon</a> &amp; <a href="http://dx.com/p/153821?utm_rid=62305252&amp;utm_source=affiliate">DX</a>)</li>
<li>Microchip RN171XV/Roving Networks RN-XV (available on <a href="http://www.amazon.com/gp/product/B007R9U4VM/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B007R9U4VM&amp;linkCode=as2&amp;tag=semifluidcom-20">Amazon</a> &amp; <a href="https://www.sparkfun.com/products/10822">Sparkfun</a>)</li>
<li>XBee USB adapter &#8211; for programming RN-XV (available on <a href="http://www.amazon.com/gp/product/B004G4XUXU/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B004G4XUXU&amp;linkCode=as2&amp;tag=semifluidcom-20">Amazon</a>, <a href="http://dx.com/p/140960?Utm_rid=62305252&amp;Utm_source=affiliate">DX</a>, &amp; <a href="https://www.sparkfun.com/products/8687">SparkFun</a>)</li>
<li>FTDI 3.3V USB cable &#8211; for programming Fio (available on <a href="http://www.amazon.com/gp/product/B004LBXO2A/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B004LBXO2A&amp;linkCode=as2&amp;tag=semifluidcom-20">Amazon</a>, <a href="http://dx.com/p/397477?Utm_rid=62305252&amp;Utm_source=affiliate">DX</a>, &amp; <a href="https://www.sparkfun.com/products/9717">SparkFun</a>)</li>
</ul>
<p>Want to make it completely wireless? I also used a Lithium Ion Polymer battery (available at <a href="https://www.sparkfun.com/products/341">Sparkfun</a>).</p>
<p>When you first get the RN-XV, it needs to be updated to the latest firmware. First, it needs to be plugged into the XBee USB adapter and connected to your computer. These days, I&#8217;m working on a Mac, so I use <a href="http://freeware.the-meiers.org/">CoolTerm</a> to communicate with the RN-XV. Here are the settings (basically 9600 baud serial communication):</p>
<p><a href="/wp-content/uploads/2013/10/Screen-Shot-2013-10-20-at-14.50.08.png"><img decoding="async" src="/wp-content/uploads/2013/10/Screen-Shot-2013-10-20-at-14.50.08-1024x858.png" alt="CoolTerm Setup Screenshot" /></a></p>
<p>Then the RN-XV needs to be connected to your wireless access point and updated. Type in <code>$$$</code> to enter the command mode and you should see the RN-XV respond <code>CMD</code>. You can then enter the commands one by one (carriage returns after each line) to connect the RN-XV to your WiFi access point. Here is my basic setup (see the <a href="http://ww1.microchip.com/downloads/en/DeviceDoc/rn-wiflycr-ug-v1.2r.pdf">RN-XV datasheet</a> for additional information):</p>
<p>[code lang=&#8221;text&#8221;]<br />
factory RESET<br />
reboot<br />
set wlan auth 4<br />
set wlan ssid XXXX<br />
set wlan phrase XXXX<br />
set wlan join 1<br />
save<br />
reboot<br />
[/code]</p>
<p>The RN-XV should associate (connect) with your wifi network and then you can test the connectivity by pinging the Microchip FTP server:</p>
<p>[code lang=&#8221;text&#8221;]<br />
ping 198.175.253.161 10<br />
[/code]</p>
<p>Then, update the RN-XV to the latest firmware (4.00.1 as of this article&#8217;s publish date):</p>
<p>[code lang=&#8221;text&#8221;]<br />
set ftp address 198.175.253.161<br />
set ftp user roving<br />
set ftp pass Pass123<br />
save<br />
ftp update<br />
[/code]</p>
<p>Once the update downloads, you can reset the factory defaults and reboot:</p>
<p>[code lang=&#8221;text&#8221;]<br />
factory RESET<br />
reboot<br />
[/code]</p>
<p>After the RN-XV resets, you should again enter the basic setup information to get the RN-XV connected to your WiFi access point (see above).  If all works out, then you can disconnect the serial port and pull the RN-XV out of the XBee adapter for the time being (don&#8217;t put it into the Arduino Fio, because the Fio needs to be programmed and the TX/RX lines are shared on the board).</p>
<p>I found a wonderful Arduino library for the RN-XV called <a href="https://github.com/harlequin-tech/WiFlyHQ">WiFlyHQ</a> by harlequin-tech.  The author includes a number of great examples, including a HTTP client, HTTP server, TCP client, UDP client, and web socket client.  Using the basic setup code in the HTTP client example, I added code from my previous <a href="/2013/08/29/arduino-fio-graphical-lcd-console/">Arduino FIO Graphical LCD Console</a> to make a simple &#8220;clock&#8221; that updates approximately every 3 seconds using the <a href="http://tf.nist.gov/tf-cgi/servers.cgi">time-c.nist.gov</a> <a href="http://www.nist.gov/pml/div688/grp40/its.cfm">time server</a>.  I used the console code because it allows for very simple debug printing (since the Fio&#8217;s serial TX/RX pins are shared with the XBee socket).  Here an admittedly boring short video illustrating the &#8220;clock&#8221; being startup and allowed to run (the value on the far left is an indicator of the wireless signal strength, <a href="https://en.wikipedia.org/wiki/Received_signal_strength_indication">RSSI</a>):</p>
<p><iframe loading="lazy" title="WiFi enabled Arduino Fio using the WiFly RN-XV" width="648" height="365" src="https://www.youtube.com/embed/bx8jDz5C-J8?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></p>
<p>And finally, here&#8217;s the Arduino sketch:</p>
<p><script src="https://gist.github.com/OrganicIrradiation/cf225ac77c26fe001f39.js"></script></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Arduino FIO Graphical LCD Console</title>
		<link>/2013/08/29/arduino-fio-graphical-lcd-console/</link>
		
		<dc:creator><![CDATA[Steven A. Cholewiak]]></dc:creator>
		<pubDate>Thu, 29 Aug 2013 07:29:18 +0000</pubDate>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[GLCD]]></category>
		<guid isPermaLink="false">/?p=3621</guid>

					<description><![CDATA[I have previously shown how to use the Arduino Fio and the mini12864 graphical LCD to create a simple oscilloscope. For this post, I wanted to demonstrate the u8glib console demo because I plan on using the GLCD to debug some of my projects and to provide a visual interface for experiments with the Microchip [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I have previously shown how to use the <a href="http://arduino.cc/en/Main/ArduinoBoardFio" target="_blank">Arduino Fio</a> and the mini12864 graphical LCD to create a <a href="/2013/05/28/arduino-fio-lcd-oscilloscope/">simple oscilloscope</a>.  For this post, I wanted to demonstrate the <a href="https://code.google.com/p/u8glib/" target="_blank">u8glib</a> console demo because I plan on using the GLCD to debug some of my projects and to provide a visual interface for experiments with the <a href="http://www.microchip.com/wwwproducts/en/RN171XV" target="_blank">Microchip RN-171-XV</a>.</p>
<p><a href="/2013/08/29/arduino-fio-graphical-lcd-console/"><img loading="lazy" decoding="async" src="/wp-content/uploads/2013/08/IMG_6922_cropped-1024x595.jpg" alt="IMG_6922_cropped" width="600" height="348" class="aligncenter size-large wp-image-3636" srcset="/wp-content/uploads/2013/08/IMG_6922_cropped-1024x595.jpg 1024w, /wp-content/uploads/2013/08/IMG_6922_cropped-300x174.jpg 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></a></p>
<p>More information on the project, a video of it in operation, and its code after the break.<br />
<span id="more-3621"></span></p>
<p>A little while ago, I picked up an Arduino Fio (available on <a href="https://www.amazon.com/dp/B005K0O1PA/?tag=semifluidcom-20" target="_blank">Amazon.com</a>) and the mini12864 graphical LCD (available on <a href="http://dx.com/p/153821?Utm_rid=62305252&#038;Utm_source=affiliate" target="_blank">dx.com</a> &amp; <a href="http://www.amazon.com/dp/B009VILK8S/?tag=semifluidcom-20" target="_blank">Amazon.com</a>) for some microcontroller tinkering.  It turned out that a great graphical LCD library was available &#8212; <a href="https://code.google.com/p/u8glib/" target="_blank">u8glib</a> &#8212; that supports the mini12864&#8217;s controller (the <a href="http://www.lcd-module.de/eng/pdf/zubehoer/uc1701.pdf" target="_blank">UC1701</a>).</p>
<p>Using u8glib, the Arduino and the GLCD communicate flawlessly.  Thankfully, the mini12864 is 3.3V compatible, so there are no issues setting it up with the Arduino Fio and the simple SPI connection makes setup surprisingly easy.  As mentioned, I was able to use u8glib to port my oscilloscope code from CCS C to the Arduino:</p>
<ul>
<li><a href="/2013/05/28/arduino-fio-lcd-oscilloscope/">Arduino FIO LCD Oscilloscope</a></li>
<li><a href="/2013/08/02/arduino-fio-2-channel-lcd-oscilloscope/">Arduino FIO 2 Channel LCD Oscilloscope</a></li>
</ul>
<p>In addition to all of the functions u8glib provides, the library also comes with a nice little serial console/terminal demonstration program. The current u8glib console code can be found <a href="https://code.google.com/p/u8glib/source/browse/sys/arduino/Console/Console.pde" target="_blank">here</a>.</p>
<p>I added four functions that would allow me to quickly and easily debug my applications u8g_print, u8g_println, u8g_print_P, and u8g_println_P.  u8g_print allows one to print a character array, u8g_println does the same, but then adds a new line to the end of the string, u8g_print_P allows you to print a character array saved in program memory, and u8g_println_P does the same but adds a new line.  Here are the new functions:</p>
<p><script src="https://gist.github.com/OrganicIrradiation/21422d7cec87ebe5ef7b.js?file=new_functions.ino"></script></p>
<p>This allowed me to create this simple demo of the GLCD debug console code:</p>
<p><center><br />
<iframe loading="lazy" title="Arduino Fio GLCD Console Demo" width="648" height="365" src="https://www.youtube.com/embed/EAcKEw0Ciu4?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe><br />
</center></p>
<p>And last but not least, here is the Arduino Sketch used to produce the above output:</p>
<p><script src="https://gist.github.com/OrganicIrradiation/21422d7cec87ebe5ef7b.js?file=u8glib_FioConsole.ino"></script></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Arduino FIO 2 Channel LCD Oscilloscope</title>
		<link>/2013/08/02/arduino-fio-2-channel-lcd-oscilloscope/</link>
		
		<dc:creator><![CDATA[Steven A. Cholewiak]]></dc:creator>
		<pubDate>Fri, 02 Aug 2013 23:25:42 +0000</pubDate>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[GLCD]]></category>
		<category><![CDATA[Programming]]></category>
		<guid isPermaLink="false">http://semifluid.com/?p=3391</guid>

					<description><![CDATA[After using my Arduino Fio to make an Arduino LCD oscilloscope, I wanted to try adding a second channel. Using the single channel Arduino FIO LCD Oscilloscope code as a template, I modified the project and added a second channel. Here&#8217;s a short demonstration video of the new two channel project: Click through the break [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>After using my Arduino Fio to make an <a href="/2013/05/28/arduino-fio-lcd-oscilloscope/">Arduino LCD oscilloscope</a>, I wanted to try adding a second channel.  Using the single channel Arduino FIO LCD Oscilloscope code as a template, I modified the project and added a second channel.</p>
<p><a href="/2013/08/02/arduino-fio-2-channel-lcd-oscilloscope"><img loading="lazy" decoding="async" src="/wp-content/uploads/2013/08/Arduino-Fio-2-Channel-LCD-Oscilloscope-1024x576.jpg" alt="Arduino-Fio-2-Channel-LCD-Oscilloscope" width="600" height="337" class="aligncenter size-large wp-image-3525" srcset="/wp-content/uploads/2013/08/Arduino-Fio-2-Channel-LCD-Oscilloscope-1024x576.jpg 1024w, /wp-content/uploads/2013/08/Arduino-Fio-2-Channel-LCD-Oscilloscope-300x168.jpg 300w, /wp-content/uploads/2013/08/Arduino-Fio-2-Channel-LCD-Oscilloscope.jpg 1920w" sizes="auto, (max-width: 600px) 100vw, 600px" /></a></p>
<p>Here&#8217;s a short demonstration video of the new two channel project:</p>
<p><center><br />
<iframe loading="lazy" title="Arduino FIO 2 Channel LCD Oscilloscope" width="648" height="486" src="https://www.youtube.com/embed/JH9s9POwMFg?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe><br />
</center></p>
<p>Click through the break to check out the code.<br />
<span id="more-3391"></span></p>
<p>The project used an Arduino Fio (available on <a href="https://www.amazon.com/dp/B005K0O1PA/?tag=semifluidcom-20" target="_blank">Amazon.com</a>) and the mini12864 128&#215;64 pixel graphical LCD (available on <a href="http://dx.com/p/153821?Utm_rid=62305252&#038;Utm_source=affiliate" target="_blank">dx.com</a> &amp; <a href="http://www.amazon.com/dp/B009VILK8S/?tag=semifluidcom-20" target="_blank">Amazon.com</a>).</p>
<p>The basic modification was to include a second set of variables that is used to store the second channel&#8217;s readings.  A more elegant solution would have been to make each variable an N-channel array (so that one could easily scale to more channels), but the low-resolution monochrome display really limits the possibilities, unfortunately.  In addition, the sampling rate for the single channel oscilloscope was already quite low (with a maximum sampling rate of approximately 28kHz), but two channels could allow for some interesting possibilities as long as one can deal with the slower acquisition speed.</p>
<p>The display refresh is triggered by a rising signal (useThreshold == 1) on the channel A input (analog pin 7, as defined by theAnalogPinA = 7), but you could easily modify the code to make this switchable so that either channel acts as the trigger. The code is very similar to my previous code, including the serial port parameter controls, so I recommend taking a look at that post first, if you have any questions: <a href="/2013/05/28/arduino-fio-lcd-oscilloscope/">Arduino FIO LCD Oscilloscope</a></p>
<p>As with the previous single channel project, you need to make sure that you have the <a href="https://code.google.com/p/u8glib/" target="_blank">u8glib</a> library installed to compile the code.</p>
<p>Here&#8217;s the Arduino sketch for the oscilloscope:</p>
<p><script src="https://gist.github.com/OrganicIrradiation/e6cc9f132bc17ab97243.js"></script></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Arduino FIO LCD Oscilloscope</title>
		<link>/2013/05/28/arduino-fio-lcd-oscilloscope/</link>
		
		<dc:creator><![CDATA[Steven A. Cholewiak]]></dc:creator>
		<pubDate>Tue, 28 May 2013 15:08:23 +0000</pubDate>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[GLCD]]></category>
		<category><![CDATA[Programming]]></category>
		<guid isPermaLink="false">http://semifluid.com/?p=3376</guid>

					<description><![CDATA[It has been 7 years (!) since I posted my PIC18F2550 KS0108 Graphical LCD Oscilloscope code and schematics. I have long since taken the circuit apart, sold my PIC microcontrollers, and moved on in my life (as one can surmise from my most recent posts detailing my graduate and postdoctoral work). However, I still get [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>It has been 7 years (!) since I posted my <a href="http://semifluid.com/2006/08/21/pic18f2550-ks0108-graphical-lcd-oscilloscope/">PIC18F2550 KS0108 Graphical LCD Oscilloscope</a> code and schematics.  I have long since taken the circuit apart, sold my PIC microcontrollers, and moved on in my life (as one can surmise from my most recent posts detailing my graduate and postdoctoral work).  However, I still get inquiries about the Microchip PIC oscilloscope, so I decided to recreate it using a simpler setup using my Arduino Fio.</p>
<p><a href="/2013/05/28/arduino-fio-lcd-oscilloscope/"><img loading="lazy" decoding="async" src="/wp-content/uploads/2013/05/IMG_4199-1024x682.jpg" alt="IMG_4199" width="600" height="399"  class="aligncenter size-large wp-image-3428" srcset="/wp-content/uploads/2013/05/IMG_4199-1024x682.jpg 1024w, /wp-content/uploads/2013/05/IMG_4199-300x200.jpg 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></a></p>
<p>Here&#8217;s a short teaser video just to show that, yes, it works (going through a couple different sine wave frequencies, some random noise, etc. just to illustrate it working):</p>
<p><center><br />
<iframe loading="lazy" title="Arduino FIO LCD Oscilloscope - Teaser" width="648" height="365" src="https://www.youtube.com/embed/Sa-n04G7uA8?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe><br />
</center></p>
<p>Click through the break to get more information on the setup.<br />
<span id="more-3376"></span></p>
<p>I used an <a href="http://arduino.cc/en/Main/ArduinoBoardFio" target="_blank">Arduino Fio</a> board that I picked up from SparkFun.com (available at <a href="https://www.amazon.com/dp/B005K0O1PA/?tag=semifluidcom-20" target="_blank">Amazon.com</a>) and a small SPI graphical LCD board that I picked up for a few bucks at dx.com (SKU <a href="http://dx.com/p/153821?Utm_rid=62305252&#038;Utm_source=affiliate" target="_blank">153821</a>, also apparently available at <a href="http://www.amazon.com/dp/B009VILK8S/?tag=semifluidcom-20" target="_blank">Amazon.com</a>).  Since I don&#8217;t have a soldering iron here, I had to improvise with some female to female cables, also purchased from dx.com (SKU <a href="http://dx.com/p/151650?Utm_rid=62305252&#038;Utm_source=affiliate" target="_blank">151650</a>).</p>
<p>Dx.com describes the LCD as a 5V module, but the GLCD board designer&#8217;s page (mini12864) states otherwise (translated from Chinese via Google Translate):</p>
<blockquote><p>
Dimensions (L × W × H): 47mm × 38mm × 6mm (excluding pins)<br />
LCD sight (L × W): 33.7mm × 33.5mm<br />
LCD Active Display Area (L × W): 30.7mm × 23mm<br />
Backlight: White LED backlight bracket<br />
<strong>Operating voltage: 3.3V ~ 5.5V</strong> (built-in booster circuit, without pressure)<br />
Control IC: UC1701<br />
Display format: 128 × 64 rows<br />
Display: Blue on White
</p></blockquote>
<p>(<a href="http://semifluid.com/wp-content/uploads/2013/05/mini12864.pdf">mini12864 datasheet</a>)</p>
<p>So, I ordered one of the graphical LCDs, waited a few weeks for delivery (because dx.com is a notoriously slow shipper), received it, hooked it up, and tried out the following simple &#8220;Hello World&#8221; script to confirm that that the GLCD/FIO combo functioned:</p>
<p><script src="https://gist.github.com/OrganicIrradiation/e8cda31673fc12509fd0.js?file=U8glib_Hello_World.ino"></script></p>
<p>And it worked!</p>
<p>Thankfully, the code I <a href="http://semifluid.com/2006/08/21/pic18f2550-ks0108-graphical-lcd-oscilloscope/">previously posted</a> was written in C, so porting to the Arduino took only a few minutes.  I took advantage of a great open source graphical LCD library (<a href="https://code.google.com/p/u8glib/" target="_blank">u8glib</a>) to handle the brunt of the work and added a serial port menu for manipulating the various display parameters.  One important difference between this project and the previous one: Since the Arduino Fio is a 3.3V device, it can only handle 0-3.3V inputs, limiting its utility as an &#8220;oscilloscope&#8221; without proper input protection/voltage scaling.  However, the code is extremely portable, meaning that you should be able to program any other Arduino and have it up-and-running in no time.</p>
<p><img loading="lazy" decoding="async" src="/wp-content/uploads/2013/05/IMG_4203-1024x682.jpg" alt="IMG_4203" width="600" height="399" class="aligncenter size-large wp-image-3429" srcset="/wp-content/uploads/2013/05/IMG_4203-1024x682.jpg 1024w, /wp-content/uploads/2013/05/IMG_4203-300x200.jpg 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></p>
<p>Here&#8217;s another 2 videos of the oscilloscope in action:</p>
<p><center><br />
<iframe loading="lazy" title="Arduino FIO LCD Oscilloscope - In action #1" width="648" height="365" src="https://www.youtube.com/embed/ZW6zGcie58w?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe><br />
</center></p>
<p><center><br />
<iframe loading="lazy" title="Arduino FIO LCD Oscilloscope - In action #2" width="648" height="365" src="https://www.youtube.com/embed/I8EWdJlqu-Y?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe><br />
</center></p>
<p>And finally, here&#8217;s the Arduino sketch for the oscilloscope:</p>
<p><script src="https://gist.github.com/OrganicIrradiation/e8cda31673fc12509fd0.js?file=U8glib_Oscilloscope.ino"></script></p>
<p>Here&#8217;s the Arduino sketch for the square wave generator shown in the second video:</p>
<p><script src="https://gist.github.com/OrganicIrradiation/e8cda31673fc12509fd0.js?file=arduino_square_wave_gen.ino"></script></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Arduino FIO DS18B20 Temperature Logger</title>
		<link>/2012/09/10/arduino-fio-ds18b20-temperature-logge/</link>
		
		<dc:creator><![CDATA[Steven A. Cholewiak]]></dc:creator>
		<pubDate>Tue, 11 Sep 2012 00:04:51 +0000</pubDate>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[RF]]></category>
		<guid isPermaLink="false">http://semifluid.com/?p=1337</guid>

					<description><![CDATA[We have a Arduino Fio temperature logger, so now maybe we can increase the accuracy by adding an external temperature sensor. I have a couple of DS18B20 Programmable Resolution 1-Wire Digital Thermometers, so I thought, heck, let&#8217;s try one out! These temperature sensors are much more accurate out-of-the-box, so I don&#8217;t need to deal with [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>We have a <a href="http://semifluid.com/2012/09/09/arduino-fio-internal-voltmeter-and-thermometer">Arduino Fio temperature logger</a>, so now maybe we can increase the accuracy by adding an external temperature sensor.  I have a couple of <a href="http://datasheets.maximintegrated.com/en/ds/DS18B20.pdf">DS18B20</a> Programmable Resolution 1-Wire Digital Thermometers, so I thought, heck, let&#8217;s try one out!</p>
<p><a href="http://semifluid.com/wp-content/uploads/2012/09/IMG_0246.jpg"><img loading="lazy" decoding="async" src="http://semifluid.com/wp-content/uploads/2012/09/IMG_0246-1024x768.jpg" alt="" title="Arduino Fio DS18B20" width="600" height="450" class="aligncenter size-large wp-image-1357" srcset="/wp-content/uploads/2012/09/IMG_0246-1024x768.jpg 1024w, /wp-content/uploads/2012/09/IMG_0246-300x225.jpg 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></a></p>
<p>These temperature sensors are much more accurate out-of-the-box, so I don&#8217;t need to deal with calibration (which I did need to worry about with the internal thermometer).  In addition, using separate, discrete components allows for the possibility of putting temperature sensors directly on/in whatever you may want to measure (rather than merely measuring the ambient temperature) and the potential for multiple temperature sensors with a single Arduino Fio (which are available at <a href="https://www.amazon.com/dp/B005K0O1PA/ref=as_li_ss_til?tag=semifluidcom-20&#038;camp=0&#038;creative=0&#038;linkCode=as4&#038;creativeASIN=B005K0O1PA&#038;adid=1KB2CEGSB0E1856D3DXX&#038;" target="_blank">Amazon.com</a>).</p>
<p><span id="more-1337"></span></p>
<p>So, the most important addition is the <a href="http://www.arduino.cc/playground/Learning/OneWire">Arduino OneWire.h library</a>.  Once we have that, all that&#8217;s needed is two simple declarations:</p>
<p>[code lang=&#8221;arduino&#8221;]<br />
#include &lt;OneWire.h&gt; // Get here: http://www.arduino.cc/playground/Learning/OneWire<br />
OneWire ds(DS18B20Data);<br />
[/code]</p>
<p>And a modified readTemp function:</p>
<p>[code lang=&#8221;arduino&#8221;]<br />
// See: http://www.arduino.cc/playground/Learning/OneWire<br />
float readTempDS18B20() {<br />
  int HighByte, LowByte, TReading, SignBit, Tc_100;<br />
  byte i;<br />
  byte present = 0;<br />
  byte data[12];<br />
  byte addr[8];<br />
  float resultTempFloat;</p>
<p>digitalWrite(DS18B20Power,HIGH);     // Power up the DS18B20<br />
  delay(250);</p>
<p>ds.search(addr);<br />
  if ( OneWire::crc8( addr, 7) != addr[7]) {<br />
      return 0.0;                      // CRC is not valid!<br />
  }</p>
<p>ds.reset();<br />
  ds.select(addr);<br />
  ds.write(0x44,1);                   // Start conversion, with parasite power on at the end</p>
<p>delay(1000);                        // Maybe 750ms is enough, maybe not<br />
                                      // We might do a ds.depower() here,<br />
                                      // but the reset will take care of it.</p>
<p>present = ds.reset();<br />
  ds.select(addr);<br />
  ds.write(0xBE);                     // Read Scratchpad</p>
<p>for ( i = 0; i &lt; 9; i++) {          // we need 9 bytes<br />
    data[i] = ds.read();<br />
  }<br />
  LowByte = data[0];<br />
  HighByte = data[1];<br />
  TReading = (HighByte &lt;&lt; 8) + LowByte;<br />
  SignBit = TReading &amp; 0x8000;        // Test most sig bit<br />
  if (SignBit)                        // Negative<br />
  {<br />
    TReading = (TReading ^ 0xffff) + 1;    // Take 2&#8217;s comp<br />
  }</p>
<p>ds.reset_search();<br />
  digitalWrite(DS18B20Power,LOW);     // Turn off DS18B20</p>
<p>resultTempFloat = (float) (6 * TReading) + TReading / 4;  // Multiply by (100 * 0.0625) or 6.25<br />
  resultTempFloat = resultTempFloat/100;<br />
  resultTempFloat = resultTempFloat * 1.8 + 32.0;  // Convert to F<br />
  return resultTempFloat;<br />
}<br />
[/code]</p>
<p><a href="http://semifluid.com/wp-content/uploads/2012/09/IMG_0247.jpg"><img loading="lazy" decoding="async" src="http://semifluid.com/wp-content/uploads/2012/09/IMG_0247-1024x768.jpg" alt="" title="Arduino Fio DS18B20 Close-up" width="600" height="450" class="aligncenter size-large wp-image-1358" srcset="/wp-content/uploads/2012/09/IMG_0247-1024x768.jpg 1024w, /wp-content/uploads/2012/09/IMG_0247-300x225.jpg 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></a></p>
<p>And we are ready to read!  Note that the measurement times are a bit longer (I measured ~75 seconds in between transmissions) because of the 1 second settling time for the DS18B20.  Here is some example output from <a href="https://ttssh2.osdn.jp/index.html.en">TeraTerm</a> (I measured the ambient temperature for measurements 1-10, then put my thumb onto the DS18B20 for measurements 11 &amp; 12, and then allowed the DS18B20 to return to ambient for readings 13-20):</p>
<p>[code gutter=&#8221;false&#8221;]<br />
ª       0       0       0<br />
~<br />
 Aª     1       3.303   71.70<br />
~<br />
 Aª     2       3.303   71.14<br />
~<br />
 @ª     3       3.303   71.22<br />
~<br />
 @ª     4       3.303   71.07<br />
~<br />
 ?ª     5       3.303   71.30<br />
~<br />
 @ª     6       3.303   70.95<br />
~<br />
 @ª     7       3.303   71.26<br />
~<br />
 ?ª     8       3.303   71.60<br />
~<br />
 ?ª     9       3.303   71.35<br />
~<br />
 0ª     10      3.303   71.01<br />
~<br />
 7ª     11      3.303   77.35<br />
~<br />
 6ª     12      3.303   77.35<br />
~<br />
 Aª     13      3.303   73.72<br />
~<br />
 Aª     14      3.303   72.14<br />
~<br />
 Aª     15      3.303   71.66<br />
~<br />
 Aª     16      3.303   71.49<br />
~<br />
 Aª     17      3.303   71.27<br />
~<br />
 Aª     18      3.303   71.40<br />
~<br />
 Aª     19      3.303   71.23<br />
~<br />
 Aª     20      3.303   70.91<br />
[/code]</p>
<p>I stored the data for another 40 readings, cut out all of the trash data between the carriage returns (deliminating the readings) and sync characters (which visually show up as &#8220;ª&#8221; in TeraTerm), removed the initial sync reading, and <a href="http://semifluid.com/wp-content/uploads/2012/09/SuperSleepyDS18B20.nb">plotted the temperature data in Mathematica</a> (voltage was constant):</p>
<p><a href="http://semifluid.com/wp-content/uploads/2012/09/SuperSleepyDS18B20.png"><img loading="lazy" decoding="async" src="http://semifluid.com/wp-content/uploads/2012/09/SuperSleepyDS18B20-300x177.png" alt="" title="SuperSleepyDS18B20" width="300" height="177" class="aligncenter size-medium wp-image-1347" srcset="/wp-content/uploads/2012/09/SuperSleepyDS18B20-300x177.png 300w, /wp-content/uploads/2012/09/SuperSleepyDS18B20.png 360w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Compare to the temperature results of the <a href="http://semifluid.com/2012/09/09/arduino-fio-internal-voltmeter-and-thermometer">Arduino Fio internal temperature sensor</a>:</p>
<p><a href="http://semifluid.com/wp-content/uploads/2012/09/SuperSleepyTempAndVolts.png"><img loading="lazy" decoding="async" src="http://semifluid.com/wp-content/uploads/2012/09/SuperSleepyTempAndVolts-300x177.png" alt="" title="SuperSleepyTempAndVolts" width="300" height="177" class="aligncenter size-medium wp-image-1334" srcset="/wp-content/uploads/2012/09/SuperSleepyTempAndVolts-300x177.png 300w, /wp-content/uploads/2012/09/SuperSleepyTempAndVolts.png 360w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p><a href="http://semifluid.com/wp-content/uploads/2012/09/IMG_0248.jpg"><img loading="lazy" decoding="async" src="http://semifluid.com/wp-content/uploads/2012/09/IMG_0248-1024x768.jpg" alt="" title="Arduino Fio DS18B20 DOF" width="600" height="450" class="aligncenter size-large wp-image-1359" srcset="/wp-content/uploads/2012/09/IMG_0248-1024x768.jpg 1024w, /wp-content/uploads/2012/09/IMG_0248-300x225.jpg 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></a></p>
<p>Here&#8217;s all of the Arduino Fio SuperSleepyDS18B20 code:</p>
<p>[code lang=&#8221;arduino&#8221;]<br />
/*<br />
 * SuperSleepyDS18B20 SuperSleepyDS18B20.ino<br />
 * Steven A Cholewiak &#8211; www.semifluid.com<br />
 *<br />
 * This sketch takes advantage of the XBee&#8217;s hibernation mode as<br />
 * well as the Ardunio Fio&#8217;s Power Save Mode to grossly reduce power<br />
 * consumption.  It impliments a temperature logging IC (DS18B20)<br />
 * That has been connected to D3,D4,D5.  Provides a much more<br />
 * accurate temperature measurement than the internal thermometer<br />
 * (see SuperSleepyTempAndVolts.ino).<br />
 *<br />
 */</p>
<p>#include &lt;avr/wdt.h&gt;<br />
#include &lt;avr/sleep.h&gt;<br />
#include &lt;avr/interrupt.h&gt;<br />
#include &lt;OneWire.h&gt; // Get here: http://www.arduino.cc/playground/Learning/OneWire</p>
<p>const int ledPin = 13;<br />
const int DS18B20Ground = 3;           // DS18B20 Pin 1<br />
const int DS18B20Data = 4;             // DS18B20 Pin 2 NOTE: 4.7k pull-up resistor required between data and power<br />
const int DS18B20Power = 5;            // DS18B20 Pin 3<br />
const int XBeeSleep = 2;               // Connect to XBee DTR<br />
const int waitPeriod = 8;              // Number of 8 second cycles before waking<br />
                                       // up XBee and sending data (8*8 = 64 seconds)</p>
<p>OneWire ds(DS18B20Data);               // Setup DS18S20 Temperature chip I/O</p>
<p>// See: http://code.google.com/p/tinkerit/wiki/SecretVoltmeter<br />
float readVcc() {<br />
  signed long resultVcc;<br />
  float resultVccFloat;<br />
  // Read 1.1V reference against AVcc<br />
  ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);<br />
  delay(10);                           // Wait for Vref to settle<br />
  ADCSRA |= _BV(ADSC);                 // Convert<br />
  while (bit_is_set(ADCSRA,ADSC));<br />
  resultVcc = ADCL;<br />
  resultVcc |= ADCH&lt;&lt;8;<br />
  resultVcc = 1126400L / resultVcc;    // Back-calculate AVcc in mV<br />
  resultVccFloat = (float) resultVcc / 1000.0; // Convert to Float<br />
  return resultVccFloat;<br />
}</p>
<p>// See: http://www.arduino.cc/playground/Learning/OneWire<br />
float readTempDS18B20() {<br />
  int HighByte, LowByte, TReading, SignBit, Tc_100;<br />
  byte i;<br />
  byte present = 0;<br />
  byte data[12];<br />
  byte addr[8];<br />
  float resultTempFloat;</p>
<p>digitalWrite(DS18B20Power,HIGH);     // Power up the DS18B20<br />
  delay(250);</p>
<p>ds.search(addr);<br />
  if ( OneWire::crc8( addr, 7) != addr[7]) {<br />
      return 0.0;                      // CRC is not valid!<br />
  }</p>
<p>ds.reset();<br />
  ds.select(addr);<br />
  ds.write(0x44,1);                   // Start conversion, with parasite power on at the end</p>
<p>delay(1000);                        // Maybe 750ms is enough, maybe not<br />
                                      // We might do a ds.depower() here,<br />
                                      // but the reset will take care of it.</p>
<p>present = ds.reset();<br />
  ds.select(addr);<br />
  ds.write(0xBE);                     // Read Scratchpad</p>
<p>for ( i = 0; i &lt; 9; i++) {          // we need 9 bytes<br />
    data[i] = ds.read();<br />
  }<br />
  LowByte = data[0];<br />
  HighByte = data[1];<br />
  TReading = (HighByte &lt;&lt; 8) + LowByte;<br />
  SignBit = TReading &amp; 0x8000;        // Test most sig bit<br />
  if (SignBit)                        // Negative<br />
  {<br />
    TReading = (TReading ^ 0xffff) + 1;    // Take 2&#8217;s comp<br />
  }</p>
<p>ds.reset_search();<br />
  digitalWrite(DS18B20Power,LOW);     // Turn off DS18B20</p>
<p>resultTempFloat = (float) (6 * TReading) + TReading / 4;  // Multiply by (100 * 0.0625) or 6.25<br />
  resultTempFloat = resultTempFloat/100;<br />
  resultTempFloat = resultTempFloat * 1.8 + 32.0;  // Convert to F<br />
  return resultTempFloat;<br />
}</p>
<p>void sleepNow()<br />
{<br />
  /* Now is the time to set the sleep mode. In the Atmega8 datasheet<br />
   * http://www.atmel.com/dyn/resources/prod_documents/doc2486.pdf on page 35<br />
   * there is a list of sleep modes which explains which clocks and<br />
   * wake up sources are available in which sleep modus.<br />
   *<br />
   * In the avr/sleep.h file, the call names of these sleep modus are to be found:<br />
   *<br />
   * The 5 different modes are:<br />
   *     SLEEP_MODE_IDLE         -the least power savings<br />
   *     SLEEP_MODE_ADC<br />
   *     SLEEP_MODE_PWR_SAVE<br />
   *     SLEEP_MODE_STANDBY<br />
   *     SLEEP_MODE_PWR_DOWN     -the most power savings<br />
   *<br />
   *  the power reduction management &lt;avr/power.h&gt;  is described in<br />
   *  http://www.nongnu.org/avr-libc/user-manual/group__avr__power.html<br />
   */</p>
<p>set_sleep_mode(SLEEP_MODE_PWR_SAVE); // Sleep mode is set here</p>
<p>sleep_enable();                      // Enables the sleep bit in the mcucr register<br />
                                       // so sleep is possible. just a safety pin<br />
  sleep_mode();                        // Here the device is actually put to sleep!!<br />
                                       // THE PROGRAM CONTINUES FROM HERE AFTER WAKING UP<br />
  sleep_disable();                     // Dirst thing after waking from sleep:<br />
                                       // disable sleep&#8230;<br />
}</p>
<p>ISR (WDT_vect) {                       // WDT Wakeup<br />
  cli();<br />
  wdt_disable();<br />
  sei();<br />
}</p>
<p>// Variable Definition<br />
volatile int MeasurementID = 1;<br />
volatile int timeKeeper = 0;<br />
volatile float averageVcc = 0.0;<br />
volatile float averageTemp = 0.0;</p>
<p>void setup(void) {<br />
  Serial.begin(57600);<br />
  pinMode(DS18B20Ground, OUTPUT);<br />
  digitalWrite(DS18B20Ground, 0);      // Ground the DS18B20 GND pin<br />
  pinMode(XBeeSleep, OUTPUT);</p>
<p>digitalWrite(XBeeSleep, 0);          // Enable XBee<br />
  digitalWrite(ledPin, 1);             // Turn on Notification LED<br />
  delay(4000);                         // 4 second LED blink, good for wireless programming<br />
  digitalWrite(ledPin, 0);             // Turn off Notification LED</p>
<p>Serial.write( 170 );                 // Sync Byte<br />
  Serial.print( &#8216;\t&#8217; );                // Tab<br />
  Serial.print( &#8216;0&#8217; );                 // Reading # (0)<br />
  Serial.print( &#8216;\t&#8217; );                // Tab<br />
  Serial.print( &#8216;0&#8217; );                 // Voltage (unmeasured, so 0)<br />
  Serial.print( &#8216;\t&#8217; );                // Tab<br />
  Serial.println( &#8216;0&#8217; );               // Temperature (unmeasured, so 0)</p>
<p>digitalWrite(XBeeSleep, 1);          // Disable XBee<br />
}</p>
<p>void loop(void) {<br />
  averageVcc = averageVcc + (float) readVcc();<br />
  averageTemp = averageTemp + (float) readTempDS18B20();</p>
<p>if (timeKeeper == (waitPeriod-1)) {  // Transmit every 8*8 (64) seconds<br />
    digitalWrite(XBeeSleep, 0);        // Enable XBee<br />
    delay(50);                         // Wait for XBee Wakeup</p>
<pre><code>Serial.write( 170 );               // Sync Byte
Serial.print( '\t' );
Serial.print( MeasurementID, DEC );
Serial.print( '\t' );
Serial.print( (float) (averageVcc/waitPeriod) , 3);
Serial.print( '\t' );
Serial.println( (float) (averageTemp/waitPeriod) , 2);
MeasurementID++;

digitalWrite(ledPin, 1);           // Turn on Notification LED
delay(50);                         // Blink LED
digitalWrite(ledPin, 0);           // Turn off Notification LED

digitalWrite(XBeeSleep, 1);        // Disable XBee

averageVcc = 0;                    // Reset voltage for new measurements
averageTemp = 0;                   // Reset temperature for new measurements
timeKeeper = 0;
</code></pre>
<p>} else {                             // Add a reading to the average<br />
    digitalWrite(ledPin, 1);           // Turn on Notification LED<br />
    delay(1);                          // Blink LED very quickly<br />
    digitalWrite(ledPin, 0);           // Turn off Notification LED</p>
<pre><code>timeKeeper++;
</code></pre>
<p>}</p>
<p>wdt_reset();                         // Get ready to go to sleep&#8230;<br />
  watchdogEnable();                    // Turn on the watchdog timer<br />
  sleepNow();                          // Go to sleep, watchdog timer will wake later<br />
}</p>
<p>void watchdogEnable() {                // Turn on watchdog timer; interrupt mode every 8.0s<br />
  cli();<br />
  MCUSR = 0;<br />
  WDTCSR |= B00011000;<br />
  //WDTCSR = B01000111;                // 2 Second Timeout<br />
  //WDTCSR = B01100000;                // 4 Second Timeout<br />
  WDTCSR = B01100001;                  // 8 Second Timeout<br />
  sei();<br />
}<br />
[/code]</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Arduino FIO Internal Voltmeter and Thermometer</title>
		<link>/2012/09/09/arduino-fio-internal-voltmeter-and-thermometer/</link>
		
		<dc:creator><![CDATA[Steven A. Cholewiak]]></dc:creator>
		<pubDate>Sun, 09 Sep 2012 19:06:15 +0000</pubDate>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[RF]]></category>
		<guid isPermaLink="false">http://semifluid.com/?p=1324</guid>

					<description><![CDATA[Let&#8217;s extend the low power Ardunio Fio + Xbee setup that I previously blogged about. &#160;I wanted to see if I could create a simple wireless temperature sensor that could allow for long(er) term logging. &#160;Interestingly, the&#160;ATmega328P&#160;on the Arduino Fio has both a &#8220;secret&#8221; internal thermometer and internal voltmeter, meaning that I could (potentially) create [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Let&#8217;s extend the low power Ardunio Fio + Xbee setup that I <a href="http://semifluid.com/2012/09/07/arduino-fio-low-power-setup/">previously blogged about</a>. &nbsp;I wanted to see if I could create a simple wireless temperature sensor that could allow for long(er) term logging. &nbsp;Interestingly, the&nbsp;<a href="http://www.atmel.com/devices/atmega328p.aspx">ATmega328P</a>&nbsp;on the Arduino Fio has both a &#8220;secret&#8221; <a href="http://code.google.com/p/tinkerit/wiki/SecretThermometer">internal thermometer</a> and <a href="http://code.google.com/p/tinkerit/wiki/SecretVoltmeter">internal voltmeter</a>, meaning that I could (potentially) create a wireless sensor with no external additional external components (other than the Fio, XBee, and battery).</p>
<p><a href="http://semifluid.com/wp-content/uploads/2012/09/IMG_0243.jpg"><img loading="lazy" decoding="async" src="http://semifluid.com/wp-content/uploads/2012/09/IMG_0243-1024x768.jpg" alt="" title="Arduino Fio Internal Thermometer" width="600" height="450" class="aligncenter size-large wp-image-1352" srcset="/wp-content/uploads/2012/09/IMG_0243-1024x768.jpg 1024w, /wp-content/uploads/2012/09/IMG_0243-300x225.jpg 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></a></p>
<p>So, taking advantage of the available hardware and the code available, I went about creating a wireless  temperature logger using an Arduino Fio (available from <a href="https://www.amazon.com/dp/B005K0O1PA/ref=as_li_ss_til?tag=semifluidcom-20&#038;camp=0&#038;creative=0&#038;linkCode=as4&#038;creativeASIN=B005K0O1PA&#038;adid=1KB2CEGSB0E1856D3DXX&#038;" target="_blank">Amazon.com</a>) and two XBees (one for the Fio and one for the coordinator).</p>
<p><span id="more-1324"></span></p>
<p>I already have code for a very low power logger setup that takes advantage of the Arduino Fio&#8217;s sleep mode as well as the XBee&#8217;s hibernation mode (see <a href="http://semifluid.com/2012/09/07/arduino-fio-low-power-setup/">here</a>). &nbsp;So, all I needed to do was to add the thermometer and voltmeter code that <a href="http://code.google.com/p/tinkerit/">tinkerit</a> documented.</p>
<p>Here is their <a href="http://code.google.com/p/tinkerit/wiki/SecretThermometer">internal thermometer</a> example code:</p>
<p><script src="https://gist.github.com/OrganicIrradiation/9e51a0a6c3bcc8ff3871.js?file=readTemp.ino"></script></p>
<p><a href="http://semifluid.com/wp-content/uploads/2012/09/IMG_0244.jpg"><img loading="lazy" decoding="async" src="http://semifluid.com/wp-content/uploads/2012/09/IMG_0244-1024x768.jpg" alt="" title="Arduino Fio Internal Thermometer Close-up" width="600" height="450" class="aligncenter size-large wp-image-1353" srcset="/wp-content/uploads/2012/09/IMG_0244-1024x768.jpg 1024w, /wp-content/uploads/2012/09/IMG_0244-300x225.jpg 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></a></p>
<p>I modified the readTemp() function so that it returned a &#8220;human-readable&#8221; float in Fahrenheit (my local method of measuring temperature).  In addition, I added a small calculation to return a more accurate temperature (calibrated against a thermometer at my house).  If you want to calibrate the internal thermometer, put the Arduino Fio into a glass of ice water (I recommend putting it into a plastic bag and vacuuming out as much air as possible!), measure the values it returns, then put it into a cup of hot water, of known temperature, and measure the values it returns.  It would be best to have multiple measurements along a series of temperatures, confirmed with a pre-calibrated thermometer (i.e., mercury thermometer).  After making the measurements, you can fit a linear model (i.e., best fit line) to the data to get the slope and y-intercept for your device.</p>
<p><script src="https://gist.github.com/OrganicIrradiation/9e51a0a6c3bcc8ff3871.js?file=readTemp_human.ino"></script></p>
<p>I also added their <a href="http://code.google.com/p/tinkerit/wiki/SecretVoltmeter">internal voltmeter</a> example code:</p>
<p><script src="https://gist.github.com/OrganicIrradiation/9e51a0a6c3bcc8ff3871.js?file=readVcc.ino"></script></p>
<p>The only modification was to convert the decimal to a float for (again) human readable format:</p>
<p><script src="https://gist.github.com/OrganicIrradiation/9e51a0a6c3bcc8ff3871.js?file=readVcc_human.ino"></script></p>
<p>And last, but not least, I&#8217;ve been finding &#8220;trash data&#8221; that can be transmitted when the XBee is woken from hibernation, so I added a sync byte (DEC 170), that allows for easier parsing of the data.  Here is some example output from <a href="https://ttssh2.osdn.jp/index.html.en">TeraTerm</a> (I measured the ambient temperature for measurements 1-10, then put my thumb onto the ATmega328P for measurements 11 &amp; 12, and then allowed the Arduino to return to ambient for readings 13-20):</p>
<p>[code gutter=&#8221;false&#8221;]<br />
ª       0       0       0<br />
~<br />
 ?ª     1       3.303   69.83<br />
~<br />
 ?ª     2       3.303   69.62<br />
~<br />
 ?ª     3       3.303   69.62<br />
~<br />
 @ª     4       3.303   69.41<br />
~<br />
 ?ª     5       3.303   69.41<br />
~<br />
 ?ª     6       3.303   69.83<br />
~<br />
 ?ª     7       3.303   69.41<br />
~<br />
 ?ª     8       3.303   68.78<br />
~<br />
 ?ª     9       3.303   69.20<br />
~<br />
 #ª     10      3.303   69.20<br />
~<br />
 &#8216;ª     11      3.303   72.35<br />
~<br />
 (ª     12      3.303   72.77<br />
~<br />
 #ª     13      3.303   72.14<br />
~<br />
 &gt;ª     14      3.303   72.35<br />
~<br />
 ?ª     15      3.303   70.88<br />
~<br />
 &gt;ª     16      3.303   70.25<br />
~<br />
 &gt;ª     17      3.303   69.62<br />
~<br />
 &gt;ª     18      3.303   69.41<br />
~<br />
 &gt;ª     19      3.303   69.41<br />
~<br />
 &gt;ª     20      3.303   68.36<br />
[/code]</p>
<p>Yes, I have poor circulation in my hands (hence only a 3 degree jump).  I stored the data for another 30 readings, cut out all of the trash data between the carriage returns (deliminating the readings) and sync characters (which visually show up as &#8220;ª&#8221; in TeraTerm), removed the initial sync reading, and <a href="http://semifluid.com/wp-content/uploads/2012/09/SuperSleepyTempAndVolts.nb">plotted the temperature data in Mathematica</a> (voltage was constant for the ~50 minutes while I wrote this post):</p>
<p><a href="http://semifluid.com/wp-content/uploads/2012/09/SuperSleepyTempAndVolts.png"><img loading="lazy" decoding="async" src="http://semifluid.com/wp-content/uploads/2012/09/SuperSleepyTempAndVolts-300x177.png" alt="" title="SuperSleepyTempAndVolts" width="300" height="177" class="aligncenter size-medium wp-image-1334" srcset="/wp-content/uploads/2012/09/SuperSleepyTempAndVolts-300x177.png 300w, /wp-content/uploads/2012/09/SuperSleepyTempAndVolts.png 360w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p>Nice!</p>
<p><a href="http://semifluid.com/wp-content/uploads/2012/09/IMG_0245.jpg"><img loading="lazy" decoding="async" src="http://semifluid.com/wp-content/uploads/2012/09/IMG_0245-1024x768.jpg" alt="" title="Arduino Fio Overall" width="600" height="450" class="aligncenter size-large wp-image-1354" srcset="/wp-content/uploads/2012/09/IMG_0245-1024x768.jpg 1024w, /wp-content/uploads/2012/09/IMG_0245-300x225.jpg 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></a></p>
<p>Here&#8217;s all of the Arduino Fio SuperSleepyTempAndVolts code:</p>
<p><script src="https://gist.github.com/OrganicIrradiation/9e51a0a6c3bcc8ff3871.js?file=SuperSleepyTempAndVolts.ino"></script></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
