# For a seasoned programmer Arduino or something else?

My Background:

I have done software fro quite a while, and I am more or less proficient in C, C++, Java, Ruby, Erlang, Haskell, Lua and Python. I also took a class in lab electronics, but apart form one brief lab with a pump, it was all about getting a signal into and A/D and from there into a x86 with LabView (not my choice of programming environments) I would like to get back into tinkering with hardware with an eye towards home automation. (I think I can do better then this for less then $500) Question: I was going to cut my teeth on an Arduino, but the more I read the more it feels like the main advantage of that system is that it is simple to program. Is this a good place for a software (who still needs to buy a soldering iron) guy to start or is there something that would suit me better? (P.S. I have more time then money) - We're looking for long answers that provide some explanation and context. Don't just give a one-line answer: please explain why you're recommending it as a solution. Answers that don't explain anything will be deleted. See Good Subjective, Bad Subjective for more information. ## 10 Answers As far as microcontroller eval boards ready to use out of the gate, there is the arduino family of course. but also consider the msp430 launchpad for$4.30. good instruction set and similar in performance to the avr with a lean toward low power/cost. For $20 you can get the stm32f4 discovery (not to be confused with the stm32 value line discovery or stm8 family) which is generally less than you would pay for a usable arduino ($35-$50) but runs circles around the arduino 168Mhz, floating point unit, caches, etc. In the upper end of the arduino price range there is another arm the mbed (mbed.org), which is probably the closest to the arduino sandbox experience. If you want to stay in a standbox and just make api calls the arduino is probably where you want to live, there is the mega for more performance or go with the leaflabs maple which is arm based but attempts to provide the arduino sandbox experience. You can get a lot more performance, bang for your buck, etc if you take on a little more responsibility and knowledge about what is going on. I recommend all three platforms (avr, msp, arm/thumb) and multiple vendors (avr and msp are locked in but arm is sold by everyone with different peripherals and I/O). For example you may be used to a platform that has no pull ups on the gpio lines and have to use external components where another chip or vendor provides that on chip at a comparable price/performance point. Likewise you may like bit banging a serial port or spi bus but find that for the same money, power, size, etc some other vendor has hardware to assist in that interface. if nothing else it is in your best interest as a programmer and someone wanting to get into hobby electronics to know more about what is going on outside the sandbox. As a way to get into this hobby electronics world the arduino is a very very comfortable transition from application programming on an operating system. sparkfun has some kits now that include the serial interface and a few periperhals there is a lilypad kit (an arduino platform) and maybe a pro kit, both are not the arduino shield form factor if that matters. sparkfun sells retail boxed and many other flavors of arduinos, the uno, etc. (the st and msp boards mentioned above you should start at ti or st's website or go to github.com/dwelch67 and I have links to the various boards in my examples). - I am also a software guy by day. About ten years ago I got started with BASIC stamps from Parallax, and after a long lapse I recently got back into embedded projects. Initially I looked at the Arduino and its different parts and realized that I could just skip past the price tag of the Arduino board and grab some ATMega168s and get started again. This worked for the most part, however I frequently ran into issues where having a prebuilt board would have been nice since I couldn't have screwed up the basic assembly. I eventually ordered an Arduino and love everything about the board and libraries. I'm not a fan of the "IDE" so I click on 'Use External Editor' and use the IDE purely for compiling and flashing the software to the board. Usually I start a project or idea with the Arduino board and then port that into a mega chip. This helps at keeping costs down by using only necessary parts for a project but it still allows me to quickly come up with a prototype. Good luck! - The Arduino is a great introduction to programming a microcontroller. There is a big difference between writing software for a PC and writing firmware for a microcontroller. The Arduino would be a good starting point for getting your head around interfacing with peripherals etc without having to get bogged down in dealing with specific chip quirks and such. But, as I say, it's an introduction. Start with the Arduino then move on to bigger and better things. I use the PIC family of microcontrollers quite a lot, but I still have my trusty li'l Arduino that I use for trying out ideas and testing things quickly. - Your question is too open ended for a straight answer, so all we can do is show you the tradeoffs. The adruino is a sugar-coated microcontroller dumbed down for the masses. It is optimized for getting basic things done quickly with the minimum of having to learn stuff. At the heart of a arduino is a ordinary microcontroller, which you can use directly too. The advantage is that you can chose your micro for exactly what you want to do, don't have somebody else's idea of what you should do between you and the micro, and you can do whatever the bare micro is capable of, which is a lot more than surfaced thru the arduino abstraction. The downside is that you'll actually have to learn something, reading a few 100 pages of datasheet is just the start, and you're not going to get instant gratification. Only you can say what is better for you. Do you want to embrace your inner moron and be led blissfully thru the garden forever being relegated to saying "huh?", "what?", and "Oh that's so cute!" to things electronic? Or would you rather trudge down the long dark path to emerge with a single blinking LED after much toil and trouble? Do you just want to drive the car or learn how the engine works so you can get maximum performance and tweak it yourself? - Olin, you are old school! I absolutely mean that as a compliment... But I respectfully disagree with you on this issue. Dealing with mediocre-ly designed software on an ill-conceived operating system has added zero to my comprehension of electronics. Has in fact soaked up days of valuable time when I could have been learning useful things from knowledgable people like yourself. I say "Long live Arduino!" – Kaelin Colclasure Dec 30 '11 at 0:01 @KaelinColclasure Your comment is some what confusing to me. You take issue with poor software and OS's, but Olin isn't addressing that at all. If anything you can consider what arduino does for you an abstraction layer like how an OS is an abstraction layer. Learning to use an arduino does very little to help you become a better engineer as the overhead will result in extra costs that are not needed. With that said, I think Arduino is a great platform, but shouldn't be considered a replacement for truely understanding the world of embedded electronics. – Kellenjb Dec 30 '11 at 0:52 Yay car analogies! Olin, for a lot of people this isn't about trudging and learning the nitty gritty of electronics and emerging to be an engineer. A lot of people just want to choose a tool that lets them achieve their goal and solve their problem. Learning the electronics is a means to an end in many cases, and is not the end itself. Not everyone's in this game for the same reasons you are. – nemik Dec 30 '11 at 15:33 Yea? Then what's that talk about "embrace your inner moron"? C'mon. Are you embracing your inner moron running Windows or Linux or OS X instead of writing your own OS like a Real Man™? Those are sugar-coated operating systems dumbed down for the masses. – nemik Dec 30 '11 at 19:08 @nemik: Embracing your inner moron was kindof a joke, just like trudging down the long dark path... Of course there is also some truth in both of those. – Olin Lathrop Dec 30 '11 at 19:44 show 3 more comments Since “Arduino” comprises several things, I think it may be useful to look at them separately: • On the hardware side, an Arduino-compatible device is basically an ATMega microcontroller with a certain bootloader. Usually a ready-made Arduino-compatible board will also include other support electronics, like a USB or serial port interface, voltage regulator, pin headers for easy access to pins, etc. The hardware devices are quite affordable if you want the USB functionality and together with the pre-programmed bootloader it saves you the need to buy a separate programmer to upload your software. So, yes, the Arduino (and compatible clones) are useful as hardware devices while prototyping; for the final build you may want to build your own with just the parts you need, so you don't need to put one complete Arduino into every project. • On the software side, the Arduino library is like any programming library and its usefulness depends on your needs. Personally I find it occasionally useful for quick prototyping (e.g., the serial port functionality), but as an experienced programmer I dislike many of the simplifications (especially the pin numbering). In any case you can easily use the original AVR libraries instead of, or in addition to, the Arduino library even if you program for an Arduino device and/or use the Arduino IDE. So, use whatever Arduino libraries you find helpful, especially when prototyping, but learn the underlying AVR as you go along (see Arduino sources & ATMega datasheet). • Finally, the Arduino IDE is the graphical programming environment with a simple editor, serial port console, “make”-like build system (hidden from the user), and (a front-end for) tools to upload your software to the actual device. Personally I hate the IDE and never use it, preferring to work on the command line, but obviously this is just a matter of personal preference. -  I don't know how they can call that monstrosity an IDE. It's the most horrendous piece of [expletive deleted] imaginable. I have Anjuta almost set up to do everything for me now that the (not very) IDE of the Arduino does. – Majenko Dec 30 '11 at 1:00 As a programmer, I much prefer programming in a language that is used by many other people, that way there are lots of books, articles, peers etc available to help me learn. In the single board computer world the Arduino is hands down the most popular with the greatest breath of support. It is an excellent choice for your first microcomputer. Considering how cheap these things are (most are less than$50), you may want to consider getting more than one type.

For someone familiar with Microsoft Visual Studio and C#, the Netduino is an excellent choice as it has a toolchain you will already know.

If your preferred environment is Unix, you may like a board like the Raspberry Pi which is due out in January 2012:

What’s a Raspberry Pi? The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming.

When will the device be available to purchase? We were hoping to have the Raspberry Pi available to order by the end of 2011. We still expect to be auctioning some of our first batch of beta boards before the end of the year (keep an eye on the site after Christmas); we’ll be moving to main production in January.

How much will it cost? The Model A will cost $25 and the Model B$35.

The really good news is there is are lots of low cost micro-controllers available with more coming out all the time.

Finally there is Texas Instruments MSP-430 Launchpad which is available for \$4.30 with free shipping. At a price that cheap, how con you not buy one?

-

Start out with Arduino to flesh out your idea and make a minimal working prototype and just learn to interface with the basics you'll need for your product (motors, sensors, serial for communication).

Later as you want more functionality (USB devices, Ethernet) move onto the ARM Cortex M-series chips. 32-bit ARM means they're very powerful and now often cheaper and with more peripherals than higher-end 8 or 16 bit chips like the AVRs and PICs. NXP's mbed (http://mbed.org) is a very gentle introduction to that platform if you're coming from Arduino.

-

When people say Arduino is "simple to program" what they really mean is that the toolchain basically just works. It works on a Mac, it works on Windows, and it works on Linux. You plug in your board, you write your code, you upload it and it goes.

To offer a little anecdotal contrast, I myself just "upgraded" to Atmel's STK600 and their AVR Studio 5 development environment. It only works on Windows, so I had to get VMware installed and running on my Mac. Then I had to get the finicky Jengo USB driver installed, which took a day of reading fussy forum posts. Then I had to figure out why I could talk to the dev board from the IDE, but not to the ATmega2560 daughter card that came with the STK600... (The JTAG cable was plugged in wrong, because I followed an illustrated tutorial on the Web that turned out to have a picture showing the cable connected backwards.)

So far I have not written a line of code with AVR Studio 5, but I have probably spent more time fiddling with it than I have total time using the Arduino IDE. And I've written dozens of Arduino sketches.

The language you are programming in is basically C++ with a tiny bit of preprocessing. With your background you will have zero trouble figuring out how to transplant any sketches you want to a "pro" environment later should the need arise. For me, the need arose only once I went beyond tinkering with the Arduino hardware and started designing my own board. YMMV, of course...

Hope this helps. :-)

-
Not to pick on you... but I disagree with you again. The reason people say an Arduino is simple to program is because they have essentially added an abstraction layer that you wouldn't get otherwise. You also bring up C++, this is very rare to see in the embedded world. It is sometimes needed for specific projects, but it also adds some overhead that you just can not have when you are trying to cut every penny. – Kellenjb Dec 30 '11 at 0:56
@Kellenjb, I can code C++ with almost no overhead, sometimes sections can have as much as 10%, but many sections with 0 overhead. But yes, it is rare because you have to pay more attention to what you are doing with your language, but wait, the same is true in C. I have seen users try malloc() in c before on embedded to not great results. – Kortuk Dec 30 '11 at 23:09

The Arduino makes a flexible stepping-off platform providing A/D, D/A (at least as PWM) lots of digital I/O, a programmable LED on the board, serial-to-USB, and ready-made modules available for lots of other kinds of hardware. If you want to roll-your-own for the learning experience, then you don't need it. If you want a platform to get something up and running just for the fun of it or while you're designing the low-cost hardware version of that something, then it's ready to go when you are. These are design, strategic, and economic decisions that are perfectly valid to make in whatever way suits your goals. There's nothing "moronic" about making tradeoffs - that's what engineers do - and are supposed to do - every day.

-

John's experience almost exactly matches mine 15 years ago when I retired from teaching computer Science (basically Assembly Language Programming, and C) to undergraduates. I realised then that to keep up with advances in computing would be prohibitively expensive, so my wife suggested going back to Electronics as a hobby, as I had enjoyed being an Electrical Engineer in the 1950s. This I did, although I had only briefly met transistors, and never seen an op-amp, so I had a lot of delightful learning to do. I retained my love of Assembly Language, and when Microchip Pics appeared in the mid '90s I got hooked on them.

I can't compare them with Arduino, which I know nothing about, but an advantage of using Pics is that it is cheap to set up, as Microchip supplies all the information free, with a brilliant IDE, and you can learn to use them, as I did, from what they publish. You can start with a home-made Programmer, lots of designs on the Internet, so it would cost only a few pounds for a few Pic chips to start off with. But I would recommend the PicKit 2 which has a lot of built-in features to make program development easy. Perhaps not PicKit 3, though, see:

http://www.eevblog.com/2009/10/21/eevblog-39-pickit-3-programmerdebugger-review/ Although this has been updated, see the notes on this reference.

There is a large number of books on Pics, but some are rubbish, beware. For an easy start, an excellent introduction to Pic is:

"Designing Embedded Systems with PIC Microcontrollers: Principles and Applications" [Paperback] by Tim Wilmshurst, £22-66 on Amazon, which includes both Assembler and C. I avoided C for a while because it seemed to take away the intimacy with the hardware that Assembler gives, but with the Microchip supplied C compiler you can see the Assembler code that is generated as well.

For an overall, good, technical (not afraid to put Maths in) coverage of modern electronics I recommend: "Practical Electronics for Inventors" 2/E [Paperback] by Paul Scherz, £19-95 on Amazon.

I paid £26-99 and £22-99 respectively for these books in shops, and do not regret it at all.

I can't cover enough here, I would be happy to correspond by email on this subject: 417weston@gmail.com (and, just in case, I am very wary about what I read or download or answer.)

-