I have developed software in C++, Java, PHP, .NET and now I am interesting to learn to program material things. I would like to program a system that could interact with IR, LCD and to be able to resuse old printer motors to use it, etc.

My problem is, where to start? I have searched the web and have found an open source board called Arduino but how to get other electronic components together? What book or tutorial should I do to be able to create a small project?

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
If this question can be reworded to fit the rules in the help center, please edit the question.

15 Answers
15

Parallax is notoriously overpriced. They get away with it because they sell their stuff to educational institutions who don't know any better.

The Arduino is a good start, go through a few of their examples (click 'Learning' on the Arduino site) and see what parts they require. My favorite hobby electronics online shop is sparkfun.com. They've got tons of parts designed to interface with things like the Arduino.

You can program them in C, C++, or AVR Assembly. Personally I'd say avoid the BASIC ones, they are way slower and if you're already into programming it's not worth the hassle.

(FYI, the Arduino is basically a board and software library designed around the wonderful AVR microcontroller)

Personally sparkfun is bit overpriced... you can find many things much cheaper through ebay or aliexpress.. if you are willing to wait a little extra time as they usually ship from china. But there are many US sellers that have good pricing on arduino sensors etc But thats just my two cents.
–
jasonFeb 26 '13 at 4:07

I'd definitely second the Arduino suggestion. They are cheap, there are several suppliers since the hardware is open source (although the name isn't), the IDE is free, you program them in C, and they're easy to hook up to just about anything. The board has 12 digital I/O pins (two of which double as serial communication pins) and six 12-bit A/D converter I/O pins (which can also be configured as digital pins). It can handle pulse-width modulation (PWM) for motor and servo control, interrupts, I2C interfaces, and most boards can either run standalone or off the USB port. Communication to the computer is handled by an FTDI serial USB driver.

In addition to Sparkfun.com, also check out www.adafruit.com for some cheap, small USB "Boarduino" boards and several nice prototyping shields for the full-sized Arduino.

The main Arduino site (Arduino.cc) has pretty much every reference and tutorial you need to get started.

Here is the "Hello, World!" of Arduino programming as an example of how easy it is. The program blinks an LED attached to digital pin 13:

Basically every Arduino program has a setup() function that runs when the power is applied or the board is reset and a loop() function that runs forever. Of course, you also have timers and interrupt functions, or your can use the loop() for polling inputs and then call out to other functions. The Arduino IDE sits on top of GCC and uses the same libraries and includes that you would use if you were writing a barebones program for the Atmega microcontroller. This means that (a) it hides the hard parts as long as you want it to (bootloaders, fuses, etc.), (b) you can get to the internals of the program if you want to, and (c) you can utilize a large selection of libraries that are out there for this family of microcontrollers.

Well, the field of microcontrollers is quite big. You have several brands, each one sporting a full range of controllers, with varying degrees of capacity, complexity and ability.

That said, the way to start with most microcontrollers is by reading the manufacturers' manual. As opposed to "normal" programming, where most programmers go by standards and rules and best practices and frameworks, etc. microcontroller programming is still done pretty much as programming was done in the early 1980s: by reading a controller's manual, reproducing examples, and extending from there.

Microchip's manuals, for example, are excellent. They also have a very good community, and provide some libraries with "standard" functions you might like to use (like math, I/O, doing serial I/O using two pins, and so on). A lot of the people working with PICs is quite open and normally share their source code if they think it might be of use to someone else.

There are some choices you have to make before beginning. The first one is what language are you going to use. You have three options:

Assembly: Most manufacturers provide free or quite cheap development kits for their microcontrollers (MCUs for short). This is the most powerful option, and the one you should use if you feel comfortable. It also will teach you a lot about computers in general.

Something else: If you'd rather use something like C, you'll have to pay quite a bit of money for the compiler (although there is at least one open source option for some of the device), and you have to consider the code produced by the high-level languages normally takes a lot of space/memory in the device. Also, depending on the standard library, you'll end up programming a fair amount of the functionality yourself anyway.

Basic/Pascal-like language: some MCUs come with an Basic/Pascal-like interpreter. These are great to start doing some "toy" projects, and getting the feeling of how this things work.

Then, you have to decide what kind of device you want to use. Prices per unit vary greatly depending on maker, whether it is PROM, EPROM, EEPROM, how much memory it has, how much storage it has, how many programmable pins, etc.

My recommendation, for starters, would be:

Try to find a free "burner" on the Internet if you want to experience the thrill of programming your MCUs using something you built. There are plenty available out there, just google for "simple PIC burner" or similar. If that's not a requirement, then you can buy a burner, but it will cost you a fair bit of money.

Get one EEPROM version of the MCU you think you are going to use the most. This will save you the problem of having to throw away a $5 piece of hardware just because you have a bug in your code.

Buy a bunch of the PROM version of the MCU. They are cheap, and you'll need them. And once you get started, you'll want to put an MCU everywhere.

Learn how to use The Emulator. Most SDKs come with an emulator you can use to test your ideas before committing them to PROM.

Find yourself some simple and interesting first project. I must emphasize the SIMPLE there. If you try to come up with a way to control your microwave oven using a remote control straight away, be ready for a long period of learning.

Well, hope this helps you! If you want any more information, I'm around the corner, just whistle! :)

I recently started learning microcontroller programming using the Arduino.
I purchased the Arduino Starter Pack from adafruit.com and walked through their introductory tutorials. Their kit comes with some basic electronics (LEDs, buttons, photoresistor) which give you some things to experiment right off the bat.

If you already know C/C++ you will be able to start creating useful and interesting projects within hours.

The BASIC stamp series is very interesting. They have a lot of nice simple control boards to get you started and the programming is dirt simple. The controller actually executes BASIC. While that might not excite a lot of people, writing microcontroller code takes time to get the hang of it. This system is great to get your feet wet. Then when you have some nice cool (and simple) project running you can move on to other more challenging controllers. These will be most likely assembly or C programmed. Debugging will be your greatest challenge.

Everything you need for startup in Arduino and electronics can be found here: http://www.smileymicros.com. If I remember well, the book author has/had a column for Arduino newbies in one of electronic magazines.
Besides that, in general you should learn I2C, SPI, 1wire and try to interface sensors with such interfaces. Read a lot of datasheets of such sensors and try to understand everything in them. Ask questions when stuck. Learn MODBUS (RTU/ASCII/TCP) or similar protocol that can open your device to the world once you embed it in the device. Learn general electronics and try to interface relays, triacs, step motors, servos, what is pull up and pull down, what is sourcing and sinking, how to draw schematics and connect basic drivers to your MCU.

I also have the impression that you need to start from basic microcontroller architecture things. PIC is good to start with, because the basic models and earliest series can be very useful - they have not too much extra functionality so you will not be lost with extras concentrating on basics which is good.

After this you need to understand lots of things about memory organization and program execution in context of microcontroller life-cycle and timing models. After this you can go forward with starting analysis of basics assembler examples for a concrete microcontroller and moving forward with more advanced techniques. Then you can move to more advanced series of PIC with DAC and other modules which are the common for most of modern microcontrollers, but on the PIC you can get lots of basics without additional pain which will work pretty the same for all other chips.

Microchip (www.microship.com) makes the Stamp microcontroller. They also offer free samples from their web site including shipping. I picked up a couple micros with built in radios to do some two way RF communications (not WIFI). Another great microcontroller manufacturer is Dallas Semiconductor http://www.maxim-ic.com/ and they also ship out free samples too. Dallas/Maxim also has an Engineering Journal that they will mail free to your address and the journal has tons of sample implementations, using their chips of course, from which you can grok lots of good information from as well.

This is probably overkill for what you are trying to do, but programming an FPGA based system can be fun. The VHDL language is more like wiring up circuits than writing C-code. A Nexys-2 board can be bought for $130.

Another vote for the Arduino which is very cool. With an Arduino board, a one-wire temperature sensor and Hyperterminal, you can start to record data about the world around you. Hook up Processing and you can log the data, graph it, analyse it in Excel, whatever. Neat.

On a side note:
If you don't want to get your hands dirty soldering a lot of stuff or are not electrically inclined to do so (like me), try looking into PLC's.
They are industrial hardware controllers with modules for almost every task such as digital I/O's, analog I/O's, stepper motor controllers, serial I/O, Ethernet, etc. You can program them in different ways, assembler like, graphical and a text editor with code looking like a mix of Pascal and Basic. They have built-in multitasking and usually perform pretty well, but they are a bit more expensive than a regular microcontroller. I always recommend Wago and their 750-841 controller.