tag:blogger.com,1999:blog-79106111536123365672024-03-19T02:21:52.119-07:00IlektronxAttempts at DIY electronics projectsStephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.comBlogger57125tag:blogger.com,1999:blog-7910611153612336567.post-8990435709361462622015-11-21T12:41:00.000-08:002015-11-21T12:41:43.267-08:00'Code With Me' Video Series<p>Guess what? After a couple years of inactivity, I'm firing up Youtube channel and blog again! I've finally been able to settle down in a place with my own workshop and will be working towards creating more content, beginning with a regular 'Code With Me' series.</p>
<h2>Code With Me Video Series</h2>
<p>In the first video I take you through the <a href="https://www.codeeval.com/browse/83/">'Beautiful Strings' challenge from Code Eval</a>.</p>
<iframe width="560" height="315" src="https://www.youtube.com/embed/videoseries?list=PLWvRT7rmq0Iq-Z7HBdleSKE_jeZcOZJ5i" frameborder="0" allowfullscreen></iframe>
<p><!-- empty p --></p>
<h3>Why a coding video series?</h3>
<p>Many people develop software in c++ and many people want to learn how to write good c++ code. One of the best ways that I've found to learn how to write good software is to work with other experienced developers. Each person usually brings new insights and strategies. Hopefully, by giving you the opportunity to look over my shoulder and watch me solve problems, you will pick up some new knowledge and hopefully even comment if you have insight of your own to add. Feel free to engage and ask questions!</p>Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com3tag:blogger.com,1999:blog-7910611153612336567.post-82566153571512788262015-02-03T20:24:00.001-08:002015-02-03T20:24:18.850-08:00Practical Applications of C++11 and Why You Should Use It<div style="width: 100%; text-align: center;"><div style="display: inline-block"></div><div style="style="display: inline-block"">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP3JaH4DhV1fK9Md6Xhhqn2fjOJPu7OrXU785KQbH4lCp-MQwwp31wAAnF8PDSgaQSRFxDqhWiglGNXucYJ7AE5xNH5NIqdg-ceCaK5iivApTXbCceJuP3aoqnGPBXdMCZ2MwHTEpkjllC/s1600/Code+cropped+and+rotated.png" imageanchor="1"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP3JaH4DhV1fK9Md6Xhhqn2fjOJPu7OrXU785KQbH4lCp-MQwwp31wAAnF8PDSgaQSRFxDqhWiglGNXucYJ7AE5xNH5NIqdg-ceCaK5iivApTXbCceJuP3aoqnGPBXdMCZ2MwHTEpkjllC/s600/Code+cropped+and+rotated.png" /></a></div><div style="display: inline-block"></div></div>
<p>
A couple years ago I began looking at the experimental support of some of the newer C++11 features. At the time, compilers only offered subsets of the functionality. My first exposure was the 'auto' keyword. I didn't like. I want a strongly typed language when I use C++. `auto` seemed so lazy and sooo un-explicit. After listening to several cppcon talks on youtube, including one by Herb Sutter, I realized that auto can be a useful tool when used appropriately.</p><p>
My experience with `auto` illustrates one of the major barriers for established C++ developers using newer C++ features. I don't know if you know this, but C++ has been around for a long time. And by long time, I mean it is ancient as far as languages are concerned. Sure, it is newer than Fortran and COBOL, but at the rate at which programming languages have exploded, C++ is a grandparent with many grandchildren. Many senior developers have spent their entire careers developing in C++ with minimal change. Sure, they lived through the wild west of the STL. Sometimes they had to use assembly when C++ just wasn't giving them the performance they needed. C++ finally provided a language that was <em>good enough</em> to solve most programming problems. C++ accumulated significant technical debt when compared to other more modern languages. As such, when it came time, releasing a new standard took a long time and had snowballed into a huge feature set.</p><p>
Fast forward to today. Several compilers actually comply to the full standard today, and will comply to future standards within months of new standards being released. How amazing is that? That means that you can use these awesome features without worrying about library compatibility or linking in 3rd party libraries. Plus, the built in features mean more cross platform compatible primitives. That... is huge.</p>
<p>Ok, so a cross platform range based for loop isn't a big deal, how about cross platform threads? Some of the new planned features may include networking, 2d graphics. How about web services? I'm betting that some of these planned features will rely heavily on the C++11 features. If you want these new features, you'd better start learning the foundation. So, a promise of new features sometime down the line is not really a good reason to learn the new standards. Let me move to my main point</p>
<h4>
C++11 features will make your life easier by reducing complexity, eliminating boiler plate code, and creating easily maintained code</h4>
<p>Use these features. Please please use them</p><p>
In the following posts I will go through some of the new features and actually talk about real world situations where these features will improve your code.</p>
<h2>
C++11 Features that I will cover with practical applications</h2>
<ul>
<li><code>auto</code></li>
<li>Range based <code>for</code> loops</li>
<li>Lambda functions and <code>std::function</code></li>
<li>C++11 additions to <code>std::algorithm</code></li>
<li><code>std::thread</code> (and <code>this_thread</code>)</li>
<li><code>mutex</code>, <code>condition_variable</code>, and locks</li>
<li>Smart pointers</li>
<li>Variadic templates</li>
<li><code>std::chrono</code></li>
<li>And other miscellaneous goodies...</li>
</ul>Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com0tag:blogger.com,1999:blog-7910611153612336567.post-81981116965883891722013-01-21T23:27:00.000-08:002013-01-22T12:41:36.776-08:00Hacking a Cheap HobbyKing 6 Channel Receiver - Summed Signals<h1>RC Hobby Receivers</h1>
<p>Any standard modern hobby RC receiver works the same way. The position of joysticks is converted to a digital value, which is then encoded, modulated, and broadcast on some radio frequency. On the other end, a receiver demodulates and decodes the values, converts them to PWM (Pulse Width Modulation), and outputs each of the PWM signals on a separate output pin. Typically, you would plug in a servo or motor controller to each output.</p>
<p>The signal on each output looks like the following picture</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgssnEqITfzswIorVpheGTRn2XwXWnRBUdyKGaAsXvmf3oNvHKZAPHLAiiLeG6lKLLaTUSbCrNShodMlj0sSuPQXmkaODG2r44moU75hdQM934yIIzfPu8BZkQX0QkGD6OxWlc0bE3EwMVP/s1600/hobby_pwm_single_channel.BMP" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" width="600" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgssnEqITfzswIorVpheGTRn2XwXWnRBUdyKGaAsXvmf3oNvHKZAPHLAiiLeG6lKLLaTUSbCrNShodMlj0sSuPQXmkaODG2r44moU75hdQM934yIIzfPu8BZkQX0QkGD6OxWlc0bE3EwMVP/s600/hobby_pwm_single_channel.BMP" /></a></div>
<p>And now let us zoom in on one of those pulses</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg85b-BOIb56vZSxZrDpmcQgBURAQOxHXaCJJe3VGKHPPXvEOtbqxJTsfCbIckAv3sdMEn81X5dNeYf4Irl2J51yvOxl1GaKqU-7g-UNB1ZiMpMIFPL4A0_hhwwvH2yexlQkwVA3Q-ZF5QN/s1600/hobby_pwm_single_channel_zoomed.BMP" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" width="600" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg85b-BOIb56vZSxZrDpmcQgBURAQOxHXaCJJe3VGKHPPXvEOtbqxJTsfCbIckAv3sdMEn81X5dNeYf4Irl2J51yvOxl1GaKqU-7g-UNB1ZiMpMIFPL4A0_hhwwvH2yexlQkwVA3Q-ZF5QN/s600/hobby_pwm_single_channel_zoomed.BMP" /></a></div>
<p>The value of the PWM is the width of the pulse. Standard hobby electronics have a pulse width between 1000us and 2000us, or between 1ms and 2ms. A pulse of 1000us is equivalent to 0% and a pulse of 2000us equals 100%. In the picture above, you can see that the pulse is about 1.46ms wide, which translates to just under 50%, or the joystick is centered. There is no official standard for the time between pulses, but typically a pulse occurs around every 20ms for use with average analog servos.</p>
<h1>The Problem</h1>
<p>Often in robotics or, for example, fancy multirotor aircraft, there may be addition smarts on the vehicle that needs to do additional computation on the inputs. RC radio transmitters are great. They usually have 2 nice joysticks, a miriad of switches, excellent range, <a name='more'></a> and input trimming built right in. It would be expensive and time consuming to build a remote control for your vehicle that matches the capabilities (such as range and features) of a cheap hobby remote control.
</p><p>Unfortunately, to communicate the PWM signals from the receiver to the autopilot or cpu of your robot, 6 channels would require 6 inputs on your processor in addition to numerous wires from your receiver to controller. Conveniently, a number of receivers can be hacked to output a sum, or the combined PWM signal of all the channels on a single output. None are as cheap and as easy to hack as the <a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=12901&aff=304010">Hobby King 2.4Ghz Receiver 6Ch V2</a></p>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=12901&aff=304010" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="373" width="565" src="http://www.hobbyking.com/hobbyking/store/catalog/HK-T6A-V2.jpg" /></a></div>
<h1>6 Output Signals on a Single Output Pin</h1>
<p>Guess what? Whoever designed the HobbyKing 6 Channel Receiver did something very nice. The 7th output pin block (marked in the picture as 'BAT') is usually reserved for the battery connector or for the binding cord. On the HK 6 channel receiver, the 'BAT' signal actually outputs the combined signal of all the other 6th outputs. Just to verify, I hooked up the receiver to an o-scope and checked the signal. Below is a screen capture.</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdUeIUF8a5nFORBH-mdHvDppmXmYtd7mCuGuTXVmw14OduiLAXzJqJJKiEVtVDOOGWgCf94dbheveQOMzWfCoij0Pz3h8JyEHXpKpPJjMlg2Lc5RFM0zoozvQG3DSjgmj90kuvWdt05-f/s1600/ADS00003.BMP" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" width="600" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitdUeIUF8a5nFORBH-mdHvDppmXmYtd7mCuGuTXVmw14OduiLAXzJqJJKiEVtVDOOGWgCf94dbheveQOMzWfCoij0Pz3h8JyEHXpKpPJjMlg2Lc5RFM0zoozvQG3DSjgmj90kuvWdt05-f/s600/ADS00003.BMP" /></a></div>
<p>Here you can see that there are 6 distinct pulses from 3.3V to 0V, separated by 400us periods where the signal is low (0V). You can see in the screenshot that the 3rd channel or pulse, which on a typical airplane configuration is the throttle, is shorter than the others. Normally the throttle stays in the 'off' position or 0%, which is represented by a 1000us pulse, opposed to the other 5 signals that by default are at 50% or around a 1500us pulse. I can't wait to actually utilize this in my autopilot.</p>
<h2>Compatible Transmitters</h2>
<p>If you want a cheap control system for your robot/uav/fancy experimental aircraft, you can pick up one of these receivers and any of the following compatible transmitters from anywhere between $25-$60. Lowest cost for the features.</p>
<ul>
<li><a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=8992&aff=304010">Turnigy 9X 9Ch Transmitter w/ Module & 8ch Receiver (Mode 2) (v2 Firmware)</a></li>
<li><a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=8338&aff=304010">Hobby King 2.4Ghz 4Ch Tx & Rx V2 (Mode 2)</a></li>
<li><a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=9042&aff=304010">Hobby King 2.4Ghz 6Ch Tx & Rx V2 (Mode 2)</a></li></ul>
Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com36tag:blogger.com,1999:blog-7910611153612336567.post-91782183167512871842012-12-11T12:20:00.000-08:002013-01-22T08:48:57.372-08:00Using GStreamer to Stream All Audio Captured from Soundcard from One PC to Another<p><a href="#final_solution">Jump to the solution</a></p>
<h1>The Problem</h1>
<p>I often work on multiple computers at a time. Additionally, I use headphones the majority of the time. Sometimes I would like to be able to stream all the sound (including system notifications) from one computer to another, allowing me to hear the system notifications from both machines on my headphones. The old-school way to accomplish this means running an audio cable from the output of one PC to the line in on the other. Although this works, the line-in device is usually low quality and noisy. Plus, what if the computers are far away? How about sending the audio digitally over the network? No need for a cable, assuming the computers are already networked!</p>
<h1>The Solution - GStreamer</h1>
<p>GStreamer is actually an amazing framework that allows you to create all sorts of media pipelines. In my opinion, it is easier to use than ffmpeg once you become familiar with the concepts of how to use it.</p>
<h2>What is GStreamer and how does it work?</h2>
<p>GStreamer uses a simple concept. You create pipes. Pipes have a source and a sink. A source generates content, and a sink consumes it. You can do fun things with pipes. Imagine that you have a soda fountain that takes in soda water for one source, soda flavoring from another, and spits out into cup sized increments. This process is very similar to the process of taking a video source and an audio source, combining them into a media stream, and then breaking it up in to packets to send it out over the network. Keep the idea of a pipe, with sources and sinks that you can chain together, in mind.</p>
<p>The trickiest part of GStreamer is that each source and each sink has its own set of input types or output types that it can produce or consume. The trick is matching up sinks to sources. If an mp3 encoding element takes in raw audio and spits out an mp3, you must ensure that something that can source raw audio is plugged in one side and something that sinks mp3 audio is plugged in the other. Makes sense, right? It is a little trickier in practice, just because there are so many different formats media can take.</p>
<a name='more'></a>
<h2>The other piece of the puzzle - PulseAudio</h2>
<p>PulseAudio is a sound proxy for Linux and other POSIX operating systems. It forms the bridge between applications and your soundcard. We'll take advantage of the fact that all the sound on our system is going through PulseAudio. We'll pull out all the audio, compress it, and send it to another computer to decompress and play. </p>
<h2>Install pavucontrol and GStreamer</h2>
<p>We need to tell PulseAudio that we want the input for gstreamer to be the system audio. The easiest way to do this is with the pavucontrol program.</p>
<pre lang="bash">
$ sudo apt-get install pavucontrol gstreamer0.10-*
</pre>
<h2>Building the pipeline - Capturing all sound card audio and playing it back</h2>
<h3>Server Side</h3>
<p>Our initial source will be the pulsesrc element. We will be using GStreamer's test application for building streams, gst-launch-0.10. Add the <code>-v</code> option to get better debug information and see how GStreamer is trying to link your elements.</p>
<pre lang="bash">
$ gst-launch-0.10 -v pulsesrc
</pre>
<p>Easy enough. Now, we add the next element, which is the audioconvert element. This just converts from the raw format coming out of the pulsesrc into a raw format that our mp3 encoder can use. Consider audioconvert as something like a simple joiner pipe fitting.</p>
<pre lang="bash">
$ gst-launch-0.10 -v pulsesrc ! audioconvert
</pre>
<p>Next, we can convert the raw audio to mp3 to make conserve bandwidth. This is not necessary, if you are on, say, a gigabit network and don't care about piddly uncompressed audio. We will be using the lame encoder which is used EVERYWHERE! We will do something advanced and set the bitrate.</p>
<pre lang="bash">
$ gst-launch-0.10 -v pulsesrc ! audioconvert ! lame bitrate=192
</pre>
<p>Next, let's do something fun and pipe the audio out over UDP to some host. Note, GStreamer supports multicast addresses, so if you want to allow numerous hosts to join, you might want to look into that. Perhaps that is a topic for another day. Okay, now our pipe becomes</p>
<pre lang="bash">
$ gst-launch-0.10 -v pulsesrc ! audioconvert ! lame bitrate=192 ! udpsink port=3000 host=<some ip address>
</pre>
<p>There! Now you can run the command at this point. You should see a bunch of GStreamer information about it building the pipeline. Ensure that gst-launch is running and recording audio before moving to the next step.</p>
<h3><em>Set PulseAudio to record all system sounds</em></h3>
<p><strong>Do not skip this step!</strong> Now you have to tell PulseAudio where GStreamer's input should come from. If you want, you can modify some config file buried somewhere... or you can just use <code>pavucontrol</code>.</p>
<p>Run <code>pavucontrol</code></p>
<pre>$ pavucontrol</pre>
<p>Go to the 'Input Devices' tab and in the dropdown 'Show' select 'Monitors'</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrVKxFjvXzkN-Cze-CXROtDn3ZZcNigPsxZZ-eR7fyWrZRCfx49wzTtGrVXnp8g5aUIFh4BzWKkuaS8AjB-7eUunM-p2rLg5Mf0bhi3dyTQGgeinBQdTLZoP3bJYdUWapbGQXluZ1JBvdq/s1600/pavucontrol_input_devices.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" width="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrVKxFjvXzkN-Cze-CXROtDn3ZZcNigPsxZZ-eR7fyWrZRCfx49wzTtGrVXnp8g5aUIFh4BzWKkuaS8AjB-7eUunM-p2rLg5Mf0bhi3dyTQGgeinBQdTLZoP3bJYdUWapbGQXluZ1JBvdq/s640/pavucontrol_input_devices.png" /></a></div>
<p>Here, ensure that the input channel is not muted. The mute button is on the top right. Next, navigate to the 'Recording' tab.</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh8bgjYCQilQ78UgVihAzDndVTuuKPQNNcTiG86Z6JNcRQN1Cxmh-b2q_os-jZ9Vw4v1VLyuXEJWhv9n9iAPepoWdKjr1LFLwyj-JCkIQl2nmQAZj-XdH0juS5I1sm2n9-iGMfHcRQmINf/s1600/pavucontrol_recording.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" width="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh8bgjYCQilQ78UgVihAzDndVTuuKPQNNcTiG86Z6JNcRQN1Cxmh-b2q_os-jZ9Vw4v1VLyuXEJWhv9n9iAPepoWdKjr1LFLwyj-JCkIQl2nmQAZj-XdH0juS5I1sm2n9-iGMfHcRQmINf/s640/pavucontrol_recording.png" /></a></div>
<p>Here, you will want to select from the 'Record Stream <i>from</i>' dropdown, 'Monitor of Built-in Audio Analog Stereo'. Ensure that the channel is not muted. Once selected, you are all done setting up the server.</p>
<h3>Client Side</h3>
<p>At this point you should have the system audio encoded as an mp3 streaming over UDP on port 3000 to some host at <some ip address> or whatever address. On the client side, we must now take in that stream and spit it out the speakers. Sound hard? Not really. All you need is GStreamer on the client computer.</p>
<pre>$ gst-launch-0.10 -v</pre>
<p>First, because on the other computer we left off with a UDP sink, we now need to connect it to a UDP source on port 3000 on the other end</p>
<pre>$ gst-launch-0.10 -v udpsrc port=3000</pre>
<p>Now, instead of encoding raw audio into mp3, we need to decode the mp3 into raw audio. We can do this using the <code>mad</code> mp3 decoder</p>
<pre>$ gst-launch-0.10 -v udpsrc port=3000 ! mad</pre>
<p>Finally, pipe the raw audio out through PulseAudio</p>
<pre>$ gst-launch-0.10 -v udpsrc port=3000 ! mad ! pulsesink</pre>
<p>With that final command, you should now have all of the audio transmitted to the other computer. Just to note, the audio is unencrypted. If privacy, for some reason, is a concern, you could easily set up an SSH tunnel and forward the port, letting SSH do all the encryption for you.</p>
<h3>Further thoughts</h3>
<p>Encoding the audio into mp3 actually may use a portion of the server's CPU. Decoding is nowhere near as CPU intensive. You can sacrifice bandwidth for CPU usage by leaving out the <code>audioconvert</code>, <code>lame</code>, and <code>mad</code> elements. Just be warned, uncompressed audio might be around 1.5mbit. Not much on a wired network, but could be enough to cause problems on spotty wireless connections. The other thought is that you could use <code>queue</code> elements to buffer the audio, as well as use some sort of RTP scheme to improve playback quality of stream. RTP can be a little tricky, but it is designed to improve streaming audio and video over a network.</p>
<a id="final_solution"></a>
<h1>The final GStreamer solution</h1>
<h2>Server Side</h2>
<pre lang="bash">
$ gst-launch-0.10 -v pulsesrc ! audioconvert ! lame bitrate=192 ! udpsink port=3000 host=<some ip address>
</pre>
<p><em>Don't forget to run <code>pavucontrol</code> to configure PulseAudio to monitor all incoming audio</em></p>
<h3>Client Side</h3>
<pre>$ gst-launch-0.10 -v udpsrc port=3000 ! mad ! pulsesink</pre>
<h1>Alternatives - icecast and darkice</h1>
<p>GStreamer is not the only solution to capture sound and spit it out to another location. Icecast is specifically a fully featured media server. You could create your own streaming media server using it, and provide playlists to your complete audio library. Darkice is an encoder that converts the output of your soundcard into mp3. Combined, darkice and icecast can provide a powerful web based streaming server. But, if all you want is to stream audio (even multicast) from one pc to the next, GStreamer is, in my opinion, a simpler solution.</p>
<h1>Alternatives - Using PulseAudio directly</h1>
<p>Trying to configure PulseAudio directly to stream audio from one computer to another turned out to be more difficult than I wanted. And I couldn't get it working in 15 minutes. So, I moved on to other things. But! It can be done. To be fair, if you got this working it would probably have the least overhead.</p>Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com212tag:blogger.com,1999:blog-7910611153612336567.post-55747568549192393262012-09-02T18:02:00.001-07:002013-01-22T08:49:20.840-08:00Winning "Jet" Powered Pinewood Derby Car<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1qcRrIazfBdFYeGBBH9F_jA0jySVGGzXyuUJptDwKqmaL3jW1tGP-HEZ_LfeqJ82lpKumnudcEPZI6PtDq7ZR5gbFHcCFojvg4CzeA2yOf2TT6G62X4BCa8kZXG3QXsx9KeCNXkl3Rmfi/s1600/pinewood_derby_car_and_trophy.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" width="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1qcRrIazfBdFYeGBBH9F_jA0jySVGGzXyuUJptDwKqmaL3jW1tGP-HEZ_LfeqJ82lpKumnudcEPZI6PtDq7ZR5gbFHcCFojvg4CzeA2yOf2TT6G62X4BCa8kZXG3QXsx9KeCNXkl3Rmfi/s400/pinewood_derby_car_and_trophy.jpg" /></a></div>
<p>I finally had an opportunity to participate in a 'no holds barred' pinewood derby for grownups. The annual competition does have some standing by-laws, however.</p>
<ol>
<li>No open flame or explosions</li>
<li>Any car leaving the track will be disqualified</li>
<li>No sabotaging the other vehicles during the race</li>
</ol>
<p>Being new to the area, and new to the competition, I set out to at least compete for the fastest car. After spending many hours finishing unpacking my garage to clear out a space to build a car, I had about 4 hours before the competition. I grabbed my tools and set to work.</p>
<h1>The Design</h1>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpP61obug_zas_FNllfu4Chzr5IAb8WgoSzplL6a4CfI-bXxQbiZz8n3JJj7lQi4mvo2LMwi8-aSbhuTNMjJbINOwFiaERqfxC8XkN3oiGtibY9tp4DhrSTjtF_27xvSfWIfLBFdY9IS07/s1600/pinewood_derby_3quarters.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="278" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpP61obug_zas_FNllfu4Chzr5IAb8WgoSzplL6a4CfI-bXxQbiZz8n3JJj7lQi4mvo2LMwi8-aSbhuTNMjJbINOwFiaERqfxC8XkN3oiGtibY9tp4DhrSTjtF_27xvSfWIfLBFdY9IS07/s400/pinewood_derby_3quarters.jpg" /></a></div>
<p>Originally, I wanted to use the bell of an outrunner electric motor as the drive wheel, but I knew I did not have enough time to design and build such a pinewood derby car. So, I decided to salvage the parts from an old RC airboat (that didn't work so well) I had collecting dust in my garage.</p>
<h2>The Chassis</h2>
<h3>The Materials</h3>
<ol>
<li><b>1/8" Scrap Plywood</b> from the Homely Despot (they usually have scrap wood in the back of the lumber section that you can pick up for pennies on the dollar</li>
<li><b>1/2" Square Hardwood Dowel</b> - Your local hardware store probably has 2ft lengths for about a dollar</li>
<li><b>3/8" Square Hardwood Dowel</b> - same as the 1/2" dowel</li>
<li><a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=6981&aff=304010">Small Self Tapping Wood Screws</a></li>
<li><b>Pinewood derby Wheels and 'Axles'</b> - You can substitute other wheels if you please</li>
<li><a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=10201&aff=304010">9x4x4mm ball bearing</a></li>
<li><b>M4 bolt</b></li>
<li><b>M4 nuts</b></li>
</ol>
<a name='more'></a>
<p>First order of business is figuring out what size track you'll be racing on. From the interwebs, I acquired these rough dimensions</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOpSBf1i9LIjZKUmUJqqtfnD2MftYKulsGmErV6RUhLbEVlAjk_9ThO-vB9jWRPWXLhDAkLB2_hPLMzIMBtrTrImxV5WqEZPzOHLdDJSwOSgsQK_EUqGKSUxiPd4TQpJdnXHpw7brjqFia/s1600/pinewood_derby_track_dimensions.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" width="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOpSBf1i9LIjZKUmUJqqtfnD2MftYKulsGmErV6RUhLbEVlAjk_9ThO-vB9jWRPWXLhDAkLB2_hPLMzIMBtrTrImxV5WqEZPzOHLdDJSwOSgsQK_EUqGKSUxiPd4TQpJdnXHpw7brjqFia/s640/pinewood_derby_track_dimensions.png" /></a></div>
<p>For stability, I wanted to keep the CG (center of gravity) as low as possible. Most Pinewood Derby tracks have a raised guide that comes up 1/4" above the track, and is 1 5/8" wide. A normal pinewood derby car straddles the guide and has a small gap between the guide and the bottom of the car. Additionally, at the end of the track, often the guide will be raised another 1/4" to slow the car at the end of the track. What I wanted was a reasonable sized deck that hugs the rail for stability and to hold the electronics</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwKR5Hiv-XqlUKs0_oEayGNa6Riz7HAeIu7XUw1QcOmTPUYNMOYGTywGHiKDNW2OrPkT17Abv0_o8FS47KgIGYtVWGroZOaBsFE4jwmHIT8mbPZaT22M2M6Uoi2eCcG-oePvyKC8tkKQsm/s1600/pinewood_derby_deck.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" width="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwKR5Hiv-XqlUKs0_oEayGNa6Riz7HAeIu7XUw1QcOmTPUYNMOYGTywGHiKDNW2OrPkT17Abv0_o8FS47KgIGYtVWGroZOaBsFE4jwmHIT8mbPZaT22M2M6Uoi2eCcG-oePvyKC8tkKQsm/s640/pinewood_derby_deck.png" /></a></div>
<p>In all honesty, I just eyeballed the length. It was almost too long and did only barely fit on the starting blocks. I gave the car a little extra width to ensure it would clear the rails, which it did. The width worked out fine, with one exception, which I will note in the Power and Control section below</p>
<h2>Power and Control</h2>
<h3>Materials</h3>
<p>I used what I readily had in my garage. The power system that I used hits the sweet spot in price, and is about as cheap as you can get.</p>
<ol>
<li><b>Motor</b> - <a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=6634&aff=304010">C20 brushless Outrunner 2050kv</a> - First off, you need a motor. I have a couple of these C20 brushless outrunners. Great little motors for the price.
</li>
<li><b>Propeller</b> - <a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=10033&aff=304010">GWS EP Propeller (DD-5030 127x76mm)</a> - A good starting propeller match for the C20 brushless outrunner are the GWS DD-5030. The DD-5030 on the C20 brushless Outrunner will draw between 6-7A and should produce enough thrust for our small light car. A pack of 6 should be plenty for now. I had some <a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=10034&aff=304010">GWS EP Propellers (DD-5043 125x110mm)</a> available in case the competition got tough, but the car was fast enough without propping up. The width becomes an issue here. A 5in prop will interfere with a large car in a lane next to it. In the video, I could not race next to the waterbottle car. Perhaps a smaller prop might allow you some more flexibility.
</li>
<li><b>Prop Adapter</b> - <a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=8237&aff=304010">Prop Saver w/ Band 3mm (10pcs)</a> - In order to mount the props onto the motor, grab some prop adapters. These prop savers fit the motor perfectly and the GWS props previously listed.</li>
<li><b>Battery</b> - A small powerful battery - 600mAh, 3S 20C rated or higher should do.
<ul>
<li><a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=7308&aff=304010">Rhino 610mAh 3S 11.1v 20C Lipoly Pack</a>
</li> - or -
<li><a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=9173&aff=304010">Turnigy 800mAh 3S 20C Lipo Pack</a></li>
</ul>
<li><b>Speed Controller (ESC)</b> - <a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=6456&aff=304010">Hobbyking SS Series 15-18A ESC</a> - Cheap and simple
<li><b>Connectors</b> -
<ul>
<li><a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=9631&aff=304010">JST Female 2 pin connector set (10pcs/set)</a> -
A pack of connectors for connecting your battery to your ESC
</li>
<li><a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=66&aff=304010">2mm Gold Connectors 10 pairs (20pc)</a> -
Some 2mm connectors to connect your motor to your esc
</li>
</ul>
</li>
<li><b>Misc</b>
<ul>
<li><b>Controller</b> - If you don't want to invest in an expensive R/C controller, and don't have one, you can pick up extremely cheap ones from HobbyKing or HobbyPartz.com. The <a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=9041&aff=304010">Hobby King 2.4Ghz 4Ch Tx & Rx V2 (Mode 2)</a> is a good choice for getting started. When there are kids around, it is always good to have a human in the loop controlling the car.</li>
<li><b>Battery Charger</b> - If you don't already have a LiPo charger and just want one for this project, you can grab something like the <a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=8247&aff=304010">Turnigy 2S 3S Balance Charger. Direct 110/240v Input</a> to get yourself started.
</li>
</ul></li>
</ol>
<h2>Assembly</h2>
<h3>Tools Used</h3>
<p>For my build I used the following tools</p>
<ol>
<li><b>Cheap miter saw and miter box</b> - a coping saw would also work</li>
<li><b>Utility knife</b></li>
<li><b>Electric drill and assorted drill bits</b></li>
<li><b>Hot glue gun</b></li>
<li><b>Screw driver</b></li>
<li><b>Dremel Tool</b> - You could get away without one of these</li>
</ol>
<p>I only had about 3 hours to throw the car together, so I chose the simplest assembly methods.</p>
<ol><li>Using the utility knife (or if you happen to have better more appropriate tools) cut out the rectangle of the 1/8" sheet of wood to form your main deck.</li>
<li>Hot glue the 1/2" rails to the bottom of the 1/8" thick deck and then reinforce each rail with 3 or so of the wood screws (don't forget to drill pilot holes).
<li>You can choose to round the rails with a Dremel and a sanding head. This helps in case the track it will race on isn't perfectly smooth, especially at the joints between track pieces.</li>
<li>Drill pilot holes about 3/4" back from the leading edge where the deck meets the rail for the front axles. I eyeballed the locations for the front wheels, and it worked out fine. This isn't your typical pinewood derby car, you'll should have plenty of thrust to power through misalignments.</li>
<li>Cut two 1" lengths of the the 3/8" diameter square dowel. Clamp the pieces together and drill a hole through both of the pieces for your rear axle. The hole should be positioned slightly offset from center so that your rear wheel clears the square dowel supports. I used a 4mm bolt for the rear axle with small 4mm nuts on either side of a ball bearing previously mentioned for the rear wheel. </li>
<li>Put the axles onto the supports with the wheel (ball bearing) installed. Then, take the rear wheel assembly and hot glue it to the bottom rear of the car.</li>
<li>Now, you can install your motor mount. This depends on what type of motor you have and what prop you want to use. I'll leave it up to you to figure this part out.</li>
<li>As a final step, I installed strips of velcro on the deck of the car for installing the electronics. The velcro also helps absorb impact if your car makes an abrupt stop at the end of the track.</li>
<li>If you need help with wiring your electronics, there are plenty of guides and forums for RC enthusiasts that can help. The focus for this post is mostly about the mechanical side.</li>
</ol>
<h1>Performance</h1>
<h2>Video</h2>
<iframe width="640" height="480" src="http://www.youtube.com/embed/VYP2-NnhME0" frameborder="0" allowfullscreen></iframe>
<p>This car performed better than I could have hoped. I never had the chance to even open it all the way up. I had a more powerful prop combo available if the first set up proved to be too wimpy. However, after the first race it became apparent that I would easy sweep the derby.</p>
<h2>Why did it perform so well?</h2>
<p>Several factors helped this car outperform my expectations.
<ol>
<li>The propeller located in rear, 3 inches above the deck, provided down force on the front of the car. This allowed all the power to be applied to accelerating the car without worrying about it popping a wheelie and flying off the track. Additionally, the down force on the front of the car kept the car on the guide rails, preventing it from jumping the rails as some of the other cars did.</li>
<li>High thrust/weight ratio. I still don't know how much the car weighed, but I estimate less than .5 lbs. I estimate that with around 1 lb of thrust, plus sqrt(2)*gravity due to the 45deg starting angle, the car accelerated at least at 2.7G. </li>
<li>Ideal starts. I was able to apply thrust before the gates dropped, allowing my car to accelerate the instant the gates dropped.</li>
</ol>Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com194tag:blogger.com,1999:blog-7910611153612336567.post-11255196975260300572012-09-01T23:57:00.000-07:002012-09-02T00:00:01.547-07:00Cheap Source for Arduino Uno and Arduino MegaOf all places, Hobbyking has a bunch of super cheap Arduino hardware. Probably the cheapest source you can find for these boards. Awesome! They even have a couple shields, if you know where to look.
<ul>
<li><a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=26838&aff=304010">Arduino Uno R3 Microcontroller - Atmel ATmega328 ~$15</a></li>
<li><a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=23767&aff=304010">Arduino Uno - Atmel Atmega 328-PU ~$13</a></li>
<li>
<a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=25085&aff=304010">Arduino Mega 2560 Microcontroller Board ~$18</a></li>
<li><a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=25086&aff=304010">Arduino Nano V3.0 Microcontroller Board ~$10</a></li>
</ul>Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com2tag:blogger.com,1999:blog-7910611153612336567.post-85940028823671407232012-05-08T22:28:00.000-07:002012-05-08T22:28:43.763-07:00Xbee Enabled RC Joystick Overview<p>Originally, I did this project to highlight how simple it can be to add a joystick to your robotics project using only:</p>
<ul><li>Two Xbees (Series 1)</li><li>One Arduino</li><li>And one old joystick with a gameport connector</li></ul>
<p>That is it. In this I also cover two things, how to hack those old joysticks all you electronics hoarders have (like myself) and demonstrate how to set up an Xbee as a data harvester and use some of the underutilized powers of the Xbee</p>
<h1>The Overview</h1>
<p>Here is a simple overview of the project. It doesn't get simpler than this.</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6-MNYUgqHhMQBqegta6t6W19UVkeoYQ2sJA3dGWIaCx5m-0-6ykUv4bifiC4ChLXl0UzSXqGlSE0IkEYKKqtvmS14o0So3-zaNu2wFdlBJH_JFcBZnqS2IRM8b2dfs4R97-B1heUrdGv0/s1600/xbee_joystick_overview.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" width="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6-MNYUgqHhMQBqegta6t6W19UVkeoYQ2sJA3dGWIaCx5m-0-6ykUv4bifiC4ChLXl0UzSXqGlSE0IkEYKKqtvmS14o0So3-zaNu2wFdlBJH_JFcBZnqS2IRM8b2dfs4R97-B1heUrdGv0/s640/xbee_joystick_overview.png" /></a></div>
<p>Additionally, for the reasonable cost of an Arduino, two Xbees, and an old joystick you can find at a local thrift shop, you can have a multi-axis controller for you robotic project.</p>
<h1>The Start - That Old Joystick</h1>
<p>First you want to learn about that old joystick of yours. Check out Part I. I explain the process of modding your old Gameport joystick to work with a regular ADC you would find on a microcontroller.</p>
<p><big><a href="http://ilektron-x.blogspot.com/2010/06/xbee-enabled-joystick-part-i.html">Xbee Enabled Joystick, part I</a></big></p>
<h1>Setting Up the Xbees</h1>
<p>The next step in the project is setting up the Xbees. This explains how to set up the Xbee to automatically read values from the ADCs and digital inputs and send that information to a predetermined Xbee. The receiving Xbee is configured to receive that data and spit it out over the serial line using API mode</p>
<p><big><a href="http://ilektron-x.blogspot.com/2011/07/xbee-enabled-joystick-part-ii.html">Xbee Enabled Joystick, part II</a></big></p>
<h1>Finishing Up, Code for the Arduino and Schematics for the Xbee</h1>
<p>In the conclusion I dust off my RC airboat, slap an Arduino to it, and demonstrate the final project. I include code samples for parsing the Xbee API packets and pulling out the ADC values from the joystick connected Xbee</p>
<p><big><a href="http://ilektron-x.blogspot.com/2011/08/xbee-enabled-joystick-piii.html">Xbee Enabled Joystick, part III</a></big></p>Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com7tag:blogger.com,1999:blog-7910611153612336567.post-50429562387342106582012-04-27T21:18:00.000-07:002012-04-28T07:54:15.212-07:00Advanced Eagle Layout Tutorial - Building Better Library Parts - Variants and Technologies<h1>
Advanced Variants</h1>
<p>
Everybody knows that to create a device set you must have at least one variant of the device that binds the symbol to the package. The default variant is called ''. That is right. Double single quotes. It represents an empty string.</p>
<h2>
Naming Variants</h2>
<p>You may have also noticed that if you name a variant, the name is appended to the device name. For example, if you have a device named</p>
<code>WIDGET</code>
<p>and a variant</p>
<code>123</code>
<p>the resulting name will appear as <p>
<code>WIDGET123</code>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZtfBPKSBMlovjOxeRpxCy2pcnlDjYm1N64nVpLIzNzBCcrRZH58IoT0sTWeOtzczmvHxex1vstVaYnegM66heKaP6Kk97W0nCR7z5bkohDZDcY-88qH0y8pB9PDz2sdsSdREk_wo8eA92/s1600/widget_with_var_appended.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" width="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZtfBPKSBMlovjOxeRpxCy2pcnlDjYm1N64nVpLIzNzBCcrRZH58IoT0sTWeOtzczmvHxex1vstVaYnegM66heKaP6Kk97W0nCR7z5bkohDZDcY-88qH0y8pB9PDz2sdsSdREk_wo8eA92/s640/widget_with_var_appended.png" /></a></div>
<p>Pretty cool, huh? Often manufacturers will have a package code embedded in the device part number. For example, if </p>
<code>WIDGET-</code>
<p>is the base part number, and the manufacturer has package codes </p>
<code>S</code>
<a name='more'></a>
<p>for the SOT23 footprint and </p>
<code>XS</code>
<p>for SC70 footprint. The resulting part number would be</p>
<code>WIDGET-S</code>
<p>for the SOT23 version and</p>
<code>WIDGET-XS</code>
<p>for the SC70 version.</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnFw90ZRR3bxxuOawM3fdwA3cNkrH2Z4LbDcbdHbo_QMHBc7eikoop87K3Icq4-44HDPSE-Y7XQF5RhapMf1duBx6NL8zrga_xuBbfEUF7PwFhSLWWGLwngRn-YS48uDpIWORwcOhzYfAK/s1600/widget_with_variants.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" width="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnFw90ZRR3bxxuOawM3fdwA3cNkrH2Z4LbDcbdHbo_QMHBc7eikoop87K3Icq4-44HDPSE-Y7XQF5RhapMf1duBx6NL8zrga_xuBbfEUF7PwFhSLWWGLwngRn-YS48uDpIWORwcOhzYfAK/s640/widget_with_variants.png" /></a></div>
<p>As you may already know, if you name your device with the base part number, and variants to match the package codes of the manufacturer, the resulting name for the device in your library will match the manufacturer's part number. Cool, huh?</p>
<h2>
Advanced Variant Naming</h2>
<p>Time to blow your mind. What if the package code is embedded in the part number and not just at the end?</p>
For example, if the part name is</p>
<code>WIDGET-X-AWESOME</code>
<p>where the <code>X</code> represents the package code, you would still want the resulting parts to be named</p>
<code>WIDGET-S-AWESOME</code>
<p>for the SOT23 variant and</p>
<code>WIDGET-XS-AWESOME</code>
<p>for the SC70 variant. Eagle will let you do this. All you have to do is put a <code>?</code> where you want the variant name to appear. If no <code>?</code> is present, the name of the variant is appended to the end of the device name. For example, </p>
<code>WIDGET-?-AWESOME</code>
<p>would turn into </p>
<code>WIDGET-S-AWESOME</code>
<p>for the <code>S</code> variant.</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQRWNQ15Ml7yPUcG2Qkzt5Hl_JHaaiig6ssE4iCTdTAiDiIceXCjgAAoaxDFtJCfk0LRHqyvTbZDRDgmEdMEDgbfZcMyKda_bePK7q3C_EfRawbJ8yYQcvnv2wG1Hb34Q3aywQMuZ63X0d/s1600/widget_with_variants_in_middle.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" width="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQRWNQ15Ml7yPUcG2Qkzt5Hl_JHaaiig6ssE4iCTdTAiDiIceXCjgAAoaxDFtJCfk0LRHqyvTbZDRDgmEdMEDgbfZcMyKda_bePK7q3C_EfRawbJ8yYQcvnv2wG1Hb34Q3aywQMuZ63X0d/s640/widget_with_variants_in_middle.png" /></a></div>
<h1>
Technologies</h1>
<p>Eagle has a very powerful feature that isn't used often enough. <b><i>Technologies</i></b>. Technologies allow you to create multiple devices of the same variant (with the same package) with different part numbers. Going back to our widget example, there are two different <code>WIDGET</code> devices, a 1.8V widget with a part number</p>
<code>WIDGET-1.8V-S-AWESOME</code>
<p>and a 3.3V variety with a part number</p>
<code>WIDGET-3.3V-S-AWESOME</code>
<p>You can easily generate these with technologies. First, we need to rename our device to include the character for technologies.</p>
<code>WIDGET-*-?-AWESOME</code>
<p>The character <code>*</code> will be replaced by the name of the technology. If <code>*</code> is not present, the technology name will be appended to the end of the device name. In the case that neither <code>?</code> or <code>*</code> is present, the resulting name will be </p><code>device_set_name+technology+package_variant</code><p> Now, create 2 technologies, <code>1.8V</code> and <code>3.3V</code>.</p>
<p>Like the variant, the default technology is a pair of single quotes, <code>''</code>. The default technology is marked by default and can be unmarked. Once the new technologies are created in mark, you should now see the technologies appear.</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdB7K84DNm78C-AJhzHDKOBL2uWQ0E3FISAVZLfVzH-nqdg71EY2OVHrPuLYG0ymlHG6NadTOL5HjKrsoW1Og6RMlZlhB_BBGfGY5jmSSNYPSnStDQ6KPywE9RNY04E0E9O8dr_fP2ca4R/s1600/widget_with_variants_and_technologies_in_lbr.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" width="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdB7K84DNm78C-AJhzHDKOBL2uWQ0E3FISAVZLfVzH-nqdg71EY2OVHrPuLYG0ymlHG6NadTOL5HjKrsoW1Og6RMlZlhB_BBGfGY5jmSSNYPSnStDQ6KPywE9RNY04E0E9O8dr_fP2ca4R/s640/widget_with_variants_and_technologies_in_lbr.png" /></a></div>
<p>And the result in the Eagle console</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNeaN1HEuyqCMVvNQ5pSQGgykMz5Jv7HKzc3eXud-xKqKrIPVR1tpr09YD4epIr6-JPCM3sSYkqyKA6qBlCJHOrB8FhyphenhyphenG1VNtis5Pn_VeHzVB7vtQooZTe1F3s8l5DdTN1G6Tygxech3j-/s1600/widget_with_variants_and_technologies.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" width="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNeaN1HEuyqCMVvNQ5pSQGgykMz5Jv7HKzc3eXud-xKqKrIPVR1tpr09YD4epIr6-JPCM3sSYkqyKA6qBlCJHOrB8FhyphenhyphenG1VNtis5Pn_VeHzVB7vtQooZTe1F3s8l5DdTN1G6Tygxech3j-/s640/widget_with_variants_and_technologies.png" /></a></div>
<p>Notice that the technologies only appear for the one variant on which the technologies were marked, in this case the <code>XS</code> variant. If you want the technologies active for a particular variant, you must mark them active for each specific variant you wish to have the technology. With variants and technologies, you can replicate a large majority of part numbers for your devices. A good device in a library matches the part number as closely as possible.</p>
<p>Now, that you have created and marked technologies for the device, you can add specific attributes for each technology. A later tutorial will cover attributes a little deeper. </p>Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com124tag:blogger.com,1999:blog-7910611153612336567.post-23487971679836637722012-04-25T07:00:00.000-07:002012-04-28T07:51:54.239-07:00Dirt Cheap USBasp AVR Programmer AvailableDid you know that you can get a <a href="http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=21321&aff=304010">super cheap USBasp AVR programmer</a>? $4.95 plus shipping (around $3 for International Unregistered). Where can I get this you might ask? An unlikely source, HobbyKing.com. Wow. I don't know of anywhere else that can sell it that cheap. Generally stuff takes at least one month to arrive to the US from China, that is if the item is in stock. Longer for backordered items. But that is super cheap!
Next HobbyKing order I make I'll through one on and review the programmer.Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com16tag:blogger.com,1999:blog-7910611153612336567.post-74397687090461988952012-04-23T09:20:00.000-07:002012-04-23T09:20:00.234-07:00Eagle's Library Part Creation Standard<p>Did you know that Eagle had a <a href=http://www.cadsoftusa.com/downloads/file/library_part_creation_standard.pdf">Library Part Creation Standard</a>? I didn't either. <a href="http://www.cadsoftusa.com/downloads/file/library_part_creation_standard.pdf">Check it out</a>. I've seen plenty of parts that violate some of these rules, and consequently make life a little more difficult.</p>Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com0tag:blogger.com,1999:blog-7910611153612336567.post-33813411610491061072012-04-22T09:14:00.000-07:002012-04-22T09:18:57.298-07:00Advanced Eagle Layout Tutorial - Building Better Library Parts - Pin Swaplevel<p>Once you have pin direction down, we can move on to some of the other features of Eagle's pins.</p>
<h1>How to Use Pinswap/Swaplevel</h1>
<p>Swaplevel can come in handy on occasion. Its purpose is to allow you to be able to dynamically change which pin is assigned to a certain pad when using an instance of a part in your schematic/on your board. The end effect would be the same as physically swapping the pins' locations in the symbol while leaving the rest of the symbol intact. Let's look at an example
using a simple resistor:</p>
<p>Now, because a resistor is the same forwards, backwards, and and any which way, it makes sense to be able to arbitrarily swap the pins. Look at the following board.</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhk9ElCAvXqd23tBJpbBmTEl5uZTkslK2HmLuI6edSRFYprX24qFax98PXEsFs3xp2RIctTTJo6U6_rdTHIH5OXRQVjXzNwaiSaL0x7bCcu9iN7EO1cIzhIR3N5CpyyED3KFdEKK6jTTrGs/s1600/board_swaplevel.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="400" width="348" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhk9ElCAvXqd23tBJpbBmTEl5uZTkslK2HmLuI6edSRFYprX24qFax98PXEsFs3xp2RIctTTJo6U6_rdTHIH5OXRQVjXzNwaiSaL0x7bCcu9iN7EO1cIzhIR3N5CpyyED3KFdEKK6jTTrGs/s400/board_swaplevel.png" /></a></div>
<p>Oops, my nice row of resistors has one that is flipped! I could rotate the part 180 degrees, but then the text name would in the wrong place. I can simply select the 'Pinswap' tool, click on the first SMD pad and then the second. Voila! The pins have been swapped!<p>
<a name='more'></a>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizYUD1WTdUf_Un8cOELUlpDtBm1ZR1Zwu5FnEloOUhk48n09R3-iYB6KMn8nnEC4CU0ahlSi4mat43uITWhu9RzzeoD7HmtU6wE2xB3I5D-Qtw08TaaayHsNsq-HJovmGNjtMVGw6tA_mv/s1600/board_swaplevel_fixed.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="400" width="326" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizYUD1WTdUf_Un8cOELUlpDtBm1ZR1Zwu5FnEloOUhk48n09R3-iYB6KMn8nnEC4CU0ahlSi4mat43uITWhu9RzzeoD7HmtU6wE2xB3I5D-Qtw08TaaayHsNsq-HJovmGNjtMVGw6tA_mv/s400/board_swaplevel_fixed.png" /></a></div>
<p>Be warned, though, that something else happened in the schematic.</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYq99bu69H1t4PWugnqwL4DmcrepddvYeUlYru1bNNkRQkohLfzanmSDhOJ3nWOALwlBOIR-8gVwzNWYOYrJF5jIrYwkJZS8ux_v4pQkJ-fVhdqiMe_ukFYkCGZh6Bfdn74KlDVTsg3148/s1600/board_swaplevel_schem_compare.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="249" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYq99bu69H1t4PWugnqwL4DmcrepddvYeUlYru1bNNkRQkohLfzanmSDhOJ3nWOALwlBOIR-8gVwzNWYOYrJF5jIrYwkJZS8ux_v4pQkJ-fVhdqiMe_ukFYkCGZh6Bfdn74KlDVTsg3148/s400/board_swaplevel_schem_compare.png" /></a></div>
<p>Do you see it? The pins were swapped on R3. R3 now needs to be rotated in the schematic.<p>
<h1>Pin Swaplevel in Symbol</h1>
<p>The swaplevel of a pin changes <ol><li>Whether or not it can be swapped</li><li>With what pins you are allowed to swap it with</li></ol> All pins with the same swaplevel can be swapped using the 'Pinswap' tool. Pins with swaplevel '0' cannot be swapped at all. So, for a resistor, both pins could be set at swaplevel '1', signifying they can be swapped, and swapped with eachother.</p>
<h1>When to Use Swaplevel</h1>
<p>Swaplevel only makes sense on mostly passive devices such as capacitors, resistors, and inductors. Perhaps it might come in handy on the coil of a relay. Swaplevel could also be used, however, on generic connectors. Say you have a 3 pin serial connector with Gnd, Rx, and Tx. If you decide that Rx and Tx are reversed, you could simply swap the pins. Swaplevel does not make sense on semiconductors, or numerous other components. For example, the pins of a diode may not be swapped, because they are functionally different.<p>
<p>In all honesty, thought, I have only ever used 'Pinswap' a handful of times. The functionality can be duplicated by just deleting nets and rerouting. However, in the few times I've needed to use 'Pinswap', it was nice to have a device with appropriate swaplevels in the library.<p>Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com1tag:blogger.com,1999:blog-7910611153612336567.post-71871658818809383052012-04-21T10:00:00.001-07:002012-04-22T09:19:12.928-07:00Advanced Eagle Layout Tutorial - Building Better Library Parts - Pin Directions<p>CadSoft Eagle is a great tool. However, I've only ever come across basic tutorials to get you started. A lot of features of Eagle are buried in the help files. These tips should help you become a power Eagle user and take advantage of a lot of things that eagle can do.</p>
<p>
I assume the reader has basic familiarity with Eagle, and has a basic understanding of PCB design. I will explain some of the more advanced features of Eagle</p>
<h1>First up, Pin Direction</h1>
<p>
Let us start in a symbol for a device.
</p><p>
When you add pins to a symbol, there are several options for the pin. Most of the options are aesthetic, but some come in handy when you run ERC. If you look in Eagle's help file under the 'PIN' command you can find this little blurb.
</p>
<h2>The Help</h2>
<code>
<pre>
Direction
The logical direction of signal flow. It is essential for the Electrical Rule Check (ERC) and for the automatic wiring of the power supply pins. The following possibilities may be used:
NC - not connected
In - input
Out - output (totem-pole)
IO - in/output (bidirectional)
OC - open collector or open drain
Hiz - high impedance output (e.g. 3-state)
Pas - passive (for resistors, capacitors etc.)
Pwr - power input pin (Vcc, Gnd, Vss, Vdd, etc.)
Sup - general supply pin (e.g. for ground symbol)
Default: IO
If Pwr pins are used on a symbol and a corresponding Sup pin exists on the schematic, nets are connected automatically. The Sup pin is not used for components.
</pre>
</code>
<a name='more'></a>
<p>
Time to go through these one at a time, and explain them a little more and how they interact with each other. I suggest creating a simple device with one of each direction of pin, like the following, and experimenting with the different types.
</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4O_9qG9-a3jc1GAbTmpgT6_rJXi1Xqd1oRhncLgVJzLDrBQ2KCune2mKnOOxW75CKyAE_eKkSv44S2xVd4umYoLzhJiyIcA7PCGh6zrtSlBdy7nFmSgQZx4sKD9i8nTkZ7R9JEFEEDxs5/s1600/symbol_with_all_directions+.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="280" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4O_9qG9-a3jc1GAbTmpgT6_rJXi1Xqd1oRhncLgVJzLDrBQ2KCune2mKnOOxW75CKyAE_eKkSv44S2xVd4umYoLzhJiyIcA7PCGh6zrtSlBdy7nFmSgQZx4sKD9i8nTkZ7R9JEFEEDxs5/s400/symbol_with_all_directions+.png" /></a></div>
<h2>The Breakdown</h2>
<ul><li><b>NC</b> - Many devices have pins that are left unconnected. Perhaps, a pin provides some manufacturer's test feature which is not suitable for a user application. You often see them called 'Reserved' pins. If you would like to represent the NC's in your device set, mark your pin as 'NC'. Pretty straight forward. If for some reason, a net gets attached to an NC pin, ERC will put up a warning.
</li>
<li>
<b>In</b> - Standard high impedance input. These can be connected to Out, IO, OC, Hiz, Pas, Pwr, Sup, and other IN pins. Any number of these pins can be on the same net. However, ERC will throw an error if a net is only connected to inputs. ERC will also produce errors if an input pin is left floating and not connected to a net.
</li>
<li>
<b>Out</b> - Standard 'totem-pole' or 'push-pull' output. These can be connected to In, IO, Hiz, Pas, and Pwr pins. Out should not be mixed with OC, and will give you an error. ERC will give you a warning, however, if you connect an Out to a Pwr pin. If you have an output of, say, a linear regulator, use Pwr instead, which can be connected to Sup pins.
</li>
<li>
<b>IO</b> - Bidirectional input and output. Eagle 6 changed this from I/O to IO. These can be connected to In, Out, IO, OC, Hiz, Pas, Pwr, and Sup pins. There are no special ERC checks for IO pins. IO is the default setting for pin direction.
</li>
<li>
<b>OC</b> - Open collector or open drain. These can be connected to In, IO, OC, Hiz, and Pas pins. Typically, you will have multiple OC pins on the same net, mixed with perhaps Pas pins. ERC will produce errors if you connect OC to anything other that the pin directions listed.
</li>
<li>
<b>Hiz</b> - High impedance output. These can be happily connected to anything except NC pins. Typical designs have multiple Hiz pins on the same net. 3-state devices are dangerous, however. The designer must take careful consideration when designing a circuit with Hiz direction pins. Just because the ERC doesn't complain, doesn't mean you won't burn something up.
</li>
<li>
<b>Pas</b> - Passive. Passive pins can also be happily connected to anything except NC pins. Generally, these are reserved for things like capacitors, resistors, inductors, and other passive devices.
</li>
<li>
<b>Pwr</b> - Power input pins. Pwr pins can be connected to In, Out, IO, Hiz, Pas, Pwr, and Sup pins. If the net is not named the same as the Pwr pin, ERC will bring up a warning. Pwr pins with the same name are automatically connected unless the pin overwritten by connecting it to a net with a different name.
</li>
<li>
<b>Sup</b> - Supply pins. Supply pins can be connected to In, IO, Hiz, Pas, and Pwr. These are special symbolic representations of power supplies. Please do not use these on devices. Supply pins should be used in device sets with a symbol and no package.
</li>
</ul>Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com14tag:blogger.com,1999:blog-7910611153612336567.post-12575496852207339182012-04-13T11:17:00.000-07:002012-04-17T07:56:38.668-07:00Graphics Cards Hacking (Repair) RoundupI must have bad luck with graphics cards. My last graphics card was an XFX nVidia 8600GT. My current graphics card is an EVGA nVidia 9800GT. Both have failed in unexpected ways. Fortunately, I have been able to fix both of them! WARNING - these procedures will most like void the warranty, if you have one.
<br />
<br />
<h1>
XFX 8600GT </h1>
<h3>
Exploding Caps </h3>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjW1XX5cdsm2hUwgrYVdRI2nQ7AkUR32BzEY98XBFDe9wdFRLxj76KAReXt_kkOFrJEHK_oM2MmyKuAFTwyzJ8weGRGDV9UVvRr14UdW6ceHJlCn5LZtmXxZ0XVX4Xbr4wlIB4L4SnngXhz/s1600/IMG138.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjW1XX5cdsm2hUwgrYVdRI2nQ7AkUR32BzEY98XBFDe9wdFRLxj76KAReXt_kkOFrJEHK_oM2MmyKuAFTwyzJ8weGRGDV9UVvRr14UdW6ceHJlCn5LZtmXxZ0XVX4Xbr4wlIB4L4SnngXhz/s640/IMG138.jpg" width="640" /></a></div>
<br />
<br />
One evening I was sitting watching TV in another room with my wife. We heard some 'pop' noises. Well, more like several loud 'cracks'. My wife asked me what the sound was. I thought it was the ice maker in our fridge. Suspiciously, though, the graphics on my computer started having problems. I began seeing artifacts here and there. Then, more pops and the display become incredibly garbled and unusable. I pulled out the graphics card and what you see above is what faced me. Numerous aluminum electrolytic capacitors had exploded. You can see the paper separator(the yellow fibrous stuff) spewing out.
<br />
<br />
<h3>
The Fix </h3>
<br />
To fix the 8600, I purchased some aluminum electrolytic capacitors from Digikey with the same values as the exploded ones. Generally, caps that large have their values and ratings printed on them. I needed some 1500uF 6.3V, 1000uF 6.3V, and 470uF 16V capacitors. The footprints for the capacitors were generic and supported multiple sizes, so I just got the cheapest ones in approximately the same size. Radial capacitors have 3 dimensions to consider. Lead spacing, diameter, and height. In retrospect, the replacement 1500uF caps are a lot taller than the original, but they still fit in my case. I wouldn't worry about stressing too much about matching ESR or any other features other than capacitance and voltage rating. Odds are that the originals are on the cheaper side.
<br />
<a name='more'></a>
<br />
I busted out my heat gun, and replaced the exploded caps with new comparable ones. Using my heat gun (a $25 Amazon special) and some patience, I pulled the old caps and immediately slid the new cap in the empty holes, noting polarity. I used the heat gun to keep the solder molten while putting the new caps in place. I touched up the leads with some fresh solder using my soldering iron and trimmed them with some diagonal flush cutters. Here is the finished product compared to the original. I may post a video tutorial of the fix.
<br />
<br />
<h2>
The Old</h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfdpyzOaorH8dm9_DDnJn0knB1zrD2fdtFbAV1AlSf_WTSzoG0kZtCEOADtwBKra8oyt_fbdZeLaJJF-VO-ENwAkTFVXNL4K429UqysOP1giCS-5kswvN-aBDQeNXxAzF1AceOcqWKxlou/s1600/IMG136.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfdpyzOaorH8dm9_DDnJn0knB1zrD2fdtFbAV1AlSf_WTSzoG0kZtCEOADtwBKra8oyt_fbdZeLaJJF-VO-ENwAkTFVXNL4K429UqysOP1giCS-5kswvN-aBDQeNXxAzF1AceOcqWKxlou/s640/IMG136.jpg" width="640" /></a></div>
<br />
<h2>
The New</h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-3TIG6nmBddISZZiDcVAETLFgMI0qpTQxv3RYrJJSYNkWcBF04FrRN0E5PuLLK39MaPglg08HIsIl4aR6Iz_oDvDnJr5hATLCsaZvL33AXiQEizw5Oj-l1co5oZO9aPf8puOHb75rLW0t/s1600/IMG_7089.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-3TIG6nmBddISZZiDcVAETLFgMI0qpTQxv3RYrJJSYNkWcBF04FrRN0E5PuLLK39MaPglg08HIsIl4aR6Iz_oDvDnJr5hATLCsaZvL33AXiQEizw5Oj-l1co5oZO9aPf8puOHb75rLW0t/s640/IMG_7089.JPG" width="640" /></a></div>
<h3>
Result </h3>
<br />
I am currently typing this post out using the 8600 with the replaced caps. It seems to be working flawlessly. I even successfully stress tested it with my favorite graphics intensive video game.
<br />
<br />
<h1>
EVGA 9800GT </h1>
<h2>
Cracked Fan </h2>
My newer card, the EVGA 9800GT failed after about 18 months of use. While I was at work, apparently the computer started making a bad rubbing sound. I was not notified of the sudden change, and noticed that it was slightly louder than before. I tried to open my favorite video game only to be disappointed by the graphics performance. Suspicious of the louder than normal fan noises, I downloaded a hardware monitoring program and discovered my GPU core was at 99C! Burning hot!
<br />
<br />
I quickly shutdown my computer, opened it up, and pulled out the graphics card. I removed the fan with molded airflow director from the heatsink. Upon discovering the sticker was loose, I remove it to find something surprising. The molded impeller body had cracked in half!
<br />
<br />
<h2>
The Front</h2>
Nothing obviously wrong here
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnWPBLmoDG6ArbplE6zovKz4JxuemRKuwnDeX2va4zYkrzlUalQnm3ChYqXWT-iIEeS6MCuAamn7iG3Z1_4zpcq-wnzbkmb1sPrpoIq-bdDsmwXd9_9bM1s1j03sEkv9HDBbfcaldhE9OG/s1600/IMG_7083.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnWPBLmoDG6ArbplE6zovKz4JxuemRKuwnDeX2va4zYkrzlUalQnm3ChYqXWT-iIEeS6MCuAamn7iG3Z1_4zpcq-wnzbkmb1sPrpoIq-bdDsmwXd9_9bM1s1j03sEkv9HDBbfcaldhE9OG/s640/IMG_7083.JPG" width="640" /></a></div>
<h2>
The back with the sticker removed</h2>
Woah! Is that the San Andreas fault?!
<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/AVvXsEjk1mLDOIfzQ61rTAz0h40hS1BQNJM5XdYRZkgkTWKF9us6SGEtyOhpnlNq0ZRVbMFuB6qQPEySdpwIo10D6rovcUy2B29G0QtOrYVWb_uBGxtLdtqcBtgV_o2GJ7H8LsQ4ZPAHbTxmREkp/s1600/IMG_7082.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjk1mLDOIfzQ61rTAz0h40hS1BQNJM5XdYRZkgkTWKF9us6SGEtyOhpnlNq0ZRVbMFuB6qQPEySdpwIo10D6rovcUy2B29G0QtOrYVWb_uBGxtLdtqcBtgV_o2GJ7H8LsQ4ZPAHbTxmREkp/s640/IMG_7082.JPG" width="640" /></a></div>
<br />
<br />
<h3>
The Fix </h3>
To fix the cracked impeller body, I simply got out my superglue with a brush applicator, and carefully applied some superglue in the crack and on the metal body of the fan where the molded plastic impeller body is mounted. I applied some pressure to keep the halves together, and voila! The fan was fixed.
<br />
<br />
<h3>
Result </h3>
The fan now operates correctly and the GPU core sits around a much more comfortable 45C under use.Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com41tag:blogger.com,1999:blog-7910611153612336567.post-88288902422148787512012-02-09T19:18:00.000-08:002012-04-23T22:01:09.904-07:00Installing the Android SDK on Ubuntu 11.10My harddrive failed, forcing me to reinstall my OS. I decided to upgrade to Ubuntu 11.10, so this is basically a rehash of my previous instructions for Ubuntu 11.04.
<br />
<ol><h1>
<li>
<h1>Make sure that you have the 32bit compatibility libraries installed if you are using 64bit Ubuntu</h1>
</li>
</h1>
<p>If you fail to install the 32bit compatibility libraries you will get an 'adb version' error at the end when you run Eclipse. If you are running 64bit Ubuntu, start out by installing the 32bit libraries</p>
<code>~$ sudo apt-get install ia32-libs</code><br><br>
<h1>
<li>Install the JDK</li>
</h1><p>This should be a straight forward step</p><code>~$ sudo apt-get install openjdk-6-jdk</code> <br><br> <h1>
<li>Download and install Eclipse</li>
</h1><p>Find and download an appropriate version of Eclipse. Since my last instructions for 11.04, the version of Eclipse in the Ubuntu repositories has jumped to 3.7. Hooray! Go ahead and install Eclipse </p><code>~$ sudo apt-get install eclipse</code> <br><br> <h1>
<a name='more'></a>
<li>Download and install the Android SDK</li>
</h1><p>Following the instructions <a href="http://developer.android.com/sdk/installing.html">here</a>, which include a download link, install the SDK. You can download it with this command</p><code>~$ wget http://dl.google.com/android/android-sdk_r16-linux.tgz</code><p>Next, untar the package</p><code>~$ tar -xvzf android-sdk_r16-linux.tgz</code> <p>You will need to remember where these files ended up when you install the ADT plugin for Eclipse. If you followed these instructions, you should have extracted the files to <code>./android-sdk-linux/</code></p><h1>
<li>Install the ADT Plugin in Eclipse</li>
</h1>
<p>The next next step historically posed me the most problems. This time proved no different. Rather than plagiarize the steps, just look <a href="http://developer.android.com/sdk/eclipse-adt.html#installing">here</a> for the instructions. To summarize the steps, you must open Eclipse, add the ADT plugin location, and install the ADT plugin within Eclipse. Once installed, you must point Eclipse to the location of the Android SDK folder, previously installed. </p><p>If you get the following error during the install</p><code>Cannot complete the install because one or more required items could not be found.
Software being installed: Android Development Tools 16.0.1.v201112150204-238534 (com.android.ide.eclipse.adt.feature.group 16.0.1.v201112150204-238534)
Missing requirement: Android Development Tools 16.0.1.v201112150204-238534 (com.android.ide.eclipse.adt.feature.group 16.0.1.v201112150204-238534) requires 'org.eclipse.wst.sse.core 0.0.0' but it could not be found</code></p> then try running Eclipse as root.</p>
<code>~$ sudo eclipse </code><br><p>and try again. This did the trick for me. It seems to be a problem on 64 bit Ubuntu with Eclipse v3.7</p><br>
<h1 id="AdditionalComponents">
<li>Install Additional Android Developer Components</li>
</h1>
<p>Now, in a terminal, and go to the <code>android-sdk-linux_x86/tools/</code> directory and run the Android program to open the Android SDK and AVD manager.</p><code>~$ cd ~/android-sdk-linux/tools/<br>~/android-sdk-linux/tools$ ./android</code> <p>You should get a window like this</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzfrrBrm8sLlBUNSZC0bDy0j_NzHUdurVns7oEf21yPenqhxEHLCu-EMbvDtOvVxnHq1ESJX9ec2JpiuJDMf5MEf7-Jc9szozoru743ojI3T_0q5QVXI18z_ra_8GUmwsFjgMrC41ES-mp/s1600/android_sdk_avd_manager.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="297" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzfrrBrm8sLlBUNSZC0bDy0j_NzHUdurVns7oEf21yPenqhxEHLCu-EMbvDtOvVxnHq1ESJX9ec2JpiuJDMf5MEf7-Jc9szozoru743ojI3T_0q5QVXI18z_ra_8GUmwsFjgMrC41ES-mp/s400/android_sdk_avd_manager.png" /></a></div><p>Select 'Available packages' on the left. Next, select the components that you want. Google provided a list of suggested components <a href="http://developer.android.com/sdk/installing.html#which">here</a>. Once you have selected the packages that you want, click the 'Install selected' button on the bottom right. Depending on what you select, it may need to download several hundred mb. This can take awhile. You can find more information on using the SDK and AVD manager <a href="http://developer.android.com/sdk/adding-components.html">here</a>. <h1>
<li>Setting up your PATH variable (Optional)</li>
</h1><p>In Ubuntu, you want to open your .bashrc file. A simple
</p><code>~$ gedit ~/.bashrc</code><p>will open the file. Next, add the following line to the end of .bashrc</p><code>export PATH=${PATH}:(path-to-sdk)/android-sdk-linux/tools:(path-to-sdk)/android-sdk-linux/platform-tools</code> <p>replacing <code>(path-to-sdk)</code> with the path to where you installed the sdk. If you followed this tutorial, it will probably be in your home directory.</p><h1>
<li>Creating an AVD</li>
</h1><p>If you've made it this far, before you dive into your 'Hello World' application, you need to create an AVD, or Android Virtual Device. <p>First, if you haven't already installed a platform in <a href="#AdditionalComponents">Step 5</a>. Once you have a platform installed, follow the instructions <a href="http://developer.android.com/resources/tutorials/hello-world.html#avd">here</a><p><h1>
<li>Start Programming!</li>
</h1><p>If all went well, you are ready to start developing an app for Android!</p></ol><br />
<h1>Some Notes</h1><p>The official Android SDK instructions say you might have to fiddle with the USB settings to get your physical hardware to play nicely with the debugger. All I had to do was to enable USB Debugging under application settings on the Android device and I was on my way. That was a nice surprise.</p><p>This time around, installing the SDK went smoothly. I think the SDK and Ubuntu showed some maturity in the ease of installing the SDK. Last year I had to fight a little with things just to get anything to work.</p><br />
<h1>Was this helpful?</h1><p>Did this work for you? Were you able to install the SDK fine on your machine? What problems did you have?</p><p>Let me know by leaving a comment!</p>Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com28tag:blogger.com,1999:blog-7910611153612336567.post-11048593263079253102012-01-06T13:05:00.000-08:002012-01-08T11:10:34.685-08:00Best Commercial White Wire Hack I've SeenAs an electronics tinkerer, I often take apart old electronics to salvage a nice audio pot here, a button there, etc... In my tinkering, I often come across white wire hacks, such as a wire after the fact soldered from one point to another, or something of the likes. Today I was taking apart a nice standard def analog Yamaha receiver that someone donated to my cause. I came across the most ridiculous white wire fix that I've seen in a commercial product to date. Did I mention that this is a nice expensive Yamaha product?
<br />
<br />
<h1>
The Hack - Dead Bugs in a Yamaha RX-V890 Natural Sound Receiver</h1>
Unfortunately the receiver was already in pieces by the time I noticed the hack. Here is the hack:
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjk2LIZ56ebZNCXI7rddDYCDxiZQFYgniPur6yLdlLVrUY69Jnz4d2O_e0z7otH6f5ZLf8NZ_OPHypJkzXkz2UIo6iQBCTbE3GK57bwR0cL521za2Z-QItv6pRNKKhAAkHdfDdpFvuWX7fj/s1600/IMG105.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjk2LIZ56ebZNCXI7rddDYCDxiZQFYgniPur6yLdlLVrUY69Jnz4d2O_e0z7otH6f5ZLf8NZ_OPHypJkzXkz2UIo6iQBCTbE3GK57bwR0cL521za2Z-QItv6pRNKKhAAkHdfDdpFvuWX7fj/s640/IMG105.jpg" width="640" /></a></div>
Do you see it? Gosh, I wish I had a camera that took better macro pictures. Let's try another picture to see if you can see the hack. Click on the pictures to get a clearer view.
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFeZgjEZSmSHgiHlbd8VTcAsKO04iP7BFfjD9hTQfMx1RKZbCgMBFhFmsx91EBRdA2gtpBHFKtSvO1wOpm1HiPm1xBo9RcZjG8XJbMPENn2Co_rOxPl5z73exYhPRwVv64ZVYWU10BMP7p/s1600/IMG109.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFeZgjEZSmSHgiHlbd8VTcAsKO04iP7BFfjD9hTQfMx1RKZbCgMBFhFmsx91EBRdA2gtpBHFKtSvO1wOpm1HiPm1xBo9RcZjG8XJbMPENn2Co_rOxPl5z73exYhPRwVv64ZVYWU10BMP7p/s640/IMG109.jpg" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpMp9lpywKquCaTguO0OnDAbyqhgz7w1tgveyUMYkTpfEIjS9cIiTyCqUtJUyEiyXkfSHTJ8ho5iBe86YA6TJH6Tyoh3IxCIWI7CYM2jYX_2yW8QC0bOZrb5Oc14c08qnEjdiQdHtTAHn6/s1600/IMG110.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpMp9lpywKquCaTguO0OnDAbyqhgz7w1tgveyUMYkTpfEIjS9cIiTyCqUtJUyEiyXkfSHTJ8ho5iBe86YA6TJH6Tyoh3IxCIWI7CYM2jYX_2yW8QC0bOZrb5Oc14c08qnEjdiQdHtTAHn6/s640/IMG110.jpg" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqu8F7lWd5nz618aSf80CbHzWQO6l2QFQXOHWgy4AnmlVKlmCYUKUHTHa56JSQlvGs3sVsV071xcFt5y-uymJuISAeaAbPbBgNdcEVudP9dJo8szxOIUYwR3g7lnbf7EdUiPE9K3i3ENWm/s1600/IMG117.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqu8F7lWd5nz618aSf80CbHzWQO6l2QFQXOHWgy4AnmlVKlmCYUKUHTHa56JSQlvGs3sVsV071xcFt5y-uymJuISAeaAbPbBgNdcEVudP9dJo8szxOIUYwR3g7lnbf7EdUiPE9K3i3ENWm/s640/IMG117.jpg" width="640" /></a></div>
Do you see it now? There are 2 relays dead-bugged with hot glue onto two ICs, 'Pass the Pigs' style. Bus wire is soldered to the relay pins down to the IC pins (most visible in the last picture). Hot glue keeps the wires and parts in place. I think those three sideways caps (most visible in the first picture) are part of the hack as well.
<br />
<br />
<h2>
Wow</h2>
As far as hacks go, this one is really well done. I'd hope so, because some poor soul probably had to fix thousands of these. I'd also hope that it was done well because this is an expensive piece of equipment. Regardless, it isn't what I was expecting to find taking apart this receiver. Who knows what other commercial products have crazy hacks!Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com8tag:blogger.com,1999:blog-7910611153612336567.post-16142415642539855712012-01-02T07:55:00.000-08:002012-01-03T21:22:33.888-08:00Compile Code for the mbed from the LPCXpresso IDERecently I found myself working on an robotics system with an mbed. I was offline, and didn't want to use mbed's IDE for development. Plus, I already had LPCXpresso running on my computer. Browsing around, it seemed fairly simple to compile code for the mbed from LPCXpresso. Basically, after setting up a project with the correct target processor (in my case the LPC1768), follow these simple steps.
<br><br>
<h1>The Steps to Build a Binary File for mbed from LPCXpresso</h1>
<ol>
<li>Build your project</li>
<li>Browse in the Project Explorer to 'Debug' folder of your project where the .axf file can be found</li>
<li>Right click on the .axf, then select 'Binary Utilities->Create Binary'</li>
</ol>
Pretty simple, eh? You should now see a .bin file with the same name as your .axf file that you can now throw onto your mbed via the USB Mass Storage Device bootloader already on the mbed. Great, now what about automatically building the binary file when you build your project? Easy enough!
<br><br>
<h1>The Steps to Automatically Generate a Binary File for mbed from LPCXpresso</h1>
<ol>
<li>Open your project properties (can be done by right clicking on your project in the Project Explorer, and selecting 'Properties' from the popup menu)</li>
<li>In the treeview on the left, select 'C/C++ General'->'Settings'</li>
<li>Select the 'Build Steps' tab</li>
<li>Remove/delete the '#' character in the Post-build steps Command box (thus uncommenting the already included command for generating a binary file)</li>
<li>Repeat for all configurations desired, apply changes, and you're done!</li>
</ol>
Now, when you build your project in LPCXpresso, you will be left with a .bin file in the Debug folder that you can throw and run on an mbed!Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com0tag:blogger.com,1999:blog-7910611153612336567.post-52192306666047663072011-11-02T00:33:00.000-07:002011-11-02T00:33:20.842-07:00First Android App - Don't Eat Pete!After a several months of developing my first Android app, I just published <a href="https://market.android.com/details?id=com.ilektronx.donteatpete">Don't Eat Pete! on the Android Market</a>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgM_nEt7byqf_Fb24jGj4RRN7R8Kocb8CyXnQCEr0jcnm4i_d4vGIqplkzDOHCOxoLciwZ-Zdh-dpbZ3BgiP4aZ8bzqMpubELkBqLdahyphenhyphenZX3s8GDWPX-kIooGO8rxpOukSohifKf-n6_MNg/s1600/donteatpete_feature.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="195" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgM_nEt7byqf_Fb24jGj4RRN7R8Kocb8CyXnQCEr0jcnm4i_d4vGIqplkzDOHCOxoLciwZ-Zdh-dpbZ3BgiP4aZ8bzqMpubELkBqLdahyphenhyphenZX3s8GDWPX-kIooGO8rxpOukSohifKf-n6_MNg/s400/donteatpete_feature.png" /></a></div>
<br />
<br />
<h1>Don't Eat Pete! - The Game</h1>
<br />
Perfect for young kids, Don't Eat Pete is a simple yet fun family activity. For those of you unfamiliar with the game, you draw a grid on a piece of paper. In each square of the grid, you place a piece of candy. Someone is selected to leave the room while the other players select a grid to be "Pete." After returning, the player begins eating candy until they begin to eat the candy on the grid selected as "Pete." All other players must yell "Don't Eat Pete" in order to prevent "Pete" from being eaten!
<br />
<br />
<h1>Don't Eat Pete! - The Android App</h1><br />
Don't Eat Pete! the app delivers all the fun of the regular game without the sugar. Simple game-play enables even young children can play and enjoy Don't Eat Pete. With the ability to control the playing grid size, the app randomly creates a grid with a hidden "Pete" square. As the player eats candy, people appear underneath until the player tries to eat Pete!
<div class="separator" style="clear: both; text-align: center; ">
<span>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFdSWHke-qPLA9Oesg7M90fqi8IlP5w1K5iy5TT4SQAqumZlP5x9F2jZPVqpfqJ9JU79GukNgADnbwUD2RXuDLWqTH2xl7APcIP0ku7q7xJXC36ZrO6Jkh9VOniSXQbl7f6ZCZEVOxn7LE/s1600/donteatpetescreen1.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="400" width="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFdSWHke-qPLA9Oesg7M90fqi8IlP5w1K5iy5TT4SQAqumZlP5x9F2jZPVqpfqJ9JU79GukNgADnbwUD2RXuDLWqTH2xl7APcIP0ku7q7xJXC36ZrO6Jkh9VOniSXQbl7f6ZCZEVOxn7LE/s400/donteatpetescreen1.png" /></a>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSV48NVIECkI6Svg_cGnZPtR_q31E7mEN0B5bym8hh6Z_V8kqrs9hHhLTAYB_-b0kACalvQaT4Mwz8F2RSqGf31BfaaJ_6u5qt5UTmqV_Ycv8o0cvrtGY2A8mAmm2MugJrnHftMtEjppM9/s1600/donteatpetescreen2.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="400" width="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSV48NVIECkI6Svg_cGnZPtR_q31E7mEN0B5bym8hh6Z_V8kqrs9hHhLTAYB_-b0kACalvQaT4Mwz8F2RSqGf31BfaaJ_6u5qt5UTmqV_Ycv8o0cvrtGY2A8mAmm2MugJrnHftMtEjppM9/s400/donteatpetescreen2.png" /></a>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIEl624fO0bhMdJoR2T_fiBGuvlDueqcFRdAFhdi99nFKy0nrYm4l-_eXkoEHbLD0tAfMlL0zoDI0smKeypdmXesbCdCyoXEyUenXJnH8UXTpCva_zVkSOIHzn6-g9KJMQ-aOq7rAMf3eR/s1600/donteatpetescreen4.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="400" width="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIEl624fO0bhMdJoR2T_fiBGuvlDueqcFRdAFhdi99nFKy0nrYm4l-_eXkoEHbLD0tAfMlL0zoDI0smKeypdmXesbCdCyoXEyUenXJnH8UXTpCva_zVkSOIHzn6-g9KJMQ-aOq7rAMf3eR/s400/donteatpetescreen4.png" /></a></span>
</div>Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com3tag:blogger.com,1999:blog-7910611153612336567.post-18681843220131663082011-09-08T07:23:00.000-07:002011-09-08T20:49:24.125-07:00All about the LPC1343 USB Bootloader<p>So, you want to use the USB bootloader function built into the LPC1343? Personally, I think this is one of the coolest built in functions. Why? A lot of chips have serial bootloaders. In fact, all of the NXP LPC series chip have a built in bootloader. Why is the USB bootloader so cool? </p>
<h1>Why is the USB bootloader so cool?</h1>
<h2>Who has a serial port?</h2>
<p>Serial bootloaders are great if you don't want to buy an expensive JTAG or programmer. However, they have some shortcomings. First, you need a serial port. In the past 10 years, serial ports have slowly disappeared from computers. Often, you need a USB to Serial converter or level shifter, which defeats the purpose of not having a JTAG or programmer.</p>
<h2>Speed is everything</h2>
<p>Serial is slow. If you are lucky, you get 115200 baud to work on the LPC bootloader. Usually, I'm stuck at 57600. Regardless, USB is fast. 12Mbit. Programming the device happens in the blink of an eye.</p>
<h2>Built in goodies</h2>
<p>Guess what? That USB bootloader implements a lot of code. Code that you can use. The LPC1343 bootloader resides in ROM and contains all the code necessary for a USB Mass Storage Device. All you have to do is fill out the necessary USB device info, call an init function, and then a connect function. The ROM saves you around 8K memory space, and a lot of headaches (if you know some stuff about it). </p>
<h1>Great! How do I use it?</h1>
<p>If you want to implement the USB bootloader functionality into a new design using the LPC1343, you need to know the following.</p>
<h2>Crystal/Oscillator selection</h2>
<p>The USB bootloader code expects a 12Mhz external clock source. Why does this matter? The bootloader must set up the USB PLL in order to generate the 48MHz clock used in USB. The PLL settings are hard coded into the ROM. Any other frequency other than 12MHz will cause the the bootloader to crash and not function.</p>
<h2>Soft Connect</h2>
<p>It took some digging to figure out what 'Soft Connect' does. In short, the Soft Connect feature allows you to control when the host device detects that a new end device becomes available. It does this by connecting a 1.5K pull-up resistor to 3.3V. What does that mean for you? The device now can control when it must respond to host commands, allowing it to execute any initiation code without time constraints. Additionally, you can disconnect and reconnect the device without physically removing the device. </p>
<p>Most reference designs use a PNP BJT. A P-channel FET works just as well, reduces current consumption, and is available in ridiculously tiny packages.</p>
<p>Here is my reference design which is known to work
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhV5BmESZTppM1xq9mD4d6EuF357i-zbT55HwoOpr-gzd3vIu0QbgVD9xbgAAMthKuitp_MEvqdlFfRX9ezdIbxg0R3cwD335lq8pbEiVCyZyhlrDnT3EDe2-AsCgcBJGoKFEurKU3zFLNd/s1600/usb_connect1.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="349" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhV5BmESZTppM1xq9mD4d6EuF357i-zbT55HwoOpr-gzd3vIu0QbgVD9xbgAAMthKuitp_MEvqdlFfRX9ezdIbxg0R3cwD335lq8pbEiVCyZyhlrDnT3EDe2-AsCgcBJGoKFEurKU3zFLNd/s400/usb_connect1.png" /></a></div></p>
<a name='more'></a>
<p>
If you can guarantee your code will service the USB Host requests in time, and your device is powered only off of USB power, you can bypass Soft Connect by just connecting a 1.5k Ohm pull-up resistor from +3.3V to the D+ line.</p>
<h2>Boot Select Pins</h2>
<p>All LPC chips have a boot select pin. On page 319 of the <a href="http://ics.nxp.com/support/documents/microcontrollers/pdf/user.manual.lpc13xx.pdf">user manual</a> you can find the needed pin configuration to initiate the bootloader code on start-up. If PIO0.1 is pulled low at start-up, the LPC1343 will begin in ISP mode. PIO0.3 determines whether the serial bootloader or the USB bootloader begins. If you notice, PIO0.3 also functions as USB_VBUS, which monitors the presence of USB power. PIO0.3 happens to be 5V tolerant, however, as a minimum, you should include a current limiting resistor of at least 2k Ohm in series with the USB power to reduce the risk of shorting USB power to ground. By connecting USB_VBUS properly to the USB +5V bus, the LPC1343 will automatically choose USB enumeration when USB is present and the chip is told to boot into ISP mode.</p>
<h2>Noise Reduction</h2>
<p>All good practices should be used to reduce noise on the USB lines. The 33 Ohm resistors in series with the data lines shown in the reference design help match line impedance to harmful reduce reflections. If you aren't familiar with transmission lines, just add them. The 18pF capacitors also help reduce noise in several ways. Be sure your USB lines run parallel and are as short as possible, don't make right angles, etc... </p>
<h1>What do I need to know to use the ROM USB MSC code?</h1>
<h2>The ROM MSC functions use the CT32B1 (32 bit, Timer 1)</h2>
<p>The ROM needs to use a 32 bit timer. It uses Timer 1. Don't use it. Don't configure it. Leave it alone and forget about it. If you need a 32 bit timer, use CT32B0. Configuring the timer and then calling the ROM MSC functions will give you a headache. Things won't work and you'll have no indication why.</p>
<h2>The ROM MSC functions change the system clock</h2>
<p>I have not seen this documented anywhere. When you initialize USB using the ROM drivers, you nuke whatever PLL settings you previously used. What you end up with is a 48MHz system clock. You must accommodate the changed clock speed when setting up any other peripheral clock.</p>
<h2>The ROM MSC functions only support 32 bit addresses</h2>
<p>The callback functions only use 32 bit addresses and access memory 64 bytes at a time. Don't expect to be able to use more than 2GB of memory in your mass storage device. If you are using memory with sectors larger than 64 bytes, expect to buffer reads and writes to improve performance.</p>
<h1>Why you shouldn't use the USB Bootloader</h1>
<p>If you develop code for the LPC1343, better alternatives exist. The JTAG on the LPC1343 only requires 2 signals, SWDIO and SWCLK, plus a ground. For these 3 connections you get full debug capabilities; break points, memory access, etc. Adding a JTAG will save you time and headaches. The USB bootloader becomes useful once you have a mature firmware. <b>I highly recommend using the JTAG, if possible.</b></p>Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com9tag:blogger.com,1999:blog-7910611153612336567.post-65764803024553894432011-09-03T22:54:00.000-07:002011-09-08T07:36:17.008-07:00Getting Started with Android Development, Modifying the Snake Example for Touch InputGoogle has done a good job with the Android SDK, especially including documentation. The only problem is, however, that the excess of documentation can be overwhelming. An inexperienced developer may find it difficult to pick out simple items in the wealth of information. Consider this the first of my 'Getting Started with Android Development' posts.<br />
Recently I purchased a newer model Android device, only to find the example games used the keyboard exclusively. Wouldn't you know, my phone doesn't have a keyboard! Let's modify the <a href="http://developer.android.com/resources/samples/Snake/index.html">Snake example</a> to work with touch events.<br />
Implementing touch events can be broken into three pieces,
<br />
<ol>
<li>Create an input listener</li>
<li>Register your listener</li>
<li>Implement your input handling function</li>
</ol>
<p>The difficult thing is to pick a way to do this. <a href="http://technoguff.com/user-input-events-and-event-handling/">Check here for an overview on the 3 ways to do this.</a> I chose method 2, implementing the event listener in the View.</p>
<h1>Creating an Input Listener</h1>
<p>For this tutorial, I assume you are able to load the Snake example program. In the /src folder find the SnakeView.java file and open it. First, we must tell the the SnakeView that it will be handling the touch events. Change </p>
<pre class="brush: java">...
/**
* SnakeView: implementation of a simple game of Snake
*
*
*/
public class SnakeView extends TileView {
...
</pre>
<a name='more'></a>
to this<br />
<pre class="brush: java">...
/**
* SnakeView: implementation of a simple game of Snake
*
*
*/
public class SnakeView extends TileView implements OnTouchListener {
...</pre>
Don't forget to press Ctrl+Shift+O to automagically import the correct packages. By adding <br />
<pre>implements OnTouchListener</pre>
we are saying that this SnakeView will take care of anything that OnTouchListener requires. In this case, the function <br />
<pre>public boolean onTouch (View v, MotionEvent event)</pre>
<p>will be handled by SnakeView. </p>
<h1>Implementing Your Input Handling Funciton</h1>
<p>Go ahead and add the following code somewhere in the SnakeView class. I added it right after my key events because the two are related.</p>
<pre class="brush: java"> @Override
public boolean onTouch (View v, MotionEvent event)
{
float x = event.getX();
float y = event.getY();
float height = this.getHeight();
float width = this.getWidth();
float slope = height/width;
// Only process DOWN action, so it responds as soon as the
// screen is touched.
if (event.getAction()==MotionEvent.ACTION_DOWN)
{
// Touch event UP
if ((y < slope*x) && (y < -slope*x + height)) {
if (mMode == READY | mMode == LOSE) {
// At the beginning of the game, or the end of a previous one,
// we should start a new game.
initNewGame();
setMode(RUNNING);
update();
return (true);
}
if (mMode == PAUSE) {
// If the game is merely paused, we should just continue where
// we left off.
setMode(RUNNING);
update();
return (true);
}
if (mDirection != SOUTH) {
mNextDirection = NORTH;
}
return (true);
}
// Touch event DOWN
if ((y > slope*x) && (y > -slope*x + height)) {
if (mDirection != NORTH) {
mNextDirection = SOUTH;
}
return (true);
}
// Touch event LEFT
if ((y > slope*x) && (y < (-slope*x + height))) {
if (mDirection != EAST) {
mNextDirection = WEST;
}
return (true);
}
// Touch event RIGHT
if ((y < slope*x) && (y > -slope*x + height)) {
if (mDirection != WEST) {
mNextDirection = EAST;
}
return (true);
}
}
return false;
}
</pre>
<p>
The code above mimics the key event listener. Instead of listening to an arrow key, though, we are listening for touch events in the four areas of the screen. The code above divides the screen from corner to corner, forming an X. Notice, we are only listening for ACTION_DOWN events.</p>
<h1>Registering the Input Listener</h1>
<p>
Next, we need to register our class to the Android device as a listener. Find the Snake.java file in your /src folder. Here, we only need to add one line, that tells the Android device that we have a listener for touch events. Add the following line in the activity's onCreate method.</p>
<pre class="brush: java"> // Register the listener
mSnakeView.setOnTouchListener(mSnakeView);</pre>
Here is the entire method
<pre class="brush: java">
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// No Title bar
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.snake_layout);
mSnakeView = (SnakeView) findViewById(R.id.snake);
mSnakeView.setTextView((TextView) findViewById(R.id.text));
// Register the listener
mSnakeView.setOnTouchListener(mSnakeView);
if (savedInstanceState == null) {
// We were just launched -- set up a new game
mSnakeView.setMode(SnakeView.READY);
} else {
// We are being restored
Bundle map = savedInstanceState.getBundle(ICICLE_KEY);
if (map != null) {
mSnakeView.restoreState(map);
} else {
mSnakeView.setMode(SnakeView.PAUSE);
}
}
}
</pre>
<h1>Play a game of Snake!</h1>
<p>If everything was done correctly, you should have a working Snake example that responds to touch events.</p>
Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com2tag:blogger.com,1999:blog-7910611153612336567.post-28751370987397187762011-08-27T08:02:00.000-07:002011-12-04T12:42:30.222-08:00XBee Enabled Joystick pIIIIf you are arriving at part III first, check out the first two parts.<br />
<br />
<a href="http://ilektron-x.blogspot.com/2010/06/xbee-enabled-joystick-part-i.html">Xbee Enabled Joystick, part I</a><br />
<a href="http://ilektron-x.blogspot.com/2011/07/xbee-enabled-joystick-part-ii.html">Xbee Enabled Joystick, part II</a><br />
<br />
<!-- google_ad_section_start -->
I finally got around to demonstrating this project. It has been a long time in the making. Throwing an Arduino with an XBee shield onto my <a href="http://rcshenanigans.blogspot.com/2011/05/kick-off-with-boat.html">homemade RC boat, Das Boot</a> seemed like the simplest method to demonstrate the 'XBee Enabled Joystick'.<br />
<!-- google_ad_section_end -->
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAAEXG5MXu3X5Br0mnqmhdeq_wfxlpb1Ch3sK91eqA7UmK0_9VS7URuhPkLp73TSqg-_tuMxIil5Vz7SIB0uNwb7V0aPuHh1ui9N5AxUOx4er_3Z-5nyrDzFsXmH04KnCZiOAtHPAVVqhR/s1600/IMG019.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAAEXG5MXu3X5Br0mnqmhdeq_wfxlpb1Ch3sK91eqA7UmK0_9VS7URuhPkLp73TSqg-_tuMxIil5Vz7SIB0uNwb7V0aPuHh1ui9N5AxUOx4er_3Z-5nyrDzFsXmH04KnCZiOAtHPAVVqhR/s640/IMG019.jpg" width="640" /></a></div><br />
<h1>Setup</h1>The setup is the same as before in the first two parts. I only changed the sample rate on the joystick XBee to <code>0x021</code>, which translates to 33ms, or about 30Hz. Below you can find sample code I used to demonstrate this project. I'll admit, the code was quick and dirty, but demonstrates some principles of parsing the XBee sample packet.<br />
<br />
Enjoy the video!<br />
<br />
<iframe width="560" height="345" src="http://www.youtube.com/embed/Ix_8P3QxJZ8" frameborder="0" allowfullscreen></iframe><br />
<br />
<a name='more'></a><br />
<h1>Schematic</h1>I'm including the schematic for the transmitting XBee (the black box seen in the video with the blinking LEDs). Really, it is quite simple.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjd6awiO2kX04gNq3xDRfhPyNpwDg4oqMuEcg10vw6PkQ6VXO2Fv7TsS5IJ_f0Q5O503wtJX44JMwuO0OsLY6rpauQ5dxGXdQweRHvBjvO9AzFfGgoINMEoHNAiAqVgcIgjabACWjgOSxf/s1600/xbee_joystick.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="252" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjd6awiO2kX04gNq3xDRfhPyNpwDg4oqMuEcg10vw6PkQ6VXO2Fv7TsS5IJ_f0Q5O503wtJX44JMwuO0OsLY6rpauQ5dxGXdQweRHvBjvO9AzFfGgoINMEoHNAiAqVgcIgjabACWjgOSxf/s640/xbee_joystick.png" width="640" /></a></div><br />
<h1>Board **Updated</h1>
This is the board layout for the transmitting XBee (black box). All the joystick outputs are routed to the ADC and GPIO pins of the XBee, like the schematic shows.
<h2>Top</h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJWieAElRcZxoleDdXXqICy3tAJwvsOcNKfX950YbQaT0lnquX_HvAEMZgUfweg9Kqi9pb1bXtFCPHBp_P1cdABG3X-IEtamcPhVdRdwdLPuAvM3ahsxi7ZZMgQmCuObxsUFCHSfVSamBO/s1600/xbee_joystick_top.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="384" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJWieAElRcZxoleDdXXqICy3tAJwvsOcNKfX950YbQaT0lnquX_HvAEMZgUfweg9Kqi9pb1bXtFCPHBp_P1cdABG3X-IEtamcPhVdRdwdLPuAvM3ahsxi7ZZMgQmCuObxsUFCHSfVSamBO/s400/xbee_joystick_top.png" /></a></div>
<h2>Bottom</h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbZBFlxGnueoK1tNvta8pvV7CTwubknoUFki0dndduaKEq8BDwAqDiQHqzTYnqARK6dGXDVYSglfl63JwdNfwu3dQ9JxhoH9hDXNDFG_fdfkp8Yp7gRlbdZXZtvqWpStrvMBjZdQLdVQll/s1600/xbee_joystick_bot.png" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="384" width="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbZBFlxGnueoK1tNvta8pvV7CTwubknoUFki0dndduaKEq8BDwAqDiQHqzTYnqARK6dGXDVYSglfl63JwdNfwu3dQ9JxhoH9hDXNDFG_fdfkp8Yp7gRlbdZXZtvqWpStrvMBjZdQLdVQll/s400/xbee_joystick_bot.png" /></a></div>
<h1>Example Code</h1><br />
<pre class="brush: c">// Simple sketch that takes in XBee sample data and converts
// it to usuable PWM servo control signals. This example will
// control 2 servos, throttle and rudder (steering).
#include <Servo.h>
#define BUFFER_SIZE 50
#define THROTTLE_PIN 9
#define RUDDER_PIN 10
#define THROTTLE_ADC 2
#define RUDDER_ADC 1
#define SERVO_MIN 900
#define SERVO_MAX 2100
#define XBEE_START 0x7E
#define XBEE_CMDID 0x83
#define XBEE_ADC_RES 10
#define XBEE_ADC_CTR (0x0001 << ((XBEE_ADC_RES) - 1))
#define XBEE_NUM_ADC 5
#define SERIAL_TIMEOUT 10000
#define SERIAL_BAUD 115200
Servo throttle; // Throttle servo
Servo rudder; // Rudder servo, steers the vehicle
int rxbuffer[BUFFER_SIZE];
int data_count = 0;
unsigned int buttons = 0;
unsigned long axis[5];
// Simple function that indefinitely waits for a byte over serial
unsigned char get_byte();
// Same as above, but can be given a timeout. If it takes too long
// to receive a byte, the functions returns 0
unsigned char get_byte(int timeout);
// Returns the length of the sensor packet sent from the XBee
int get_length();
// Parses the packet from the XBee. Return 1 if a valid packet
// has been received.
int get_packet();
unsigned char get_byte()
{
while (!Serial.available()) {;}
return Serial.read();
}
unsigned char get_byte(int timeout)
{
int i = 0;
while (!Serial.available() && i < timeout) {timeout++;}
if (Serial.available()) {
return Serial.read();
} else {
return 0;
}
}
int get_length()
{
int length = 0;
// Get two bytes from the serial stream, which equal the
// length of the packet
length = (get_byte() << 8) | get_byte();
return length;
}
int get_packet()
{
int i, j = 0;
int length = 0;
int num_samples = 0;
int channel_ind_msb = 0;
int channel_ind_lsb = 0;
unsigned char checksum = 0;
unsigned char adc_msb = 0, adc_lsb = 0;
char c = 0;
// First step is to read in the length
length = get_length();
// Next figure out if this is the command we're looking for
if (get_byte() != XBEE_CMDID) {
return 0;
}
checksum += XBEE_CMDID;
// The next couple bytes tell us a little more about this packet
// Right now, we won't do anything with them, other than add them
// to our checksum
checksum += get_byte(); // Source Address MSB
checksum += get_byte(); // Source Address LSB
checksum += get_byte(); // Source Address RSSI
checksum += get_byte(); // Source Address Options
// The next byte contains the number of samples
num_samples = get_byte();
checksum += num_samples;
// Repeat the following steps for for each sample. Hopefully,
// for this program this will always be 1.
for (i=0; i < num_samples; i++) {
// Find out which lines are active
channel_ind_msb = get_byte();
checksum += channel_ind_msb;
channel_ind_lsb = get_byte();
checksum += channel_ind_lsb;
// If any digital lines are active, read them in
if ((channel_ind_msb & 0x01) || channel_ind_lsb) {
// Right now, not doing anything with this data
checksum += get_byte();
checksum += get_byte();
}
// Now, read in all the ADC values
for (j=0; j < 5; j++) {
if (channel_ind_msb & 0x01 << (j+1))
{
// There is a reading for this ADC
adc_msb = get_byte();
checksum += adc_msb;
adc_lsb = get_byte();
checksum += adc_lsb;
// Join the bytes into an int
axis[j] = (adc_msb << 8) | adc_lsb;
}
}
}
// return 1 if there is a correct checksum
if ((0xFF - checksum) == get_byte())
{
return 1;
} else {
return 0;
}
}
void setup() {
int i=0;
// Start serial port at SERIAL_BAUD bps.
// For this example, it should be 115200:
Serial.begin(SERIAL_BAUD);
//Set up some pins as PWM for a servo
rudder.attach(RUDDER_PIN, SERVO_MIN, SERVO_MAX);
throttle.attach(THROTTLE_PIN, SERVO_MIN, SERVO_MAX);
// Zero out the joystick axis values
for (i=0; i < XBEE_NUM_ADC; i++)
{
axis[i] = 0;
}
}
void loop() {
// Let's parse us an XBee sample packet!
if (get_byte(SERIAL_TIMEOUT) == XBEE_START) {
if (get_packet())
{
// Only command the servos if a valid
// packet has been received.
rudder.write((axis[RUDDER_ADC]*180)/1024);
throttle.write((axis[THROTTLE_ADC]*180)/1024);
}
}
}
</pre>Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com43tag:blogger.com,1999:blog-7910611153612336567.post-29566352875855987812011-08-22T22:40:00.000-07:002011-09-08T20:40:14.333-07:00How to Neuter the Invincible Tornado (How to Remove the Speaker)My mother-in-law decided to give my son an <a href="http://www.amazon.com/Invincible-Tornado-Control-Aerobatic-Twister/dp/B002SDSTLY/ref=sr_1_2?s=toys-and-games&ie=UTF8&qid=1314073906&sr=1-2">Invincible Tornado</a> for his birthday. <br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqaU_lP2KHwHIcTfkria7-gx3DiF_prp0kAyFqS_kFm7PaKDlnUOXDM7eI6i2Y_i9Nkw_sQFXvJL90Ri06pSKZtoJ1kLzSg76WCCk9uXFKpWTo2IENcHyjmawVppE2VkjxCW6Rub4g7bIj/s1600/IMG_5929.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqaU_lP2KHwHIcTfkria7-gx3DiF_prp0kAyFqS_kFm7PaKDlnUOXDM7eI6i2Y_i9Nkw_sQFXvJL90Ri06pSKZtoJ1kLzSg76WCCk9uXFKpWTo2IENcHyjmawVppE2VkjxCW6Rub4g7bIj/s640/IMG_5929.JPG" width="640" /></a></div>Looks like a fun little R/C car. Unfortunately, there are 2 versions. One version (the version we got) plays annoying loud music when powered on. My mother-in-law warned me about this, and suggested I do what I know how and mute it with my electronics know-how. I'll be going through the steps for anyone else with aching ears.<br />
<ol><h1>
<li>Remove 3 screws on top</li>
</h1>First, remove the 3 screws on the top of the vehicle. The screw on the front is covered by a sticker that can be peeled back. <div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK-deiKxlKhIoiqdsjkynpVuU6IfaVIvjxC4uTlcazZVzuJG3WdH9t6i1K2pegF96u_vCaVdUZUgxZAHPzcrQKlA3soq9hqRwPbD9Bv0mQnILOTp2mfKW2ShZKh8bF5dDAvXpUtXR02-9H/s1600/IMG_5924_screws1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK-deiKxlKhIoiqdsjkynpVuU6IfaVIvjxC4uTlcazZVzuJG3WdH9t6i1K2pegF96u_vCaVdUZUgxZAHPzcrQKlA3soq9hqRwPbD9Bv0mQnILOTp2mfKW2ShZKh8bF5dDAvXpUtXR02-9H/s640/IMG_5924_screws1.JPG" width="640" /></a></div><h1>
<a name='more'></a>
<li>Remove 2 screws</li>
</h1>I ended up removing too many screws, and the front wheel assembly came off, but you should be able to access the speaker just be removing 4 more screws. Remove the 2 screws on the back of the vehicle <div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQcurun1nfhdo2_Q_8KLhOsCDGzpd4JFYoLTgNhv1rPnJdgU5iNbT2fk2zS1aKW3sYPiQX9C0ndUNCpfKlWQfc9Nn-ETTFK6vupQkksXWaOgFrpy48n8ihQrI4ivfFR3by1NTZ2I52Vgja/s1600/IMG_5924_screws2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="472" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQcurun1nfhdo2_Q_8KLhOsCDGzpd4JFYoLTgNhv1rPnJdgU5iNbT2fk2zS1aKW3sYPiQX9C0ndUNCpfKlWQfc9Nn-ETTFK6vupQkksXWaOgFrpy48n8ihQrI4ivfFR3by1NTZ2I52Vgja/s640/IMG_5924_screws2.JPG" width="640" /></a></div><h1>
<li>Remove 2 screws</li>
</h1>Only 2 more screws to go! These can be found underneath the top assembly that the first set of 3 screws liberated. <div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZPKEYSF9br-G00dNv9kmqu4euZuguHvPZrVUFSBqKkbPzIPCnXuR-F9JvEh0uOFa8w_nMAVFktUoXeeJXuxRHeMZB5JyzGNXX1U3R-aZONRc2jUAqmwetjA2wlEb9nfc1a8D92jhaON2a/s1600/IMG_5924_screws3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZPKEYSF9br-G00dNv9kmqu4euZuguHvPZrVUFSBqKkbPzIPCnXuR-F9JvEh0uOFa8w_nMAVFktUoXeeJXuxRHeMZB5JyzGNXX1U3R-aZONRc2jUAqmwetjA2wlEb9nfc1a8D92jhaON2a/s640/IMG_5924_screws3.JPG" width="640" /></a></div><h1>
<li>Remove that dang speaker!</li>
</h1>Now for the important step. Pull up the piece you should have just released by remove the 4 screws. The two parts should pull apart relatively easily. Underneath, you should see the main drive motor, printed circuit board (PCB), and the speaker. The speaker is not fixed in any manner and should almost fall out. You have a couple options. The two brown wires connected to the speaker can just be pulled off, snipped, or you can whip out your handy pair of diagonal flush cuts and cut the wires right at the circuit board. If you choose a less tidy method of removing the speaker, be sure to cover the ends to ensure nothing will short out once you put the vehicle back together. <div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEic39scOgOq3v6M1lExknLAH3QntIMvoEY5qOIuD7mY8ytQxh5suy2nB3DWBawQ0qbPVRSp34JsfHx7Q2aPPPQk5KfW53A6k6wyvVslvQifzBf4yjIJXI92_Gl35IhFYsKR0vW4s3FaEwRX/s1600/IMG_5928_speaker.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEic39scOgOq3v6M1lExknLAH3QntIMvoEY5qOIuD7mY8ytQxh5suy2nB3DWBawQ0qbPVRSp34JsfHx7Q2aPPPQk5KfW53A6k6wyvVslvQifzBf4yjIJXI92_Gl35IhFYsKR0vW4s3FaEwRX/s640/IMG_5928_speaker.JPG" width="640" /></a></div><h1>
<li>Put it all back together</li>
</h1>I will leave this last part up to you. Just one note, if there is a loose white wire, don't panic. This is the antenna. Make sure you route it as close to the top of the car as you can.</ol><br />
<h1>Hooray!</h1><p>Now you have a nice quiet RC car to let your kid play with. Enjoy!</p>Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com2tag:blogger.com,1999:blog-7910611153612336567.post-47230553952859098642011-08-16T06:55:00.001-07:002011-08-16T06:55:40.108-07:00Turnigy 9X Antenna HackI finally finished my Turnigy 9X Antenna Hack video! This moves the antenna to the wireless module, making it possible to completely remove the wireless module. The video is a little long, enjoy!<br />
<br />
<iframe width="560" height="349" src="http://www.youtube.com/embed/W74Acmam_0c" frameborder="0" allowfullscreen></iframe>Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com3tag:blogger.com,1999:blog-7910611153612336567.post-44917641302671059912011-08-02T15:41:00.000-07:002011-09-08T20:41:49.560-07:00HowTo: Handbrake + Ubuntu + Encrypted DVDsEvery now and again I re-install Ubunutu and have to figure out how to re-install Handbrake and the DVD decryption.<br />
<br />
Just a disclaimer, the legality of this is suspect, and this should only be used to make back-ups of DVDs you own. Blah blah blah. Be honest.<br />
<br />
The following instructions come from <a href="https://help.ubuntu.com/community/Medibuntu">Medibuntu documentation</a> and <a href="https://edge.launchpad.net/~stebbins/+archive/handbrake-releases">Handbrake Ubuntu Installation instructions</a> and work for me on Ubuntu 11.04.<br />
<br />
<h1>The 5 steps to use Handbrake with Encrypted DVDs on Ubuntu</h1>
<ol><li>Install Handbrake. There is a handy Ubuntu PPA, which has the most recent Handbrake builds.<br />
<code>$ sudo add-apt-repository ppa:stebbins/handbrake-releases</code><br />
</li><li>Add the Medibuntu repositories, which have the libraries for decrypting DVDs<br />
<code>$ sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && sudo apt-get --quiet update && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring && sudo apt-get --quiet update</code><br />
</li><li>Install the libdvdcss2 library for decrypting DVDs<br />
<code>$ sudo apt-get install libdvdcss2</code><br />
</li><li>Update everything and install Handbrake<br />
<code>$ sudo apt-get update && apt-get upgrade -y && apt-get install handbrake-gtk -y</code><br />
</li><li>If everything went well, you can run handbrake with<br />
<code>$ ghb</code> <br />
and you can read encrypted DVDs! Hooray!<br />
</li></ol>Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com1tag:blogger.com,1999:blog-7910611153612336567.post-8027353283252951772011-07-08T16:10:00.001-07:002011-07-08T16:10:44.420-07:00Turnigy 9X Wireless Module Resistor FixI recently posted how to do the Turnigy 9X resistor fix on <a href="http://www.rcgroups.com/forums/showthread.php?t=1452911">rcgroups</a>. Somebody pointed out that you could do the fix without opening the radio itself. You could apply the fix to the wireless module on the back of the 9X itself. I felt a little 'hackish' tonight, so I thought I'd give it a try and post a video HowTo.<br />
<br />
<iframe width="560" height="349" src="http://www.youtube.com/embed/28-47SuDhT4" frameborder="0" allowfullscreen></iframe>Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com0tag:blogger.com,1999:blog-7910611153612336567.post-86825842536663160482011-07-04T09:06:00.000-07:002012-03-22T06:58:59.305-07:00How to generate .hex files from Code Red's LPCXpresso to use with FlashMagicRecently I struggled to be able to use with the LPC serial bootloader and FlashMagic with the LPCXpresso software from Code Red. All I wanted was a .hex file to load onto an LPC1759. LPCXpresso generates a binary AXF file. FlashMagic requires an ihex file. The hex file actually is just the binary file converted to an ascii file. Unfortunately, due to the rich features of LPCXpresso, you have to dig to figure out how to automatically convert the .axf into a .hex. These steps should bring you a step closer to flashing code to your LPC chip over serial.<br />
<br />
<h1>Official Code Red and LPCXpresso Documentation</h1>
<br />
Code Red provides two links with information on how to convert your program into a usable .hex for FlashMagic.<br />
<br />
<ol><li><a href="http://support.code-red-tech.com/CodeRedWiki/OutputFormats">Generating srec (Motorola S format), binary, ihex (Intel Hex) files</a></li><li><a href="http://support.code-red-tech.com/CodeRedWiki/PostProcessApp">Post-processing your linked application</a></li></ol>
<br />
<h1>Changing the project settings</h1><br />
In order to begin, you need to open your project settings. Once the project properties are open, choose 'C/C++ Build' -> 'Settings'. On the right, select the 'Build Steps' tab.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiy31TV8UGyHnLl82AtrLrRZmJjiUc4JqX_i05MDbvG-NR1xjnf1XS3hzLsxsTehD2GFvbzLuHwi16tbKOC83lhrK8IxJpTZzERugBWCeV61Gvqxq-Mc48d7m9km8bYF_wJ40BcDev13QZ/s1600/lpcxpresso_project_properties.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="635" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiy31TV8UGyHnLl82AtrLrRZmJjiUc4JqX_i05MDbvG-NR1xjnf1XS3hzLsxsTehD2GFvbzLuHwi16tbKOC83lhrK8IxJpTZzERugBWCeV61Gvqxq-Mc48d7m9km8bYF_wJ40BcDev13QZ/s640/lpcxpresso_project_properties.png" width="640" /></a></div><br />
Now, edit the 'Post-build steps' command and add the steps to create a .hex that FlashMagic can use.<br />
<br />
<h1>Steps to go from a ELF to a FlashMagic compatible HEX file</h1><br />
I got these steps from a <a href="http://knowledgebase.nxp.com/showthread.php?t=597">thread</a> on NXP's user forum. They agree with the <a href="http://support.code-red-tech.com/CodeRedWiki/OutputFormats">knowledge base article</a>. <br />
<br />
Add the following steps to your <b>Post-build Steps -> Commands</b><br />
<ol><li>ELF=>BIN without CRC:<br />
<br />
<code>arm-none-eabi-objcopy -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin";</code><br />
<br />
</li>
<li>BIN=>BIN with CRC (this is useful for USB ISP mode with LPC13xx parts):<br />
<br />
<code>checksum -v "${BuildArtifactFileBaseName}.bin";</code><br />
<br />
</li>
<li>BIN with CRC => HEX with CRC:<br />
<br />
<code>arm-none-eabi-objcopy -I binary "${BuildArtifactFileBaseName}.bin" -O ihex "${BuildArtifactFileBaseName}.hex";</code><br />
<br />
</li>
<li>Save your project properties, and then repeat for your other Build Configurations (Debug/Release).</li>
</ol><br />
Now, when you rebuild your project, LPCXpresso should generate a .hex file that FlashMagic will be able to use.<br />
<br />
Next, getting your code to actually run...Stephen Farnsworthhttp://www.blogger.com/profile/09128294133162852134noreply@blogger.com21