author2
3Instructables355,401Views35CommentsJoined December 7th, 2013
I'm an aerospace research engineer with a B.S. in Aeronautical Engineering and an M.S. in Mechanical Engineering. I have a *tremendous* interest in Radio Control (RC) aircraft and have developed many skills in computer science/computer programming, Arduino microcontroller programming, and electrical engineering as well. Check out my website at http://www.ElectricRCAircraftGuy.com for many articles on things such as RC aircraft, LiPo batteries, and Arduino programming! The programming langu... Read More »

Achievements

10K+ Views Earned a bronze medal
  • How to Get an Arduino Micros() Function With 0.5us Precision

    SHORT ANSWER: Without testing it conclusively, I speculate 5us is the shortest pulse that can be measured by an ATmega328 mcu running at 16Mhz.-------------------------LONG ANSWER:Nick Gammon, an Arduino expert I've learned a lot from, states here (https://gammon.com.au/interrupts), that it takes around "4 μs" to enter an ISR (Interrupt Service Routing, or interrupt handler), and "around 5 µS to enter and leave an ISR". In order to measure a pulse, you need to interrupt on a pin change at the start of the pulse, enter the ISR, grab a timestamp (or use the input capture register if using the Timer 1 input capture feature, which is the best way to do it), and exit the ISR. Then, you need to do the same thing on the trailing edge of the pulse. Since it takes 4us to ente...

    see more »

    SHORT ANSWER: Without testing it conclusively, I speculate 5us is the shortest pulse that can be measured by an ATmega328 mcu running at 16Mhz.-------------------------LONG ANSWER:Nick Gammon, an Arduino expert I've learned a lot from, states here (https://gammon.com.au/interrupts), that it takes around "4 μs" to enter an ISR (Interrupt Service Routing, or interrupt handler), and "around 5 µS to enter and leave an ISR". In order to measure a pulse, you need to interrupt on a pin change at the start of the pulse, enter the ISR, grab a timestamp (or use the input capture register if using the Timer 1 input capture feature, which is the best way to do it), and exit the ISR. Then, you need to do the same thing on the trailing edge of the pulse. Since it takes 4us to enter an ISR, I speculate the shortest pulse you could measure is 5us. Otherwise, the pulse will be over before you can even grab a timestamp from the leading edge of it. An Arduino can easily output a pulse, using the Output Compare registers in a timer, of 62.5ns, however, since that is the time it takes for 1 clock tick on a 16MHz clock, so this could be tested with 2 Arduinos where 1 generates a pulse anywhere between 62.5ns and 20us or so, and the other tries to read this pulse until it no longer can. Anyway, without testing it conclusively, I speculate 5us is the shortest pulse that can be measured by an ATmega328 mcu running at 16Mhz. Let's walk through what this might look like: at 0us the edge occurs and the interrupt flag is triggered. At 4us you enter the ISR and store the timestamp (of 0us if reading the Input Capture register, or of 4us if reading a raw timestamp from a timer/counter). At 5us you exit the ISR, and the trailing edge of the pulse occurs, tripping the interrupt flag. At 9us you enter the ISR, and store the timestamp (of 5us if reading the Input Capture register, or of 9us if reading a raw timestamp from a timer/counter). At 10us you exit the ISR. Your main loop does the calculation of ending_timestamp - beginning_timestamp and you calculate 5-0 = 5us in the Input Capture case, or 9-4 = 5us in the raw timestamp case. Perhaps I'm off a little and it would be more like 6us, but like I said, this could be tested. In either case, being able to do anything better than probably 20us or so would require knowledge of everything I said above, plus a very tight control over all interrupts and processes happening on the microcontroller to ensure that measuring the pulses takes highest priority, even possibly requiring turning on nested interrupts to ensure this interrupt measuring the pulse can interrupt other interrupt handlers (ISRs). I hope that helps. Someday perhaps I'll actually do this test, get conclusive results, and post them on GitHub. Could be interesting, though I've personally never needed to measure anything < 20us ~ 30us or so yet, and usually measure more like 500us or more. Having said all that, my library here is *not* optimized to measure 5us pulses. It is optimized to measure 500~2500us pulses, and probably wouldn't like anything less than 20~30us or so (guestimated).

    SHORT ANSWER: Without testing it conclusively, I speculate 5us is the shortest pulse that can be measured by an ATmega328 mcu running at 16Mhz.-------------------------LONG ANSWER:Nick Gammon, an Arduino expert I've learned a lot from, states here (https://gammon.com.au/interrupts), that it takes around "4 μs" to enter an ISR (Interrupt Service Routing, or interrupt handler), and "around 5 µS to enter and leave an ISR". In order to measure a pulse, you need to interrupt on a pin change at the start of the pulse, enter the ISR, grab a timestamp (or use the input capture register if using the Timer 1 input capture feature, which is the best way to do it), and exit the ISR. Then, you need to do the same thing on the trailing edge of the pulse. Since it takes 4us to ente...

    see more »

    SHORT ANSWER: Without testing it conclusively, I speculate 5us is the shortest pulse that can be measured by an ATmega328 mcu running at 16Mhz.-------------------------LONG ANSWER:Nick Gammon, an Arduino expert I've learned a lot from, states here (https://gammon.com.au/interrupts), that it takes around "4 μs" to enter an ISR (Interrupt Service Routing, or interrupt handler), and "around 5 µS to enter and leave an ISR". In order to measure a pulse, you need to interrupt on a pin change at the start of the pulse, enter the ISR, grab a timestamp (or use the input capture register if using the Timer 1 input capture feature, which is the best way to do it), and exit the ISR. Then, you need to do the same thing on the trailing edge of the pulse. Since it takes 4us to enter an ISR, I speculate the shortest pulse you could measure is 5us. Otherwise, the pulse will be over before you can even grab a timestamp from the leading edge of it. An Arduino can easily output a pulse, using the Output Compare registers in a timer, of 62.5ns, however, since that is the time it takes for 1 clock tick on a 16MHz clock, so this could be tested with 2 Arduinos where 1 generates a pulse anywhere between 62.5ns and 20us or so, and the other tries to read this pulse until it no longer can. Anyway, without testing it conclusively, I speculate 5us is the shortest pulse that can be measured by an ATmega328 mcu running at 16Mhz. Let's walk through what this might look like: at 0us the edge occurs and the interrupt flag is triggered. At 4us you enter the ISR and store the timestamp (of 0us if reading the Input Capture register, or of 4us if reading a raw timestamp from a timer/counter). At 5us you exit the ISR, and the trailing edge of the pulse occurs, tripping the interrupt flag. At 9us you enter the ISR, and store the timestamp (of 5us if reading the Input Capture register, or of 9us if reading a raw timestamp from a timer/counter). At 10us you exit the ISR. Your main loop does the calculation of ending_timestamp - beginning_timestamp and you calculate 5-0 = 5us in the Input Capture case, or 9-4 = 5us in the raw timestamp case. Perhaps I'm off a little and it would be more like 6us, but like I said, this could be tested. In either case, being able to do anything better than probably 20us or so would require knowledge of everything I said above, plus a very tight control over all interrupts and processes happening on the microcontroller to ensure that measuring the pulses takes highest priority, even possibly requiring turning on nested interrupts to ensure this interrupt measuring the pulse can interrupt other interrupt handlers (ISRs). I hope that helps. Someday perhaps I'll actually do this test, get conclusive results, and post them on GitHub. Could be interesting, though I've personally never needed to measure anything < 20us ~ 30us or so yet, and usually measure more like 500us or more. Having said all that, my library here is *not* optimized to measure 5us pulses. It is optimized to measure 500~2500us pulses, and probably wouldn't like anything less than 20~30us or so (guestimated).

    View Instructable »
  • 7-day Option: How to Separate From the Air Force

    This information is so hard to find that I really think this article deserves more visibility. In an attempt to get it to be more "Googlable", I'm going to add some keywords in this comment that will hopefully get searched and found by the Google searchbots & web crawlers. Keywords: military separation, separate from the military, air force separation, separate from the air force, 7-day opt, 7-day option, seven day option, how to separate from the military, how to separate from the air force, how to seven day opt, how to 7-day opt, how to take the 7-day option, how to take the seven day option, how to leave the air force, how to leave the military, how to fill out paperwork to leave the military, what paperwork is required to leave the military, how to fill out paperwork t...

    see more »

    This information is so hard to find that I really think this article deserves more visibility. In an attempt to get it to be more "Googlable", I'm going to add some keywords in this comment that will hopefully get searched and found by the Google searchbots & web crawlers. Keywords: military separation, separate from the military, air force separation, separate from the air force, 7-day opt, 7-day option, seven day option, how to separate from the military, how to separate from the air force, how to seven day opt, how to 7-day opt, how to take the 7-day option, how to take the seven day option, how to leave the air force, how to leave the military, how to fill out paperwork to leave the military, what paperwork is required to leave the military, how to fill out paperwork to leave the air force, what paperwork is required to leave the air force, how to get randolph air force base to let me out, how to tell the military I'm leaving, how to tell the air force I'm leaving, randolph personnel center get out of military, randolph afb exit air force, randolph afb leave military, randolph air force base paperwork to get out of military, military separation, separation from the military, afpc paperwork required to leave the military, afpc paperwork required to leave the air force, what paperwork do i need to do to leave the air force, how to tell my commander I'm leaving, how to tell my commander I don't want to be in the military anymore, how to tell my commander I don't want to be in the air force anymore, what to do to get out of the military, what to do to get out of your service commitment, what to do to when I've completed my military service commitment, how does an officer leave the military, how to leave the military enlisted, how to complete military service, what do i need to do to leave the military, what do i need to do to leave the air force, air force leaving checklist, checklist to leave the military, checklist to leave the air force, vmpf self service actions to leave the military, vmpf self service actions to leave the air force, military personnel center leave the air force, virtual military personnel center leave the air force, virtual military personnel center leave the military, mypers leave the military, mypers paperwork to leave the military, mypers paperwork to leave the air force, mypers separation process, mypers military separation process.If you can add anymore key search phrases I missed, to make this article start popping up in Google searches, since it's so fantastically useful, please do!

    View Instructable »
  • ElectricRCAircraftGuy commented on Inquiring Mind's instructable How to Enlist1 year ago
    How to Enlist

    For anyone interested in the flip-side: "How to Separate from the Air Force", which is also a difficult and complicated process, here's another useful instructable: https://www.instructables.com/id/7-day-Option-How-to-Separate-From-the-Air-Force/.

    Yes, I don't know the details, but many foreigners, who are not US citizens, serve in the US military. Please do some online research to find out how. Feel free to reply here or edit your question directly to provide links and help to others once you learn how.

    View Instructable »
  • 7-day Option: How to Separate From the Air Force

    I made it!!!!!!! YAAAAAAAAAY!!! I wish I would have had a nice tutorial like this when I was figuring things out, as not knowing how to do it also cost me an additional (and undesired/inadvertent) service commitment of > 2 years. Thanks for writing this up, as I think it will help a lot of people make more-informed decisions and more easily navigate the bureaucratic hell that exists all around them. It's hard enough trying to (1) make the decision to get out, (2) prepare for, qualify for, and obtain the skills necessary for a new job, (3) find a new job and, (4) make a new life for yourself outside the military, and yet sometimes the biggest hurdle (and also the FIRST hurdle)--which also feels insurmountable at times, is just figuring out *HOW* to try to get out. Most people don't re...

    see more »

    I made it!!!!!!! YAAAAAAAAAY!!! I wish I would have had a nice tutorial like this when I was figuring things out, as not knowing how to do it also cost me an additional (and undesired/inadvertent) service commitment of > 2 years. Thanks for writing this up, as I think it will help a lot of people make more-informed decisions and more easily navigate the bureaucratic hell that exists all around them. It's hard enough trying to (1) make the decision to get out, (2) prepare for, qualify for, and obtain the skills necessary for a new job, (3) find a new job and, (4) make a new life for yourself outside the military, and yet sometimes the biggest hurdle (and also the FIRST hurdle)--which also feels insurmountable at times, is just figuring out *HOW* to try to get out. Most people don't realize that getting out of the military is at a MINIMUM a 6-month to 1-year ENDEAVOR, and that 7-day opting is frequently the first step to this long and difficult process. IMPORTANT: if any of you are in a situation where you STILL HAVE A SERVICE COMMITMENT REMAINING, yet they are trying to PCS you (ie: move you via a "Permanent Change of Station"), IF YOU DON'T WANT TO INCUR ADDITIONAL SERVICE COMMITMENT YOU CAN *REJECT* THE ASSIGNMENT AND *7-DAY OPT* EVEN WITH A CURRENT SERVICE COMMITMENT. Simply make your separation date the *first day after* your current service commitment end date and YOU CAN DO THE 7-DAY OPT! If any of your supervisors, commander, etc, tell you otherwise--or indicate you *must* accept the new assignment in order to "become gainfully employed," THEY ARE *WRONG.* You can 7-day opt anyway--even with an outstandign service commitment! Request a separation date as early as the day after your current commitment. In such a case, the Air Force will then do 1 of 2 things: either (1) keep you exactly where you are and find you a new job (or let you continue in your current job) withOUT PCSing you, or (2) they will PCS you anyway BUT SINCE YOU 7-DAY OPTED THEY WILL DO IT WITH*OUT* FORCING another 2-year service commitment onto you for the PCS. Just make sure that's the case. In the end, YOU CAN 7-DAY OPT no matter what your circumstances are. DON'T LISTEN TO YOUR DUMBASS O-6 WHO TELLS YOU OTHERWISE just because he's in your chain of command and you think an O-6 should know what he's talking about. Make sure you speak directly to the person who has "G-series orders" (ie: legal authority) over you, NOT just the person who's highest ranking over you. The first person in your chain of command over you with G-series orders is the person you should be speaking to. In the case of the Air Force Research Lab, for instance, this will be probably a Major (O-4) in the Orderly Room, NOT your day-to-day "commander", who may be an O-5 or O-6. Best of luck out there! If you decide to separate and become a civilian, at least be informed! It's a challenging, but rewarding road for those who truly desire it and work their butts off to make it happen! I wish you all the best no matter what you decide to do! Thanks, urucoug, for helping us do and understand this overly-complicated, time-wasting, bureaucratic idiotic process more clearly!

    View Instructable »
  • ElectricRCAircraftGuy followed urucoug1 year ago