Saturday, May 31, 2014

eRCaGuy_ButtonReader Library for Arduino - Debounce and read the current button state, & most recent action ("just pressed" or "just released") easily!

By Gabriel Staples Written: 31 May 2014
Last Updated: 31 May 2014

Other Articles to Check Out:

This Article:

I just released this library to GitHub!

I wanted a simple and universal, yet very powerful & reliable library to read a button or switch in such a way that I can easily implement toggled actions and momentary actions, know the true, debounced state of a button or switch at any given time, and specify whether I want an action to take place when the button is *pressed* or *released.* This library makes implementing all of these things easy for me, and I now use it on all of my projects that require reading a button or switch, so I wanted to share it with others. Hopefully you find it useful too. Check out the included examples.  

This code is an elaboration of, and library form of, the main Arduino-sponsored "Debounce" example found here.  Thanks to David A. Mellis, Limor Fried (LadyAda), and Mike Walters for writing that excellent and well-thought-out example code.

Download the eRCaGuy_ButtonReader Library here --> then go to "Download ZIP" at the bottom of the right-hand pane.  See the Readme file right here too if you need help installing Arduino libraries.

Tuesday, May 13, 2014

Using the Arduino Uno’s built-in 10-bit to 21-bit ADC (Analog to Digital Converter)

By Gabriel Staples Written: 13 May 2014
Last Updated: 11 July 2014 - added an update in green below

A Few Other Articles to Check Out:

This Article:

Using the Arduino Uno’s built-in 10-bit to 21-bit ADC (Analog to Digital Converter)???
--Wait, what did you say!? I thought that Arduinos only had a 10-bit ADC!  How can you get, for example, 16-bit resolution out of a 10-bit ADC?  Well, the answer is oversampling.  Atmel has written a really good article about it called "AVR121 Enhancing ADC resolution by oversampling."

Before I continue, I'd like to give a very special thanks to user "fat16lib," on the Adafruit Forums, who first made this technique known unto me by his post right here, thereby inspiring me to write this, my first ever, library.

Now on to the library:

------------------------------------------------------------------------------------------------------------
27 May 2014: Update: With a ton of help from Ray Benitez, of Hackscribble, I am still evaluating the practicality & legitimacy of oversampling, via experimental data collection & analysis, in order to see if it really is increasing the precision to the degree I am claiming/hoping.

Update: 11 July 2014: I still plan on doing much more testing with my library, when I get the chance, and working on it to refine and validate it a lot more.  I want to know for myself, with certainty, how well it really is or isn't working, and what its limitations are.  One of the refinements I will make, for instance, will be to speed up the Arduino ADC from ~8kHz max sample rate to ~54kHz max sample rate, by changing the ADCSRA register to have an ADC prescaler of 16 instead of 128 (thanks to Simon Monk, pg. 82 of "Going Further with Sketches" for teaching me about this).  This way, I can see if reading the ADC faster affects the results produced by oversampling.  It will also be nice to just not have to wait so long for high-bit ADC reads that require tons of 10-bit samples to get one high-bit sample.  Meanwhile, if you are concerned about whether or not my library truly produces higher-precision ADC reads, you might just consider buying a 12 or 16-bit ADC from Adafruit.  They look really nice.  I will be using these myself to test my library eventually, in conjunction with an LTC1650CN 16-bit DAC to produce a signal to test.  As part of my test, I will vary the reference pin source from a noisy voltage regulator to a clean, dedicated reference IC chip.  This way, I can see how the noise affects the results.  Also, as part of my testing, I'll modify my library to introduce random noise (via software) to the analog readings, to see how that affects oversampling (It's possible that introducing just the right magnitude of random noise will increase precision of the oversampling process).  
Anyway, here's the Adafruit ADCs!  
12-bit ($10): https://www.adafruit.com/products/1083
16-bit ($15): https://www.adafruit.com/products/1085 
------------------------------------------------------------------------------------------------------------

Download my Library (eRCaGuy_analogReadXXbit) on GitHub by clicking here --> then click the "Download Zip" link at the bottom of the right-hand pane.  Using my library, you can actually choose any precision you want between 10 and 21 bits, when using the analogReadXXbit() function!

Keep reading below:

Sunday, April 20, 2014

TED Talk - Massimo Banzi: How Arduino is open-sourcing imagination

By Gabriel Staples
Written: 20 April 2014
Last Updated: 20 April 2014

Related Articles:

This Article:

Watch the talk!


Enough said. :)


Sunday, April 13, 2014

Propeller Static & Dynamic Thrust Calculation - Part 2 of 2 - How Did I Come Up With This Equation?

By Gabriel Staples Written: 12 April 2014
Last Updated: 4 May 2014
-made some minor additions & formatting changes, incl. adding more info. about future work & possibly considering some blade element theory techniques - 13 Apr. 2014
-minor units correction - 16 Apr. 2014
-minor addition to section describing prop helical twist - 29 Apr. 2014
-additions & corrections to the bold portions of the "Application & Conjecturing" section - 4 May 2014

Related Articles:

This Article:

Since posting my initial "Propeller Static & Dynamic Thrust Calculation" post, I have had many questions about where this equation comes from, and several requests to explain more.  I have even had college students ask me about the equation.  Additionally, this is my most popular post at the moment and is getting over 700 views per month, with the bulk of those hits being from Google Search results about propeller thrust.  So, I think it's time I explain more about the background of the equation.  Here goes.

First off, here's the nomenclature I will use:

Friday, April 11, 2014

Aim High

Aim high!  Shoot for the stars and you’ll land on the moon; shoot for the moon and you’ll land on the roof; shoot for the roof and you’ll land in the dumpster. Aim high!

I've heard quotes similar to this, and the other day (22 March 2014) I thought about this and wrote it on the top of a to-do list I had which pertains to Unmanned Aerial Systems-related projects I'm working on.  These are the types of things I try to remind myself regularly.  Aim high.

~Gabriel Staples

Related Article:



Tuesday, February 25, 2014

The Goal of a Lifetime

Last Updated: 17 March 2014
-added links & descriptions of other articles to check out

What are My Limits?




"It should be the end goal of any professional to reach such a high level of skill at what you do that you are no longer limited by your abilities; but rather, you are limited only by your imagination."
~Gabriel Staples, 25 Feb. 2014

I was inspired with this thought tonight while listening to this song (Fear Not This Night (ft. Asja)), followed by this song (David Guetta - Titanium ft. Sia).  As the second song finished, I thought to myself, “did you hear any flaw in her voice?...are there any notes she cannot reach?...does she not have a perfect mastery of music?”  And then it hit me, musical artists at this level are not limited by their skillset, or the lack thereof; they are not limited by vocal control, or a sparse understanding of music, beat, rhythm, and notes.  Rather, singers like this are so skilled that they are limited, in what they will accomplish in their music, only by their imagination.  So it must be with engineers.  In the world of engineers, hobbyists, users and creators of electronics, RC pilots, systems and electronics integration experts and inventors, mathematicians, we must become so adept in our fields that the only limiting factor in what we can create in our areas of expertise is our imaginations.  Let us resolve to better learn our fields, and to make personal efforts to improve our skills on a daily basis, so that we can become doers and not just hearers in whatever we do.  "Be a Thinker, and Be a Doer," that is what drives me [1].

In regards to my professional interests, my goal is to become so skilled in Unmanned Aerial Systems, electronics, aviation, and computer programming, that nothing can hold me back from developing whatever I want to on the leading edge of technology, stretching the bounds of our world as we know it today.

By Gabriel Staples
25 Feb. 2014

References:
[1] - "Be a thinker, and be a doer" is a quote from Destin, on his "Smarter Every Day" series on YouTube.
--photo is a picture of me in Egypt, by the Red Sea, in June 2009, on a trip to study Arabic.

Other Articles to Check Out:

Friday, February 14, 2014