Sunday, February 9, 2014

Arduino micros() function with 0.5us precision - using my Timer2_Counter Library


Subscribe by Email!
...merging the world of Arduino and Radio Control, one tool at a time...
...CODE FOR A PRECISE MICROS() FUNCTION IS POSTED BELOW...

"I wrote a libary to get 0.5us precision on a "micros()" replacement function, so that I can get repeatable results reading a PWM or PPM signal, to within 1us.  I searched all around the internet and could not find something comparable (or that was easy to use, and maintained the Arduino's ability to write PWM signals via the Servo Libary), so I think this is my first real contribution to the world of Arduino and Radio Control."  

(font above is type "standard," from here)

Download this library:
  • Click the above link, optionally donate (just set the price you want to pay to $0 if you like), & download the library. You may also click here, then choose the appropriate download. 
    • For the email address field, you may enter none@gmail.com if you like. Or, enter your real email if you want to receive an email with the download link, and if you don't mind if I send you an occasional email with something I'm working on (perhaps a few times a year or so).
  • Install the library into the Arduino IDE (using Sketch --> Include Library --> Add .ZIP Library), then run the examples to see how to use the library.
  • GitHub: https://github.com/ElectricRCAircraftGuy/eRCaGuy_TimerCounter

***Subscribe by Email!***

Saturday, February 8, 2014

Quick Tip: 4 Ways to Power an Arduino


Subscribe by Email!
By Gabriel Staples
Written: 8 Feb. 2014
Updated: 27 May 2014 - minor details added

Other Articles:

4 Ways to Power Your Arduino:

  1. USB cable
  2. External power supply, or battery, going into the 2.1mm x 5.5mm DC power jack (recommended 7~12V input)
  3. External power supply, or battery, going into the "VIN" and "GND" pins on the board, via jumpers (recommended 7~12V input)
  4. External, regulated 5V power going straight into the "5V" and "GND" pins; this can come from another Arduino's 5V and GND pins even!
========================================================================
Please support my work and contributions by purchasing an Arduino-compatible Nano from me here.
Also, don't forget to like, share, and subscribe at the right.
========================================================================

END OF POST

***Subscribe by Email!***

Arduino Power, Current, and Voltage Limitations


Subscribe by Email!
By Gabriel Staples
Started: 6 Jan. 2014
Last Updated: 12 June 2015
Update History (newest on top)
-added info about IO pin voltage protection using a single resistor (ex: 10K --> +15.5V/-10.5V) - 20150612
-very minor corrections: some clarity added - 20140730

Related Articles:
Other Articles You May Be Interested in Reading:
(image above is from this Adafruit tutorial here) 

In using Arduino and designing my circuits for it, I have often-times asked myself the question, "What are the power/current/voltage limitations of the Arduino?"  "Will I risk damaging it?"  In the image above, for instance, a large servo is being powered by the voltage regulator right on the Arduino development board.  Larger servos and motors like these have the potential to push the Arduino past its max current limits, potentially causing it to reset itself and cause unusual errors while running, or possibly even damage the Arduino (I should note that most linear voltage regulators have an over-temperature auto-cutoff feature, however, so damage is unlikely).  In either case, it's important to understand the limitations of your Arduino, its input/output pins, and its voltage regulators.

Here, I will attempt to succinctly and accurately describe the power limitations of the standard Arduino boards, such as the Uno and Nano.  References will be included at the end, and references for particular data are denoted by square braces with the reference number, such as this: "[1]."  Following my references and methodology, you can use the same techniques to figure out the limits of your particular board, in case you're not using an Uno or Nano.

Summary of information below:

  • Input Voltage Limits:
    • Recommended: 7~12V
    • Absolute: 6~20V
    • Input/Output (I/O) pins: -0.5V to +5.5V (the actual max is "Vcc + 0.5V," which for a 5V Arduino, is +5.5V) (Note 1)
  • Output Current Limits:
    • When powered by USB: total of 500mA
    • With external battery or power supply: total of 500mA~1A (see below for specifics)
    • 5V pin: same as above: 500mA or 500mA~1A
    • Each input/output pin: 40mA
    • Sum of all input/output pins combined (but NOT including the "5V" pin): 200mA
Note 1: simply by adding a resistor in series with an I/O pin, you get increased input voltage protection for that pin. Ex: a 10k resistor provides voltage enough protection to allow input voltages between -10.5V and +15.5V. A 100k resistor allows DC input voltages from -100.5V to +105.5V. Read my article here for more info: Quick Tip: Arduino Input/Output (I/O) Pin Over-Voltage Protection Using a *Single* Resistor!

KEEP READING BELOW FOR MORE DETAILS.

Power Limitations of the Arduino Uno & Nano:


***Subscribe by Email!***

Thursday, January 30, 2014

eRCaGuy Store Just Opened


Subscribe by Email!
By: Gabriel Staples
Written: 30 Jan. 2014

Related Links:
I have just opened up a tiny web-shop in order to make a little extra money to support my work.  I intend on purchasing extra parts and pieces when I engage in Arduino or electronics-related products, so that I can sell them on my site.

Please support my work, research, blog, and contributions to the world of Radio Control and Arduino microcontroller programming by purchasing my products.


I am currently selling brand new Arduino-compatible Nano V3.0's, with breadboard, USB cable, and FREE shipping from and to the United States.



***Subscribe by Email!***

Sunday, January 5, 2014

The Power of Arduino


Subscribe by Email!
...And how you can learn to use computer programming to control and customize the physical world around you, including your RC vehicles...

Subscribe to and share this blog by clicking the links to the right -->

By: Gabriel Staples
Written: 5 Jan. 2014
Last Updated:  15 Apr. 2017
History (newest on TOP):
-updated Amazon links & prices, added Elegoo products, and converted Amazon links to Amazon Affiliate links - 15 Apr. 2017
-added link to (incomplete, but functional) touch lamp code - 20 Oct. 2016
-added info on __attribute__ syntax - 25 Sept. 2015
-added more __attribute__((__packed__)) and #pragma pack(1) links to bottom - 4 Sept. 2015
-macro comment addition to Intermediate section - 20 June 2015
-added Expert links section - 9 May 2015
-links edited at bottom - 5 March 2015
-added another Advanced link - 24 Feb 2015
-added Vilros starter kit links to bottom - 7 Feb 2015
-added source code link for my RC car read PWM sketch - 2 Nov. 2014
-added a bunch of new links at bottom of article (mostly Intermediate) - 14 June 2014
-added details and corrections pertaining to microcontrollers being used in servos - 17 March 2014

====================================================================
Be sure to check out the links and resources at the end of this article, as they are EXTREMELY useful to anyone who uses Arduino microcontroller development boards!
====================================================================

Other Related or Interesting Articles:
One Good Use of an Arduino: Use it as a Touch Lamp controller [source code]:

Background:
So, you may be wondering why I haven't written an article in the last few months.  To be honest, writing a well-informed article, with plots, pictures, and sources takes vast amounts of time, and life gets busy.  However, I should also tell you that I have been heavily involved in Arduino microcontroller programming for the last several months, and I have spent countless hours learning about and programming Arduino.  I have now built up a variety of Arduino tools and resources that I use, including dozens of bits of test code, many projects and programs, and hundreds of files, links, and resources.  I have even written some code and functions which I have seen nowhere else, which I think are very valuable, and which I intend to periodically share here on my blog.  In other words, I think I have some useful things to contribute to the vast world of Arduino, some of which will help bridge the world between Radio Control, robotics, and Arduino microcontroller programming.  Though I am constantly learning, and constantly seeking help from resources and people who know much more than I, I would consider myself a very informed Arduino user with a sound, yet constantly growing, understanding of electricity, electrical engineering, programming, and computer science.

Why have I recently been doing Arduino programming instead of doing Radio Control stuff?

Learning Arduino is doing Radio Control stuff.  It turns out that the world of Radio Control is

***Subscribe by Email!***