tag:blogger.com,1999:blog-45126452494998649832024-03-20T17:04:12.049-07:00Henry's BlogHenry Thttp://www.blogger.com/profile/10834719808707381737noreply@blogger.comBlogger16125tag:blogger.com,1999:blog-4512645249499864983.post-73327348660334701702021-07-21T11:49:00.000-07:002021-07-21T11:49:00.452-07:00LED visualization with Teensy, an IMU, and WS2812<p> This is from a few years back.</p><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="BLOG_video_class" height="266" src="https://www.youtube.com/embed/t9_F-3_S0ZQ" width="320" youtube-src-id="t9_F-3_S0ZQ"></iframe></div><br /><p></p>Henry Thttp://www.blogger.com/profile/10834719808707381737noreply@blogger.com0tag:blogger.com,1999:blog-4512645249499864983.post-53981652371153045852021-02-04T11:30:00.001-08:002021-07-21T11:31:40.110-07:00Serial port - what is it doing in your home?<p></p><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="BLOG_video_class" height="266" src="https://www.youtube.com/embed/O99VLn7LRxE" width="320" youtube-src-id="O99VLn7LRxE"></iframe></div><br /> <p></p>Henry Thttp://www.blogger.com/profile/10834719808707381737noreply@blogger.com0tag:blogger.com,1999:blog-4512645249499864983.post-77924654444432143702021-01-08T09:44:00.002-08:002021-07-21T11:30:16.423-07:00DJI Spark RC repair using basic hardware hacking<p> Haven't posted in a while! New video:</p><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="BLOG_video_class" height="266" src="https://www.youtube.com/embed/EnzzxcUU8sI" width="320" youtube-src-id="EnzzxcUU8sI"></iframe></div><br />Henry Thttp://www.blogger.com/profile/10834719808707381737noreply@blogger.com0tag:blogger.com,1999:blog-4512645249499864983.post-78278534185273090372019-04-06T11:43:00.001-07:002019-04-06T11:43:32.257-07:00Tesla Coil VideoFirst post in a few years! Life got a bit busy. I think I'm going to be primarily focusing on video posts, and this is my very first foray into that.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/nn9URgdDnfg/0.jpg" src="https://www.youtube.com/embed/nn9URgdDnfg?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<br />Henry Thttp://www.blogger.com/profile/10834719808707381737noreply@blogger.com0tag:blogger.com,1999:blog-4512645249499864983.post-30677718451101323662015-11-15T17:09:00.000-08:002020-04-17T13:04:42.334-07:00Halloween "The Sims" costume with color changing LEDs<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhk9PW59U38aFevO-rGu_RiW-Q0sHWiYHzf199NWOs3iUkKi5_8d_ea8UWarOw4TxRxwn84Dg6jFgbWnYlfl0hZwokq0dhJ8CCG2LRlVkpVRcXyRqg8ONMusig84XXAqeLkGcVhx2rOHr8J/s1600/2015-11-01%25252011.01.51.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhk9PW59U38aFevO-rGu_RiW-Q0sHWiYHzf199NWOs3iUkKi5_8d_ea8UWarOw4TxRxwn84Dg6jFgbWnYlfl0hZwokq0dhJ8CCG2LRlVkpVRcXyRqg8ONMusig84XXAqeLkGcVhx2rOHr8J/s320/2015-11-01%25252011.01.51.jpg" width="187" /></a></div>
<br />
This year my girlfriend and I wanted to make a <a href="https://en.wikipedia.org/wiki/The_Sims" target="_blank">The Sims</a> costume for Halloween. We took a few pics of the build process for anyone else that might be interested in making one.<br />
<a name='more'></a><br />
<br />
The basic idea was to make a sort of lamp-shade in the shape of the diamond (known in the Sims world as the "Plumbob"). This would slide over a clear acrylic tube with some LEDs inside to hold it up. <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi46bX6CYdhtGvClREkCxrIWhkzFXNJCGU6s0zz59PoP0hr4K2Ax5NnB9VpN7QzWz2DHPCt9JIJpM3_ZF151JqKvgwG80ERjbYH5aP_Ow5eGWAsXSOOruYTxdnjgDFMSYVkeSbCjKeOjQDG/s1600/drawing.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi46bX6CYdhtGvClREkCxrIWhkzFXNJCGU6s0zz59PoP0hr4K2Ax5NnB9VpN7QzWz2DHPCt9JIJpM3_ZF151JqKvgwG80ERjbYH5aP_Ow5eGWAsXSOOruYTxdnjgDFMSYVkeSbCjKeOjQDG/s320/drawing.png" width="111" /> </a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
We debated for a while about what materials to actually use for the "lamp-shade". Here were some thoughts we had about the following:</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul>
<li>Cut out acrylic triangles and glue them together. Seems like it would require very precise cutting to get everything to fit together without gaps.</li>
<li>Wire-frame using wooden dowels held together using glue. Probably could have went this route, we were unsure about using wood glue which needs to be held in place for a long time to set. However using wooden dowels and hot glue probably would have been fine.</li>
<li>Wire-frame using some metal coat-hanger like material and solder together. We decided to go this route because soldering is relatively quick and strong. And we could strengthen the joints afterward with an epoxy.</li>
</ul>
Some other thoughts:<br />
<br />
Soldering vs Sugru? - Sugru might have been the best way to go about it since you can easily hold everything in place while the Sugru is still soft. <br />
<br />
Paper vs Fabric? - Fabric seemed more durable but more time consuming. Also the cotton we bought didn't actually seem to diffuse light as well as regular paper, but it turned out to be okay. In the end we went with cotton mainly due to the durability.<br />
<br />
Okay, without further ado, the build photos:<br />
<br />
<h2>
Wire-frame </h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-w295aeajKqY/Vj5p5o4w4zI/AAAAAAAAPE0/tqrTQG4sfC4/s1600/image1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://1.bp.blogspot.com/-w295aeajKqY/Vj5p5o4w4zI/AAAAAAAAPE0/tqrTQG4sfC4/s320/image1.JPG" width="320" /></a></div>
<div style="text-align: center;">
Cutting the 0.062" steel rod stock I bought turned out to be a nightmare. I had to resort to using my rotary tool and a cutting wheel to cut through it</div>
<div style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-R1YPwISPDhU/Vj5p3gQ_1mI/AAAAAAAAPEc/l80kfylLs2M/s1600/image3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://1.bp.blogspot.com/-R1YPwISPDhU/Vj5p3gQ_1mI/AAAAAAAAPEc/l80kfylLs2M/s320/image3.JPG" width="240" /></a></div>
<div style="text-align: center;">
Tacking the pieces in place and soldering. These were about 3" in length. Using lots of rosin flux (the gross looking Q-tip is flux, I swear!)</div>
<div style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-3_GREkcbxbg/Vj5p8v4Q7oI/AAAAAAAAPFM/bbyj31Curfk/s1600/image3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://2.bp.blogspot.com/-3_GREkcbxbg/Vj5p8v4Q7oI/AAAAAAAAPFM/bbyj31Curfk/s320/image3.JPG" width="320" /></a></div>
<div style="text-align: center;">
Finished soldering the base piece together</div>
<div style="text-align: center;">
</div>
<div style="text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-pAw57pXnke0/Vj5pHp2ZnPI/AAAAAAAAPCk/_HoKirYKO5w/s1600/image15.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://1.bp.blogspot.com/-pAw57pXnke0/Vj5pHp2ZnPI/AAAAAAAAPCk/_HoKirYKO5w/s320/image15.JPG" width="240" /></a></div>
<div style="text-align: center;">
Soldering the side pieces. These were about 7" in length. It's very helpful to have an extra hand at this point! Starting off with 3 at a time so that the tip will be centered.</div>
<div style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-Nd55kYjrYqA/Vj5pQ9JpOrI/AAAAAAAAPD4/5oTAWkg8_Oc/s1600/image22.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://1.bp.blogspot.com/-Nd55kYjrYqA/Vj5pQ9JpOrI/AAAAAAAAPD4/5oTAWkg8_Oc/s320/image22.JPG" width="240" /></a></div>
<div style="text-align: center;">
The rest of the side pieces soldered and the tip soldered.</div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-0nGaomK2_4c/Vj5pAGKUkKI/AAAAAAAAPBA/3Zx7DMAr3W8/s1600/image19.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://2.bp.blogspot.com/-0nGaomK2_4c/Vj5pAGKUkKI/AAAAAAAAPBA/3Zx7DMAr3W8/s320/image19.JPG" width="240" /></a></div>
<div style="text-align: center;">
Same process to solder the side pieces for the bottom, but more annoying because it doesn't lay flat on the table anymore. Lots of helping hands needed for this one! Started off by holding 3 in place then soldering the other 3.</div>
<div style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-WmaDH2WrFw8/Vj5pStmD6CI/AAAAAAAAPEA/0gAWtj4dDBA/s1600/image18.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://1.bp.blogspot.com/-WmaDH2WrFw8/Vj5pStmD6CI/AAAAAAAAPEA/0gAWtj4dDBA/s320/image18.JPG" width="240" /></a></div>
<div style="text-align: center;">
Wire-frame almost complete. A hole still needs to be cut on the bottom.</div>
<div style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEAkRJmJa9hI6YVIB6WoIFWBX-k7msPyZqMyYh5ge9n1r7Qevy6E66vMhXiD3GEieSxR1RuyUlFeMG4joiC6An40TEpRyDZnFxvdGac7QjthVGT4YnphUkNeL0aKZsQ378vRaJSmU30_tK/s1600/20151025_211504.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEAkRJmJa9hI6YVIB6WoIFWBX-k7msPyZqMyYh5ge9n1r7Qevy6E66vMhXiD3GEieSxR1RuyUlFeMG4joiC6An40TEpRyDZnFxvdGac7QjthVGT4YnphUkNeL0aKZsQ378vRaJSmU30_tK/s320/20151025_211504.jpg" width="180" /></a></div>
<div style="text-align: center;">
Soldered some smaller pieces near the tip so it can be cut off without losing its strength. In hindsight we should have done this before the bottom was completed so it could sit flat on the table. Lots of goopy rosin flux.</div>
<div style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5KDxRyWYQpPxUq9OMbm3oxTD1ymbRDDwHbXGPxl21e1T8lTo_x_oazhc1_gDiDXWBRgjuJgJGyGeKyvC6395mpYTQIznO4E3CaxZwXCZaEKLMXFmBdfqFlTaait73P-E544Ll3tJEZt0L/s1600/20151025_185733.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5KDxRyWYQpPxUq9OMbm3oxTD1ymbRDDwHbXGPxl21e1T8lTo_x_oazhc1_gDiDXWBRgjuJgJGyGeKyvC6395mpYTQIznO4E3CaxZwXCZaEKLMXFmBdfqFlTaait73P-E544Ll3tJEZt0L/s320/20151025_185733.jpg" width="180" /></a></div>
<div style="text-align: center;">
Since we were making two, I learned from my mistake and soldered the bottom support pieces on the first half this time. This one was a bit uglier because the support pieces went around the outside versus in between the side pieces, but it actually ended up breaking fewer times, so I suppose it was stronger.</div>
<div style="text-align: left;">
<h2>
Fabric</h2>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfASjU99InPpTdfvkA8l0rAZBm65XQjERqQhziyW320shNyx6O_vdHWV0S5jwmv55QVIs4TSdR2p0m4f6WridU8pFzlktYFUO27HnuZ38QjhJmyG4eptlPUwp9U0KAPopJsMgiYb4FCxVf/s1600/20151029_223037.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfASjU99InPpTdfvkA8l0rAZBm65XQjERqQhziyW320shNyx6O_vdHWV0S5jwmv55QVIs4TSdR2p0m4f6WridU8pFzlktYFUO27HnuZ38QjhJmyG4eptlPUwp9U0KAPopJsMgiYb4FCxVf/s320/20151029_223037.jpg" width="180" /></a></div>
<div style="text-align: center;">
Time to cover it in fabric. The hot glue actually wouldn't stick very well to the smooth steel rods. We ended up creating small folds and hot gluing the fabric to itself with the rods in between for a strong connection.</div>
<div style="text-align: center;">
We decided to use white fabric because we wanted it to show equally well for green, yellow, and red like in the game.</div>
<div style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv_6FWEA-5En3sMgXzpT-7ou-1tOXi3prB6Bcq-SpynSCXgu0jKavWpurnTiQYgEMPUYdLQqnfrvbkrT6nb1L-SBHgOoq-o173p9i65jdez0dwVI5l4GcIhhCoQ0SPGOxEWUcYQOxkLQzT/s1600/20151029_223942.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhv_6FWEA-5En3sMgXzpT-7ou-1tOXi3prB6Bcq-SpynSCXgu0jKavWpurnTiQYgEMPUYdLQqnfrvbkrT6nb1L-SBHgOoq-o173p9i65jdez0dwVI5l4GcIhhCoQ0SPGOxEWUcYQOxkLQzT/s320/20151029_223942.jpg" width="320" /></a></div>
<div style="text-align: center;">
First piece glued down.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiL69-zdAJViwLNhzuywNtJNZWnOeBNe4ZbsbpdsdbrI8Y5UFKChqqOwz2aCymb2Xs2DSwkrzXJWEzI6gGpjLcBpC9aQnPl8g-PVSJsbWWBZmDI71EldiR3pllf9uQMxLq5vrfiYgJAe3DG/s1600/20151029_232151.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiL69-zdAJViwLNhzuywNtJNZWnOeBNe4ZbsbpdsdbrI8Y5UFKChqqOwz2aCymb2Xs2DSwkrzXJWEzI6gGpjLcBpC9aQnPl8g-PVSJsbWWBZmDI71EldiR3pllf9uQMxLq5vrfiYgJAe3DG/s320/20151029_232151.jpg" width="320" /></a></div>
<div style="text-align: center;">
Shorter side glued down.</div>
<div style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRnIRQbZbGnwS83Yib-OEApjfGv0qbKkmtGjRId3mixVISxNuYnqhEM_0DhqBfN4RHTdViIRiIsA4IK7Yn8Sx1JmqQuGuPjp9Pk-AeXGgjiCC6KuzHWvYaxYCPLsBnEvqrr7EVYYqDtH5w/s1600/20151029_235015.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRnIRQbZbGnwS83Yib-OEApjfGv0qbKkmtGjRId3mixVISxNuYnqhEM_0DhqBfN4RHTdViIRiIsA4IK7Yn8Sx1JmqQuGuPjp9Pk-AeXGgjiCC6KuzHWvYaxYCPLsBnEvqrr7EVYYqDtH5w/s320/20151029_235015.jpg" width="320" /></a></div>
<div style="text-align: center;">
Rotate and repeat for the top piece, ensuring that the fabric is pulled taught throughout the process, but not too taught that it breaks the joints. This was probably one of the most frustrating parts of the build.</div>
<div style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipzau4RdVRU7muixg7Laht4pifp-j8DQk1F9SoBJWxj-OL165lSYS4Z4S6GHM7V6zZdhwzWeN8QRxCxwnQEb72F6aRKuVG0vj0TbQL55uVV6doI2vPyG1rGHxg2rxlW1-jPSFaap0jlVqT/s1600/20151030_002507.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipzau4RdVRU7muixg7Laht4pifp-j8DQk1F9SoBJWxj-OL165lSYS4Z4S6GHM7V6zZdhwzWeN8QRxCxwnQEb72F6aRKuVG0vj0TbQL55uVV6doI2vPyG1rGHxg2rxlW1-jPSFaap0jlVqT/s320/20151030_002507.jpg" width="320" /></a></div>
<div style="text-align: center;">
Starting on the bottom half.</div>
<div style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBAf8kQ51BAjZAiIsatOydDnIo8PGYYjzHi6zExeDr80coRYSWp7sSC9oYFUiKg3hcOzXy-Us4kYaqHKd2n38jeJ6Kkx0-V-6arg9EJfjBsXIbEgzU68evK9gxpqWsxeaxKQhWAzQ1wSOX/s1600/20151030_011334.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBAf8kQ51BAjZAiIsatOydDnIo8PGYYjzHi6zExeDr80coRYSWp7sSC9oYFUiKg3hcOzXy-Us4kYaqHKd2n38jeJ6Kkx0-V-6arg9EJfjBsXIbEgzU68evK9gxpqWsxeaxKQhWAzQ1wSOX/s320/20151030_011334.jpg" width="320" /></a></div>
<div style="text-align: center;">
Magnets were helpful to hold the fabric in place while gluing. For the bottom half, the fabric is just glued flat onto the top half (doesn't wrap around the rods).</div>
<div style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5Ppu4Ve_MhpK4ZxYgOqx-W3VtqQKGvs9ldgHA3eYYgFwv3KQomd_sIXqakrbYCsR9ka4z_3jl_u8xP8Wj523XVEKh8Zk6LLi-PN5ZTM07lwbET2OD9uhZWosv8-9w-dFwD5PtdZdWjGWv/s1600/20151030_020042.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5Ppu4Ve_MhpK4ZxYgOqx-W3VtqQKGvs9ldgHA3eYYgFwv3KQomd_sIXqakrbYCsR9ka4z_3jl_u8xP8Wj523XVEKh8Zk6LLi-PN5ZTM07lwbET2OD9uhZWosv8-9w-dFwD5PtdZdWjGWv/s320/20151030_020042.jpg" width="180" /></a></div>
<div style="text-align: center;">
All covered up!</div>
<div style="text-align: left;">
<h2>
Electronics</h2>
</div>
The electronics were the easy part of this project (but I might be a little biased). The plan was to use the ws2812 "neopixel" LED strips that I already had on hand and a <a href="https://www.pjrc.com/teensy/teensyLC.html" target="_blank">Teensy-LC</a> as the controller, all powered from a 5V USB "mobile charger".<br />
<br />
The LED strips need a 5V power supply. I simply made connections to the Teensy Vin/VBUS/5V and GND pads. If you're using many more LEDs you won't want to share the same wires to power both the Teensy and the LEDs (in this case the USB cable), but for the 16 that I used I didn't have any issues.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdDOb5lBrS3RLHOjZpyfHOBwgYl759y5KmPyiPNzuGJpG_Y7NFkUk6pq7Vu5V_8iWQxBEmWRZ6u9AXCGsFzlJLubgOppfekmUd_knog2Vr59P5N2wgeiAgXquGYDIuuDHN3PiZrmtiTAU_/s1600/20151113_182207.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdDOb5lBrS3RLHOjZpyfHOBwgYl759y5KmPyiPNzuGJpG_Y7NFkUk6pq7Vu5V_8iWQxBEmWRZ6u9AXCGsFzlJLubgOppfekmUd_knog2Vr59P5N2wgeiAgXquGYDIuuDHN3PiZrmtiTAU_/s320/20151113_182207.jpg" width="180" /></a></div>
<div style="text-align: center;">
Connections to the Teensy-LC</div>
<br />
There is only 1 signal that is needed to connect the Teensy to the LED strip, and that is Pin 17 on the Teensy-LC. This pin has a 3.3V to 5V level shifter which may be required for some LED strips to work properly, although mine works with 3.3V levels just fine.<br />
<br />
Take note that the LED strips are "directional" in that one set of pads is for an input, and the other for an output. These are indicated by arrows. The Teensy-LC should be connected to the input side, and if daisy-chaining strips together, the output of one strip should connect to the input of another.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXjjBMDbeayuDPjG1pOrHOkUnMB1faKn7xd44xZvCBRQ89NxiLqNr3QKcvNr9-8KXd9FbL1Y6lSPDtmDKYJOXDbGQRTjZiRkHebX9gqYzezWZgJhHqd9Y_UZ7GZsA799FVrVlCNwv8cJ_K/s1600/20151113_182332.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXjjBMDbeayuDPjG1pOrHOkUnMB1faKn7xd44xZvCBRQ89NxiLqNr3QKcvNr9-8KXd9FbL1Y6lSPDtmDKYJOXDbGQRTjZiRkHebX9gqYzezWZgJhHqd9Y_UZ7GZsA799FVrVlCNwv8cJ_K/s320/20151113_182332.jpg" width="180" /></a></div>
<div style="text-align: center;">
Connections to the LED strip. Note the direction of the arrow</div>
<br />
I was able to put two strips back-to-back and solder the pads directly to each other. My strips came with a "weatherproofing" jacket that I kept on to prevent the pads from shorting to each other on the back sides.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhB7GBK4myxpb2gE3KOZSATENODwsx3i4Qc8357_PPLuhFa3E5_1EwJw9yoBODwqUl16o6MbrDNZCx-y8rMc1au1LAjAX-SC6BI37pO0z07oC-0hFJVSoo2H8jqX6aGHWW1HrMPs6HQS7zC/s1600/20151113_182436.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhB7GBK4myxpb2gE3KOZSATENODwsx3i4Qc8357_PPLuhFa3E5_1EwJw9yoBODwqUl16o6MbrDNZCx-y8rMc1au1LAjAX-SC6BI37pO0z07oC-0hFJVSoo2H8jqX6aGHWW1HrMPs6HQS7zC/s320/20151113_182436.jpg" width="180" /></a></div>
<div style="text-align: center;">
Strips soldered back to back</div>
<div style="text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxqTQXyLPeycomdZf75z2cy-lGgoDsZeXYbNTroaC8AKBmmjpfKCWXlxxuoJ0toSPksFZT4qlgf5yhhwfqV2Y_tQ0IZfaf9Gj1eIy4TNoPn4xTIvatVY8w-f4pjvPXxDx2RJEbgqMm_tmy/s1600/20151113_182634.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxqTQXyLPeycomdZf75z2cy-lGgoDsZeXYbNTroaC8AKBmmjpfKCWXlxxuoJ0toSPksFZT4qlgf5yhhwfqV2Y_tQ0IZfaf9Gj1eIy4TNoPn4xTIvatVY8w-f4pjvPXxDx2RJEbgqMm_tmy/s320/20151113_182634.jpg" width="180" /></a></div>
<div style="text-align: center;">
The complete system. The Red block is the USB charger.</div>
<div style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjclpGNi5sJ16h7po6RqqB9qlooh2Sint5EFLiRw4JKf790qH1Ls-p_L1lbAX1DB74LfYR5-eMnnGm7X69A5wkvXe4abhw5do_5GgEh2ZP1x3RWXwKYaw-og8ZKWOAQRXaNngLay_f-pm17/s1600/20151113_182713.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjclpGNi5sJ16h7po6RqqB9qlooh2Sint5EFLiRw4JKf790qH1Ls-p_L1lbAX1DB74LfYR5-eMnnGm7X69A5wkvXe4abhw5do_5GgEh2ZP1x3RWXwKYaw-og8ZKWOAQRXaNngLay_f-pm17/s320/20151113_182713.jpg" width="180" /></a></div>
<div style="text-align: center;">
Some hot glue at the bottom for strain-relief</div>
<h2>
Code</h2>
<div>
You can find the code at <a href="https://bitbucket.org/snippets/htonoyan/kpRg4">https://bitbucket.org/snippets/htonoyan/kpRg4</a><br />
<br />
I used the "FastLED" library that came installed with Teensyduino. This made it pretty simple to set up the LEDs and make smooth gradients from Green to Red without doing all the interpolations myself.</div>
<div>
<br /></div>
<div>
The code I set up is a very simple state machine with 4 states:</div>
<div>
<ul>
<li>State 1 - Keep the plumbob green for 15 minutes.</li>
<li>State 2 - Transition from green to yellow to red. This takes 2.5 minutes.</li>
<li>State 3 - Keep the plumbob red for 2 minutes.</li>
<li>State 4 - Transition from red to yellow to green. This takes 2.5 minutes. Return to state 1</li>
</ul>
<div>
The FastLED library uses a number from 0-255 to control the Hue of the LEDs. Red is 0, and green is 68. If you know how long you want it to take to transition from green to red, you can easily figure out how long you need to pause before incrementing or decrementing the color. In my case, we wanted it to take 2.5 minutes, so each increment should take approximately 2.2 seconds.<br />
<br />
<h2>
Holding it up and finishing touches</h2>
We were thinking about creating some sort of harness to hold the whole thing up, but in the end, we just shoved the thing down our shirts. For the ladies, a bra helps. For the guys, I used some shoelaces tied around my body to support the thing. A <a href="http://www.animatedknots.com/midshipmans/" target="_blank">taut line aka midshipman's knot</a> worked much better than a typical square knot to keep the shoelaces tight in place.<br />
<br />
My girlfriend also made some cardboard props from the game to go along with it!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-9MCR9p3Ajkg/Vj5pAlgzXfI/AAAAAAAAPNk/0OtOdmFYIKI/s1600/image11.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://2.bp.blogspot.com/-9MCR9p3Ajkg/Vj5pAlgzXfI/AAAAAAAAPNk/0OtOdmFYIKI/s320/image11.JPG" width="320" /></a></div>
<br />
<h2>
End Result</h2>
It actually ended up looking pretty good! We won some prizes at a costume contest at a bar, but ended up losing 2nd place to Daft Punk.<br />
<br />
Some interesting observations from throughout the night:<br />
<ul>
<li>People either LOVE the costume, or have no idea what it is</li>
<li>Walking around with these definitely draws a lot of attention</li>
<li>You'll be able to spot yourself in party photos no matter how many people are in the crowd</li>
<li>You'll never find yourself in the dark</li>
<li>After taking these off, your brain will start to see a weird green tinge to everything for a few hours</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY-4qKxQ4DQtYxzeFRMlI4rnKdjxY_mE8YUq7tAlecf8l9bgF-PjB1BFocxT7L4v3ZxAViD1smvj3bjKDuABYWc3evtA3ZhmAZJoJ9JXwnNjlnyqhyVlS1dGn09G4VK_wGM9Hpnq8g5odh/s1600/12194808_424450401093652_1546786089443367946_o.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY-4qKxQ4DQtYxzeFRMlI4rnKdjxY_mE8YUq7tAlecf8l9bgF-PjB1BFocxT7L4v3ZxAViD1smvj3bjKDuABYWc3evtA3ZhmAZJoJ9JXwnNjlnyqhyVlS1dGn09G4VK_wGM9Hpnq8g5odh/s320/12194808_424450401093652_1546786089443367946_o.jpg" width="213" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSxRQClJgkI3KXpzS5W9LPF50MzWxJRB7P8IQkaI0vYTz7IJl3RxCQ2ezlEGzx5vs6ogH8X7x_e_WhxQw3Ody0pSDDK9ZO4M0u5qsDK5z6471KyNeIm-5GGmIjGnuhxGMSjNfv-Xx5Bz9A/s1600/12186654_424444881094204_1671120787839182087_o.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSxRQClJgkI3KXpzS5W9LPF50MzWxJRB7P8IQkaI0vYTz7IJl3RxCQ2ezlEGzx5vs6ogH8X7x_e_WhxQw3Ody0pSDDK9ZO4M0u5qsDK5z6471KyNeIm-5GGmIjGnuhxGMSjNfv-Xx5Bz9A/s320/12186654_424444881094204_1671120787839182087_o.jpg" width="212" /></a></div>
</div>
<div>
<br /></div>
</div>
Henry Thttp://www.blogger.com/profile/10834719808707381737noreply@blogger.com0tag:blogger.com,1999:blog-4512645249499864983.post-21146172510167984182015-07-01T21:25:00.002-07:002015-07-01T21:25:41.650-07:00Hardware Files Now on GitHubI finally started using Git for my hardware files as well as the software files. You can now find all the schematics and PCB project files for my <a href="http://htonoyan.blogspot.com/search/label/LED%20Heart" target="_blank">LED Heart</a> and <a href="http://htonoyan.blogspot.com/search/label/Digital%20Clock" target="_blank">Digital Clock</a> on my <a href="https://github.com/htonoyan" target="_blank">Github page</a>. The files are in Altium Designer format, but I have also included a PDF output and Gerber outputs for the PCB.Henry Thttp://www.blogger.com/profile/10834719808707381737noreply@blogger.com0tag:blogger.com,1999:blog-4512645249499864983.post-6960343073532849562015-05-16T18:06:00.001-07:002020-04-17T13:07:01.629-07:00Using a PS3 eye toy with OpenCVI was looking for a USB webcam that I could use for doing some openCV/digital control systems projects. The PS3 Eye seems like a great product for this!<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgb7M0zyApcoZSGp4EDw6UHbzVOfkzxp_66lCaVB7y3VECDCQHLWEugsnW9Rh4Ho2Wzf6pQ5mbLpBvxrMvgIfQmu-YIxAGqBUDP57fpLYR05JyMPoqh6wtSxz0GUPrkiNruXSBhujlh4aBz/s1600/41WwP4QjHNL.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="416" data-original-width="500" height="266" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgb7M0zyApcoZSGp4EDw6UHbzVOfkzxp_66lCaVB7y3VECDCQHLWEugsnW9Rh4Ho2Wzf6pQ5mbLpBvxrMvgIfQmu-YIxAGqBUDP57fpLYR05JyMPoqh6wtSxz0GUPrkiNruXSBhujlh4aBz/s320/41WwP4QjHNL.jpg" width="320" /></a></div>
<ul>
<li>$7 on Amazon!!</li>
<li>Standard USB interface</li>
<li>640 x 480 resolution. Not great but...</li>
<li>60 fps framerate, up to 120 fps with lower resolution (320x240)</li>
<li>Did I mention...$7?!</li>
</ul>
<h2>
</h2>
So I tried this out with a simple program I wrote in OpenCV, and after actually writing a frame-rate counter I realized that I actually wasn't running it at 60fps! Hmmm. Turns out you need to do a little bit of work to get the settings just right.<br />
<a name='more'></a><br />
<h2>
Video for Linux (libv4l2)</h2>
You can get access to the more advanced features of camera by using a library called video for linux. On ubuntu, I installed an application called qv4l2 and all the necessary dependencies. It looks like this(when I first start it up, it shows my video0 device, which is my laptop's webcam)<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyx_cNfzaYIl3Dz5_7JcYThTk1JJpWUhFiomGcBZQp4pRmHE7XopK3PoDlZkRnAuJLCaqnsJyYoGfgOVDzRUOSrt5BbFqX04vQbS6455MKkwqVxb1gTXRwXQyhtOrC6hqs3ee_-xH3W-gr/s1600/Screenshot+from+2015-05-16+16:51:28.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="163" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyx_cNfzaYIl3Dz5_7JcYThTk1JJpWUhFiomGcBZQp4pRmHE7XopK3PoDlZkRnAuJLCaqnsJyYoGfgOVDzRUOSrt5BbFqX04vQbS6455MKkwqVxb1gTXRwXQyhtOrC6hqs3ee_-xH3W-gr/s320/Screenshot+from+2015-05-16+16:51:28.png" width="320" /></a></div>
Now, you need to open up the PS3 Eye. Usually this is under the device /dev/video1:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijPTEm-UK3NaDnMp-Ly96VL3czkGRhRiVdBJ6oTgUFeGUT_QuKWFWvZz5CptLiQBELqMPpzwSiDICh86lWnFk7RG2E6nUJbvkm2nPyFGlx12u2N_TloH5Wz4yl6IcYZaJsDZLGWk8bawNi/s1600/Screenshot+from+2015-05-16+16:52:46.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="224" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijPTEm-UK3NaDnMp-Ly96VL3czkGRhRiVdBJ6oTgUFeGUT_QuKWFWvZz5CptLiQBELqMPpzwSiDICh86lWnFk7RG2E6nUJbvkm2nPyFGlx12u2N_TloH5Wz4yl6IcYZaJsDZLGWk8bawNi/s320/Screenshot+from+2015-05-16+16:52:46.png" width="320" /></a></div>
The "open file" dialog is a little strange because it doesn't show the device until you acutally type in the full name.<br />
<br />
Once the PS3 Eye is open, you have access to all the settings that can be changed through the USB protocol! In addition to the screen above, there are more parameters that can be changed:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgapMz0mo95GIoIKE4vDbZRUx94_FGjb0q62zqt3RgIp1esHtYKfnFqTHFyKqKi1jXxjwaz5HmSJnEbq1R-OlzreFRoLJN7Jcgzgf28KOw_f-eKTpv_9GzYUEDqDEzryK98szGKA4fkJb3Y/s1600/Screenshot+from+2015-05-16+17:51:41.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="163" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgapMz0mo95GIoIKE4vDbZRUx94_FGjb0q62zqt3RgIp1esHtYKfnFqTHFyKqKi1jXxjwaz5HmSJnEbq1R-OlzreFRoLJN7Jcgzgf28KOw_f-eKTpv_9GzYUEDqDEzryK98szGKA4fkJb3Y/s320/Screenshot+from+2015-05-16+17:51:41.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEio0rqIegGCnSAlgoxt78Xln3KmZC-4vAf3uEfGcSxvdjA4jnPuAZSN4tumvH9Yqgw2mPkJwpJqEZkYHBFvxR1QwcKkh_9wzO73jsZwuDcWr89u-hDK00oQIbT5utLiimEtlUYmWNWpptDg/s1600/Screenshot+from+2015-05-16+17:51:50.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="163" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEio0rqIegGCnSAlgoxt78Xln3KmZC-4vAf3uEfGcSxvdjA4jnPuAZSN4tumvH9Yqgw2mPkJwpJqEZkYHBFvxR1QwcKkh_9wzO73jsZwuDcWr89u-hDK00oQIbT5utLiimEtlUYmWNWpptDg/s320/Screenshot+from+2015-05-16+17:51:50.png" width="320" /></a></div>
Manual exposure and gain are especially handy if you're trying to track some objects and you don't want the camera to be adjusting the brightness/contrast if bright objects are entering the scene. Also, a darker exposure will have less motion blur, and a lower gain will have less grain/noise, at the cost of brightness.<br />
<br />
Here are some examples below from my tests waving a laser around:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCg4b2Cr1LRXbIhzvs7qwyJaXJ8sINm4vYcl22mWhUyGLBlee5CxGbpEDwhUHkPrg1iWtSww-RYw9k6y0XX3Rfc3UrBaVucwyhr5sq-fglZgAUey29HVAJ0NID8O-g9Wc0UKoOasGIDpai/s1600/eyetoy_30fps_auto_expose.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="261" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCg4b2Cr1LRXbIhzvs7qwyJaXJ8sINm4vYcl22mWhUyGLBlee5CxGbpEDwhUHkPrg1iWtSww-RYw9k6y0XX3Rfc3UrBaVucwyhr5sq-fglZgAUey29HVAJ0NID8O-g9Wc0UKoOasGIDpai/s320/eyetoy_30fps_auto_expose.png" width="320" /></a></div>
<div style="text-align: center;">
Auto exposure, 30fps</div>
<div style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgr70qS6G1pXod6gJKiCHO8O886mG89ThFsHGonQuGJ8e0EJx9EMdGr_NZChD4AyTxgWeyJJFHGSipLuswisGFvVEpKlJWu6MIDkOg7T04XfGl-4aAiC10WuOwr0TfOlsOQomYQ2ib_VHWo/s1600/eyetoy_60fps_25_exposure.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="261" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgr70qS6G1pXod6gJKiCHO8O886mG89ThFsHGonQuGJ8e0EJx9EMdGr_NZChD4AyTxgWeyJJFHGSipLuswisGFvVEpKlJWu6MIDkOg7T04XfGl-4aAiC10WuOwr0TfOlsOQomYQ2ib_VHWo/s320/eyetoy_60fps_25_exposure.png" width="320" /></a></div>
<div style="text-align: center;">
60fps, manual exposure</div>
<div style="text-align: center;">
<br /></div>
<h2 style="text-align: left;">
Using the Eye with OpenCV</h2>
<div style="text-align: left;">
On my system using Ubuntu, I didn't need to do anything special to get the Eye to work with OpenCV. I just needed to pass the video device ID (in my case 1) to the VideoCapture.open() command.<br />
<br />
The exposure settings and the framerate can be changed from qv4l2 while your openCV app is running. However, you can also have your openCV app change the settings directly. Additionally, some settings, like the capture frame size cannot be set in qv4l2 while openCV is running.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
The VideoCapture object in OpenCV has the method <a href="http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#videocapture-set" target="_blank">set(propID, value)</a> which lets you change any of the settings above. However, I've had trouble actually getting it to work. I have read something about needing to compile openCV with v4l2 support, so I am going to give that a shot.</div>
Henry Thttp://www.blogger.com/profile/10834719808707381737noreply@blogger.com6tag:blogger.com,1999:blog-4512645249499864983.post-31496680530673128232015-04-26T21:19:00.003-07:002015-04-26T21:19:43.623-07:00Waterfall audio visualization<div class="separator" style="clear: both; text-align: left;">
So it's been a while since I've posted. I didn't realize I had not posted my favorite LED visualization so far, a "waterfall" display.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Currently I am still using an ATmega48 to control the LED strip, and a basic FTDI cable to talk to the ATmega. In the future I would like to use a teensy and the ws2812 library in order to control more LEDs.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
More to come...</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/qW0AdCIGXU0/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/qW0AdCIGXU0?feature=player_embedded" width="320"></iframe></div>
<br />Henry Thttp://www.blogger.com/profile/10834719808707381737noreply@blogger.com0tag:blogger.com,1999:blog-4512645249499864983.post-48473983970294302022014-10-06T22:27:00.002-07:002014-10-06T22:28:38.440-07:00Code for Audio VisualizationsI finally got around to cleaning up the code to my <a href="http://htonoyan.blogspot.com/search/label/Audio%20Visualizations" target="_blank">audio visualizations</a> a bit and publishing it on BitBucket.<br />
<br />
If you're interested, you can find it here:<br />
<a href="https://bitbucket.org/htonoyan/audio-visualizer">https://bitbucket.org/htonoyan/audio-visualizer</a>Henry Thttp://www.blogger.com/profile/10834719808707381737noreply@blogger.com0tag:blogger.com,1999:blog-4512645249499864983.post-68473084185213118822014-08-23T02:14:00.000-07:002020-04-17T13:07:27.130-07:00Wine Bottle Digital ClockCircuit board done in Altium Designer. Took me a year to finally decide how to house the giant displays.<br />
<div>
<br /></div>
<div>
Will upload schematics/gerbers/code eventually.</div>
<div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtJbp5k-Qlcfv9ufBxEj18hrVPNEYPc6riCQlMGO_eZl_iBvbM8P_BrQvwMhF2-rZ07C4J2pdOoUKbJJbFczcar7RSMfF6UB3DM9pCSq1ULcCkAvyMSxQn-mHd0N7wQrVe80hynRNI60kC/s1600/20140810_183900.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtJbp5k-Qlcfv9ufBxEj18hrVPNEYPc6riCQlMGO_eZl_iBvbM8P_BrQvwMhF2-rZ07C4J2pdOoUKbJJbFczcar7RSMfF6UB3DM9pCSq1ULcCkAvyMSxQn-mHd0N7wQrVe80hynRNI60kC/s1600/20140810_183900.jpg" width="320" /></a></div>
<a name='more'></a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZfe58MDUAhJRVhbDjdLwu7Ri1LfYSmgvvszoG7M-zDPIyqEcmebzycIh0wuWfnUNaR0z-7DTjg6PjfkA4xMX906ApOtVWdN5ukmjRuALDfyr5g9mAy-e6QtC40ZBUz6e9MjS3r12evehs/s1600/20140810_183954.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZfe58MDUAhJRVhbDjdLwu7Ri1LfYSmgvvszoG7M-zDPIyqEcmebzycIh0wuWfnUNaR0z-7DTjg6PjfkA4xMX906ApOtVWdN5ukmjRuALDfyr5g9mAy-e6QtC40ZBUz6e9MjS3r12evehs/s1600/20140810_183954.jpg" width="180" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXfJsDlpnfG29KXDm2-hUZ9Ia1OtfNGGvMoZowjQXgAog02e5pq2nbDZcilJ2cHiX8hP0RMwt6gMOzbZGwntPCy8RVQIZWMlSNvSo6f7n-SgImY4f6sE6DWyl4Y2EwR9kei_OPZqyFaiiy/s1600/20140810_184651.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXfJsDlpnfG29KXDm2-hUZ9Ia1OtfNGGvMoZowjQXgAog02e5pq2nbDZcilJ2cHiX8hP0RMwt6gMOzbZGwntPCy8RVQIZWMlSNvSo6f7n-SgImY4f6sE6DWyl4Y2EwR9kei_OPZqyFaiiy/s1600/20140810_184651.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJfPzAj6x-9yCRXhUbScj_UNjFEb2hC_Rvfu3THzsRG5OEZNAsZJ1EVkmEPqEWbHEejUpozUN_uKci1fSP0PEcZ_7thyiXUSa4n9w9_oKmUnNxB_iMcNOraD3sVgpXaLogxdOm5LFer26D/s1600/20140810_184708.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJfPzAj6x-9yCRXhUbScj_UNjFEb2hC_Rvfu3THzsRG5OEZNAsZJ1EVkmEPqEWbHEejUpozUN_uKci1fSP0PEcZ_7thyiXUSa4n9w9_oKmUnNxB_iMcNOraD3sVgpXaLogxdOm5LFer26D/s1600/20140810_184708.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBOwOL1rlCqBT-7kYar7fFcU4WDqADD5qNKkV-PUQYLrHnnJdnHnP2wp2sasYp7Jz0ue82K0A7lmX2hne0fqmlyQeCkjCSn9OhuZ1xcYvtLCyzUsQPTlu7PspUK-lqkDqHTwGNS_rCWuj-/s1600/20140810_193600.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBOwOL1rlCqBT-7kYar7fFcU4WDqADD5qNKkV-PUQYLrHnnJdnHnP2wp2sasYp7Jz0ue82K0A7lmX2hne0fqmlyQeCkjCSn9OhuZ1xcYvtLCyzUsQPTlu7PspUK-lqkDqHTwGNS_rCWuj-/s1600/20140810_193600.jpg" width="180" /></a></div>
</div>
Henry Thttp://www.blogger.com/profile/10834719808707381737noreply@blogger.com0tag:blogger.com,1999:blog-4512645249499864983.post-43353708205028242132014-04-19T19:26:00.000-07:002014-04-19T19:26:00.996-07:00Light Show Now On UbuntuSo my previous set up was pretty janky. If you've read my previous post, I had a win32 program using some APIs to get an audio stream, process the data and write "peak" values to stdio. This was then piped into a Python script which calculated the LED string colors and wrote them out serially using PySerial.<br />
<br />
I re-wrote the audio capture code in Python using PyAudio. This is much cleaner now as the whole thing can be done in Python, and it works on Ubuntu!<br />
<br />
I also had some graphics plotted really badly using win32 APIs. I rewrote that section of code using matplotlib so it looks much nicer now and is more responsive.<br />
<div style="text-align: center;">
<br /><iframe allowfullscreen="" frameborder="0" height="315" src="//www.youtube.com/embed/gLBEMceqf2M" width="420"></iframe></div>
Henry Thttp://www.blogger.com/profile/10834719808707381737noreply@blogger.com4tag:blogger.com,1999:blog-4512645249499864983.post-43940504266755520242014-03-03T17:22:00.003-08:002020-04-17T13:09:42.185-07:00Heart is complete!<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/9jf7k3OPVIw/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/9jf7k3OPVIw?feature=player_embedded" width="320"></iframe></div>
<a name='more'></a><br />
<div>
<br /></div>
So I added a couple more visualizations to the LED heart from my last post, and also got a frame for it! A little bit of hacking away at the back to make a hole for the DC power jack and it was good to go! I used a 1/16" white acrylic sheet instead of the glass on the frame.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_luza3r2Y46ksCTOXOHXhJkqUdfMjGaslNAO3MtcZ7GRhYIhMIvIhxLom8SSrKZJJL38vADSfEntK5-r4ejjXMjanIe0vUEl7SfsANWzvo5QhTX9BGg0WQIh-_zLwyNTuyuvFUBPLV3gX/s1600/IMG_20140302_211934.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_luza3r2Y46ksCTOXOHXhJkqUdfMjGaslNAO3MtcZ7GRhYIhMIvIhxLom8SSrKZJJL38vADSfEntK5-r4ejjXMjanIe0vUEl7SfsANWzvo5QhTX9BGg0WQIh-_zLwyNTuyuvFUBPLV3gX/s1600/IMG_20140302_211934.jpg" width="240" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgumqFzQjp6V4sVuP2sTfNPT4htR_0h8jLLmw7TrlMFCOUx4dUjrEGuZYlxYBuKDrz-UYJPwfpT5lQCXQif9jKVcrr9of0jva0rUwbz8M0W6UaMhu6CnTkd5V6v7cu_HWHzHlS_FZPerCGZ/s1600/IMG_20140302_211918.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgumqFzQjp6V4sVuP2sTfNPT4htR_0h8jLLmw7TrlMFCOUx4dUjrEGuZYlxYBuKDrz-UYJPwfpT5lQCXQif9jKVcrr9of0jva0rUwbz8M0W6UaMhu6CnTkd5V6v7cu_HWHzHlS_FZPerCGZ/s1600/IMG_20140302_211918.jpg" width="240" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhysRV2jTamsxuipC80TdgWkDXnfiCneNZ9cGny5yEol6BnKye3xl5dtoqKaMqa7MlsbpM8xsRSGDhAUhzNaTo63vRLDke2-W5uKCPpkoTPG02UzpiMBjW9-mBjs9SKHWioxK2UeG1clXrU/s1600/IMG_20140302_200310.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhysRV2jTamsxuipC80TdgWkDXnfiCneNZ9cGny5yEol6BnKye3xl5dtoqKaMqa7MlsbpM8xsRSGDhAUhzNaTo63vRLDke2-W5uKCPpkoTPG02UzpiMBjW9-mBjs9SKHWioxK2UeG1clXrU/s1600/IMG_20140302_200310.jpg" width="240" /></a></div>
<br />Henry Thttp://www.blogger.com/profile/10834719808707381737noreply@blogger.com0tag:blogger.com,1999:blog-4512645249499864983.post-66167306332064350392014-02-15T18:32:00.002-08:002020-04-17T13:10:09.327-07:00A Valentine's Day Surprise<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;">Update: Source code and hardware files can be found on <a href="https://github.com/htonoyan/LED-Heart" target="_blank">this github page</a>.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/RpaVPTPtsj0/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/RpaVPTPtsj0?feature=player_embedded" width="320"></iframe><br />
<br />
Last week I had the idea to create a last-minute valentine's day gift for my girlfriend. I had a bunch of WS2812 LEDs from my previous endeavors and decided to make a big LED heart. These are a great choice because of the very minimal amount of components necessary: no I/O expanders, driving transistors or ICs necessary. Plus you just need one I/O line from your microcontroller to drive them.<br />
<br />
<a name='more'></a><br /><br />
Since they run off 5V, I planned to create a board that is powered from a wall-wart power supply. That way the board doesn't even need a voltage regulator on it. I chose to use an ATMega48 because I have several from previous projects.<br />
<br />
First was deciding on the placement of the LEDs. Being a bit OCD I wanted them spaced out in some organized fashion. Wolfram Math World has <a href="http://mathworld.wolfram.com/HeartCurve.html" target="_blank">a post</a> with some parametric and polar equations that plot out different heart shapes. I plotted three concentric hearts in excel and played around with some scaling factors and how I wanted them spaced out.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgt0unnx5LyCSYPlI8VV_HfR6mxRKWX95no62GKJOLxt6jjJPqMHia7DWfXeOv1vCa026Ar5Xv-NVvzWjHL3S8YBi23-7N8pvgK6HA7S3cXzmdsODujkKqmgayS_1-c9TeKoSG5mROuIZzp/s1600/heart_shape.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="286" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgt0unnx5LyCSYPlI8VV_HfR6mxRKWX95no62GKJOLxt6jjJPqMHia7DWfXeOv1vCa026Ar5Xv-NVvzWjHL3S8YBi23-7N8pvgK6HA7S3cXzmdsODujkKqmgayS_1-c9TeKoSG5mROuIZzp/s1600/heart_shape.png" width="320" /></a></div>
<br />
Now I had the coordinates for each LED so it was easy enough to load these into Altium Designer.<br />
<br />
After a night of PCB layout I had a decent enough layout:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinne5Q76UyY-GpgaTQl7KTAunU-9e5DO1jz9fPR3eGKs_9aaAGGTxNXlG6yiMMWtFgDV6glotvgSUvVubZlI2iReFEzQAKxjTq7zbX7-foRAlsXGPu2HO45AdzeWaIpCtcUK2jYKsEr-SI/s1600/heart_top.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinne5Q76UyY-GpgaTQl7KTAunU-9e5DO1jz9fPR3eGKs_9aaAGGTxNXlG6yiMMWtFgDV6glotvgSUvVubZlI2iReFEzQAKxjTq7zbX7-foRAlsXGPu2HO45AdzeWaIpCtcUK2jYKsEr-SI/s1600/heart_top.png" width="265" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPto3huPwtE7_NvrHfsxWUswoT3wPl6tOFahqGWXBkzPpBNQdIVFVy_xWl5GB6vtnZnVjX45Mx6qexY5ZwTPoCk7JHj_PTik9cB8uqiXTAo87uuSXZlBLQ6cDYUvNTQ3K1xz01xRRcI9sT/s1600/heart_top_3d.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPto3huPwtE7_NvrHfsxWUswoT3wPl6tOFahqGWXBkzPpBNQdIVFVy_xWl5GB6vtnZnVjX45Mx6qexY5ZwTPoCk7JHj_PTik9cB8uqiXTAo87uuSXZlBLQ6cDYUvNTQ3K1xz01xRRcI9sT/s1600/heart_top_3d.png" width="268" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I used a big copper pour on the top layer for 5V, and a ground place on the bottom. In hindsight I really should have increased the spacing between the 5V pour and the other traces (that was a pain in the butt to clean up!)</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
But I wasn't finished! There's so much empty board space on the back! Surely it would be cool to have a cool design etched into the bottom copper layer.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Now, I'm no artist, but after messing around with <a href="http://verysimpledesigns.com/vectors/inkscape-tutorial-spiro-swirls.html" target="_blank">a few</a> inkscape <a href="http://verysimpledesigns.com/vectors/inkscape-tutorial-urban-design.html" target="_blank">tutorials</a> I was able to whip up a pretty cool looking design with her name that I think looks nice.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAmPUdS11NVWmVHgWOEm-GLsEGRnWte5smizup7eK85ZPr_zcgfETF0jajbmbhyoheA035X6aBRXjoHV9yK0w0E45FiZJUTm_W-_69QfuKynDCtDz82pz654BVb2aYdKZzjPdojgyEaAJz/s1600/drawing.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="167" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAmPUdS11NVWmVHgWOEm-GLsEGRnWte5smizup7eK85ZPr_zcgfETF0jajbmbhyoheA035X6aBRXjoHV9yK0w0E45FiZJUTm_W-_69QfuKynDCtDz82pz654BVb2aYdKZzjPdojgyEaAJz/s1600/drawing.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Getting this into Altium Designer was a bit of a pain, but eventually I succeeded! I wish I could have made the design a bit bigger, but that would cut the ground connection to some of the LEDs.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicr9JGlEZ-43oegnBzynsYHh3L7pG0h1v2shjW1q1CLN1CfjkiKKX5LLMSG22V45YrG_GOBX8PsHlDbc0XnB-u-sVT95mVpkeVXZ-DmsbRUUm9r8kp212LSgWTQdLHAczw9EagRocnb3nQ/s1600/heart_bottom_3d.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicr9JGlEZ-43oegnBzynsYHh3L7pG0h1v2shjW1q1CLN1CfjkiKKX5LLMSG22V45YrG_GOBX8PsHlDbc0XnB-u-sVT95mVpkeVXZ-DmsbRUUm9r8kp212LSgWTQdLHAczw9EagRocnb3nQ/s1600/heart_bottom_3d.png" width="269" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Backside</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I sent out the order to Advanced Circuit's bare bones service (no silk-screen nor soldermask, 1-day turn) on Sunday evening. It shipped on Tuesday and by Thursday it was in my hands! Pretty sweet!</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
After a few hours of soldering all the components were on the board. Then after a significantly longer time, plenty of cursing, and slightly burnt fingers later, all the short-circuits were cleared up and the board was ready to go. Note to self - don't wait until you're done soldering to start checking your connections. Boy was it fun to try to figure out what could be shorting on a board with dozens of components on a copper plane...</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
After the whole rush for trying to make it for Valentine's day, my girlfriend didn't even have time to see this weekend because she's traveling for vacation. Oh well, I will have more time to polish it up with more animations and a frame of some sort.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: large;"><a href="https://github.com/htonoyan/LED-Heart" target="_blank">Download Source Code and PCB Files</a></span></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
More to come!</div>
Henry Thttp://www.blogger.com/profile/10834719808707381737noreply@blogger.com6tag:blogger.com,1999:blog-4512645249499864983.post-48089930023218995352013-12-28T15:20:00.000-08:002015-04-26T21:23:09.120-07:00Better oscilloscope visualization<div class="separator" style="clear: both; text-align: center;">
<br /><iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/oF0cF4QFBZ8/0.jpg" src="https://www.youtube.com/embed/oF0cF4QFBZ8?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<br />
Working on better oscilloscope triggering to get a less jittery display. Not sure how this would look on an LED display with limited resolution, but it would look pretty sweet with a laser projector (a project for the future, maybe?).<br />
<br />
Next up is an audio spectrum analyzer!Henry Thttp://www.blogger.com/profile/10834719808707381737noreply@blogger.com0tag:blogger.com,1999:blog-4512645249499864983.post-63726798113043537752013-12-26T18:35:00.000-08:002015-04-26T21:24:03.822-07:00Oscilloscope Visualization Using C++I got audio capturing to work using the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd370800(v=vs.85).aspx" target="_blank">example code from MSDN</a>. By setting my default input device to the "stereo mix" I'm able to get my program to grab all the audio data being sent to my sound card! Using this will enable me to create visualizations like an oscilloscope, spectrum analyzer, and a beat detector.<br />
<br />
Here's a quick program I wrote up in C++ drawing directly to the command prompt for a simple oscope visualization. It does really basic triggering on a rising edge so the scope doesn't "dance" around.<br />
<div class="separator" style="clear: both; text-align: center;">
<br /><iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/7Zw8gYHsUhE/0.jpg" src="https://www.youtube.com/embed/7Zw8gYHsUhE?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<br />Henry Thttp://www.blogger.com/profile/10834719808707381737noreply@blogger.com0tag:blogger.com,1999:blog-4512645249499864983.post-33273340784297091472013-12-23T23:08:00.000-08:002015-04-26T21:24:31.956-07:00LED Strip Peakmeter using WS2812 aka Adafruit "NeoPixel" LEDs<div class="separator" style="clear: both; text-align: center;">
<br /><iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/6MEjZoMOOsE/0.jpg" src="https://www.youtube.com/embed/6MEjZoMOOsE?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<div class="separator" style="clear: both; text-align: center;">
(Unfortunately, the video doesn't do it much justice and it looks MUCH better in person)</div>
<br />
This is a basic peakmeter I made using the <a href="http://www.adafruit.com/products/1376" target="_blank">Neopixel LED strips</a> obtained by the adafruit store. If you haven't seen these before, they're pretty sweet because the driver circuitry for each LED is built into the LED itself and is controlled through a 1-wire serial protocol which can be daisy-chained through the whole strip. This means you can control the color and brightness of each LED individually using a single wire and you don't need any high current FETs on your board to do all the color switching.<br />
<br />
The project currently consists of 3 parts and is a rather dirty way of doing it.<br />
<br />
A C++ program gets peak meter data and prints it to stdout. This is piped into a python script which figures out the colors for the strip. This is then sent through serial to an AVR which then finally sends it through to the LED strip using the WS2812 serial protocol.<br />
<br />
More details:<br />
<br />
<ul>
<li>The C++ program running on windows uses the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd316561(v=vs.85).aspx" target="_blank">Peak Meter</a> API included in Windows Vista and newer to get the system peak meter value and print it to stdout as an integer between 0 and 255.</li>
<li>The python script reads this number through command line redirection (a simple pipe) and figures out the color and brightness of each LED. It puts all these together in a very basic frame structure and uses <a href="http://pyserial.sourceforge.net/" target="_blank">pySerial</a> for serial communication to an <a href="http://www.adafruit.com/products/284" target="_blank">FTDI module</a> which then speaks UART to an ATMega48 I have on a very basic devboard I made for myself a long while ago.</li>
<li>The ATMega48 waits for frames to come in and then pushes out the corresponding string of color using code taken from the <a href="https://github.com/adafruit/Adafruit_NeoPixel" target="_blank">Arduino library written by Adafruit</a> to communicate with the WS2812 chips. Because of the strict timing requirements needed for the WS2812, it's rather tricky to get running on an 8MHz processor, and needs to be done in assembly. Luckily the good people at Adafruit had already provided this for free so I was able to use that without dealing with that mess myself. In the future I will probably just use a faster CPU as to not have to deal with that issue.</li>
</ul>
<div>
<br /></div>
<div>
My future plans for this are to use the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd316551(v=vs.85).aspx" target="_blank">Audio capture APIs</a> in windows to get the actual waveforms for audio being played on the system. Then I can do some fancier visualizations with several rows of the LED strips (spectrum analyzer, oscilloscope view, etc). Eventually it will be a continuous dance party in my apartment =p.</div>
Henry Thttp://www.blogger.com/profile/10834719808707381737noreply@blogger.com0