views:

3085

answers:

13

I have developped software in C++, Java, PHP, .Net and now I am interesting to learn to program material thing. I would like to program system that could interact with IR, LCD and to be able to resuse old printer motor 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 electric component together? What book or tutorial should I do to be able to create small project?

+2  A: 

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.

Parallax BASIC Stamp

John Dyer
+1  A: 

Every microcontroller is different. The BASIC stamp is very popular among hobbyists, because you can program it in a high-level language.

For lower-level work, one extremely common choice is the PIC, a cheap (<$4) and fast (~20MHz) chip with almost no onboard memory. You can find a list of development environments on Wikipedia.

If you need to buy electronic components to go with your microcontroller, DigiKey is an excellent place to start.

emk
A: 

I have two suggestions.

  1. Stamp microcontrollers are great introductory chips. You can pick up the kits on eBay cheap ( < $30 typically). I can also recommend the Stamp2 Communications and Control Projects book by Tom Petruzzellis http://www.amazon.com/STAMP-2-Communications-Control-Projects/dp/0071411976/ref=sr_11_1?ie=UTF8&amp;qid=1221613350&amp;sr=11-1

  2. 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.

Eric M
This book have a terrible rating on amazon :P
Daok
+26  A: 

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)

davr
Great answer! just to add a bit, similar to Arduino, there is the Freeduino project: http://www.freeduino.org/
George Profenza
+1  A: 

I also have 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 no too many extra functionality so you will not be lost with extras concentrating on basics which is good. After this you need to understand lots of thing 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 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 basic without additional pain which will work pretty the same for all other chips.

Cheers.

dimarzionist
+10  A: 

Hi!

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 80's: 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 maths, 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 ahve two options:

  1. 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.
  2. 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.
  3. 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:

  1. 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.
  2. 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.
  3. 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.
  4. Learn how to use The Emulator. Most SDKs come with an emulator you can use to test your ideas before committing them to PROM.
  5. 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 info, I'm around the corner, just whistle! :)

Cheers, David

dguaraglia
+1  A: 

Check out Physical Computing by Dan O'Sullivan: http://itp.nyu.edu/~dbo3/physical/physical.html He also has links to Basic Stamp, BX24, Basic Atom, and PIC "Quick References".

Arduino is a great platform with a large, supportive community. I recommend it.

msutherl
+17  A: 

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:

int ledPin = 13;                 // LED connected to digital pin 13

void setup()
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
}

void loop()
{
  digitalWrite(ledPin, HIGH);   // sets the LED on
  delay(1000);                  // waits for a second
  digitalWrite(ledPin, LOW);    // sets the LED off
  delay(1000);                  // waits for a second
}

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.

CMPalmer
+8  A: 

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 Arduino is also great because once you get familiar with it you can expand to writing raw c on any of the Atmel AVR line of microcontrollers with ease.

I also recommend The Electronics Goldmine where you can purchase assortments of electronics for pretty cheap to get a good starter set to work with.

Eric Lathrop
A: 

plus to above comments i'd suggest to read a book called " so You Wanna Be an Embedded Engineer: The Guide to Embedded Engineering " it'd give you some clue.

avar
A: 

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 IO's, analog IO's, stepper motor controllers, serial IO, 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.

Niklas Winde
+1  A: 

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.

Austin
+1  A: 

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.

jford