Using The Second Microcontroller On An Arduino

While newer Arduinos and Arduino compatibles (including the Hackaday.io Trinket Pro. Superliminal Advertising!) either have a chip capable of USB or rely on a V-USB implementation, the old fogies of the Arduino world, the Uno and Mega, actually have two chips. An ATMega16u2 takes care of the USB connection, while the standard ‘328 or ‘2560 takes care of all ~duino tasks. Wouldn’t it be great is you could also use the ’16u2 on the Uno or Mega for some additional functionality to your Arduino sketch? That’s now a reality. [Nico] has been working on the HoodLoader2 for a while now, and the current version give you the option of reprogramming the ’16u2 with custom sketches, and use seven I/O pins on this previously overlooked chip.

Unlike the previous HoodLoader, this version is a real bootloader for the ’16u2 that replaces the DFU bootloader with a CDC bootloader and USB serial function. This allows for new USB functions like HID keyboard, mouse, media keys, and a gamepad, the addition of extra sensors or LEDs, and anything else you can do with a normal ‘duino.

Setup is simple enough, only requiring a connection between the ‘328 ISP header and the pins on the ’16u2 header. There are already a few samples of what this new firmware for the ’16u2 can do over on [Nico]’s blog, but we’ll expect the number of example projects using this new bootloader to explode over the coming months. If you’re ever in an Arduino Demoscene contest with an Arduino and you’re looking for more pins and code space, now you know where to look.

45 thoughts on “Using The Second Microcontroller On An Arduino

  1. Does anybody know if the protocol/data values for the Xbox One controller (both PC & Xbox connection) has been sniffed out yet?

    This sort of thing would be great for use in arcade mods for controllers.

  2. Or you could buy one of the countless REAL microcontrollers out there and stop milking the kiddie crutch bootloader brigade. No matter how much a I hate arduino and all of it’s followers. It gives me a chuckle when someone says “remember when arduino, blah blah blah?” Like its been around all that long when countless other microcontrollers have been around DECADES longer… and some of them even ran on BASIC and were actually just as easy to learn. But give something a douchey sounding Italian name and market it to a bunch of know nothing hipster kids, and you got yourself a star. If anything, it’s excellent marketing I guess.

    1. Why don’t you submit some projects you’ve completed? Then let us comment on your abilities. Why not link to some already completed projects from your past? Why do you even read this site if you can’t stand the arduino posts?
      #dieswithamilliondicksinthroat

    2. wow you are mr cranky pants.
      Funny but we have people in our hardware group using Arduinos to test out a new design in an FPGA that will end up being our new ASIC….
      They are cheap, easy to use and have a SPI bus so they use them.
      Really get over it and move on.

    3. So in essence you are upset because in this brave new world some kid with a *duino and a breadboard does stuff faster than you used to do with your old-fashioned beloved rinkydink non-standardized bodging solutions?
      Be careful unless you want to whine and moan yourself into obsolescence.

    4. I used to be like you, but then I saw the light and saved weeks of time that could’ve been wasted learning the same old crap on yet another new micro. Stop being elitist and annoying, old hag.

    5. I think it’s time to hang up your resentment and anger, it’s not helping anybody. Arduino has never been about the maximal use of hardware, it was designed to expose people to electronics and programming without turning them off because angry people yell at them to read some data sheet, not realizing that they once were at that level.

      It’s pretty apparent that the existing microcontroller community is essentially xenophobic – openly hostile to newcomers. And then they wonder why people don’t join their folds. Nothing like projecting snobbishness when they themselves are snobs.

    6. I’m pretty sure that the Arduino IS something new. It combines affordability with ease of use for beginners and unprecidented online open community support. Sure plenty of competitors exist. I think that anything that came before Arduino though probably had at best 1 out of those 3, even today most competitors only manage 2. I must admit though, I am a little unsure of what was available in the early 2000s. Please inform me with specific examples after reading below if you still think I am wrong.

      I think the best time to begin a maker hobby is as a kid. When you have time (summer vacaions) but not a lot of money (to buy pre-made consumer stuff). That means the BASIC stamp was NEVER a contender. Sorry, they are just too d@mn expensive! I know they have been around a long time. I used to read about them in magazines back in the 90s. They were never really available though except to people that probably could have afforded a “REAL” professional microcontroller, university labs and a few exceptional high-schools that one had to be really lucky to live in one of those few school districts. I still see dusty old BASIC stamps in the back of RatShack stores with > $100 price tags. Nobody is going to buy that!

      PIC is good affordable contender. I’m not sure when it became so. I was kind of out of the hobby for most of the 0s. Maybe it was then? Still.. most of the community I have seen around PIC is still the more old school printed magazines. Until just recently most of the micros in QST.. PIC. Most of what one finds in a Google result… Arduino. Arduino has built up a community not unlike Linux and other open source software. I’m not saying there is no PIC material online but it’s online presence just doesn’t compare.

      I think maybe it’s a generational gap. Sorry but to most younger people online community isn’t a trivial thing, it’s an esential feature. If it’s not there they will go elsewhere. That’s not laziness, it’s sensible. If you can accomplish the same thing with a few minutes and a search engine as you could with half a dozen magazine subscriptions and a trip to the library then you can get more interesting things done using the internet. Who cares if the old way was good enough before, take the best way availalbe today.

      Parallax Propellers are pretty interesting. They have a pretty good online community but not on the same scale as Arduino. Also, their community seems sheltered. Most of the community produced content is posted on Parallax servers. Most projects use all Parallax parts. I’m not saying there is anything wrong with that, they are good quality parts, not necessarily overpriced as their quality is good but not as inexpensive as what the kids are going to afford either. Also, I think subconsciously all those articles where everything is Parallax can kind of start to set off those sub-conscious ad filters people develop after spending a lot of time online.

      TI’s MSP430s are interesting too. Where Propeller is interesting for it’s unique abilities the 430 is interesting for it’s low power use and price. They just didn’t start building their online community quickly enough. The momentum is with Arduino, they missed it. Now TI has a pretty nice community at 43oh and I’m not knocking it but again, if I search for solutions to a problem on some search engine I am going to find dozens of Arduino solutions before I ever stumble upon an MSP430 option.

      Then there is Atmel.. non Arduino Atmel. That seems like a pretty natural progression beyond Arduino. Hardware wise I for one am already there. I won’t buy a Arduino board when I can get an Atmega chip and a power regulator for 1/10 or less of the price. Learning to code directly to the chip without the Arduino stuff would probably be more efficient and thus make bigger projects possible on the same chip. I bet lot’s of Arduino users (like me) are saying they will do that “one of these days”. But… some pretty powerful chips are available today for awful cheap. Look at all the things people are accomplishing WITH the overhead of Arduino. It makes it kind of hard to be motivated to move away from that!

      Well, did I manage to list your favorite Arduino competitor? Do you have something else we should all use instead of Arduino?

        1. ARM has a history back to early 80s but saw little use beyond the BBC1(?) until recently.
          ARM certainly is a market leader (mart phones, embedded pc and now micros) but maybe not the biggest. Def not in the microcontroller market. Although a massive promo campaign by multiple vendors would love for you to think it is.

          No.

          Think of all your TV remotes, air conditioner controllers. Microwaves, coffee pots, the 100 or so in your car, and on and on. Motorola/Free scale secretly has all the things.

          1. A lot of those low ended processors are in the price sensitive market so they are likely to have very limited on chip memory especially on RAM, so they might not be useful for anyone other than some hard core hackers to use.

            If you were to filter out the prices from $1 and up on retail, then ARM has a good spread of products from low to high end on the uP & SoC. The ARM products are built on newer process and they tend to have better memory/cost ratio. By the time you get 2kB of RAM, you can get an ARM chip with better specs at very comparable pricer specs. Going forward with the trend of bloated software, they will gain market shares.

            Most of the traditional uC vendors now have offerings of ARM in additional to their own line. That’s pretty much the trend. It is like the old 8051, but much more licensees.

      1. Let me say that MSP430 power consumption is far from good. While Sleep mode is quite good, active mode is very high, at the same level as a non-low power Cortex-M4, for really less performance. MSP430 is perfect for sleeping, a bit less when it comes to work.

      1. It depends on the application, transistors have many positive attributes. There is a very limited number of applications where tubes outperform transistors. You should select which ever best suits you application. It you want your project to survive an electromagnetic pulse then go with tubes, in certain audio amps tubes produce a richer fuller sound. Most of the time transistors are the way to go, but take apart any decent guitar amp and you’ll find some tubes.

    7. Or maybe you can get over yourself and realize that some people prefer the ease of use, countless online sources and communities and the very low price point the Arduino offers… Why use something else when an Arduino is more than enough for whatever project they want to create? Just because you don’t like the Arduino doesn’t mean everyone else does, as many have said already, opinions are like assholes, everyone has one… The difference here is that your opinion makes YOU look like an asshole…

    8. FYI- The Arduino is not a microcontroller- Atmel micro controllers are used for the arduino hardware, and yes those have been around longer than the Arduino platform also. The Arduino IDE (integrated development environment, FYI , as you do not appear to know the technical details) is from the Processing programming environment, meant to make programming easier for art and media projects. Both are using the GCC compiler, under the hood- a real , hard core, programming tool. If you know what you are doing, you can also program the Atmel microcontrollers in assembly or with the open source C/C++ compiler. As far as learning useful embedded programming, the Arduino IDE is a good introduction as you are learning C++ with training wheels. You can take the training wheels off and use a real industrial programming tool chain- far more valuable to learn for real world embedded programming than hobby platforms using BASIC. It is kind of funny hearing you make fun of Arduino, and hold up BASIC controllers as a comparison. I was not so keen on the Arduino platform at first, but it is a very easy way to get people interested in embedded programming and hardware. Yes, it was developed by an artsy crowd- but who cares. It is far better to have the huge amount of interest, hardware, and libraries being written for it and adding to the entire open source environment rather than what is was like when embedded programming was very expensive and hard to get started in. It is not just good marketing- it has helped generate a lot if interest in programming and embedded hardware, which anyone can pick up and play or work with.

    9. Ask someone to define AVR for you and your head will asplode. I do like that you crawl up onto Snakeoil Wagon here and let us know though. Sparkfun, Make:, and Adafruit are all hobbyist hucksters imho. They sell the feel good vibe that falls a bit short when actual support is needed and something outside of planning another Sell-a-Con or selling a $10 cape for $80 and then letting other users support users to keep costs low because hey, it’s open source :P and that feels good like solar energy boofing Wal-mart or a dog that knits a sweater for a cat. It is all poop. That is why I buy my cat sweaters at Target.

      1. In the near future such thinking will not only be archaic but irrelevant as well. Not trying to bash.
        But consider the track of abstraction software has gone through in the last 30 years.
        Industrial hardware has already experimented with abstraction in the form of ladder logic and visual “programming.” Both of which are industry wide standards.

        Even in microcontroller applications it is rare to ACTUALLY NEED direct register access and ML speed execution loops/timing. Why fight when abstraction is waiting for you.
        In fact, most GOOD hardware developers write their own libraries and quick routines to accomplish the very tasks they complain that the arduino does for them.
        The part no one seems to get is that its avr-gcc. Don’t like how arduino did it? Think you can do it better? Just do it. You can hijack it as much or as little as necessary to get the performance you are after.

  3. Expensive? You could for DECADES buy PICs cheaply, or AVRs for that matter and program them with super cheap programmers in assembly and actually learn something about coding AND hardware, using pretty much the same FREE SOFTWARE and 10 times cheaper hardware. I’ve used and learned several micros over the years, I even own a couple of arduino boards that never get used because they are pointless to me. A lot of wasted space without doing anything I really need.

    Last I checked an honest to goodness branded Ardunio board was around $20-30 each. Where as a PIC or AVR costs a couple of dollars… And a lot of them, PICs mostly, have wayyyyyy more peripherals on board for the money and without wasting all that space.

    GCC supports a number of other micros, yes including the AVR. And there are many more ways to filet a feline. I used BASIC as an example of an easy to use programming language on a platform that was around well before the arduino, not that C++ is any harder, SO just learn freaking C++ without the script kiddie crap and bloatloader baggage. I think you are doing yourself a huge disservice if you waste your time playing with libraries when you could write something better on your own, and learn a skill while doing it, as many libraries are poorly written to begin with. Garbage in, garbage out. You’re just picking up bad habits.

    I know this is hard for the “buh, buh, but I need a library of code to give me my instant gratification!” crowd of today who couldn’t survive without code libraries and sketches.

    Communities are out there for all the micros from what I’ve seen. And yes, some of them are more closed and don’t pass around libraries and sketches, but it’s for a reason. Many of us feel it’s best to pick up the datasheet and understand it and learn something for yourself, and I know for some of you that hurts. You just want it to go, you don’t want to do any of the work yourself, but you want to claim the finished project as your own. We are doing you a favor by posting pseudo code and letting you figure out the rest. It’s called learning, damn it. We see you as standing on everyone else’s shoulders and yelling “look at what I can do…, when everyone else does all the work for me!!!”.

    We don’t -not- help you, we help you a little and then let you help yourself. You will learn something and be better off for it! Being able to do something for yourself is a gift. I promise it won’t hurt you. You don’t need magazines and search engines for f*cks sake! It’s all in the FREE datasheets, although the internet does have a wealth of information too. So you need to admit is laziness. They see the blinky at the end of the tunnel, but don’t want to do the real work to get there. period.

    And if a whole generation wants to go down as that, fine. Good thing there are still people around who care enough to really keep the lights on.

    It’s funny how people argue by throwing out talk of toolchains and semantics of the proper use of “microcontroller” to somehow try to discredit you, while at the same time defending the “I can read” version of microcontrollers – arduino boards for the sake of simplification are microcontrollers, as are basic stamps (really PICs) etc etc. Just as they are eval boards for the microcontrollers that reside on them. So calling them microcontrollers is fine. Oh, and I have a degree in electronics and programming and I work in electronics for a living, so I might know a thing or two about the subject matter…

    And getting left in the dust by anyone using arduinos as their go to “engineering” solution???!!! Did you seriously just imply that?! From most of what I’ve gathered here, people use them because they are “easy” enough to use as in you don’t have to do anywork yourself really, just download someone else’s poorly written code you don’t really understand… Super innovative…

    Using an evaluation board to do evaluation or a bit prototyping is understandable, but taking an eval board that has 50 extra un-needed components on there, when a single chip could do it 99.9% of the time is hugely wasteful. But its your money.

    Arduino projects for the most part are as about as interesting as hooking up a light bulb to a battery and proclaiming yourself to be an electrical engineer. Great for school kids in stem programs or hashing out a simple problem, but post worthy? Not really.

    Tubes are still very useful, in fact they are critical. Most of you don’t realize that most satellites are using microwave tubes as their power amplifiers for communications. You cannot get the same high power out of solid state devices at the frequencies required for the amount of bandwidth you can get out of microwave and millimeter wave frequencies. They are more robust, practically immune to space radiation without the need for hardening and degrade gracefully when compared to solid state devices. and they cook your popcorn in the that magical device on your countertop in the form of a magnetron. Argue audio tubes vs. solid state all you want, but saying “tubes are dead” is about as foolish as it gets when you really know nothing of the full subject matter.

    I don’t post my projects because I don’t care what YOU think for one thing. Two, working for a living in electronics, I get my fill on a daily basis, so my home projects are my sanctuary from doing crap for other people, which the job already entails. So taking pictures and doing write ups and papers and posting things sounds an awful lot like work to me. No thank you.

    But when I see arduino fan boys acting like they are old school, I can’t help but laugh. As for the original post, good on whoever for getting a little more out of their $20 evaluation board.

    1. this is some extremely intense butthurt. sorry I didn’t follow your rules with my stupid hobby projects. I was too busy getting a PhD and chasing a career in a field that interests me and can’t be outsourced to teenagers with $2 electronics.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.