I spend most of my microcontroller time with Microchip PIC processors. I'm far from being a world authority on their care and feeding, but I have been designing and programming PIC-based circuits for more than a decade. They do what I need. They are easy to use (fuse bits notwithstanding) and inexpensive.
Until recently, I've largely ignored the Arduino as an alternative. As far as I was concerned, it was a good learning and light hobby tool but not something for real-world applications. My gut feeling was that the Arduino infrastructure added too much overhead to a garden-variety eight-bit Atmel MCU. However, I started to change my mind when I took a look at the PIC32-based chipKIT Arduino compatible board and the "official" 32-bit ARM-based Arduino Due.
With the Arduino platform being made available on higher-power processors, the overhead of the extensive library/abstraction layer becomes less of an issue. That prompted me to re-examine the Arduino. The combination of 32-bit processing power and the extensive library set offers an incredible amount of value. In fact, even on the eight-bit MCUs, I now see value in the extensive set of libraries. It's far faster and easier to achieve proof of concept for a new GPS, WiFi, or other module when the driver code is already written for the Arduino than it is on a bare-metal MCU.
With prompting from Designline Editor Max Maxfield, I recently dove further into the Arduino ecosystem by creating some custom-designed, Arduino-compatible hardware. In brief, I'm designing an Arduino-compatible sensor board for use with small and midsized robots. Without the Arduino platform as an option, this would have been a PIC-based design for me. That would have been fine for my own use, but Max has been spending time learning the Arduino, not C or ASM on a PIC MCU.
This illustrates one reason to consider the Arduino in a professional environment: The language is now well known enough to be a factor in the selection process. When building a device that someone else may need to customize, the device's sales potential opens to a much larger group of people if it's Arduino-compatible. Many of you reading this blog are familiar with MCU programming, but the majority of people out there are not.
This board will have a set of SRF04 ultrasonic range finders. To find a range with this sensor, the SRF04 is instructed to send out an ultrasonic ping. The MCU times the interval until the return echo. This time is translated into a corresponding distance value.
An Arduino library for this sensor handles all the nitty-gritty details, so there's no need to spend a lot of time getting to know the sensor. That can always be done later, but you can get a lot of work done before needing to dig deep. The key remaining question to me: What makes an ATmega chip into an Arduino?
The Arduino uses an open-source design, so it's easy enough to find and examine the schematic. However, the schematic doesn't hold the answer. It's more or less a garden-variety Atmel MCU design. Some versions use a second MCU for USB connectivity. Some communicate over RS232, and at least two varieties use the ATmega32U4 with built-in USB connectivity.
Further study reveals that it's not the hardware that makes an ATmega chip into an Arduino -- it's the boot loader. This means that nothing special is required in the MCU portion of the hardware design. The ATmega32U4 and just a few popcorn components comprise all the required base hardware. The following image shows a minimal, hand-wired board that is fully compatible with the Arduino IDE, which recognizes it as an Arduino Leonardo.
The Arduino ecosystem may be primarily an education and hobby world, but it may not stay that way. The availability of higher-power MCUs and today's rapid design requirements mean that the Arduino may very well end up solidly in the commercial developer's tool kit.
In my next blog, we'll walk through some of the decisions that will mold this into the "Sensor for All Seasons" Max hopes to get.