• Why Not Arduino?

    04/09/2014 at 20:37 0 comments

    It seems like most HackADay projects involve Arduinos, in their various forms. I view Arduino as a gateway drug: it lets people start experimenting with micro controllers, but you will (probably) soon outgrow them. My first micro controller project, Drum Master, was started with an Arduino. However I soon started running into limitations of the system (mostly speed limitations). For instance, has anyone actually looked at how many instructions are required to turn a single pin on or off?!? Compare that to PORTA |= _BV(PORTA5). If you are doing anything timing sensitive, using raw AVR-GCC is a much better option, IMHO. Unfortunately, you lose all the convenience functions which make Arduino such an attractive platform in the first place.

    To help mitigate some of the inconvenience of losing all the nice functions in Arduino land, Warren and I have spent the last few years building a collection of libraries for the AVR family of chips to help with various things. All of these libraries have been written with modularity and speed in mind. Two of these are used in this project: the PSX controller, and blocking serial. In addition to these, there are various timers, PWM generators (which can control as many pins as you have on your micro controller without messing up the timing of individual pins), non-blocking serial, shift register using arbitrary pins, I2C (master + slave, read + write), raster drawing code for either LED matrices or LCDs, manchester encoding / decoding for cheap eBay 433 ASK transmitters, etc. While not strictly related to this project, you can view details about these libraries from my web page: http://digitalcave.ca/resources/avr/lib.jsp

    So: Why did I not use an Arduino for new projects? Essentially, Arduino does not give you the control necessary for timing-critical operations. Add to this the fact that an Arduino board costs many times more than the comparable AVR chip, not to mention the size constraints of a development board, and I think it makes perfect sense to use the raw AVR chips.

    All that said, I do own an Arduino plus some RBBBs (Arduino compatible clones which fit nicely on a breadboard), and even though I no longer use the Arduino IDE in favour of using raw AVR-GCC plus make files, I do find that I reach for the RBBBs before anything else when initially prototyping something. Plus, I do owe my current level of micro controller knowledge to the Arduino: it was only by learning through experience the strengths and limitations of that platform that I was able to get my feet wet and start doing more serial work.