<?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>PWM Archives - Digital Me</title>
	<atom:link href="https://ba0sh1.com/tag/pwm/feed/" rel="self" type="application/rss+xml" />
	<link>https://ba0sh1.com/tag/pwm/</link>
	<description>Electronics, Computers at leisure time</description>
	<lastBuildDate>Mon, 11 Jul 2022 13:40:30 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.1</generator>
	<item>
		<title>Saleae Logic PWM generator</title>
		<link>https://ba0sh1.com/2012/12/30/saleae-pwm-generator/</link>
					<comments>https://ba0sh1.com/2012/12/30/saleae-pwm-generator/#comments</comments>
		
		<dc:creator><![CDATA[Baoshi]]></dc:creator>
		<pubDate>Sun, 30 Dec 2012 15:07:30 +0000</pubDate>
				<category><![CDATA[Project]]></category>
		<category><![CDATA[Logic Analyzer]]></category>
		<category><![CDATA[PWM]]></category>
		<category><![CDATA[Saleae]]></category>
		<category><![CDATA[Tool]]></category>
		<guid isPermaLink="false">https://www.ba0sh1.com/?p=526</guid>

					<description><![CDATA[<p>In a recent project I need a 3.3V PWM signal generator. Initially I think the fastest  way to do it is using an Arduino and write a simple program with analogWrite() function....</p>
<p>The post <a rel="nofollow" href="https://ba0sh1.com/2012/12/30/saleae-pwm-generator/">Saleae Logic PWM generator</a> appeared first on <a rel="nofollow" href="https://ba0sh1.com">Digital Me</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In a recent project I need a 3.3V PWM signal generator. Initially I think the fastest  way to do it is using an Arduino and write a simple program with analogWrite() function. But I&#8217;m too lazy to setup the breadboard&#8230; so I tried google.</p>
<p>Soon I come across a free software called &#8220;<a title="PWM Logic" href="http://www.brrrbaybay.com/index.php/pwm-logic/about" target="_blank" rel="noopener">PWM Logic</a>&#8220;. Supposedly it will turn Saleae Logic Analyzer into a PWM generator. An original Saleae Logic is somewhat too steep for my pocket right now. But I do have a cheap Chinese clone lying aroung. So I hook it up. Not surprisingly it does not work.<span id="more-526"></span></p>
<figure id="attachment_527" aria-describedby="caption-attachment-527" style="width: 600px" class="wp-caption aligncenter"><img decoding="async" class="thumbnail size-full wp-image-527" alt="Salea Logic clone" src="http://blog.ba0sh1.com/wordpress/wp-content/uploads/2012/12/a4c97-salea-logic-clone.jpg" width="600" height="450" srcset="https://ba0sh1.com/wp-content/uploads/2012/12/a4c97-salea-logic-clone.jpg 600w, https://ba0sh1.com/wp-content/uploads/2012/12/a4c97-salea-logic-clone-300x225.jpg 300w" sizes="(max-width: 600px) 100vw, 600px" /><figcaption id="caption-attachment-527" class="wp-caption-text">Salea Logic clone</figcaption></figure>
<p>Knowing that Saleae Logic hardware is nothing but a Cypress CY68013A chip (that is why it is so easy to clone),  I decide to take a further step to reverse engineer the board and check why.</p>
<p>Some more googling leads me to the schematic of a cloned USBEE AX. USBEE AX is basically the same as Saleae except for two analog channels with limited function. On the schematic there is a 74LCV245 octal bus transceiver in between the testing terminals and CY68013A. The direction pin is connected to &#8220;DIR&#8221; net, but does not seems to link to anywhere else.</p>
<figure id="attachment_529" aria-describedby="caption-attachment-529" style="width: 300px" class="wp-caption aligncenter"><a class="thumbnail" href="http://blog.ba0sh1.com/wordpress/wp-content/uploads/2012/12/ecbb7-schematic.jpg"><img decoding="async" loading="lazy" class="size-medium wp-image-529" alt="USBEE AX (clone) schematic" src="http://blog.ba0sh1.com/wordpress/wp-content/uploads/2012/12/ecbb7-schematic.jpg?w=300&#038;h=157" width="300" height="157" srcset="https://ba0sh1.com/wp-content/uploads/2012/12/ecbb7-schematic.jpg 960w, https://ba0sh1.com/wp-content/uploads/2012/12/ecbb7-schematic-300x157.jpg 300w, https://ba0sh1.com/wp-content/uploads/2012/12/ecbb7-schematic-768x402.jpg 768w" sizes="(max-width: 300px) 100vw, 300px" /></a><figcaption id="caption-attachment-529" class="wp-caption-text">USBEE AX (clone) schematic</figcaption></figure>
<p>Tracing the board, the culprit is found immediately. On my Saleae clone, the 74245 direction pin is grounded, which means it can only receive signal from the terminals, not output to them. While examine the original Saleae <a href="http://electronicsjunk.com/?p=27" target="_blank" rel="noopener">teardown</a>, there is no 74245 at all, the terminals are directly connected to CY68013A (with some schottky barrier, maybe). So the Chinese copycat actually did some &#8220;innovation&#8221; to include a buffer chip, for protection?</p>
<p>Since the reason is found, the next step is simple: break the 74245 direction pin and install a jumper to select input/output function.</p>
<figure id="attachment_530" aria-describedby="caption-attachment-530" style="width: 600px" class="wp-caption aligncenter"><img decoding="async" loading="lazy" class="thumbnail size-full wp-image-530" alt="Jumper added (front)" src="http://blog.ba0sh1.com/wordpress/wp-content/uploads/2012/12/9998e-added-jumper-front.jpg" width="600" height="450" srcset="https://ba0sh1.com/wp-content/uploads/2012/12/9998e-added-jumper-front.jpg 600w, https://ba0sh1.com/wp-content/uploads/2012/12/9998e-added-jumper-front-300x225.jpg 300w" sizes="(max-width: 600px) 100vw, 600px" /><figcaption id="caption-attachment-530" class="wp-caption-text">Jumper added (front)</figcaption></figure>
<figure id="attachment_531" aria-describedby="caption-attachment-531" style="width: 600px" class="wp-caption aligncenter"><img decoding="async" loading="lazy" class="thumbnail size-full wp-image-531" alt="Jumper added (back)" src="http://blog.ba0sh1.com/wordpress/wp-content/uploads/2012/12/06f73-added-jumper-back.jpg" width="600" height="450" srcset="https://ba0sh1.com/wp-content/uploads/2012/12/06f73-added-jumper-back.jpg 600w, https://ba0sh1.com/wp-content/uploads/2012/12/06f73-added-jumper-back-300x225.jpg 300w" sizes="(max-width: 600px) 100vw, 600px" /><figcaption id="caption-attachment-531" class="wp-caption-text">Jumper added (back)</figcaption></figure>
<figure id="attachment_534" aria-describedby="caption-attachment-534" style="width: 600px" class="wp-caption aligncenter"><img decoding="async" loading="lazy" class="thumbnail size-full wp-image-534" alt="Finished LA/PWM box" src="http://blog.ba0sh1.com/wordpress/wp-content/uploads/2012/12/63b74-la_pwm.jpg" width="600" height="450" srcset="https://ba0sh1.com/wp-content/uploads/2012/12/63b74-la_pwm.jpg 600w, https://ba0sh1.com/wp-content/uploads/2012/12/63b74-la_pwm-300x225.jpg 300w" sizes="(max-width: 600px) 100vw, 600px" /><figcaption id="caption-attachment-534" class="wp-caption-text">Finished LA/PWM box</figcaption></figure>
<p>Now I have a dual function Logic Analyzer / PWM Generator <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<figure id="attachment_535" aria-describedby="caption-attachment-535" style="width: 510px" class="wp-caption aligncenter"><img decoding="async" loading="lazy" class="thumbnail size-full wp-image-535" alt="PWM Logic screen shot" src="http://blog.ba0sh1.com/wordpress/wp-content/uploads/2012/12/56b2b-pwm-logic-sc.jpg" width="510" height="418" srcset="https://ba0sh1.com/wp-content/uploads/2012/12/56b2b-pwm-logic-sc.jpg 510w, https://ba0sh1.com/wp-content/uploads/2012/12/56b2b-pwm-logic-sc-300x246.jpg 300w" sizes="(max-width: 510px) 100vw, 510px" /><figcaption id="caption-attachment-535" class="wp-caption-text">PWM Logic screen shot</figcaption></figure>
<p>P.S. CY68013A based logic analyzer is as good as its companion software does. Saleae have put a lot of efforts into its Logic software. Buying a clone and pirate the original software is not legal.</p>
<p>Update 28/09/2013: The PWM Logic homepage seems to be down at the moment. I have a local mirror here: <a href="http://blog.ba0sh1.com/wordpress/wp-content/uploads/2013/09/d0409-pwmlogicsetup_1_0_1_3.zip">PwmLogicSetup 1.0.1.3</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a rel="nofollow" href="https://ba0sh1.com/2012/12/30/saleae-pwm-generator/">Saleae Logic PWM generator</a> appeared first on <a rel="nofollow" href="https://ba0sh1.com">Digital Me</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://ba0sh1.com/2012/12/30/saleae-pwm-generator/feed/</wfw:commentRss>
			<slash:comments>11</slash:comments>
		
		
			</item>
		<item>
		<title>Project Crystal (Part 2)</title>
		<link>https://ba0sh1.com/2012/06/13/project-crystal-part-2/</link>
					<comments>https://ba0sh1.com/2012/06/13/project-crystal-part-2/#respond</comments>
		
		<dc:creator><![CDATA[Baoshi]]></dc:creator>
		<pubDate>Tue, 12 Jun 2012 19:23:55 +0000</pubDate>
				<category><![CDATA[Project]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Arduino Sleep]]></category>
		<category><![CDATA[Distance Sensor]]></category>
		<category><![CDATA[LED Strip]]></category>
		<category><![CDATA[PIR Sensor]]></category>
		<category><![CDATA[PWM]]></category>
		<category><![CDATA[RGB LED]]></category>
		<guid isPermaLink="false">https://ba0sh1.com/?p=88</guid>

					<description><![CDATA[<p>It took me a while but I&#8217;ve made some progress &#8230; Here are the photos of finished board: Working as a software engineer for ten over years, I did not initially consider...</p>
<p>The post <a rel="nofollow" href="https://ba0sh1.com/2012/06/13/project-crystal-part-2/">Project Crystal (Part 2)</a> appeared first on <a rel="nofollow" href="https://ba0sh1.com">Digital Me</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>It took me a while but I&#8217;ve made some progress &#8230;<br><br>Here are the photos of finished board:</p>



<span id="more-88"></span>



<figure class="is-layout-flex wp-block-gallery-1 wp-block-gallery columns-3 is-cropped"><ul class="blocks-gallery-grid"><li class="blocks-gallery-item"><figure><img decoding="async" loading="lazy" width="800" height="600" src="https://ba0sh1.com/wp-content/uploads/2012/06/377c9-crystal_back.jpg" alt="Controller board back view" data-id="103" data-full-url="https://ba0sh1.com/wp-content/uploads/2012/06/377c9-crystal_back.jpg" data-link="https://ba0sh1.com/crystal_back/" class="wp-image-103" srcset="https://ba0sh1.com/wp-content/uploads/2012/06/377c9-crystal_back.jpg 800w, https://ba0sh1.com/wp-content/uploads/2012/06/377c9-crystal_back-300x225.jpg 300w, https://ba0sh1.com/wp-content/uploads/2012/06/377c9-crystal_back-768x576.jpg 768w" sizes="(max-width: 800px) 100vw, 800px" /><figcaption class="blocks-gallery-item__caption">Controller board back view</figcaption></figure></li><li class="blocks-gallery-item"><figure><img decoding="async" loading="lazy" width="800" height="600" src="https://ba0sh1.com/wp-content/uploads/2012/06/2a4f5-crystal_front.jpg" alt="Controller board front view" data-id="102" data-full-url="https://ba0sh1.com/wp-content/uploads/2012/06/2a4f5-crystal_front.jpg" data-link="https://ba0sh1.com/crystal_front/" class="wp-image-102" srcset="https://ba0sh1.com/wp-content/uploads/2012/06/2a4f5-crystal_front.jpg 800w, https://ba0sh1.com/wp-content/uploads/2012/06/2a4f5-crystal_front-300x225.jpg 300w, https://ba0sh1.com/wp-content/uploads/2012/06/2a4f5-crystal_front-768x576.jpg 768w" sizes="(max-width: 800px) 100vw, 800px" /><figcaption class="blocks-gallery-item__caption">Controller board front view</figcaption></figure></li><li class="blocks-gallery-item"><figure><img decoding="async" loading="lazy" width="800" height="600" src="https://ba0sh1.com/wp-content/uploads/2012/06/6836f-crystal_sensors.jpg" alt="PIR sensor and distance sensor" data-id="105" data-full-url="https://ba0sh1.com/wp-content/uploads/2012/06/6836f-crystal_sensors.jpg" data-link="https://ba0sh1.com/crystal_sensors/" class="wp-image-105" srcset="https://ba0sh1.com/wp-content/uploads/2012/06/6836f-crystal_sensors.jpg 800w, https://ba0sh1.com/wp-content/uploads/2012/06/6836f-crystal_sensors-300x225.jpg 300w, https://ba0sh1.com/wp-content/uploads/2012/06/6836f-crystal_sensors-768x576.jpg 768w" sizes="(max-width: 800px) 100vw, 800px" /><figcaption class="blocks-gallery-item__caption">PIR sensor and distance sensor</figcaption></figure></li></ul></figure>



<p>Working as a software engineer for ten over years, I did not initially consider Adruino programming is of any difficulty. But I soon realized that I have been deeply spoiled by the modern operation systems. Giving a task that is so naturally to be implemented as a thread, it is never trivial in micro controller system. I spend one whole day to map out a flow chart of the control tasks, then turn the chart into C code. I can imaging that the time would have double or trippled if I don&#8217;t do this. Old school way rules, isn&#8217;t it?</p>



<p>I have attached the flow chart and Arduino sketch here. Sorry I dislike documentation, just refer to the inline comments and flow chart in case needed.</p>



<div class="wp-block-file"><object class="wp-block-file__embed" data="https://ba0sh1.com/wp-content/uploads/2012/06/b303f-crystal_flowchart.pdf" type="application/pdf" style="width:100%;height:600px" aria-label="Embed of Embed of Crystal_Flowchart.pdf.."></object><a href="https://ba0sh1.com/wp-content/uploads/2012/06/b303f-crystal_flowchart.pdf">Crystal_Flowchart.pdf</a><a href="https://ba0sh1.com/wp-content/uploads/2012/06/b303f-crystal_flowchart.pdf" class="wp-block-file__button" download>Download</a></div>



<div class="wp-block-file"><a href="https://ba0sh1.com/wp-content/uploads/2012/06/648ad-crystal_sketch.zip">Crystal_Sketch.zip</a><a href="https://ba0sh1.com/wp-content/uploads/2012/06/648ad-crystal_sketch.zip" class="wp-block-file__button" download>Download</a></div>



<p>Having a license term is still better then nothing, so I make this one:</p>



<ol><li>Tribute goes to&nbsp;<a href="http://makeprojects.com/User/9189/Francisco+Castro" target="_blank" rel="noopener">Francisco Castro</a>&nbsp;and his&nbsp;<a href="http://makeprojects.com/Project/Luminch-One/1773/1" target="_blank" rel="noopener">Luminch One</a>&nbsp;project.</li><li>The redesign here is provided on AS-IS basis. If it works, it is designed by ba0sh1.</li><li>If it doesn&#8217;t work, I do not know who designed it</li></ol>



<p>And enjoy the demo video. My first YouTube upload <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f600.png" alt="😀" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="Project Crystal Demo" width="640" height="360" src="https://www.youtube.com/embed/vYRVWFtfnt4?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div></figure>
<p>The post <a rel="nofollow" href="https://ba0sh1.com/2012/06/13/project-crystal-part-2/">Project Crystal (Part 2)</a> appeared first on <a rel="nofollow" href="https://ba0sh1.com">Digital Me</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://ba0sh1.com/2012/06/13/project-crystal-part-2/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Project Crystal (Part 1)</title>
		<link>https://ba0sh1.com/2012/05/24/project-crystal-part-1/</link>
					<comments>https://ba0sh1.com/2012/05/24/project-crystal-part-1/#comments</comments>
		
		<dc:creator><![CDATA[Baoshi]]></dc:creator>
		<pubDate>Thu, 24 May 2012 03:35:26 +0000</pubDate>
				<category><![CDATA[Project]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Distance Sensor]]></category>
		<category><![CDATA[LED Strip]]></category>
		<category><![CDATA[PIR Sensor]]></category>
		<category><![CDATA[PWM]]></category>
		<category><![CDATA[RGB LED]]></category>
		<guid isPermaLink="false">https://ba0sh1.com/?p=26</guid>

					<description><![CDATA[<p>A small project I did while waiting for the Raspberry Pi &#8211; Arduino controlled RGB LED light. The initial idea was stolen taken from Luminch One I made several redesigns: RGB LED strip instead of...</p>
<p>The post <a rel="nofollow" href="https://ba0sh1.com/2012/05/24/project-crystal-part-1/">Project Crystal (Part 1)</a> appeared first on <a rel="nofollow" href="https://ba0sh1.com">Digital Me</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>A small project I did while waiting for the Raspberry Pi &#8211; Arduino controlled RGB LED light.</p>
<p>The initial idea was <del>stolen</del> taken from <a href="http://makeprojects.com/Project/Luminch-One/1773/1" target="_blank" rel="noopener">Luminch One</a></p>
<p>I made several redesigns:</p>
<ol>
<li>RGB LED strip instead of original high-powered LED</li>
<li>Use battery power.</li>
</ol>
<div>
<p><span id="more-1261"></span>The journey for battery power ends up to be much more complex. The major concern is standby (light off) power consumption. I wished the circuit could remain standby for at least one week. With three 3100mAh 18650 battery cell at 3.7V each, the maximum allowed current draw works out as 3100 * 0.8 / 7 (days) / 24 (hrs) = 14.7mA (<a href="http://www.powerstream.com/battery-capacity-calculations.htm" target="_blank" rel="noopener">reference</a> here, number of cells actually does not help, but LED light needs 12V). However, the Arduino Nano alone consumes 20mA when running. After removing the power LED, it still consumes about 17mA. The distance sensor, Sharp GP2Y0A21YK0F takes another whopping 20mA. With these two monsters, standby time is 3100 * 0.8 / 37mA = 67 Hours ~ 2.8 days (show stopper).</p>
<p>It seems I need to turn off distance sensor and put Arduino into sleep mode during standby. It is solved by adding a Passive Infrared (PIR) sensor which powers on GP2Y0A21YK0F only when human (or pet) walks near the light. Together with AVR sleep mode the current now reduces to 2mA standby. My standby time is 51 days <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>Here comes the schematic.</p>
<figure id="attachment_63" aria-describedby="caption-attachment-63" style="width: 1262px" class="wp-caption alignnone"><img decoding="async" loading="lazy" class="    wp-image-63 size-full" title="Crystal schematic" src="https://ba0sh1.com/wp-content/uploads/2012/06/69689-crystal_sch.png" alt="Crystal schematic" width="1262" height="769" srcset="https://ba0sh1.com/wp-content/uploads/2012/06/69689-crystal_sch.png 1262w, https://ba0sh1.com/wp-content/uploads/2012/06/69689-crystal_sch-300x183.png 300w, https://ba0sh1.com/wp-content/uploads/2012/06/69689-crystal_sch-1024x624.png 1024w, https://ba0sh1.com/wp-content/uploads/2012/06/69689-crystal_sch-768x468.png 768w" sizes="(max-width: 1262px) 100vw, 1262px" /><figcaption id="caption-attachment-63" class="wp-caption-text">Crystal schematic</figcaption></figure>
<p>Notes:</p>
<ol>
<li>Q1 controls power to the Sharp sensor. I tried to drive this sensor directly from an Arduino pin but failed. The sensor output is unstable. I believe GP2Y0A21YK0F  specified 20mA power draw is only average value. Its peak current is quite higher.</li>
<li>Q2 is reverse voltage protection (<a href="http://youtu.be/IrB-FPcv1Dc" target="_blank" rel="noopener">reference</a>)</li>
<li>J_LIGHT is the main RGB LED light. J_LIGHT_BK is for backup.</li>
<li>R1/R2 is voltage divider for battery voltage measurement.</li>
<li>J_INDI connects to a Bi-color (Red/Green) LED light as indication.</li>
</ol>
<div>
<p> The final construction will be on a perf-board. So I start Eagle PCB, set grid to 0.1inch and route the design. All files at the bottom.</p>
<p>Next part will include Arduino sketch, photos, and demo video. Stay tuned &#8230;</p>
</div>
</div>


<p></p>
<p>The post <a rel="nofollow" href="https://ba0sh1.com/2012/05/24/project-crystal-part-1/">Project Crystal (Part 1)</a> appeared first on <a rel="nofollow" href="https://ba0sh1.com">Digital Me</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://ba0sh1.com/2012/05/24/project-crystal-part-1/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
