Monday, November 21, 2016

MAX5481 10-bit Digital Potentiometer Arduino Code

Subscribe by Email!
By Gabriel Staples
Written: 21 Nov 2016
Last Updated: 21 Nov 2016

Here is a sample code I wrote a couple years ago to command and control a MAX5481 digital potentiometer using SPI commands, including storing commands in the chip's on-board EEPROM (to save the last value written), or not.

In this example you have to type commands into the Arduino Serial Monitor to set the digital potentiometer. I then interpret your serial command you typed, then I send it to the MAX5481 via its defined serial SPI API.

The circuit and hookup is described in full in my comments at the top of my code. If you have any questions please post a comment below and I'll be sure to try and get back to you.


***Subscribe by Email!***

Tuesday, November 8, 2016

Eagle PCB CAD - How to copy a part from one schematic to another

Subscribe by Email!
Gabriel Staples
8 Nov 2016

Learning EagleCAD? Here's how to copy a part from one schematic or board layout to another.
  1. Open up an Eagle Control Panel, and the board and schematic you are working on.
  2. Open up a *second* Eagle Control Panel, and the board and schematic you want to copy from.
  3. Use the group tool to make a selection of a part to copy.
  4. Click the copy tool, then ctrl + right click to copy the *grouped* selection to the clipboard. Press Esc now to not paste it anywhere in this project. 
    1. Note that you *must* use the group tool followed by ctrl + right click even if only copying a single object, since that's the only way to get it to your PC's clipboard.
  5. Go back to the schematic you'd like to paste into, and click the "paste" tool. Left-click anywhere to paste what's in the clipboard. 


Helpful References:
...among many others.

***Subscribe by Email!***

Monday, October 24, 2016

Learning More About Power Electronics

Subscribe by Email!
By Gabriel Staples
Written: 24 Oct. 2016
Last Updated: 24 Oct. 2016

Other Articles:
So, recently I was introduced to by SixtySecondTech, a website which aims to become somewhat of a "website directory that lists quality websites they find valuable and resourceful for the Technology community" (source). As SixtySecondTech grows their database, I hope they can become a good resource to the electronics, maker, Arduino, Raspberry Pi, and other communities.

PowerElectronicsNews is a brand new company who offers "electrical engineering news focused on power and power solutions," including highlighting "solutions and products featuring the latest innovations" in power design.  As I continue to grow my skills I hope to be able to apply some of the background knowledge I glean from their articles, so I can use it in real, hands-on projects I can then share and apply instead of just reading a high-level description of it. A few interesting-looking articles of theirs include the following. I have marked with asterisks the articles that particularly interest me. The more asterisks, the better.

***Subscribe by Email!***

Friday, October 21, 2016

Monday, July 11, 2016

Arduino-like millisecond (ms) and microsecond (us)-resolution timestamps in Python: millis(), micros(), delay(), & delayMicroseconds()

Subscribe by Email!
By Gabriel Staples
Written: 11 July 2016
Last Updated: 22 Oct 2016
History (newest on top):
-posted updated code (v0.2.1) with Linux functions too (not just Windows) - 22 Oct. 2016

Other Articles:
Below, I show some code for basic Python millisecond (ms) and microsecond (us)-resolution timing functions. I made these to resemble Arduino functions I am already familiar with. Since these functions use the Windows API's QueryPerformanceCounter and QueryPerformanceFrequency functions, as-written, they work for Python in Windows only. If you decide to adapt them to Linux, please share how you did it in the comments section. Update (19 Oct 2016): I have updated these functions to work with Python in Linux now too! See below.

Functions and code samples. Functions include:

***Subscribe by Email!***

Saturday, July 2, 2016

About Me

Subscribe by Email!
By Gabriel Staples
Electric RC Aircraft Guy, LLC
Written: 2 July 2016
Last Updated: 21 Jan. 2018
-20180121 - replaced 2016 resume with a 2017 version (still needs a little updating but is much more recent); also changed "Consulting Work" link to say "Custom Embedded Systems Work" instead, since that's a more accurate description
-20171014 - corrected "fluent in French" to "conversational in French," and added some detail about it
-20170429 - Added/Major updates to "Today" section
-20170318 - Updated links; added Consulting Work link, etc
-20170110 - Intro updated
-20160806 - More comments and notes added about my thesis Version 1; updated resume uploaded.

Other Links:

A Few Other Articles:
Table of Contents:

  • Introduction
  • Early Days
  • Today
  • Education
    • Master's thesis downloads
  • Resume
  • LinkedIn


My name is Gabriel Staples. I strive to make a positive difference in this world by means of robotics, programming, PCB design, small Unmanned Aerial Systems (SUAS) and Vehicles (UAVs), microcontrollers and embedded systems, flight controllers, sensors, electronics, mechatronics, and autonomous systems in general. I seek to be both a thinker and a doer on a daily basis, including at work and in my personal electronics and SUAS-related interests and endeavors at home.

I'm a passionate and enthusiastic engineer who loves to make things work and solve real-world problems. Some may wonder about who I am, my background and experience, etc, so here it is. I'm the owner of and engineer behind Electric RC Aircraft Guy, LLC. At the moment I'm just a one-man shop. I build the website, write the articles, do the projects, write the code, design the PCBs, answer the emails, do the marketing, etc--everything myself.

If you'd like me to come work for you as an engineer, contact me, as I'm separating from the US Air Force this fall (approx. Sept. 2017), after achieving both a B.S. and M.S. degree in engineering and serving 7 years as an officer-engineer. The military provided me a great education and foundation for success, and now I am thrilled to be separating in pursuit of my engineering dreams. I thrive on using my engineering and other skills I've built up, and I fully intend to utilize all of my design engineering skills at work too instead of just at home. I'm also fluent in Spanish and conversational in French (I took 6 months French language training for 4~6 hrs/day, originally intending to move to France, in 2015) and love meeting new peoples and cultures and developing and utilizing my language skills, in addition to my engineering skills. I hope to do engineering oversees when given the opportunity too--perhaps even in Toulouse, France, Munich, Germany, or Switzerland, for instance. I'd really like to move overseas and solidify my French someday. 

A link to download my resume is below. You can find my email by clicking the "Contact Me" tab at the top of this website. To see some of my passion and goals, read my short blurb titled "The Goal of a Lifetime." You should also read how important it is to me to "Aim High."

Early Days:

***Subscribe by Email!***

Saturday, May 14, 2016

BattleBots Season 2 "Buzz" Fire Drone for Team Caustic Creations, with Team Interviews & fire-shooting Videos

Subscribe by Email!

By Gabriel Staples 
Written: 14 May 2016
Last Updated: 25 Apr. 2017
Update History (newest on TOP):
 - 25 Apr 2017 - updated "motor and prop sizing calculator" link below from (broken) to (new).
 - 11 June 2016 - updated article intro below, and added the big Battlebots photo below, since BattleBots just posted it a few days ago. Also added team photo & link to buy our T-shirts on the BattleBots store.

Related Articles:

I'm the creator of a fire-shooting flame-throwing battle drone (multi-copter), "Buzz," who is an air robot hexacopter companion to our ground bot killing machine, Poison Arrow, of Team Caustic Creations (see our team Facebook page here), on ABC's BattleBots Season 2 (see our BattleBots page here, buy our T-Shirts to support us here), which will air on ABC starting 23 June 2016. I'm just one of 5 members on our team. Our main bot is "Poison Arrow." Read below for some crazy-cool fire-shooting drone previews and build drama of Buzz, as well as team & bot interviews made by our sponsor, Arrow.comshowing and discussing both robots.
Photo Source:

Build drama: why's fire gotta be so complicated!?

So, from ~17 Feb. 2016 to 14 April 2016, I worked frantically to get my fire drone, "Buzz," built from scratch and working in time for the BattleBots Season 2 competition, which was filmed in Los Angeles, CA from 15-25 April. It was very very frantic indeed. It was a very difficult project it turned out, and took me approx. 300 hrs before going to the event, in addition to another 100 hrs or so spent working on the vehicle, writing more code, and competing at the event. It also just so happened to be my first ever multi-rotor I put together from scratch (but don't worry, I've been using them for years and I have a lot of background research experience with them). Zach Goff, our team captain, worked with me to size the vehicle too. Putting our experience and skills together for that part was very helpful, as was this motor and prop sizing calculator here.

I meticulously wrote a couple thousand lines of C++ code (some of which I started years ago, before I had the skills to complete it) running on the vehicle in order to give me greater control over it, for future additions and work which I hope to implement later in order to add more autonomy, hopefully for Season 3 next year. While at the event, in my frantic last-minute coding, I was even able to get a serial BlueTooth device working on the vehicle, and I implemented a custom command-line interface, from scratch, to configure parameters on-board the vehicle using my Android smart phone. I was pretty excited about that! :).

So, without further adieu, here's the result of my hard work. This is a GIF I created from a teaser trailer that ABC made for their show. This was pulled from their teaser trailer here, at approximately 1:40. The teaser is pretty awesome; you should watch it!

As you can see, the vehicle is shooting fire. turns out, was pretty stinking hard. Of my 300 hrs spent on the vehicle prior to the event (I actually logged 288.5 hrs in my project spreadsheet, but who's counting), probably *half* of that was spent just on the flamethrower. I ran into *many* problems, and each was hard to overcome. It turns out making things burn isn't as easy as one might think...especially when you need it all to be remote-controlled (RC). I had to build custom circuits, write lots of code, do some fancy programming in my Tx running OpenTx, and play with lots of hardware. Needless to say, however, I learned a *lot*...and also ruined, burned up, and destroyed some parts along the way.

***Subscribe by Email!***

Friday, March 18, 2016

Building for BattleBots - with Team Caustic Creations

Subscribe by Email!
By Gabriel Staples
Written: 18 March 2016
Last Updated: 24 March 2016 - added BattleBots 2015 Championship sample video

A Few Other Articles:
Our ground robot & drone (multicopter) builds for BATTLEBOTS: follow us on social media via the links below!

(What is BattleBots? - here is a sample video below of the championships from last year)

So, aside from my IR remote-controlled car horn/siren project, about which I posted a couple sample videos previously, I have undertaken a new project recently: building an air vehicle for the hit robot fighting TV series, BattleBots, which will be hosted by ABC this year. You can see a sample episode above, which is the final championship fight from BattleBots 2015. I was not a part of that event. For BattleBots 2016, however, I will be participating by building a secondary, fighting drone/air vehicle which will fly and shoot fire.
(see some of my preliminary flamethrowing trials below)

***Subscribe by Email!***

Sunday, January 17, 2016


Subscribe by Email!
By Gabriel Staples
Written: 16 Jan 2016
Last Updated: 18 Jan 2016

Related Pages:

-Are you benefitting? Consider giving back.
-Is my website, code, information, etc, valuable? Consider contributing.

Hi, occasionally I get emails from people asking how they can contribute. Tools, equipment, & time cost money. Your contributions help me pay for more projects, buy better tools, get more equipment, have a higher quality of life, better provide for my family, and ultimately produce better content, to benefit you, more often. So, today I am setting up some mechanisms.

Before I continue, though, I thank you for your support!


I do my best to give you useful information, knowledge, understanding, and help on a variety of Radio Control, Arduino, and electronics topics. I strive to write outstanding articles, at a high quality, that are thorough, clear and accurate.

By supporting me, you improve the quantity and quality of my content, while saving yourself valuable time and learning interesting things along the way. I try to share useful information and project knowledge that might otherwise take you many hours to figure out on your own (it certainly took me many hours). I also frequently share and post code samples, and sometimes even full libraries. I save you time, while enhancing your life. Your contributions help me do this. Thank you!

How to financially contribute:
  • Paypal: 
    • 1) Choose an amount from the drop-down menu, then press "Add to Cart." You may then modify the *quantity* to get variable amounts. Ex: add $10, then change quantity to 3 and click "update", to pay $30.

      • Amount
    • 2) Or, click this button, then manually type in an amount on the next page, and click "update" before checking out.
  • Gumroad:
  • Patreon
    • Become a patron. Patreon allows you to pay a fixed amount for each new, significant website article or YouTube video I produce, optionally up to a maximum, fixed amount per month that you specify! This way, you only give me something if I give you something. It allows me to get a more steady income so I can improve both the quality and quantity of the content I produce: 
  • Bitcoin payments (coming later)
  • Flattr (coming later)


***Subscribe by Email!***

Saturday, January 16, 2016

One of my current projects: Arduino police siren w/simple, custom transistor amplifier/speaker driver circuit

Subscribe by Email!
By Gabriel Staples Written: 16 Jan 2016
Last Updated: 2 Oct. 2017
History (newest on top):
2 Oct. 2017 - link to source code added
16 Jan 2016 - first written

A Few Other Articles:
So, a few days ago I got a car horn *and* a car audio speaker to play a siren sound!

In these two videos, I do a quick desktop demo of playing a siren sound through first a "fixed frequency" car horn, and then through a standard car audio speaker, rated at 120W peak, 60W RMS, and 4 Ohms. Using an Arduino, a relatively simple, custom transistor-based amplifier circuit, and the Arduino core tone() function in my code, I drive the horn and speaker to play a siren sound by sinusoidally varying the driving frequency.  I also show the signal to the devices on an oscilloscope, and briefly discuss and hook up a Schottky diode in a "snubber diode" configuration to knock down the inductance-induced voltage spikes created each time the square wave has a falling edge.

First, watch the "fixed frequency" type car horn play a varying-frequency siren sound:

***Subscribe by Email!***